Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
lazycoder207 #1
Member since Sep 2007 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: right way to get presence after login
Hello,

        i want to know what is the correct way to get presence info immediately after login.. i have onLogin and onPresence events handled..but iam unable to get presence info of all contacts correctly after logging in..sometimes contacts r showing up online correctly .. sometimes it doesnt..is there something i should explicitly do when configuring XmppClientConnection object ?

Thank you,
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hellol,

when you send your own presence to the server, your server starts sending the online presences of your contacts to you.
All contacts from whom you get no presence are offline.
If some contacts show not up correctly then there must be a problem on your server or the contacts server.

Alex
Avatar
lazycoder207 #3
Member since Sep 2007 · 7 posts
Group memberships: Members
Show profile · Link to this post
thank you for quick reply... i did check for contacts who r offline..but they were online..anyway i didnt know that server sends presence info when i send my presence..i will check that..thanks again..
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
the server starts sending presence after you send your own initial presence.
You don't have to send your presence again to get presence updates. They come automatically as long as you are online or log off.

If you don't send your presence to the server the server also sends no presences from your contacts. This is useful for applications which don't need the presence.

Alex
Avatar
lazycoder207 #5
Member since Sep 2007 · 7 posts
Group memberships: Members
Show profile · Link to this post
Quote by Alex:
the server starts sending presence after you send your own initial presence.
You don't have to send your presence again to get presence updates. They come automatically as long as you are online or log off.

If you don't send your presence to the server the server also sends no presences from your contacts. This is useful for applications which don't need the presence.

Alex

which means the best time to send my presence is in OnRosterEnd .. when all the contacts r downloaded ..atleast in my case.. my problem occurred since in OnRosterItem i added contacts with default value of offline .. and i sent my presence in OnLogin.. so kind of sync problem was there..now that i put it in OnRosterEnd.. its solved.. but if anyone has good ideas on how to add roster items after login.. please reply..
Avatar
Jabberer #6
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
you can add contacts at any time after login and will get their presences when your are subscribed to them.
Software Developer
AG-Software
Avatar
lazycoder207 #7
Member since Sep 2007 · 7 posts
Group memberships: Members
Show profile · Link to this post
Quote by Jabberer:
you can add contacts at any time after login and will get their presences when your are subscribed to them.

can u please explain a bit more on the subscribe part ? i saw 2 classes  PresenceGrabber and PresenceManager ..with subscribe methods.. i didnt exactly follow what their purpose is ... if presences come automatically when contacts login/logoff.. why must we use them ?
Thank you
Avatar
Jabberer #8
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Please study the MiniClient example (add contact form).
There is all code you need.
Software Developer
AG-Software
Avatar
lazycoder207 #9
Member since Sep 2007 · 7 posts
Group memberships: Members
Show profile · Link to this post
ok.. i think i understand now .. thanks for your help and sorry for the trouble ..
Avatar
Jabberer #10
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
hey no problem ;-)
Software Developer
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 RSS