How to retrive user status (online/offline) in process method.

Ehsan Mozaffari
Added over 2 years ago


I'd like to find that the specific user "B" is offline or online in process method from the session variable. The problem is when user A tries to send a message to the user B, if the user B is not online, each stanza goes through the Session Manager component just one time. So, How can I find out the user B is offline in my plugin ,without database query, just by the process of message in Session Manager?

Thank you.

Replies (3)

Added by Wojciech Kapcia TigaseTeam over 2 years ago

It goes through Session Manager twice - for the session of UserA, and then for the session of UserB. If the UserB is offline, the in your plugin session variable will be null - please check message or msgoffline plugins.

Added by Ehsan Mozaffari over 2 years ago

Thank you for your rapid answer.

When session is null message goes through session manager twice and the to parameter appears, one time with full JID and one time with bare JID. why this happens? and what is the difference between the first time and the second time?


Added by Andrzej Wójcik IoT 1 CloudTigaseTeam over 2 years ago

Message is processed twice as Tigase processes it twice - once as message sent to full jid, but as this full jid is not available it processes it seconds time as message sent to bare jid. This is done due to fact that Tigase uses XMPP message processing as defined in RFC 6121: Section

It is possible to change processing and return error if recipient to which message is sent to full jid is not avilable by changing delivery-rules setting.