From f10a61f12a281e0dc627b0822e96f4cbe9beb360 Mon Sep 17 00:00:00 2001 From: Danny van Heumen Date: Fri, 13 Feb 2015 23:47:41 +0100 Subject: Immediately remove nick from MONITOR monitored list, after 'MONITOR - nick' command is issued, since we will not get confirmation of removal. --- .../impl/protocol/irc/MonitorPresenceWatcher.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/net/java/sip/communicator/impl/protocol/irc') diff --git a/src/net/java/sip/communicator/impl/protocol/irc/MonitorPresenceWatcher.java b/src/net/java/sip/communicator/impl/protocol/irc/MonitorPresenceWatcher.java index 31e1405..be33967 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/MonitorPresenceWatcher.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/MonitorPresenceWatcher.java @@ -49,6 +49,15 @@ class MonitorPresenceWatcher private final Set nickWatchList; /** + * List of monitored nicks. + * + * The instance is stored here only for access in order to remove a nick + * from the list, since 'MONITOR - ' command does not reply so we cannot + * manage list removals from the reply listener. + */ + private final Set monitoredList; + + /** * Constructor. * * @param irc the IRCApi instance @@ -80,7 +89,12 @@ class MonitorPresenceWatcher throw new IllegalArgumentException("nickWatchList cannot be null"); } this.nickWatchList = nickWatchList; - this.irc.addListener(new MonitorReplyListener(monitored, operationSet)); + if (monitored == null) + { + throw new IllegalArgumentException("monitored cannot be null"); + } + this.monitoredList = monitored; + this.irc.addListener(new MonitorReplyListener(this.monitoredList, operationSet)); setUpMonitor(this.irc, this.nickWatchList, maxListSize); LOGGER.debug("MONITOR presence watcher initialized."); } @@ -141,7 +155,9 @@ class MonitorPresenceWatcher LOGGER.trace("Removing nick '" + nick + "' from MONITOR watch list."); this.nickWatchList.remove(nick); this.irc.rawMessage("MONITOR - " + nick); - // FIXME Also remove from monitoredNicks list! + // 'MONITOR - nick' command does not send confirmation, so immediately + // remove nick from monitored list. + this.monitoredList.remove(nick); } /** -- cgit v1.1