How can I know a user is offline with ejabberd?

0 down vote favorite

I just want to check if a user is offline or online with his jid. I google so much, but could not solve this issue.

What can I do?

The presence of a user is

The presence of a user is private information. Such information is only shared with his contacts (for which the user granted access to his presence).

Of course, if you are the server administrator, you can use administrative tools to know the presence of any user in the server.

badlop wrote: The presence of

badlop wrote:

The presence of a user is private information. Such information is only shared with his contacts (for which the user granted access to his presence).

Of course, if you are the server administrator, you can use administrative tools to know the presence of any user in the server.

Badlop,
I have the similar requirement that I have users registered online, and I need to know the presence status before sending user the chat session otherwise just email. Since the recipient has to accept the subscribe presence in order for me to request status, it's kind of inconvenience for the end user to accept my request. I want to do it automatically on behalf of the users.

Can you show me how to do it through the administrative tools? Do you know any 3rd party tools provide such method as well?

Thanks very much

fei wrote: Can you show me

fei wrote:

Can you show me how to do it through the administrative tools? Do you know any 3rd party tools provide such method as well?

By executing an ejabberd command in the shell. In this example user1 is connected, and user2 is offline:

$ ejabberdctl user_resources user1 localhost
tka1
$ ejabberdctl user_resources user2 localhost         
$    

You can query ejabberd commands using XML-RPC if you install ejabberd_xmlrpc, or using REST if you install mod_rest.

Syndicate content