private void updatePreview(object sender, EventArgs e) { SkypeMessage message = new SkypeMessage(); message.senderID = "lordgreggreg"; message.sender = "LGG"; message.setData("Hello World!"); message.msgDate = DateTime.Now; this.textBox1Preview.Text = mwf.formatMessage(message, this.getFormat()); }
private List<SkypeMessage> getSkypeMessages(Conversation c) { List<SkypeMessage> messages = new List<SkypeMessage>(); //debugAdd("Loading messages for " + c.Identity); if (c.getType() == 2) { SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = "select timestamp,from_dispname,author,body_xml from Messages where chatname='" + c.Identity + "' order by timestamp"; SQLiteDataReader dataRead = cmd.ExecuteReader(); while (dataRead.Read()) { //debugAdd("Found message " + dataRead["body_xml"]); SkypeMessage message = new SkypeMessage(); message.sender = dataRead["from_dispname"].ToString(); message.senderID = dataRead["author"].ToString(); message.setData(dataRead["body_xml"].ToString()); message.setDate(dataRead["timestamp"].ToString()); messages.Add(message); } } else if(c.getType()==1) { if (c.chats.Length == 0) return messages; String wheres = ""; foreach (string name in c.chats) { wheres += "OR chatname='" + name + "' "; } SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = "select timestamp,from_dispname,author,body_xml from Messages where " + wheres.Substring(3) + " order by timestamp"; SQLiteDataReader dataRead = cmd.ExecuteReader(); while (dataRead.Read()) { //debugAdd("Found message " + dataRead["body_xml"]); SkypeMessage message = new SkypeMessage(); message.sender = dataRead["from_dispname"].ToString(); message.senderID = dataRead["author"].ToString(); message.setData(dataRead["body_xml"].ToString()); message.setDate(dataRead["timestamp"].ToString()); messages.Add(message); } } else if (c.getType() == 3) { String wheres = ""; if(c.chats!=null) foreach (string name in c.chats) { wheres += "OR dialog_partner='" + name + "' "; } SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = "select timestamp,from_dispname,author,body_xml from Messages where " + "ifnull(chatname, '') = '' and from_dispname='"+c.DisplayName+"'" + wheres + " order by timestamp"; SQLiteDataReader dataRead = cmd.ExecuteReader(); while (dataRead.Read()) { SkypeMessage message = new SkypeMessage(); message.sender = dataRead["from_dispname"].ToString(); message.senderID = dataRead["author"].ToString(); message.setData(dataRead["body_xml"].ToString()); message.setDate(dataRead["timestamp"].ToString()); messages.Add(message); } } return messages; }
private List <SkypeMessage> getSkypeMessages(Conversation c) { List <SkypeMessage> messages = new List <SkypeMessage>(); //debugAdd("Loading messages for " + c.Identity); if (c.getType() == 2) { SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = "select timestamp,from_dispname,author,body_xml from Messages where chatname='" + c.Identity + "' order by timestamp"; SQLiteDataReader dataRead = cmd.ExecuteReader(); while (dataRead.Read()) { //debugAdd("Found message " + dataRead["body_xml"]); SkypeMessage message = new SkypeMessage(); message.sender = dataRead["from_dispname"].ToString(); message.senderID = dataRead["author"].ToString(); message.setData(dataRead["body_xml"].ToString()); message.setDate(dataRead["timestamp"].ToString()); messages.Add(message); } } else if (c.getType() == 1) { if (c.chats.Length == 0) { return(messages); } SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = "select timestamp,from_dispname,author,body_xml from Messages where convo_id = " + c.ConvoId + " order by timestamp"; SQLiteDataReader dataRead = cmd.ExecuteReader(); while (dataRead.Read()) { //debugAdd("Found message " + dataRead["body_xml"]); SkypeMessage message = new SkypeMessage(); message.sender = dataRead["from_dispname"].ToString(); message.senderID = dataRead["author"].ToString(); message.setData(dataRead["body_xml"].ToString()); message.setDate(dataRead["timestamp"].ToString()); messages.Add(message); } } else if (c.getType() == 3) { String wheres = ""; if (c.chats != null) { foreach (string name in c.chats) { wheres += "OR dialog_partner='" + name + "' "; } } SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = "select timestamp,from_dispname,author,body_xml from Messages where " + "ifnull(chatname, '') = '' and from_dispname='" + c.DisplayName + "'" + wheres + " order by timestamp"; SQLiteDataReader dataRead = cmd.ExecuteReader(); while (dataRead.Read()) { SkypeMessage message = new SkypeMessage(); message.sender = dataRead["from_dispname"].ToString(); message.senderID = dataRead["author"].ToString(); message.setData(dataRead["body_xml"].ToString()); message.setDate(dataRead["timestamp"].ToString()); messages.Add(message); } } return(messages); }