diff options
author | Yana Stamcheva <yana@jitsi.org> | 2012-08-22 12:45:08 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2012-08-22 12:45:08 +0000 |
commit | 59d61ccd9670949dec01dc510e45f2d7e0e9d84c (patch) | |
tree | 8521f60ae8e811f0e05d6c1e1f5b0fa92e319e30 /src/net/java/sip/communicator/impl/gui/main | |
parent | a1c61aec2d66b43d27d100b5bee8038d46fbe16c (diff) | |
download | jitsi-59d61ccd9670949dec01dc510e45f2d7e0e9d84c.zip jitsi-59d61ccd9670949dec01dc510e45f2d7e0e9d84c.tar.gz jitsi-59d61ccd9670949dec01dc510e45f2d7e0e9d84c.tar.bz2 |
Removes notifications that are no longer available.
Diffstat (limited to 'src/net/java/sip/communicator/impl/gui/main')
-rw-r--r-- | src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationGroup.java | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationGroup.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationGroup.java index ff5a88b..8a3967a 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationGroup.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationGroup.java @@ -201,25 +201,31 @@ public class NotificationGroup if (messages != null) { - // find messages that need to be removed - Hashtable<String, NotificationContact> contactToRemove = - (Hashtable<String, NotificationContact>)contacts.clone(); - while (messages.hasNext()) + // Removes contacts that are no longer available. + Enumeration<String> contactIdentifiers = contacts.keys(); + while (contactIdentifiers.hasMoreElements()) { - NotificationMessage message = messages.next(); + String identifier = contactIdentifiers.nextElement(); - if (message.getMessageGroup().equals(groupName)) + boolean toRemove = true; + messages = event.getMessages(); + while (messages.hasNext()) { + NotificationMessage message = messages.next(); String messageIdentifier - = message.getFromContact() + message.getMessageDetails(); - contactToRemove.remove(messageIdentifier); + = message.getFromContact() + + message.getMessageDetails(); + + if (identifier.equals(messageIdentifier)) + { + toRemove = false; + break; + } + } + if (toRemove) + { + removeNotificationContact(contacts.get(identifier)); } - } - // now remove what needs to be removed - TreeContactList contactList = GuiActivator.getContactList(); - for(NotificationContact c : contactToRemove.values()) - { - contactList.removeContact(c); } messages = event.getMessages(); @@ -315,4 +321,19 @@ public class NotificationGroup contact.getUnreadMessageCount())); } } + + /** + * Removes the given <tt>NotificationContact</tt>. + * + * @param contact the <tt>NotificationContact</tt> to remove + */ + private void removeNotificationContact(NotificationContact contact) + { + TreeContactList contactList = GuiActivator.getContactList(); + + if (contactList.getCurrentFilter().isMatching(contact)) + { + contactList.removeContact(contact); + } + } } |