private void chatListBoxFriend_DoubleClickSubItem(object sender, ChatListEventArgs e) { ChatListSubItem subItem = e.SelectSubItem; if (!Util.ChatFormHashtable.ContainsKey(subItem.JidUser)) { RibbonFormChat formChat = new RibbonFormChat(_connection, new Jid(subItem.JidUser) { Resource = subItem.Resource }, subItem.NicName); formChat.Show(); } }
private void _connection_OnMessage(object sender, Message msg) { if (InvokeRequired) { BeginInvoke(new OnMessageDelegate(_connection_OnMessage), new[] { sender, msg }); return; } if (msg.Type == MessageType.groupchat) { return; } if (msg.Type == MessageType.error) { return; } if (msg.HasTag(typeof(Data))) { Element e = msg.SelectSingleElement(typeof(Data)); Data xdata = e as Data; if (xdata != null && xdata.Type == XDataFormType.form) { //TODO:xdata } } else if (msg.HasTag(typeof(agsXMPP.protocol.extensions.ibb.Data))) { } else { if (msg.Body != null) { RibbonFormChat formChat = null; if (Util.ChatFormHashtable.Contains(msg.From.Bare)) { formChat = (RibbonFormChat)Util.ChatFormHashtable[msg.From.Bare]; } else { formChat = new RibbonFormChat(_connection, msg.From, msg.From.User); } formChat.Show(); formChat.IncomingMessage(msg); } } }