Check if User is Authenticated in OpenFire

284 views Asked by At

How do you check that the receiver user is currently authenticated?

When intercepting the packet , I want to know if the receiver user is currently online or offline.

How can i check that ?

Thank you in advanced .

1

There are 1 answers

0
Obscure Geek On

In case of authentication check of receiver I believe that will be taken care by the recipients jid field. When this field is incorrect the server will generate appropriate error message. Also if you have username-password authentication in mind then that will not be possible as the recipients password will not be known.

For presence information, it is better the sender subscribes to the recipients presence and this presence is shown at the client itself as this is the normal approach. Saying this if you want to still monitor this at the server side then you will need a message interceptor which will do the following:

  • Intercept the message
  • Get user presence status from database
  • Take the appropriate action

Since this task is time consuming and will be performed for each message I recommend you to follow the protocol based implementation.

You can find the official documentation here.