How do I know if JID specified is already connected to the server?

155 Views Asked by At

I'm trying to find a solution to check if the user is logged in through the jid as a parameter, but without success.

I wonder if there is a way to check this without my having to log into the server. Before log verify that jid is already logged in and then treat with a message blocking access. I am using the agsXMPP library. Does anyone know how to solve it?

1

There are 1 best solutions below

5
AudioBubble On

You can try to get the presence via the JID directly from server without logging on. For example in open-fire :

http://example.com:9090/plugins/presence/[email protected]&type=xml

would give you back the user presence so you know he is online or not.

I do not believe the agxmpp sdk has any such method on its own.