Exemplo n.º 1
0
 public RosterItem[] GetRoster()
 {
     ElementList nl = SelectElements(typeof(RosterItem));
     int i = 0;
     RosterItem[] result = new RosterItem[nl.Count];
     foreach (RosterItem ri in nl)
     {
         result[i] = (RosterItem) ri;
         i++;
     }
     return result;
 }
Exemplo n.º 2
0
        void firneItem_OpenChat(Friend friend,Jid sender, string CName)
        {
            RosterItem ritem = new RosterItem(sender);
            friend.Ritem = ritem;
            if (panel_userList.Controls.ContainsKey("FI" + friend.Ritem.Jid.Bare))
            {
                panel_userList.Controls.RemoveByKey(CName);
                UpdateControls();

                if (OpenChatEvent != null)
                {
                    OpenChatEvent(friend, sender, CName);
                }
            }
            Debug.WriteLine("打开:"+sender.ToString());
        }
Exemplo n.º 3
0
        /// <summary>
        /// 通过消息盒子打开消息窗体
        /// </summary>
        /// <param name="friend"></param>
        /// <param name="sender"></param>
        /// <param name="CName"></param>
        void QQMainForm_OpenChatEvent(Friend friend, Jid sender, string CName)
        {
            RosterItem ritem = new RosterItem(sender);
            friend.Ritem = ritem;
            //throw new NotImplementedException();
            //friendListView_OpenChatEvent(friend);
            if (!Util.ChatForms.ContainsKey(friend.Ritem.Jid.Bare.ToString()))
            {
                friendListView.UpdateFriendFlicker(friend.NikeName);
                ChatForm chat = new ChatForm(friend.Ritem.Jid, XmppCon, friend.NikeName);

                Friend flfriend = friendListView.Rosters[friend.NikeName];
                if (flfriend!=null)
                {
                    chat.UpdateFriendOnline(flfriend.IsOnline);
                }

                if (msgBox.ContainsKey(friend.Ritem.Jid.Bare.ToString()))
                {
                    chat.FristMessage(msgBox[friend.Ritem.Jid.Bare.ToString()]);
                    msgBox.Remove(friend.Ritem.Jid.Bare.ToString());
                }
                chat.Show();
            }
            else
            {
                try
                {
                    ChatForm chatform = Util.ChatForms[friend.Ritem.Jid.ToString()] as ChatForm;
                    chatform.WindowState = FormWindowState.Normal;
                    chatform.Activate();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            if (ChatMessageBox.GetInstance(this).FrienMessageCount() > 0)
                Debug.WriteLine("?");
            else
            {
                notifyIcon1.Icon = CSS.IM.UI.Properties.Resources.Iico;
                timer_notifyIco.Enabled = false;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Add a Rosteritem to the Roster
        /// </summary>
        /// <param name="jid">The BARE jid of the rosteritem that should be removed</param>
        /// <param name="nickname">Nickname for the RosterItem</param>
        /// <param name="group">An Array of groups when you want to add the Rosteritem to multiple groups</param>
        public void AddRosterItem(Jid jid, string nickname, string[] group)
        {
            RosterIq riq = new RosterIq();
            riq.Type = IqType.set;

            RosterItem ri = new RosterItem();
            ri.Jid	= jid;

            if (nickname != null)
                ri.Name	= nickname;

            foreach (string g in group)
            {
                ri.AddGroup(g);
            }

            riq.Query.AddRosterItem(ri);

            m_connection.Send(riq);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Removes a Rosteritem from the Roster
        /// </summary>
        /// <param name="jid">The BARE jid of the rosteritem that should be removed</param>
        public void RemoveRosterItem(Jid jid)
        {
            RosterIq riq = new RosterIq();
            riq.Type = IqType.set;

            RosterItem ri = new RosterItem();
            ri.Jid = jid;
            ri.Subscription = SubscriptionType.remove;

            riq.Query.AddRosterItem(ri);

            m_connection.Send(riq);
        }
Exemplo n.º 6
0
 public void AddRosterItem(RosterItem r)
 {
     this.ChildNodes.Add(r);
 }