Change Presence via Plugin

Dear Reader,

for my Plugin I try to change the presence status. That works fine if the user is initiating a presence change via the UI . I am able to catch that event with a custom PresenceListener as showen in the examples.

However, the initial event (user logges in and gets “Available”) does not trigger the PresenceListener. Therefore I would like to set the presence onvce after login to ensure that it is - what it should be.

I tried: +SparkManager.getSessionManager().changePresence(presence); +

Unfortunatly this results in an NullPointerException:

  • at com.jivesoftware.spark.ui.status.StatusBar.changeAvailability( 0)

at com.jivesoftware.spark.ui.status.StatusBar$2.presenceChanged( )

at com.jivesoftware.spark.SessionManager.changePresence(

I assume the problem is that the original Event (User hit change availability) is missing.

What is the prefered way of changing the presence status?

Thanks & Regards,

Thorsten Zoerner

Ok, in my particular case creating a blank Presence package and sending it directly to the XMPP connection was the solution. Because if my assumption is true after the initial connect every presence change should pass sessionManager.presenceListener.