powered by Jive Software

User''s online presence (again - but slightly different situation)

If I am hosting a XMPP/Jabber based instant messaging server (TIMP) myself and also have an external java application that needs to get user presence information (e.g. online/offline status). Is it possible to get this information by using the SMACK library? If so how?

I realise that for privacy reasons a normal user should not be able to see another user’'s status unless that user appears in their roster. However in this case - is there no admin only methods that I can use - since I would own the server?!

I have read around and can’‘t seem to find a better solution than to have a “bot” user that all users would have to subscribe to in order to have their online status published. That way logging in as this “bot” user from my app, all the user’‘s I’‘m interested in would appear in it’‘s roster - and hence I would get their presence info. This does seem a bit overkill! From the user’'s point of view, they would have to explicitly subscribe to this “bot” - which would automatically accept them. There must be a better way!

Thanks and regards, Alex.

I think your best solution would be to modify the server code. It’'s got a database somewhere with all users and all information about them, and if you put the requisite time into understanding the code, I think you can modify it to tell you whatever you need to know.


Hmm, I’'d rather not modify any server code. Is there any other approaches I could take?

I am still waiting for an answer myself. The only way around I could come up with was to create a group with all my users in it. You can set it up so that group shows up in your roster from the admin console.

When you connect and login, you can retrieve your roster which will have all the users in it. For each user, you can check the presence/status.

This seems to work but not highly performant for some reason and I am not sure why yet. But this seems to be a work around anyway. There have to be a better way. I was a little hesitant to go directly to the database but this would be my next option.


Yes - that would work for a non-changing set of users. For instance, if I know I will only ever have user x,y and z - then I can just add them to this group as you say.

But I need it to work for the case when new users sign up too! I don’'t want to have to go and change this group each time a new user joins. There will be many users joining all the time…

Check this: http://www.jivesoftware.org/forums/thread.jspa?threadID=14967&tstart=0

Ryan might implement it for you!


No that thread is talking about Jive Messanger (which I am not using). I am talking about the XMPP/Jabber specification which Jive Messenger implements. So any changes to Jive Messenger do not help me in the slightest - as I am writting code to the specification.

Hi Alexp,

The search plugin that Messenger uses adhears to the Jabber Search url=http://www.jabber.org/jeps/jep-0055.htmlJEP-0055[/url] spec. As Gato pointed out in the thread that Pat linked to, often times XMPP servers do not allow presence based searches for security and privacy reasons. So, what you’'re looking to do is going to have to be (at least partially) done on the server side to expose presence information to client/search service.

Hope that helps,