Not logged in. · Lost password · Register
Forum: XMPP Protocol RSS
Avatar
cml #1
Member since Oct 2005 · 15 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to group the roster list?
hi~
In order to group my roster list, I have read the document and have found an method item.AddGroup when the client get OnRosterItem event. But I couldn't understand how to use it. I have tried to add one but it wasn't saved in server.  :red:

thank you~
Avatar
Alex #2
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you have to send the updated rosterItem with a RosterIq to to the server.

<iq id='agsXMPP1' type='set'><query xmlns='jabber:iq:roster'><item jid='test@server' name='Nickname'><group>Work</group></item></query></iq>

RosterIq riq = new RosterIq();
riq.Type = IqType.set;
               
RosterItem ri = new RosterItem();
ri.Jid    = new Jid(&quot;test@server&quot;);
ri.Name    = &quot;Nickname&quot;;
ri.AddGroup(&quot;Work&quot;);

riq.Query.AddRosterItem(ri);

m_XMPP.Send(riq);

or use the UpdateRosterItem in the RosterManager class where you can do this with one line of code.

Alex
Avatar
cml #3
Member since Oct 2005 · 15 posts
Group memberships: Members
Show profile · Link to this post
How could I get the group's info ?
I couldn't find the fnction support that in documents. :red:
ex. How many groups I have now?
or
ex.How many users in a specific group?

thanks a lot~
Avatar
Alex #4
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi,

the library doent manage this.
You have to handle yourself how many groups you have and how many items belong to each group.
You can do this with a Hashtable or smth similar. Or with the Treeview that draws your roster, or a custum roster control.

Alex
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: