powered by Jive Software

Problem listening presence packets

Hi there… I have this problem: I have a PresencePacketListener to listen presence packets and it can listen the packets when a user logs in and logs out but it can’‘t listen the packets that I send to the connection when I want to change a user status. I’'m sending the packet with this code:


new Presence( Presence.Type.AVAILABLE, “I’'m sleeping”, 5, Presence.Mode.AWAY )


Any ideas?

Thanks, Guille


A working sample will help me understand better the problem. I’‘m not sure what you are trying to do but what do you mean by "it can’'t listen the packets that I send to the connection"? Asking the connection to send a Presence packet will not trigger your listener. Your listener will be triggered when a presence packet is received by Smack. You can use the Smack debugger to check that your client is in fact receiving a presence from the server.


– Gato


All I want is to let a user change its status and the rest of the users to listen to that action. I thougth that the right way to do that was to send a Presence packet to the connection and add a packet listener to the connection, but it seems that is not the right way… What should I do? I’‘m not using a roster because I’'m not developing a IM app.

Thanks, Guille

I forgot to tell you that all the users involved are in the same muc…


Since all your users are occupants of the same room you should try sending a presence to the room and adding ParticipantListeners to the MultiUserChat to get the updated presences.

This is an example of the presence you need to send to the room:

<presence to="myroom@conference.localhost/gato">

Hope that helps,

– Gato

Yes Gato, it helped a lot!

Thanks one more time…

Saludos, Guille