Browse Source

Fixes for from removing unknown_command action.

Depends-On: Ibcfc059d943a64494842eab68428ea8351206a09
Change-Id: I06ee87cf6f7795eb3ee07828fb43f4381a465ac3
Reviewed-on: http://gerrit.dmdirc.com/3491
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
changes/91/3491/4
Greg Holmes 10 years ago
parent
commit
75e125283f

+ 1
- 1
src/com/dmdirc/addons/dcc/ChatContainer.java View File

@@ -79,7 +79,7 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
79 79
             final URLBuilder urlBuilder,
80 80
             final EventBus eventBus) {
81 81
         super(parent, title, "dcc-chat-inactive", configManager,
82
-                new DCCCommandParser(configManager, commandController),
82
+                new DCCCommandParser(configManager, commandController, eventBus),
83 83
                 messageSinkManager,
84 84
                 tabCompleterFactory,
85 85
                 urlBuilder,

+ 6
- 2
src/com/dmdirc/addons/dcc/DCCCommandParser.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.commandparser.parsers.GlobalCommandParser;
27 27
 import com.dmdirc.interfaces.CommandController;
28 28
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
29 29
 
30
+import com.google.common.eventbus.EventBus;
31
+
30 32
 /**
31 33
  * DCC CommandParser.
32 34
  */
@@ -40,11 +42,13 @@ public class DCCCommandParser extends GlobalCommandParser {
40 42
      *
41 43
      * @param configManager     Config manager
42 44
      * @param commandController The controller to load commands and command info from.
45
+     * @param eventBus          Event bus to post events on
43 46
      */
44 47
     public DCCCommandParser(
45 48
             final AggregateConfigProvider configManager,
46
-            final CommandController commandController) {
47
-        super(configManager, commandController);
49
+            final CommandController commandController,
50
+            final EventBus eventBus) {
51
+        super(configManager, commandController, eventBus);
48 52
     }
49 53
 
50 54
     /**

+ 9
- 2
src/com/dmdirc/addons/time/TimedCommand.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.commandparser.parsers.CommandParser;
27 27
 import com.dmdirc.commandparser.parsers.GlobalCommandParser;
28 28
 import com.dmdirc.interfaces.CommandController;
29 29
 
30
+import com.google.common.eventbus.EventBus;
31
+
30 32
 import java.util.Timer;
31 33
 import java.util.TimerTask;
32 34
 
@@ -49,6 +51,8 @@ public class TimedCommand extends TimerTask {
49 51
     private final TimerManager manager;
50 52
     /** The command controller to use when executing global commands. */
51 53
     private final CommandController commandController;
54
+    /** Event bus to post events on. */
55
+    private final EventBus eventBus;
52 56
 
53 57
     /**
54 58
      * Creates a new instance of TimedCommand.
@@ -60,6 +64,7 @@ public class TimedCommand extends TimerTask {
60 64
      * @param delay             The number of seconds between each execution
61 65
      * @param command           The command to be executed
62 66
      * @param origin            The frame container to use for the execution
67
+     * @param eventBus          The Event bus to post events on
63 68
      */
64 69
     public TimedCommand(
65 70
             final TimerManager manager,
@@ -68,13 +73,15 @@ public class TimedCommand extends TimerTask {
68 73
             final int repetitions,
69 74
             final int delay,
70 75
             final String command,
71
-            final FrameContainer origin) {
76
+            final FrameContainer origin,
77
+            final EventBus eventBus) {
72 78
         this.commandController = commandController;
73 79
         this.timerKey = timerKey;
74 80
         this.repetitions = repetitions;
75 81
         this.command = command;
76 82
         this.origin = origin;
77 83
         this.manager = manager;
84
+        this.eventBus = eventBus;
78 85
 
79 86
         timer = new Timer("Timed Command Timer");
80 87
         timer.schedule(this, delay * 1000L, delay * 1000L);
@@ -101,7 +108,7 @@ public class TimedCommand extends TimerTask {
101 108
     public void run() {
102 109
         CommandParser parser;
103 110
         if (origin == null) {
104
-            parser = new GlobalCommandParser(origin.getConfigManager(), commandController);
111
+            parser = new GlobalCommandParser(origin.getConfigManager(), commandController, eventBus);
105 112
         } else {
106 113
             parser = origin.getCommandParser();
107 114
         }

+ 8
- 2
src/com/dmdirc/addons/time/TimerManager.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.interfaces.ActionController;
27 27
 import com.dmdirc.interfaces.CommandController;
28 28
 
29
+import com.google.common.eventbus.EventBus;
30
+
29 31
 import java.util.Calendar;
30 32
 import java.util.HashMap;
31 33
 import java.util.Map;
@@ -47,6 +49,8 @@ public class TimerManager {
47 49
     private final CommandController commandController;
48 50
     /** Action controller. */
49 51
     private final ActionController actionController;
52
+    /** Event bus to post events on . */
53
+    private final EventBus eventBus;
50 54
     /** Have we registered our types already? */
51 55
     private static boolean registered;
52 56
     /** The timer to use for scheduling. */
@@ -54,9 +58,11 @@ public class TimerManager {
54 58
 
55 59
     @Inject
56 60
     public TimerManager(final CommandController commandController,
57
-            final ActionController actionController) {
61
+            final ActionController actionController,
62
+            final EventBus eventBus) {
58 63
         this.commandController = commandController;
59 64
         this.actionController = actionController;
65
+        this.eventBus = eventBus;
60 66
     }
61 67
 
62 68
     public void load() {
@@ -99,7 +105,7 @@ public class TimerManager {
99 105
         synchronized (this) {
100 106
             final int timerKey = findFreeKey();
101 107
             timerList.put(timerKey, new TimedCommand(this, commandController, timerKey,
102
-                    repetitions, interval, command, origin));
108
+                    repetitions, interval, command, origin, eventBus));
103 109
         }
104 110
     }
105 111
 

Loading…
Cancel
Save