|
@@ -23,10 +23,17 @@
|
23
|
23
|
package com.dmdirc.addons.channelwho;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.DMDircMBassador;
|
|
26
|
+import com.dmdirc.config.prefs.PreferencesCategory;
|
|
27
|
+import com.dmdirc.config.prefs.PreferencesSetting;
|
|
28
|
+import com.dmdirc.config.prefs.PreferencesType;
|
|
29
|
+import com.dmdirc.events.ClientPrefsOpenedEvent;
|
|
30
|
+import com.dmdirc.events.GroupChatPrefsRequestedEvent;
|
26
|
31
|
import com.dmdirc.events.ServerConnectingEvent;
|
27
|
32
|
import com.dmdirc.events.ServerDisconnectedEvent;
|
28
|
33
|
import com.dmdirc.interfaces.Connection;
|
29
|
34
|
import com.dmdirc.interfaces.ConnectionManager;
|
|
35
|
+import com.dmdirc.plugins.PluginDomain;
|
|
36
|
+import com.dmdirc.util.validators.NumericalValidator;
|
30
|
37
|
|
31
|
38
|
import com.google.common.annotations.VisibleForTesting;
|
32
|
39
|
|
|
@@ -42,6 +49,7 @@ import net.engio.mbassy.listener.Handler;
|
42
|
49
|
*/
|
43
|
50
|
public class ChannelWhoManager {
|
44
|
51
|
|
|
52
|
+ private final String domain;
|
45
|
53
|
private final ConnectionHandlerFactory connectionHandlerFactory;
|
46
|
54
|
private final ConnectionManager connectionManager;
|
47
|
55
|
private final DMDircMBassador eventBus;
|
|
@@ -49,9 +57,11 @@ public class ChannelWhoManager {
|
49
|
57
|
|
50
|
58
|
@Inject
|
51
|
59
|
public ChannelWhoManager(
|
|
60
|
+ @PluginDomain(ChannelWhoPlugin.class) final String domain,
|
52
|
61
|
final ConnectionHandlerFactory connectionHandlerFactory,
|
53
|
62
|
final ConnectionManager connectionManager,
|
54
|
63
|
final DMDircMBassador eventBus) {
|
|
64
|
+ this.domain = domain;
|
55
|
65
|
this.connectionHandlerFactory = connectionHandlerFactory;
|
56
|
66
|
this.connectionManager = connectionManager;
|
57
|
67
|
this.eventBus = eventBus;
|
|
@@ -79,6 +89,25 @@ public class ChannelWhoManager {
|
79
|
89
|
}
|
80
|
90
|
}
|
81
|
91
|
|
|
92
|
+ @VisibleForTesting
|
|
93
|
+ @Handler
|
|
94
|
+ void handleGroupChatPrefsRequestedEvent(final GroupChatPrefsRequestedEvent event) {
|
|
95
|
+ event.getCategory().addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, domain,
|
|
96
|
+ "sendWho", "Send Who Requests", "Should we send who requests to the channel?",
|
|
97
|
+ event.getConfig(), event.getIdentity()));
|
|
98
|
+ }
|
|
99
|
+
|
|
100
|
+ @VisibleForTesting
|
|
101
|
+ @Handler
|
|
102
|
+ void handlePrefsDialog(final ClientPrefsOpenedEvent event) {
|
|
103
|
+ final PreferencesCategory category = new PreferencesCategory("Channel Who", "Provides " +
|
|
104
|
+ "support for sendinw WHO requests to channels at regular intervals");
|
|
105
|
+ category.addSetting(new PreferencesSetting(PreferencesType.DURATION,
|
|
106
|
+ new NumericalValidator(0, Integer.MAX_VALUE), domain, "whointerval",
|
|
107
|
+ "Who Interval", "The interval WHO requests will be sent to channels",
|
|
108
|
+ event.getModel().getConfigManager(), event.getModel().getIdentity()));
|
|
109
|
+ }
|
|
110
|
+
|
82
|
111
|
@VisibleForTesting
|
83
|
112
|
@Handler
|
84
|
113
|
void handleServerConnectingEvent(final ServerConnectingEvent event) {
|