1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

Remove any pending packet listener from the connection. SMACK-48

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2464 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-03-07 22:01:18 +00:00 committed by gaston
parent 8c2ea94613
commit 941b9e752f
2 changed files with 16 additions and 0 deletions

View file

@ -42,6 +42,7 @@ public class GroupChat {
private String nickname = null;
private boolean joined = false;
private List participants = new ArrayList();
private List connectionListeners = new ArrayList();
private PacketFilter presenceFilter;
private PacketFilter messageFilter;
@ -249,6 +250,7 @@ public class GroupChat {
*/
public void addParticipantListener(PacketListener listener) {
connection.addPacketListener(listener, presenceFilter);
connectionListeners.add(listener);
}
/**
@ -332,6 +334,7 @@ public class GroupChat {
*/
public void addMessageListener(PacketListener listener) {
connection.addPacketListener(listener, messageFilter);
connectionListeners.add(listener);
}
public void finalize() throws Throwable {
@ -340,6 +343,10 @@ public class GroupChat {
if (messageCollector != null) {
messageCollector.cancel();
}
// Remove all the PacketListeners added to the connection by this GroupChat
for (Iterator it=connectionListeners.iterator(); it.hasNext();) {
connection.removePacketListener((PacketListener) it.next());
}
}
catch (Exception e) {}
}