powered by Jive Software

How can i know the users who logged bfore n after a user has logged in!

I want to get the list of users who are currently login with Jive Server

Can Roster class help me…

Roste class will give u information about friendlist of user logged in, and their respective status. I m not sure wht u want actully…r u trying to get whole list of users logged in or just friend list.

Thanks for the reply!!!

Actually I am getting the Roster Entries of all the users …

But failing to get their presence…

I’'d called getPresence(arg) but it is returning as null…

though the user is online ( checked in Jive Console)…

Plz help me out!!1

It might be timing. Are you getting presence on a new connection? You might just have to wait for the roster to get updated. Packets need to go back and forth to the server, so how long to wait depends on network latency (at least).

I was having the same problem. I would create a connection then check the roster and presences. Calling roster.getPresence(user) just got null even though I could see the users were available in the admin console. But if I made the thread wait for a second, roster.getPresence(user) got what I expected.

Forcing the thread to wait is not pretty. You could make a java.util.TimerTask instead that checks the roster every second or so until it is ready. Or you could look at Java 5’'s concurrency package.

Hope this helps,

Chris

Smack can be event driven as well. Instead of waiting for an arbitrary period of time you could add a listener to the roster which notifies you every time a presence packet is processed by the roster. The roster entry should be present in the roster at that point.

Alex

You can also go for PacketCollector… for Presence… it will automatically inform u about presence status changes.