public void xmpp_OnRosterItem(object sender, RosterItem item)
 {
     try
     {
         Core.UserList.Add(item);
         Core.RunOnUiThread(() =>
             {
                 if (item.GetAttribute("name") == "Facebook User")
                 {
                     return;
                 }
                 try
                 {
                     var chatItem = new ChatPlayerItem
                     {
                         Group = item.GetAttribute("group"),
                         Jid = item.Jid,
                         Messages = new List<string>(),
                         Username = item.GetAttribute("name")
                     };
                     Core.AllPlayers.Add(item.GetAttribute("name"), chatItem);
                 }
                 catch
                 {
                     var itemPlayer = Core.AllPlayers[item.GetAttribute("name")];
                     Core.AllPlayers.Remove(item.GetAttribute("name"));
                     Core.AllPlayers.Add(item.GetAttribute("name"), itemPlayer);
                 }
                 var control = new PlayerChatControl
                 {
                     _playerNameLabel = { Content = item.GetAttribute("name") },
                     Tag = Core.AllPlayers[item.GetAttribute("name")]
                 };
                 Core.PlayerChatControls.Add(item.GetAttribute("jid"), control);
             });
     }
     catch
     {
         //MessageBox.Show(ex.ToString());
     }
 }
示例#2
0
        private void OnClientRosterItem(object sender, RosterItem item)
        {
            if (!_roster.ContainsKey(item.Jid.User))
            {
                _roster.Add(item.Jid.User, item.Name);

                _nicks.Add(item.Name, item.GetAttribute("mention_name"));

                Logger.Info(string.Format("User '{0}' logged in", item.Name));
            }
        }
示例#3
0
 private void onRosterItem(object sender, RosterItem item)
 {
     m_Logger.log(ELogLevel.LVL_TRACE, "Add new Roster item!", m_sModuleName);
     //TODO: check if roster item is already in addressbook
     m_Contacts.Add(item.GetAttribute("jid").ToString(), item.GetAttribute("name").ToString());
     m_ClientConnection.MessageGrabber.Add(item.Jid, new BareJidComparer(), new MessageCB(MessageCallback), null);
 }
示例#4
0
        private void onRosterItem(object sender, RosterItem item)
        {
            m_Logger.log(ELogLevel.LVL_TRACE, "Add new Roster item!", m_sModuleName);
            m_Contacts.Add(item.GetAttribute("jid").ToString(), item.GetAttribute("name").ToString());
            m_ClientConnection.MessageGrabber.Add(item.Jid, new BareJidComparer(), new MessageCB(MessageCallback), null);

            Contact _contact = m_ContactManager.getContactById (item.GetAttribute ("jid").ToString ());

            //checks if contact is in addressbook
            //TODO: check if this test works
            if (_contact.id == null) {
                Contact newContact = new Contact ();
                newContact.bIsXmppSupported = true;
                newContact.bIsEmailSupported = null;
                newContact.id = item.GetAttribute ("jid").ToString ();
                newContact.nickname = item.GetAttribute ("name").ToString ();

                return;
            }

            //Update contacts xmpp support
            _contact.bIsXmppSupported = true;

            //TODO: check if update contact is needed
            //m_ContactManager.updateContact (_contact);
        }