Server side account status change

Titas Lapinskas
Added over 4 years ago


I am facing with a problem. My task is to create functionality so that outside party should be able to change user status. That outside party is not xmpp client, I am using JMX.

I wrote my management MBean which locates JID and corresponding connection and modifies presence and calls setPresence in the XMPPResourceConnection instance.

By looking at that code it calls handlePresenceSet which should notify all interested parties.

Sadly that's not the case

For example I have 2 logins with 2x clients on 2x machines.

User1 and User2

Both online, I modify User1 presence and set it. I can confirm that presence is saved via logs I added. But still both see each other as online.

I go offline with User2, then online with User2, now he re-requests status from server and correctly shows status of User1 as xa (eXtended Away).

Any ideas, suggestions what I am missing, or point to example which already does that and I could just add my logic of deciding should I change status and to which?

Thank you advance.

Titas Lapinskas

Replies (2)

Added by Wojciech Kapcia TigaseTeam over 4 years ago

setPresence only updates presence within SessionManager. You also need to broadcast this presence to contacts using @tigase.xmpp.impl.Presence.sendPresenceBroadcast()@. Alternatively you could prepare a presence packet on behalf of the connected user and send it to SessionManager component (it should be Packet itself address, not the presence stanza that it contains).

Added by Titas Lapinskas over 4 years ago

Sorry for late answer, but thank you for pointing direction. That helped.

I used Presence.sendPrensenceBroadcast and had to add those packets to SessionManager.addOutPackets()