Example #1
0
 private void editToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     if (listContacts.SelectedItems.Count > 0)
     {
         var item  = listContacts.SelectedItems[0];
         var input = new FrmAddUser(_dictContactGroups, false, xmppClient);
         input.Name    = item.Text;
         input.Address = item.Name;
         input.Group   = item.Group.Header;
         if (input.ShowDialog() == DialogResult.OK)
         {
             var rm  = new RosterManager(xmppClient);
             Jid jid = input.Address;
             rm.Update(jid, input.Name, input.Group);
         }
     }
 }
Example #2
0
        void client_Roster(object sender, XmppRosterEventArgs e)
        {
            if (e.Type != XmppIqType.Result)
            {
                return;
            }

            Log("roster received");
            bool flagRosterRecv = RosterMgr.Count() > 0;

            /*for (int i = 0; i < 1000; i++) {
             *      XmppRosterItem item = new XmppRosterItem(i.ToString() + "@test.com", "", "", "");
             *      e.Roster.Add(item);
             * }*/

            Parallel.ForEach(e.Roster, item => {
                Dispatcher.BeginInvoke(new Action(() => {
                    if ((item.Subscription == "none" || item.Subscription == "from") && item.Ask != "subscribe" && string.IsNullOrWhiteSpace(item.Name))
                    {
                        return;
                    }

                    RosterItem ri = new RosterItem(client, item, UserSetting.RosterVwrMode);
                    RosterMgr.Update(item.Jid, ri);
                }), DispatcherPriority.Normal);
            });

            Dispatcher.BeginInvoke(new Action(() => {
                lstRoster.ItemsSource = RosterMgr.UpdateRosterView();

                if (flagRosterRecv == false)
                {
                    this.FadeIn(panelRoster.Name, TimeSpan.FromMilliseconds(500));
                }

                panelConnect.Visibility = Visibility.Hidden;
                panelRoster.Visibility  = Visibility.Visible;
                Log(string.Format("roster now contain {0} contacts", RosterMgr.Count()));
            }), DispatcherPriority.Normal);
        }
Example #3
0
 private void editToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     if (listContacts.SelectedItems.Count > 0)
     {
         var item = listContacts.SelectedItems[0];
         var input = new FrmAddUser(_dictContactGroups, false, xmppClient);
         input.Name = item.Text;
         input.Address = item.Name;
         input.Group = item.Group.Header;
         if (input.ShowDialog() == DialogResult.OK)
         {
             var rm = new RosterManager(xmppClient);
             Jid jid = input.Address;
             rm.Update(jid, input.Name, input.Group);
         }
     }
 }