|
@@ -29,6 +29,7 @@ import com.dmdirc.commandparser.CommandType;
|
29
|
29
|
import com.dmdirc.commandparser.parsers.ChannelCommandParser;
|
30
|
30
|
import com.dmdirc.config.ConfigManager;
|
31
|
31
|
import com.dmdirc.interfaces.ConfigChangeListener;
|
|
32
|
+import com.dmdirc.interfaces.NicklistListener;
|
32
|
33
|
import com.dmdirc.interfaces.TopicChangeListener;
|
33
|
34
|
import com.dmdirc.parser.interfaces.ChannelClientInfo;
|
34
|
35
|
import com.dmdirc.parser.interfaces.ChannelInfo;
|
|
@@ -319,8 +320,8 @@ public class Channel extends MessageTarget<ChannelWindow> implements ConfigChang
|
319
|
320
|
|
320
|
321
|
setIcon("channel-inactive");
|
321
|
322
|
|
322
|
|
- for (ChannelWindow window : getWindows()) {
|
323
|
|
- window.updateNames(new ArrayList<ChannelClientInfo>());
|
|
323
|
+ for (NicklistListener listener : listeners.get(NicklistListener.class)) {
|
|
324
|
+ listener.clientListUpdated(new ArrayList<ChannelClientInfo>());
|
324
|
325
|
}
|
325
|
326
|
}
|
326
|
327
|
|
|
@@ -365,14 +366,34 @@ public class Channel extends MessageTarget<ChannelWindow> implements ConfigChang
|
365
|
366
|
}
|
366
|
367
|
}
|
367
|
368
|
|
|
369
|
+ /**
|
|
370
|
+ * Registers a new nicklist listener for this channel.
|
|
371
|
+ *
|
|
372
|
+ * @since 0.6.5
|
|
373
|
+ * @param listener The listener to be added
|
|
374
|
+ */
|
|
375
|
+ public void addNicklistListener(final NicklistListener listener) {
|
|
376
|
+ listeners.add(NicklistListener.class, listener);
|
|
377
|
+ }
|
|
378
|
+
|
|
379
|
+ /**
|
|
380
|
+ * Removes the specified nicklist listener from this channel.
|
|
381
|
+ *
|
|
382
|
+ * @since 0.6.5
|
|
383
|
+ * @param listener The listener to be removed
|
|
384
|
+ */
|
|
385
|
+ public void removeNicklistListener(final NicklistListener listener) {
|
|
386
|
+ listeners.remove(NicklistListener.class, listener);
|
|
387
|
+ }
|
|
388
|
+
|
368
|
389
|
/**
|
369
|
390
|
* Adds a ChannelClient to this Channel.
|
370
|
391
|
*
|
371
|
392
|
* @param client The client to be added
|
372
|
393
|
*/
|
373
|
394
|
public void addClient(final ChannelClientInfo client) {
|
374
|
|
- for (ChannelWindow window : getWindows()) {
|
375
|
|
- window.addName(client);
|
|
395
|
+ for (NicklistListener listener : listeners.get(NicklistListener.class)) {
|
|
396
|
+ listener.clientAdded(client);
|
376
|
397
|
}
|
377
|
398
|
|
378
|
399
|
tabCompleter.addEntry(TabCompletionType.CHANNEL_NICK, client.getClient().getNickname());
|
|
@@ -384,8 +405,8 @@ public class Channel extends MessageTarget<ChannelWindow> implements ConfigChang
|
384
|
405
|
* @param client The client to be removed
|
385
|
406
|
*/
|
386
|
407
|
public void removeClient(final ChannelClientInfo client) {
|
387
|
|
- for (ChannelWindow window : getWindows()) {
|
388
|
|
- window.removeName(client);
|
|
408
|
+ for (NicklistListener listener : listeners.get(NicklistListener.class)) {
|
|
409
|
+ listener.clientRemoved(client);
|
389
|
410
|
}
|
390
|
411
|
|
391
|
412
|
tabCompleter.removeEntry(TabCompletionType.CHANNEL_NICK, client.getClient().getNickname());
|
|
@@ -402,8 +423,8 @@ public class Channel extends MessageTarget<ChannelWindow> implements ConfigChang
|
402
|
423
|
* @param clients The list of clients to use
|
403
|
424
|
*/
|
404
|
425
|
public void setClients(final Collection<ChannelClientInfo> clients) {
|
405
|
|
- for (ChannelWindow window : getWindows()) {
|
406
|
|
- window.updateNames(clients);
|
|
426
|
+ for (NicklistListener listener : listeners.get(NicklistListener.class)) {
|
|
427
|
+ listener.clientListUpdated(clients);
|
407
|
428
|
}
|
408
|
429
|
|
409
|
430
|
tabCompleter.clear(TabCompletionType.CHANNEL_NICK);
|
|
@@ -434,8 +455,8 @@ public class Channel extends MessageTarget<ChannelWindow> implements ConfigChang
|
434
|
455
|
return;
|
435
|
456
|
}
|
436
|
457
|
|
437
|
|
- for (ChannelWindow window : getWindows()) {
|
438
|
|
- window.updateNames();
|
|
458
|
+ for (NicklistListener listener : listeners.get(NicklistListener.class)) {
|
|
459
|
+ listener.clientListUpdated();
|
439
|
460
|
}
|
440
|
461
|
}
|
441
|
462
|
|