Getting all the users logged in with their status programmatically

Submitted by Anonymous on Sat, 2009-05-16 03:05

I am trying to fetch all the users currently logged into tigase and their status through a program. How can I do this with PHP or java or some other language?

Thanks,
vi

kobit's picture

I guess that would be me

I guess that would be me ;-)
Have a look here.

Arthur, If you can give me

Arthur,

If you can give me some pointers/direction on who to go about setting up an admin script to check the logged in users, it will be useful.

Thanks,
-vi

Thanks for your reply. I am

Thanks for your reply.

I am trying to get the list of users using php. I was just checking on the tigase tables and find tig_users table has field online_status. I dont see that getting updated or even the last_login and last_logout. I have configured the server to work with mysql as the db. I am able to register, login and chat with other users as usual. I am able to register users programmatically as well. Only thing is, I dont see any of these columns (last_login, last_logout, online_status) being updated at all.

Is there some configuration or sorts to get this working?

Thanks,
-vi

kobit's picture

There are 2 ways for doing

There are 2 ways for doing this. A simple but less reliable is to use database. This works only if you use tigase-auth authentication connector.

If you look in the Tigase DB schema in tig_users table, line 56 there is a field online_status. It keeps number of connections the user has currently open to the Tigase server. Basically if it is greater than 0 it means the user is online. You can query the database with your own SQL statement or you can use stored procedure: TigOnlineUsers().

This is however, less reliable because if the Tigase server is restarted it doesn't clean the online_status in the database. You would need to do it yourself with every Tigase restart.

Another method would be to write an admin script and load it to the Tigase server. Then the script can be called via XMPP as ad-hoc command. This is very reliable way to get a list of online users as you get it directly from inside the Tigase server. Of course it is much more difficult to implement and use.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.