Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
zgc #1
Member since Oct 2005 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: how to presence my rosters's status of on-line/off-line?
how to presence my rosters's status of on-line/off-line?
there are many Contacts for a user,
how can i get my rosters's status of online/offline quickly after successed establish a session to server?

thanks!
Avatar
Alex #2
Member since Feb 2003 · 4246 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

for sending your own presence to the server use the SendMyPresence method in XmppClientConnection.

XmppCon.Show = ShowType.away;
XmppCon.Status = "gone away"
XmppCon.SendMyPresence();

sending your own offline status:

Presence pres = new Presence();
pres.Type = PresenceType.unavailable;
XmppCon.Send(pres);

You receive presence from your contacts in the OnPresence Event of your connected XmppClientConnection. The server will send you the presences only if you are online.
All this stuff is covered in the MiniClient sample.

Alex
Alexander Gnauck
AG-Software
Avatar
preky #3
Member since Jan 2006 · 17 posts
Group memberships: Members
Show profile · Link to this post
Subject: What is the difference
What is difference between PresenceType and ShowType and how and when to use them?
It's a bit confusing...There should be something like Connection state (state of current connection to server) and UserPresenceState (away, ONLINE seams to be missing, and other), some concepts of Microsoft Messenger are good, and after working with Messenger it's a bit unusual for me to think the other way.

Yes, and what about ONLINE ShowType value... How can I say I'm online? is that ShowType.chat value? (maybe I have old version I don't know).

Greatings!
Preky
Avatar
Alex #4
Member since Feb 2003 · 4246 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Preky,

An empty presene packet (no ShowType) means online in XMPP.

some samples:
<presence from=&quot;somejid&quot;/>
--> User is online
or
<presence type=&quot;available&quot; from=&quot;somejid&quot; />
--> shows you that a user just became available.
<presence from=&quot;somejid&quot;><show>chat</show><status>im online</status></presence>
--> User wants to chat
<presence from=&quot;somejid&quot;><show>dnd</show><status>don't bother me</status></presence>
--> User asks not to be disturbed
<presence from=&quot;somejid&quot;><show>away</show></presence>
--> User is away
<presence from=&quot;somejid&quot;><show>xa</show></presence>
--> User is extended away
<presence type=&quot;unavailable&quot; />
--> User went offline

The other types here are used for subscription. If you want to subscribe to the presence of somebody (subscribe, unsubscribe etc...)

status is only a optional attribute which shows a optional status message. eg. &quot;in a meeting&quot; in combination with an xa presence.

Alex
Alexander Gnauck
AG-Software
Avatar
preky #5
Member since Jan 2006 · 17 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

So in other words if I want to see my friend status first I have to suscribe on his JID, and then event would be fired when he/she changes his/her presence.
Do I have to store my friends JID list by myself or it is handled on server automaticly? I didn't came across on method that would list my contacts or I haven't been looking good enough (sorry if that is the case).

Tell me if I'm right:
1) have to store my contact list by myself
2) loading my client I have to go through that list and suscribe to event of precence change  (OnPresence) every time i load my client app
3) how to suscribe to someones JID?

Thx for reply!
Preky
Avatar
Alex #6
Member since Feb 2003 · 4246 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi perky,

the server stores the contacts for you once you added them. You find samples in the MiniClient how to add contacts. The server stores the list for you and agsXMPP requests the list on each login. You get each contact in an OnRosterItem Event.

And yes, you also have to subscribe to the presence and will get the Presences in the OnPresence event. You will also see how to do that in the MiniClient sample. When adding a contact the MiniClient also asks dor subscription.

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