Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
evilempire22 #1
Member since Oct 2006 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to add a new Group to Roster
My question is, how do I add a new group to the roster and have it saved on the server? I am able to add the group with the following code:

rosterControl.AddGroup(groupName, RootNode);

Which adds a new group to the RootNode, but once I close the application and open it again, the new group is not there. I know there is something I am missing, I just don't know what it is. Anyone have any suggestions?


Also, how do I update the name of a group and have that change saved?

And one more...if I delete a group, are all nodes associated to that group deleted as well?
This post was edited on 2006-10-11, 17:31 by evilempire22.
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by evilempire22:
My question is, how do I add a new group to the roster and have it saved on the server? I am able to add the group with the following code:

rosterControl.AddGroup(groupName, RootNode);

Which adds a new group to the RootNode, but once I close the application and open it again, the new group is not there. I know there is something I am missing, I just don't know what it is. Anyone have any suggestions?
The group of each contact is stored with the contact, and the contact list is stored on the server. When MiniClient receives the contact list it builds the groups and adds them to the RosterControl. So there is no way to add only a single group without adding or updating a contact. Of couse you can add it to the rosterControl like you described it, but if there is no contact which belongs to this group then it will be lost with the next login.

Quote by evilempire22:
Also, how do I update the name of a group and have that change saved?
You have to update the group(s) of a rosterItem. If this group contains multiple contacts then you have to update each contact. You can do this with the update functions of the RosterManager class.

Quote by evilempire22:
And one more...if I delete a group, are all nodes associated to that group deleted as well?

No, a group will disappear automatically when none of you contacts belongs to this group anymore. You can achieve this with udpating or deleting the contacts in this group.

Alex
Alexander Gnauck
AG-Software
Avatar
evilempire22 #3
Member since Oct 2006 · 10 posts
Group memberships: Members
Show profile · Link to this post
Quote by Alex:
Quote by evilempire22:
Also, how do I update the name of a group and have that change saved?
You have to update the group(s) of a rosterItem. If this group contains multiple contacts then you have to update each contact. You can do this with the update functions of the RosterManager class.

Ok, I understand how groups work now. My problem is, how do I get the list of contacts from a certain group (node) so that I can perform my update on them?

To use the UpdateRosterItem function, I need to know at least the Jid of the child node I want to update the group for correct? How do I access those child nodes?
This post was edited on 2006-10-11, 21:06 by evilempire22.
Avatar
evilempire22 #4
Member since Oct 2006 · 10 posts
Group memberships: Members
Show profile · Link to this post
Nevermind, I figured it out. Thanks again for your help.

                    foreach (RosterNode node in ParentNode.Nodes)
                    {
                        Chat.Connection.RosterManager.UpdateRosterItem(node.RosterItem.Jid, node.RosterItem.Name, GroupName);
                    }
Avatar
Alex #5
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes this code is correct.
The RosterControl should only be an example how you can build your roster. If it doesnt fit to your app then you have to extend or rewrite it. Because there was not much interest at the GUI controls we will not update them anymore and move them to the examples in one of the next releases.

Alex
Alexander Gnauck
AG-Software
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP SDK Support RSS