mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Remove listeners.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@4879 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -374,15 +374,14 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
|
||||
* @param room the room to remove.
|
||||
*/
|
||||
private void cleanupChatRoom(ChatRoom room) {
|
||||
fireChatRoomClosed(room);
|
||||
room.removeMessageListener(this);
|
||||
|
||||
|
||||
final PacketListener listener = (PacketListener)presenceMap.get(room.getRoomname());
|
||||
if (listener != null) {
|
||||
SparkManager.getConnection().removePacketListener(listener);
|
||||
}
|
||||
|
||||
fireChatRoomClosed(room);
|
||||
room.removeMessageListener(this);
|
||||
|
||||
// Remove mappings
|
||||
presenceMap.remove(room.getRoomname());
|
||||
|
||||
|
||||
@ -68,7 +68,12 @@ import javax.swing.event.DocumentEvent;
|
||||
*/
|
||||
public final class GroupChatRoom extends ChatRoom {
|
||||
private final MultiUserChat chat;
|
||||
|
||||
// Define Listeners
|
||||
private final AndFilter chatFilter;
|
||||
private final AndFilter presenceFilter;
|
||||
|
||||
|
||||
private final String roomname;
|
||||
private Icon tabIcon = SparkRes.getImageIcon(SparkRes.CONFERENCE_IMAGE_16x16);
|
||||
private String tabTitle;
|
||||
@ -101,11 +106,12 @@ public final class GroupChatRoom extends ChatRoom {
|
||||
// making sure to filter by room
|
||||
chatFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(chat.getRoom()));
|
||||
// We only want to listen to the presence in this room, no other.
|
||||
AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(chat.getRoom()));
|
||||
// Register PacketListeners
|
||||
presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(chat.getRoom()));
|
||||
|
||||
// Register PacketListeners
|
||||
SparkManager.getConnection().addPacketListener(this, chatFilter);
|
||||
SparkManager.getConnection().addPacketListener(this, presenceFilter);
|
||||
|
||||
// Thie Room Name is the same as the ChatRoom name
|
||||
roomname = chat.getRoom();
|
||||
roomTitle = roomname;
|
||||
@ -249,6 +255,9 @@ public final class GroupChatRoom extends ChatRoom {
|
||||
// Specify the end time.
|
||||
super.closeChatRoom();
|
||||
|
||||
// Remove Listener
|
||||
SparkManager.getConnection().removePacketListener(this);
|
||||
|
||||
ChatContainer container = SparkManager.getChatManager().getChatContainer();
|
||||
container.leaveChatRoom(this);
|
||||
container.closeTab(this);
|
||||
@ -980,7 +989,7 @@ public final class GroupChatRoom extends ChatRoom {
|
||||
return roomInfo;
|
||||
}
|
||||
|
||||
public long getLastActivity(){
|
||||
public long getLastActivity() {
|
||||
return lastActivity;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user