示例#1
0
        private static void LoadBuddyListNames()
        {
            //get the buddy list from the session
            AccCoreLib.IAccBuddyList bl = accSess.BuddyList;

            //list of users
            List <String> lst = new List <string>();

            //iterate groups
            for (int i = 0; i < bl.GroupCount; i++)
            {
                //iterate names in the group
                for (int j = 0; j < bl.GetGroupByIndex(i).BuddyCount; j++)
                {
                    //get user
                    IAccUser user = bl.GetGroupByIndex(i).GetBuddyByIndex(j);

                    //add user to dictionary
                    lst.Add(user.Name);
                }
            }

            //raise the NamesLoaded event
            if (NamesLoaded != null)
            {
                NamesLoaded.Invoke(lst);
            }
        }
示例#2
0
        private static void LoadBuddyListGroups()
        {
            //temp buddy list var
            AccCoreLib.IAccBuddyList bl = accSess.BuddyList;

            //list of KeyValue pairs
            List <KeyValuePair <int, String> > lst = new List <KeyValuePair <int, string> >();

            //iterate the groups
            for (int i = 0; i < bl.GroupCount; i++)
            {
                //get group name and position
                String strName     = bl.GetGroupByIndex(i).Name;
                int    intPosition = bl.GetGroupPosition(bl.GetGroupByIndex(i));

                //add to list
                lst.Add(new KeyValuePair <int, string>(intPosition, strName));
            }

            //add Offline group
            lst.Add(new KeyValuePair <int, string>(lst.Count, "Offline"));

            //raise event
            if (GroupsLoaded != null)
            {
                GroupsLoaded.Invoke(lst);
            }
        }