powered by Jive Software

Best Way to Get any Change in Who's Logged In

Curious if someone can point me to the best way to get notification of any change in the users logged in. I don’t care about presence, just need to know if anyone logs in, or out.

Help?

Thanks.

Kit

Hey Kit,

The SessionEventListener will let you react when a user comes online or logs off. You can create a new plugin that provides an implementation of that interface to do whatever you want to.

Regards,

– Gato

Hey Thanks.

That’s where I am now. Just to make sure…will SessionEventListener.sessionCreated() and SessionEventListener.sessionDestroyed() catch all users?

BTW, the event listeners are awesome. The OpenFire API is one of the best I’ve seen.

Kit

Hey Kit,

That’s where I am now. Just to make sure…will SessionEventListener.sessionCreated() and SessionEventListener.sessionDestroyed() catch all users?

Yep, those 2 messages will be sent when any non-anonymous user logs in or logs out. For anonymous users the following messages will be sent: #anonymousSessionCreated(Session) and #anonymousSessionDestroyed(Session)

BTW, the event listeners are awesome. The OpenFire API is one of the best I’ve seen.

Super.

Thanks,

– Gato

If you are about to write a plugin using these status you might want to have a look at the user status plugin. It just saves the login/logoff status (and presence changes) to the database and is quite simple.

You find it here or just the source.