Project

General

Profile

Is there a way to know a status of any user(online\offline) in plugin?

Igor Khomenko
Added about 4 years ago

Is there a way to know a status of any user(online\offline) in plugin?

I would like to build kind of a pre processor and if an opponent is offline - block a packet.

I see that SessionManager has a method

XMPPResourceConnection conn = getXMPPResourceConnection(packet);

is it possible to get an access to such functionality within a plugin?


Replies (5)

Added by Wojciech Kapcia TigaseTeam about 4 years ago

Current plugins API doesn't allow such functionality.

Added by Igor Khomenko about 4 years ago

I know I can do it on the receiver side by checking session==null

but is there a way to check this on the sender side?

Added by Wojciech Kapcia TigaseTeam about 4 years ago

You can try accessing this data through TigaseRuntime, however bare in mind that this solution is not optimal and the results may not be 100% correct under some circumstances.

Added by Igor Khomenko about 4 years ago

btw,

does SessionManager class have only single instance in memory all the time?

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 4 years ago

Igor, the main question is why you need access to other plugins online status? Current implementation intentionally forbids access to other users' session data when a packet is processed within a user context.

You can have access to online status of the user's contacts as there is a fields in the roster data stored in user's session which tells you whether the contact is online or offline. However, access to other users' presence is intentionally restricted. If you provide more details about your use case, then, perhaps we could suggest you an optimal approach.

    (1-5/5)