Exemple #1
0
        private void xmppClient_OnMessage(object sender, MessageEventArgs e)
        {
            DisplayEvent("OnMessage");


            // we ignore GroupChat Messages here
            if (e.Message.Type == MessageType.GroupChat)
            {
                return;
            }

            if (e.Message.Type == MessageType.Error)
            {
                //Handle errors here
                // we dont handle them in this example
                return;
            }
            if (e.Message.Body != null)
            {
                if (!Util.ChatForms.ContainsKey(e.Message.From.Bare))
                {
                    //get nickname from the roster listview
                    string nick = e.Message.From.Bare;
                    var    item = listContacts.Items[e.Message.From.Bare];
                    if (item != null)
                    {
                        nick = item.Text;
                    }

                    var f = new FrmChat(e.Message.From, xmppClient, nick);
                    f.Show();
                    f.IncomingMessage(e.Message);
                }
            }
        }
Exemple #2
0
 private void chatToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     if (listContacts.SelectedItems.Count > 0)
     {
         var item = listContacts.SelectedItems[0];
         if (!Util.ChatForms.ContainsKey(item.Name))
         {
             var f = new FrmChat(item.Name, xmppClient, item.Text);
             f.Show();
         }
     }
 }
Exemple #3
0
 private void listContacts_DoubleClick(object sender, System.EventArgs e)
 {
     if (listContacts.SelectedItems.Count > 0)
     {
         var item = listContacts.SelectedItems[0];
         if (!Util.ChatForms.ContainsKey(item.Name))
         {
             var     roomJid = new Jid(item.Name);
             FrmChat f       = new FrmChat(roomJid, xmppClient, item.Text);
             f.MdiParent = FrmParent.Instance;
             f.Show();
         }
     }
 }
Exemple #4
0
        private void xmppClient_OnMessage(object sender, MessageEventArgs e)
        {
            DisplayEvent("OnMessage");

            // we ignore GroupChat Messages here
            if (e.Message.Type == MessageType.GroupChat)
                return;

            if (e.Message.Type == MessageType.Error)
            {
                //Handle errors here
                // we dont handle them in this example
                return;
            }
            if (e.Message.Body != null)
            {
                if (!Util.ChatForms.ContainsKey(e.Message.From.Bare))
                {
                    //get nickname from the roster listview
                    string nick = e.Message.From.Bare;
                    var item = listContacts.Items[e.Message.From.Bare];
                    if (item != null)
                        nick = item.Text;

                    var f = new FrmChat(e.Message.From, xmppClient, nick);
                    f.MdiParent = FrmParent.Instance;
                    f.Show();
                    f.IncomingMessage(e.Message, e.Message.From.Resource, DateTime.Now);
                }
            }
        }
Exemple #5
0
 private void listContacts_DoubleClick(object sender, System.EventArgs e)
 {
     if (listContacts.SelectedItems.Count > 0)
     {
         var item = listContacts.SelectedItems[0];
         if (!Util.ChatForms.ContainsKey(item.Name))
         {
             var roomJid = new Jid(item.Name);
             FrmChat f = new FrmChat(roomJid, xmppClient, item.Text);
             f.MdiParent = FrmParent.Instance;
             f.Show();
         }
     }
 }