Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
alinux #1
Member since Feb 2008 · 20 posts
Group memberships: Members
Show profile · Link to this post
Subject: Getting Roster..Contact List
Hi All

I am trying to load the roster into an array, I have checked the miniclient example. I am not concerned about presence at this stage.
But I am not sure about which part of the code actually loads the roster information.

Any suggestions are appreciated.

Is it the

RosterItem[] GetRoster()  function ..if so should I use

agsXMPP.protocol.iq.roster ? Roster
agsXMPP.protocol.x.rosterx ? RosterX
This post was edited on 2008-02-28, 15:38 by alinux.
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The roster is requested automatically on login when AutoRoster is true.
Look at the following events in the MiniClient example: OnRosterStart, OnRosterItem, OnRosterEnd.

Alex
Alexander Gnauck
AG-Software
Avatar
alinux #3
Member since Feb 2008 · 20 posts
Group memberships: Members
Show profile · Link to this post
Yeah I have read that..actually I can see the roster being transferred to the client..but I am having issues trying to load the contact names from the roster.
Avatar
Alex #4
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you get each contact in a OnRosterItem event. For more info look at the example codes and the Api docs.

Alex
Alexander Gnauck
AG-Software
Avatar
jogissa #5
Member since Feb 2008 · 6 posts
Group memberships: Members
Show profile · Link to this post
Ok, I understand that if you put autoroster=true, when you login it automatically charges contacts list. But the question is, if you put false there (or if you just want to make a service that returns you your contact list), how should you do?.

From one hand we have rostermanager, but it lacks of a getroster() method, and from the other hand we have roster object, which has a getroster method but I do not know how to attach it to a xmppclientconnection... some ideas?

Thanks in advance,
Best regards
Avatar
Alex #6
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
If you don't request the contact list at Login you can request it at any time later with:

  1. xmppCon.RequestRoster();

or this code directly in your program

  1. public void RequestRoster()
  2. {      
  3.     RosterIq iq = new RosterIq(IqType.get);
  4.     xmppCon.IqGrabber.SendIq(iq, new IqCB(OnRosterResult), null);
  5. }
  6.  
  7. private void OnRosterResult((object sender, IQ iq, object data))
  8. {         
  9.     Roster r = iq.Query as Roster;
  10.     if (r != null)
  11.     {
  12.         foreach (RosterItem i in r.GetRoster())
  13.         {
  14.             // Loops thru all contacts
  15.         }
  16.     }
  17. }

agsXMPP has no internal collection for all your contacts. If gives you only the events and objects. You have to write your own code which keeps the roster in an arrary, hashtable or whatever in the memory. You could also store the roster in a sql database if you want.

The most existing XMPP applications request the roster on each login. But this is not required, and I think a persistent storage, and only sync the the roster on command makes sense.

Alex
Alexander Gnauck
AG-Software
This post was edited on 2008-03-04, 12:36 by Alex.
Avatar
xxyoungmasterxx #7
Member since May 2009 · 6 posts · Location: cebu city phil
Group memberships: Members
Show profile · Link to this post
Subject: auto roster
hi i jst want to knw where to put the auto roster code.. i see all the events that u mentioned... but i am very much confused on auto roster issue..pls tell me where can i put this code in miniclient example
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