ソースを参照

Use new scoped event bus.

Change-Id: Iad1f97cc02ce17c909df72e72c8aa7a0cd393bad
Reviewed-on: http://gerrit.dmdirc.com/3265
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
changes/65/3265/2
Chris Smith 10年前
コミット
25e229901e

+ 2
- 10
src/com/dmdirc/addons/contactlist/ContactListCommand.java ファイルの表示

@@ -34,8 +34,6 @@ import com.dmdirc.commandparser.commands.context.CommandContext;
34 34
 import com.dmdirc.interfaces.CommandController;
35 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 36
 
37
-import com.google.common.eventbus.EventBus;
38
-
39 37
 import javax.inject.Inject;
40 38
 
41 39
 /**
@@ -47,20 +45,15 @@ public class ContactListCommand extends Command implements IntelligentCommand {
47 45
     public static final CommandInfo INFO = new BaseCommandInfo("contactlist",
48 46
             "contactlist - show a contact list for the current channel",
49 47
             CommandType.TYPE_CHANNEL);
50
-    /** Event bus to listen to events on. */
51
-    private final EventBus eventBus;
52 48
 
53 49
     /**
54 50
      * Creates a new instance of this command.
55 51
      *
56 52
      * @param controller The controller to use for command information.
57
-     * @param eventBus   Event bus to listen to events on
58 53
      */
59 54
     @Inject
60
-    public ContactListCommand(final CommandController controller,
61
-            final EventBus eventBus) {
55
+    public ContactListCommand(final CommandController controller) {
62 56
         super(controller);
63
-        this.eventBus = eventBus;
64 57
     }
65 58
 
66 59
     /** {@inheritDoc} */
@@ -69,8 +62,7 @@ public class ContactListCommand extends Command implements IntelligentCommand {
69 62
             final CommandArguments args, final CommandContext context) {
70 63
         final ChannelCommandContext chanContext = (ChannelCommandContext) context;
71 64
 
72
-        final ContactListListener listener = new ContactListListener(chanContext.getChannel(),
73
-                eventBus);
65
+        final ContactListListener listener = new ContactListListener(chanContext.getChannel());
74 66
         listener.addListeners();
75 67
         listener.clientListUpdated(chanContext.getChannel().getChannelInfo().getChannelClients());
76 68
     }

+ 5
- 11
src/com/dmdirc/addons/contactlist/ContactListListener.java ファイルの表示

@@ -51,14 +51,12 @@ public class ContactListListener implements NicklistListener, FrameCloseListener
51 51
     /**
52 52
      * Creates a new ContactListListener for the specified channel.
53 53
      *
54
-     * @param channel  The channel to show a contact list for
55
-     * @param eventBus Event bus to listen to events with
54
+     * @param channel The channel to show a contact list for
56 55
      */
57 56
     @Inject
58
-    public ContactListListener(final Channel channel,
59
-            final EventBus eventBus) {
57
+    public ContactListListener(final Channel channel) {
60 58
         this.channel = channel;
61
-        this.eventBus = eventBus;
59
+        this.eventBus = channel.getEventBus();
62 60
     }
63 61
 
64 62
     /**
@@ -110,16 +108,12 @@ public class ContactListListener implements NicklistListener, FrameCloseListener
110 108
 
111 109
     @Subscribe
112 110
     public void handleUserAway(final ChannelUserAwayEvent event) {
113
-        if (event.getChannel() == channel) {
114
-            clientAdded(event.getUser());
115
-        }
111
+        clientAdded(event.getUser());
116 112
     }
117 113
 
118 114
     @Subscribe
119 115
     public void handleUserBack(final ChannelUserBackEvent event) {
120
-        if (event.getChannel() == channel) {
121
-            clientAdded(event.getUser());
122
-        }
116
+        clientAdded(event.getUser());
123 117
     }
124 118
 
125 119
     @Override

読み込み中…
キャンセル
保存