Get a users realtime presence status

Hey Guys,

Is it possible to programmatically get a contacts presence information to see if they are online regardless if the contact is a local user on the Openfire server or a jabber user on a different server for example GoogleTalk>

If so does anybody know what helper method to look at or have code that does it.

best

Mark

http://www.igniterealtime.org/projects/openfire/plugins.jsp

Presence Service

but you wount be able to pull presence info from the other servers

Hey wroot,

Thanks for that but its getting the presence of a contact that is residing on Googletalk that im mostly intersted in.

I discover that the SessionManager in the API has a method of exposing a users presence once the user has a session with the openfire server but a GoogleTalk contact would not have this so it does not work.

Any body else know if you can get the presence of contacs using servers other than openfire?

Best

Mark

I think such a wish is just conflicting with security reasons. There shouldnt be a way for outside person to get presence information, this would be classified as security flaw. So i doubt you will find a solution for that.

You should be able to probe the presence of every Jabber user, if you are in his contact list and he has authorized you to see his presence.

Hey Mark,

Wroot is correct, in accordance with section 5.1.3. Presence Probes of the Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence:

If the user is not in the contact’s roster with a subscription state of “From”, “From + Pending Out”, or “Both” (as defined under Subscription States), the contact’s server MUST return a presence stanza of type “error” in response to the presence probe.

Cheers,

Ryan

Hey Guys,

Thanks for the feedback, Yep all the contacts i would want to get presence info of would be contacts on my roster and subscribed. So i would like to iterate through the roster and if a user is online send out a message, When a user is subscribed normally i can see thier presnce info so im not sure if it would be a security flaw if i could also see it programmatically once they are a contact on my roster.

Yea that presence probe looked promising using the PreseneManager in the API but it does not return anything, so im not sure how it should work.

void probePresence(JID prober, JID probee)

"Probes the presence of the given XMPPAddress and attempts to send it to the given user. If the user probing the presence is using his bare JID then the probee's presence will be sent to all connected resources of the prober. "

I think all it would though is allow a prober to visually see the probee’s presence through a IM client. i think, not sure though.

Regards

Mark

Hi guys,

Just an update there on the presence, so there does not seem to be a method to get the presence of a user, but updates should be sent from a GTalk account and should be picked up by the openfire server. I believe the trouble i was having is a Google problem and can be read here…

http://groups.google.com/group/google-talk-open/browse_thread/thread/c5f436974fa fd197

Best

Mark