public void IncomingMessage(Message msg, string person, DateTime date) { FlashWindow.Flash(this.MdiParent, 1); if (msg.Delay != null) { string datetime = msg.Delay.GetAttribute("stamp"); DateTime dt = new DateTime(); DateTime.TryParse(datetime, out dt); if (dtTemp == null || dtTemp.CompareTo(DateTime.MinValue) == 0) { dtTemp = dt; rtfChat.SelectionColor = Color.Black; rtfChat.SelectionAlignment = HorizontalAlignment.Center; rtfChat.SelectionFont = new System.Drawing.Font(rtfChat.Font, FontStyle.Bold); rtfChat.AppendText(dt.ToLongDateString().ToString()); rtfChat.AppendText("\r\n"); } else { if (dtTemp.Date.CompareTo(dt.Date) != 0) { dtTemp = dt; rtfChat.SelectionColor = Color.Black; rtfChat.SelectionAlignment = HorizontalAlignment.Center; rtfChat.SelectionFont = new System.Drawing.Font(rtfChat.Font, FontStyle.Bold); rtfChat.AppendText(dt.ToLongDateString().ToString()); rtfChat.AppendText("\r\n"); } } } else if (dtTemp == null || dtTemp.CompareTo(DateTime.MinValue) == 0) { dtTemp = DateTime.Now; rtfChat.SelectionColor = Color.Black; rtfChat.SelectionAlignment = HorizontalAlignment.Center; rtfChat.SelectionFont = new System.Drawing.Font(rtfChat.Font, FontStyle.Bold); rtfChat.AppendText(dtTemp.ToLongDateString().ToString()); rtfChat.AppendText("\r\n"); } else if (dtTemp.Date.CompareTo(date.Date) < 0) { dtTemp = date; rtfChat.SelectionColor = Color.Black; rtfChat.SelectionAlignment = HorizontalAlignment.Center; rtfChat.SelectionFont = new System.Drawing.Font(rtfChat.Font, FontStyle.Bold); rtfChat.AppendText(dtTemp.ToLongDateString().ToString()); rtfChat.AppendText("\r\n"); } rtfChat.SelectionAlignment = HorizontalAlignment.Left; rtfChat.SelectionFont = new System.Drawing.Font(rtfChat.Font, FontStyle.Regular); rtfChat.SelectionColor = Color.Red; rtfChat.AppendText(_nickname + " said: "); rtfChat.SelectionColor = Color.Black; rtfChat.AppendText(msg.Body); rtfChat.AppendText("\r\n"); SaveHistory(person, msg.Body, date, _nickname); }
private void OutgoingMessage(Message msg) { rtfChat.SelectionColor = Color.Blue; rtfChat.AppendText("Me said: "); rtfChat.SelectionColor = Color.Black; rtfChat.AppendText(msg.Body); rtfChat.AppendText("\r\n"); }
private void cmdSend_Click(object sender, EventArgs e) { var msg = new Message {Type = MessageType.chat, To = _jid, Body = rtfSend.Text}; _xmppClient.Send(msg); OutgoingMessage(msg); rtfSend.Text = ""; }
public void IncomingMessage(Message msg) { rtfChat.SelectionColor = Color.Red; rtfChat.AppendText(_nickname + " said: "); rtfChat.SelectionColor = Color.Black; rtfChat.AppendText(msg.Body); rtfChat.AppendText("\r\n"); }
/// <summary> /// Changing the subject in a chatroom in MUC rooms this could return an error when you are a normal user and not allowed /// to change the subject. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdChangeSubject_Click(object sender, EventArgs e) { var msg = new Matrix.Xmpp.Client.Message { Type = MessageType.groupchat, To = _roomJid, Subject = txtSubject.Text }; _xmppClient.Send(msg); }
private void cmdSend_Click(object sender, EventArgs e) { // Make sure that the users send no empty messages if (rtfSend.Text.Length > 0) { var msg = new Matrix.Xmpp.Client.Message { Type = MessageType.groupchat, To = _roomJid, Body = rtfSend.Text }; _xmppClient.Send(msg); rtfSend.Clear(); } }