예제 #1
0
        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);
        }
예제 #2
0
파일: FrmChat.cs 프로젝트: uri247/lib
 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");
 }
예제 #3
0
파일: FrmChat.cs 프로젝트: uri247/lib
        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 = "";
        }
예제 #4
0
파일: FrmChat.cs 프로젝트: uri247/lib
 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");
 }
예제 #5
0
파일: FrmGroupChat.cs 프로젝트: uri247/lib
        /// <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);
        }
예제 #6
0
파일: FrmGroupChat.cs 프로젝트: uri247/lib
        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();
            }
        }