diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java index f07083bf7..1072ea940 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java @@ -166,6 +166,11 @@ public class ChatRoomJabberImpl private List chatRoomConferenceCalls = new ArrayList(); + /** + * The Presence listener instance. + */ + private PresenceListener presenceListener = null; + /** * Creates an instance of a chat room that has been. * @@ -586,8 +591,9 @@ public void joinAs(String nickname, byte[] password) } else { + presenceListener = new PresenceListener(this); this.provider.getConnection().addPacketListener( - new PresenceListener(this), + presenceListener, new AndFilter( new FromMatchesFilter(multiUserChat.getRoom()), new PacketTypeFilter( @@ -909,7 +915,14 @@ private void leave(String reason, String alternateAddress) // connection can be null if we are leaving cause connection failed if(connection != null) + { connection.removePacketListener(invitationRejectionListeners); + if(presenceListener != null) + { + connection.removePacketListener(presenceListener); + presenceListener = null; + } + } opSetMuc.fireLocalUserPresenceEvent( this,