Sfoglia il codice sorgente

FrameContainers should expose a Connection.

Anywhere that doesn't just work with a Connection, cast back to a Server for
now. These can be tidied up later.

Change-Id: I02a54b0bcfaef08d5757cc015c356f9779ec0371
Depends-On: Id55c3611173be7ed79fae8f9e976996d713b8646
Reviewed-on: http://gerrit.dmdirc.com/2950
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.8rc1
Chris Smith 10 anni fa
parent
commit
c59e662ad4
33 ha cambiato i file con 82 aggiunte e 65 eliminazioni
  1. 7
    1
      src/com/dmdirc/Channel.java
  2. 3
    3
      src/com/dmdirc/ChannelEventHandler.java
  3. 3
    2
      src/com/dmdirc/CustomWindow.java
  4. 5
    4
      src/com/dmdirc/FrameContainer.java
  5. 2
    1
      src/com/dmdirc/GlobalWindow.java
  6. 4
    7
      src/com/dmdirc/Query.java
  7. 2
    1
      src/com/dmdirc/Raw.java
  8. 1
    1
      src/com/dmdirc/Server.java
  9. 4
    4
      src/com/dmdirc/actions/ActionSubstitutor.java
  10. 3
    2
      src/com/dmdirc/actions/CoreActionComponent.java
  11. 1
    1
      src/com/dmdirc/commandparser/commands/channel/Mode.java
  12. 1
    1
      src/com/dmdirc/commandparser/commands/channel/Names.java
  13. 1
    1
      src/com/dmdirc/commandparser/commands/channel/ShowTopic.java
  14. 3
    3
      src/com/dmdirc/commandparser/commands/chat/Me.java
  15. 2
    1
      src/com/dmdirc/commandparser/commands/context/ChatCommandContext.java
  16. 1
    1
      src/com/dmdirc/commandparser/commands/global/Echo.java
  17. 3
    2
      src/com/dmdirc/commandparser/commands/global/OpenWindow.java
  18. 5
    4
      src/com/dmdirc/commandparser/commands/global/SetCommand.java
  19. 1
    1
      src/com/dmdirc/commandparser/commands/server/Ignore.java
  20. 4
    3
      src/com/dmdirc/commandparser/commands/server/JoinChannelCommand.java
  21. 1
    1
      src/com/dmdirc/commandparser/commands/server/Message.java
  22. 1
    1
      src/com/dmdirc/commandparser/commands/server/OpenQuery.java
  23. 4
    3
      src/com/dmdirc/commandparser/parsers/CommandParser.java
  24. 1
    1
      src/com/dmdirc/messages/AllMessageSink.java
  25. 2
    2
      src/com/dmdirc/messages/ChannelMessageSink.java
  26. 2
    2
      src/com/dmdirc/messages/CommonChanelsMessageSink.java
  27. 5
    3
      src/com/dmdirc/messages/CustomWindowMessageSink.java
  28. 3
    2
      src/com/dmdirc/messages/LastCommandMessageSink.java
  29. 2
    1
      src/com/dmdirc/messages/ServerMessageSink.java
  30. 1
    1
      test/com/dmdirc/actions/ActionSubstitutorTest.java
  31. 1
    1
      test/com/dmdirc/commandparser/commands/channel/ModeTest.java
  32. 1
    1
      test/com/dmdirc/commandparser/commands/channel/NamesTest.java
  33. 2
    2
      test/com/dmdirc/harness/TestWritableFrameContainer.java

+ 7
- 1
src/com/dmdirc/Channel.java Vedi File

@@ -27,6 +27,7 @@ import com.dmdirc.actions.CoreActionType;
27 27
 import com.dmdirc.commandparser.CommandType;
28 28
 import com.dmdirc.commandparser.parsers.ChannelCommandParser;
29 29
 import com.dmdirc.interfaces.CommandController;
30
+import com.dmdirc.interfaces.Connection;
30 31
 import com.dmdirc.interfaces.NicklistListener;
31 32
 import com.dmdirc.interfaces.TopicChangeListener;
32 33
 import com.dmdirc.interfaces.config.ConfigChangeListener;
@@ -72,7 +73,6 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
72 73
     private ChannelInfo channelInfo;
73 74
 
74 75
     /** The server this channel is on. */
75
-    @Getter
76 76
     private Server server;
77 77
 
78 78
     /** The tabcompleter used for this channel. */
@@ -641,4 +641,10 @@ public class Channel extends MessageTarget implements ConfigChangeListener {
641 641
     public void removeTopicChangeListener(final TopicChangeListener listener) {
642 642
         listenerList.remove(TopicChangeListener.class, listener);
643 643
     }
644
+
645
+    /** {@inheritDoc} */
646
+    @Override
647
+    public Connection getConnection() {
648
+        return server;
649
+    }
644 650
 }

+ 3
- 3
src/com/dmdirc/ChannelEventHandler.java Vedi File

@@ -68,7 +68,7 @@ public class ChannelEventHandler extends EventHandler implements
68 68
     /** {@inheritDoc} */
69 69
     @Override
70 70
     protected Connection getConnection() {
71
-        return owner.getServer();
71
+        return owner.getConnection();
72 72
     }
73 73
 
74 74
     /**
@@ -78,7 +78,7 @@ public class ChannelEventHandler extends EventHandler implements
78 78
      * @return True if the client is ourself, false otherwise.
79 79
      */
80 80
     protected boolean isMyself(final ChannelClientInfo client) {
81
-        return client.getClient().equals(owner.getServer().getParser().getLocalClient());
81
+        return client.getClient().equals(owner.getConnection().getParser().getLocalClient());
82 82
     }
83 83
 
84 84
     /** {@inheritDoc} */
@@ -258,7 +258,7 @@ public class ChannelEventHandler extends EventHandler implements
258 258
 
259 259
         if (owner.doNotification(date, "channelCTCP", CoreActionType.CHANNEL_CTCP,
260 260
                 client, type, message)) {
261
-            owner.getServer().sendCTCPReply(client.getClient().getNickname(),
261
+            owner.getConnection().sendCTCPReply(client.getClient().getNickname(),
262 262
                     type, message);
263 263
         }
264 264
     }

+ 3
- 2
src/com/dmdirc/CustomWindow.java Vedi File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc;
24 24
 
25
+import com.dmdirc.interfaces.Connection;
25 26
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
26 27
 import com.dmdirc.ui.core.components.WindowComponent;
27 28
 
@@ -75,8 +76,8 @@ public class CustomWindow extends FrameContainer {
75 76
 
76 77
     /** {@inheritDoc} */
77 78
     @Override
78
-    public Server getServer() {
79
-        return getParent() == null ? null : getParent().getServer();
79
+    public Connection getConnection() {
80
+        return getParent() == null ? null : getParent().getConnection();
80 81
     }
81 82
 
82 83
 }

+ 5
- 4
src/com/dmdirc/FrameContainer.java Vedi File

@@ -24,6 +24,7 @@ package com.dmdirc;
24 24
 
25 25
 import com.dmdirc.actions.ActionManager;
26 26
 import com.dmdirc.actions.CoreActionType;
27
+import com.dmdirc.interfaces.Connection;
27 28
 import com.dmdirc.interfaces.FrameCloseListener;
28 29
 import com.dmdirc.interfaces.FrameComponentChangeListener;
29 30
 import com.dmdirc.interfaces.FrameInfoListener;
@@ -309,11 +310,11 @@ public abstract class FrameContainer {
309 310
     }
310 311
 
311 312
     /**
312
-     * Returns the server instance associated with this container.
313
+     * Returns the connection that this container is associated with.
313 314
      *
314
-     * @return the associated server connection
315
+     * @return the associated connection, or {@code null}.
315 316
      */
316
-    public abstract Server getServer();
317
+    public abstract Connection getConnection();
317 318
 
318 319
     /**
319 320
      * Sets the icon to be used by this frame container.
@@ -344,7 +345,7 @@ public abstract class FrameContainer {
344 345
     public Styliser getStyliser() {
345 346
         synchronized (styliserSync) {
346 347
             if (styliser == null) {
347
-                styliser = new Styliser(getServer(), getConfigManager());
348
+                styliser = new Styliser(getConnection(), getConfigManager());
348 349
             }
349 350
             return styliser;
350 351
         }

+ 2
- 1
src/com/dmdirc/GlobalWindow.java Vedi File

@@ -26,6 +26,7 @@ import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.commandparser.CommandType;
27 27
 import com.dmdirc.commandparser.parsers.CommandParser;
28 28
 import com.dmdirc.commandparser.parsers.GlobalCommandParser;
29
+import com.dmdirc.interfaces.Connection;
29 30
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
30 31
 import com.dmdirc.interfaces.config.ConfigChangeListener;
31 32
 import com.dmdirc.messages.MessageSinkManager;
@@ -94,7 +95,7 @@ public class GlobalWindow extends WritableFrameContainer {
94 95
 
95 96
     /** {@inheritDoc} */
96 97
     @Override
97
-    public Server getServer() {
98
+    public Connection getConnection() {
98 99
         return null;
99 100
     }
100 101
 

+ 4
- 7
src/com/dmdirc/Query.java Vedi File

@@ -27,6 +27,7 @@ import com.dmdirc.actions.CoreActionType;
27 27
 import com.dmdirc.commandparser.CommandType;
28 28
 import com.dmdirc.commandparser.parsers.QueryCommandParser;
29 29
 import com.dmdirc.interfaces.CommandController;
30
+import com.dmdirc.interfaces.Connection;
30 31
 import com.dmdirc.logger.ErrorLevel;
31 32
 import com.dmdirc.logger.Logger;
32 33
 import com.dmdirc.messages.MessageSinkManager;
@@ -313,13 +314,9 @@ public class Query extends MessageTarget implements PrivateActionListener,
313 314
         }
314 315
     }
315 316
 
316
-    /**
317
-     * Returns the Server associated with this query.
318
-     *
319
-     * @return associated Server
320
-     */
317
+    /** {@inheritDoc} */
321 318
     @Override
322
-    public Server getServer() {
319
+    public Connection getConnection() {
323 320
         return server;
324 321
     }
325 322
 
@@ -371,7 +368,7 @@ public class Query extends MessageTarget implements PrivateActionListener,
371 368
     /** {@inheritDoc} */
372 369
     @Override
373 370
     public void setCompositionState(final CompositionState state) {
374
-        getServer().getParser().setCompositionState(host, state);
371
+        getConnection().getParser().setCompositionState(host, state);
375 372
     }
376 373
 
377 374
 }

+ 2
- 1
src/com/dmdirc/Raw.java Vedi File

@@ -24,6 +24,7 @@ package com.dmdirc;
24 24
 
25 25
 import com.dmdirc.commandparser.parsers.ServerCommandParser;
26 26
 import com.dmdirc.interfaces.CommandController;
27
+import com.dmdirc.interfaces.Connection;
27 28
 import com.dmdirc.logger.ErrorLevel;
28 29
 import com.dmdirc.logger.Logger;
29 30
 import com.dmdirc.messages.MessageSinkManager;
@@ -122,7 +123,7 @@ public class Raw extends WritableFrameContainer
122 123
 
123 124
     /** {@inheritDoc} */
124 125
     @Override
125
-    public Server getServer() {
126
+    public Connection getConnection() {
126 127
         return server;
127 128
     }
128 129
 

+ 1
- 1
src/com/dmdirc/Server.java Vedi File

@@ -1163,7 +1163,7 @@ public class Server extends WritableFrameContainer implements ConfigChangeListen
1163 1163
 
1164 1164
     /** {@inheritDoc} */
1165 1165
     @Override
1166
-    public Server getServer() {
1166
+    public Connection getConnection() {
1167 1167
         return this;
1168 1168
     }
1169 1169
 

+ 4
- 4
src/com/dmdirc/actions/ActionSubstitutor.java Vedi File

@@ -282,13 +282,13 @@ public class ActionSubstitutor {
282 282
         }
283 283
 
284 284
         if (hasFrameContainer() && serverMatcher.matches()) {
285
-            final Connection server = ((FrameContainer) args[0]).getServer();
285
+            final Connection connection = ((FrameContainer) args[0]).getConnection();
286 286
 
287
-            if (server != null) {
287
+            if (connection != null) {
288 288
                 try {
289 289
                     final ActionComponentChain chain = new ActionComponentChain(
290 290
                         Connection.class, substitution, actionController);
291
-                    return escape(checkConnection(chain, args, server));
291
+                    return escape(checkConnection(chain, args, connection));
292 292
                 } catch (IllegalArgumentException ex) {
293 293
                     return ERR_ILLEGAL_COMPONENT;
294 294
                 }
@@ -314,7 +314,7 @@ public class ActionSubstitutor {
314 314
     protected String checkConnection(final ActionComponentChain chain,
315 315
             final Object[] args, final Object argument) {
316 316
         if ((chain.requiresConnection() && args[0] instanceof FrameContainer
317
-                    && ((FrameContainer) args[0]).getServer().getState()
317
+                    && ((FrameContainer) args[0]).getConnection().getState()
318 318
                     == ServerState.CONNECTED) || !chain.requiresConnection()) {
319 319
             final Object res = chain.get(argument);
320 320
             return res == null ? ERR_NULL_CHAIN : res.toString();

+ 3
- 2
src/com/dmdirc/actions/CoreActionComponent.java Vedi File

@@ -548,8 +548,9 @@ public enum CoreActionComponent implements ActionComponent {
548 548
     WINDOW_SERVER {
549 549
         /** {@inheritDoc} */
550 550
         @Override
551
-        public Object get(final Object arg) { return ((Window) arg)
552
-                .getContainer().getServer(); }
551
+        public Object get(final Object arg) {
552
+            return ((Window) arg).getContainer().getConnection();
553
+        }
553 554
         /** {@inheritDoc} */
554 555
         @Override
555 556
         public Class<?> appliesTo() { return Window.class; }

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/Mode.java Vedi File

@@ -74,7 +74,7 @@ public class Mode extends Command implements IntelligentCommand,
74 74
         if (args.getArguments().length == 0) {
75 75
             sendLine(origin, args.isSilent(), "channelModeDiscovered", cChannel.getModes(), cChannel);
76 76
         } else {
77
-            channel.getServer().getParser().sendRawMessage("MODE "
77
+            channel.getConnection().getParser().sendRawMessage("MODE "
78 78
                     + cChannel + " " + args.getArgumentsAsString());
79 79
         }
80 80
     }

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/Names.java Vedi File

@@ -67,7 +67,7 @@ public class Names extends Command implements IntelligentCommand,
67 67
     public void execute(final FrameContainer origin,
68 68
             final CommandArguments args, final CommandContext context) {
69 69
         final Channel channel = ((ChannelCommandContext) context).getChannel();
70
-        channel.getServer().getParser().sendRawMessage("NAMES "
70
+        channel.getConnection().getParser().sendRawMessage("NAMES "
71 71
                 + channel.getChannelInfo().getName());
72 72
     }
73 73
 

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/ShowTopic.java Vedi File

@@ -71,7 +71,7 @@ public class ShowTopic extends Command implements ExternalCommand {
71 71
             if (cChannel.getTopic().isEmpty()) {
72 72
                 sendLine(origin, args.isSilent(), "channelNoTopic", cChannel);
73 73
             } else {
74
-                final String[] parts = channel.getServer().parseHostmask(cChannel.getTopicSetter());
74
+                final String[] parts = channel.getConnection().parseHostmask(cChannel.getTopicSetter());
75 75
 
76 76
                 sendLine(origin, args.isSilent(), "channelTopicDiscovered",
77 77
                         "", parts[0], parts[1], parts[2], cChannel.getTopic(),

+ 3
- 3
src/com/dmdirc/commandparser/commands/chat/Me.java Vedi File

@@ -76,14 +76,14 @@ public class Me extends Command implements ValidatingCommand {
76 76
     public ValidationResponse validateArguments(
77 77
             final WritableFrameContainer origin,
78 78
             final CommandArguments arguments) {
79
-        if (origin.getServer() == null
80
-                || origin.getServer().getParser() == null) {
79
+        if (origin.getConnection() == null
80
+                || origin.getConnection().getParser() == null) {
81 81
             return new ValidationResponse();
82 82
         }
83 83
 
84 84
         final int length = 2 + arguments.getArgumentsAsString().length();
85 85
 
86
-        if (origin.getServer().getParser().getMaxLength("PRIVMSG",
86
+        if (origin.getConnection().getParser().getMaxLength("PRIVMSG",
87 87
                 origin.getName()) <= length) {
88 88
             return new ValidationResponse("Too long");
89 89
         } else {

+ 2
- 1
src/com/dmdirc/commandparser/commands/context/ChatCommandContext.java Vedi File

@@ -24,6 +24,7 @@ package com.dmdirc.commandparser.commands.context;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.MessageTarget;
27
+import com.dmdirc.Server;
27 28
 import com.dmdirc.commandparser.CommandInfo;
28 29
 
29 30
 /**
@@ -45,7 +46,7 @@ public class ChatCommandContext extends ServerCommandContext {
45 46
      */
46 47
     public ChatCommandContext(final FrameContainer source,
47 48
             final CommandInfo commandInfo, final MessageTarget chat) {
48
-        super(source, commandInfo, chat.getServer());
49
+        super(source, commandInfo, (Server) chat.getConnection());
49 50
         this.chat = chat;
50 51
     }
51 52
 

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/Echo.java Vedi File

@@ -138,7 +138,7 @@ public class Echo extends Command implements IntelligentCommand {
138 138
                 && context.getPreviousArgs().get(0).equals("--ts"))) {
139 139
 
140 140
             final List<FrameContainer> windowList = new ArrayList<>();
141
-            final Server currentServer = context.getWindow().getServer();
141
+            final Server currentServer = (Server) context.getWindow().getConnection();
142 142
 
143 143
             //Active window's Children
144 144
             windowList.addAll(context.getWindow().getChildren());

+ 3
- 2
src/com/dmdirc/commandparser/commands/global/OpenWindow.java Vedi File

@@ -25,6 +25,7 @@ package com.dmdirc.commandparser.commands.global;
25 25
 import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.CustomWindow;
27 27
 import com.dmdirc.FrameContainer;
28
+import com.dmdirc.Server;
28 29
 import com.dmdirc.commandparser.BaseCommandInfo;
29 30
 import com.dmdirc.commandparser.CommandArguments;
30 31
 import com.dmdirc.commandparser.CommandInfo;
@@ -82,13 +83,13 @@ public class OpenWindow extends Command implements IntelligentCommand {
82 83
         FrameContainer parent = null;
83 84
 
84 85
         if (args.getArguments().length > 0 && "--server".equals(args.getArguments()[0])) {
85
-            if (origin.getServer() == null) {
86
+            if (origin.getConnection() == null) {
86 87
                 sendLine(origin, args.isSilent(), FORMAT_ERROR,
87 88
                         "This window doesn't have an associated server.");
88 89
                 return;
89 90
             }
90 91
 
91
-            parent = origin.getServer();
92
+            parent = (Server) origin.getConnection();
92 93
             start = 1;
93 94
         } else if (args.getArguments().length > 0 && "--child".equals(args.getArguments()[0])) {
94 95
             parent = origin;

+ 5
- 4
src/com/dmdirc/commandparser/commands/global/SetCommand.java Vedi File

@@ -24,6 +24,7 @@ package com.dmdirc.commandparser.commands.global;
24 24
 
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.FrameContainer;
27
+import com.dmdirc.Server;
27 28
 import com.dmdirc.commandparser.BaseCommandInfo;
28 29
 import com.dmdirc.commandparser.CommandArguments;
29 30
 import com.dmdirc.commandparser.CommandInfo;
@@ -114,14 +115,14 @@ public class SetCommand extends Command implements IntelligentCommand {
114 115
         AggregateConfigProvider manager = identityController.getGlobalConfiguration();
115 116
 
116 117
         if (res.hasFlag(serverFlag)) {
117
-            if (origin.getServer() == null) {
118
+            if (origin.getConnection() == null) {
118 119
                 sendLine(origin, args.isSilent(), FORMAT_ERROR,
119 120
                         "Cannot use --server in this context");
120 121
                 return;
121 122
             }
122 123
 
123
-            identity = origin.getServer().getServerIdentity();
124
-            manager = origin.getServer().getConfigManager();
124
+            identity = origin.getConnection().getServerIdentity();
125
+            manager = ((Server) origin.getConnection()).getConfigManager();
125 126
         }
126 127
 
127 128
         if (res.hasFlag(channelFlag)) {
@@ -133,7 +134,7 @@ public class SetCommand extends Command implements IntelligentCommand {
133 134
 
134 135
             final Channel channel = ((ChannelCommandContext) context).getChannel();
135 136
             identity = identityFactory.createChannelConfig(
136
-                    origin.getServer().getNetwork(), channel.getName());
137
+                    origin.getConnection().getNetwork(), channel.getName());
137 138
             manager = channel.getConfigManager();
138 139
         }
139 140
 

+ 1
- 1
src/com/dmdirc/commandparser/commands/server/Ignore.java Vedi File

@@ -180,7 +180,7 @@ public class Ignore extends Command implements IntelligentCommand {
180 180
             targets.include(TabCompletionType.CHANNEL_NICK);
181 181
             targets.include(TabCompletionType.QUERY_NICK);
182 182
         } else if (arg == 1 && context.getPreviousArgs().get(0).equals("--remove")) {
183
-            final IgnoreList ignoreList = context.getWindow().getServer()
183
+            final IgnoreList ignoreList = context.getWindow().getConnection()
184 184
                 .getIgnoreList();
185 185
             if (ignoreList.canConvert()) {
186 186
                 for (String entry : ignoreList.getSimpleList()) {

+ 4
- 3
src/com/dmdirc/commandparser/commands/server/JoinChannelCommand.java Vedi File

@@ -36,6 +36,7 @@ import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36 36
 import com.dmdirc.interfaces.ActionController;
37 37
 import com.dmdirc.interfaces.ActionListener;
38 38
 import com.dmdirc.interfaces.CommandController;
39
+import com.dmdirc.interfaces.Connection;
39 40
 import com.dmdirc.interfaces.actions.ActionType;
40 41
 import com.dmdirc.parser.common.ChannelJoinRequest;
41 42
 import com.dmdirc.ui.input.AdditionalTabTargets;
@@ -122,7 +123,7 @@ public class JoinChannelCommand extends Command implements
122 123
     public AdditionalTabTargets getSuggestions(final int arg,
123 124
             final IntelligentCommandContext context) {
124 125
         final FrameContainer source = context.getWindow();
125
-        final Server server = source.getServer();
126
+        final Connection connection = source.getConnection();
126 127
         final List<String> results = checkSource(source, true, true);
127 128
 
128 129
         final AdditionalTabTargets targets = new AdditionalTabTargets().excludeAll();
@@ -143,13 +144,13 @@ public class JoinChannelCommand extends Command implements
143 144
         if (!showExisting) {
144 145
             for (String result : results) {
145 146
                 // Only tab complete channels we're not already on
146
-                if (!server.hasChannel(result)) {
147
+                if (!connection.hasChannel(result)) {
147 148
                     targets.add(prefix + result);
148 149
                 }
149 150
             }
150 151
         }
151 152
 
152
-        for (char chPrefix : server.getChannelPrefixes().toCharArray()) {
153
+        for (char chPrefix : connection.getChannelPrefixes().toCharArray()) {
153 154
             // Let them tab complete the prefixes as well
154 155
             targets.add(prefix + chPrefix);
155 156
         }

+ 1
- 1
src/com/dmdirc/commandparser/commands/server/Message.java Vedi File

@@ -120,7 +120,7 @@ public class Message extends Command implements IntelligentCommand,
120 120
             final CommandArguments arguments) {
121 121
         if (arguments.getArguments().length >= 2) {
122 122
             final String target = arguments.getArguments()[0];
123
-            return origin.getServer().getNumLines("PRIVMSG "
123
+            return ((Server) origin.getConnection()).getNumLines("PRIVMSG "
124 124
                     + target + " :" + arguments.getArgumentsAsString(1));
125 125
         } else {
126 126
             return 1;

+ 1
- 1
src/com/dmdirc/commandparser/commands/server/OpenQuery.java Vedi File

@@ -117,7 +117,7 @@ public class OpenQuery extends Command implements IntelligentCommand,
117 117
             final CommandArguments arguments) {
118 118
         if (arguments.getArguments().length >= 2) {
119 119
             final String target = arguments.getArguments()[0];
120
-            return origin.getServer().getNumLines("PRIVMSG "
120
+            return ((Server) origin.getConnection()).getNumLines("PRIVMSG "
121 121
                     + target + " :" + arguments.getArgumentsAsString(1));
122 122
         } else {
123 123
             return 1;

+ 4
- 3
src/com/dmdirc/commandparser/parsers/CommandParser.java Vedi File

@@ -35,6 +35,7 @@ import com.dmdirc.commandparser.commands.CommandOptions;
35 35
 import com.dmdirc.commandparser.commands.ExternalCommand;
36 36
 import com.dmdirc.commandparser.commands.PreviousCommand;
37 37
 import com.dmdirc.interfaces.CommandController;
38
+import com.dmdirc.interfaces.Connection;
38 39
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
39 40
 import com.dmdirc.util.collections.RollingList;
40 41
 
@@ -178,12 +179,12 @@ public abstract class CommandParser implements Serializable {
178 179
         final String[] cargs = args.getArguments();
179 180
 
180 181
         if (cargs.length == 0 || !parseChannel || origin == null
181
-                || origin.getServer() == null
182
+                || origin.getConnection() == null
182 183
                 || !commandManager.isChannelCommand(command)) {
183 184
             return false;
184 185
         }
185 186
 
186
-        final Server server = origin.getServer();
187
+        final Connection server = origin.getConnection();
187 188
         final String[] parts = cargs[0].split(",");
188 189
         boolean someValid = false;
189 190
         for (String part : parts) {
@@ -207,7 +208,7 @@ public abstract class CommandParser implements Serializable {
207 208
 
208 209
                     if (actCommand != null && actCommand.getValue() instanceof ExternalCommand) {
209 210
                         ((ExternalCommand) actCommand.getValue()).execute(
210
-                                origin, server, channel, silent,
211
+                                origin, (Server) server, channel, silent,
211 212
                                 new CommandArguments(commandManager, args.getCommandName()
212 213
                                 + " " + args.getWordsAsString(2)));
213 214
                     }

+ 1
- 1
src/com/dmdirc/messages/AllMessageSink.java Vedi File

@@ -48,7 +48,7 @@ public class AllMessageSink implements MessageSink {
48 48
             final WritableFrameContainer source,
49 49
             final String[] patternMatches, final Date date,
50 50
             final String messageType, final Object... args) {
51
-        source.getServer().addLineToAll(messageType, date, args);
51
+        source.getConnection().addLineToAll(messageType, date, args);
52 52
     }
53 53
 
54 54
 }

+ 2
- 2
src/com/dmdirc/messages/ChannelMessageSink.java Vedi File

@@ -54,8 +54,8 @@ public class ChannelMessageSink implements MessageSink {
54 54
         final String user = String.format(patternMatches[0], args);
55 55
         boolean found = false;
56 56
 
57
-        for (String channelName : source.getServer().getChannels()) {
58
-            final Channel channel = source.getServer().getChannel(channelName);
57
+        for (String channelName : source.getConnection().getChannels()) {
58
+            final Channel channel = source.getConnection().getChannel(channelName);
59 59
             if (channel.getChannelInfo().getChannelClient(user) != null) {
60 60
                 channel.addLine(messageType, date, args);
61 61
                 found = true;

+ 2
- 2
src/com/dmdirc/messages/CommonChanelsMessageSink.java Vedi File

@@ -55,8 +55,8 @@ public class CommonChanelsMessageSink implements MessageSink {
55 55
         final String user = String.format(patternMatches[0], args);
56 56
         boolean found = false;
57 57
 
58
-        for (String channelName : source.getServer().getChannels()) {
59
-            final Channel channel = source.getServer().getChannel(channelName);
58
+        for (String channelName : source.getConnection().getChannels()) {
59
+            final Channel channel = source.getConnection().getChannel(channelName);
60 60
             if (channel.getChannelInfo().getChannelClient(user) != null) {
61 61
                 channel.addLine(messageType, date, args);
62 62
                 found = true;

+ 5
- 3
src/com/dmdirc/messages/CustomWindowMessageSink.java Vedi File

@@ -24,6 +24,7 @@ package com.dmdirc.messages;
24 24
 
25 25
 import com.dmdirc.CustomWindow;
26 26
 import com.dmdirc.FrameContainer;
27
+import com.dmdirc.Server;
27 28
 import com.dmdirc.WritableFrameContainer;
28 29
 import com.dmdirc.ui.WindowManager;
29 30
 
@@ -62,12 +63,13 @@ public class CustomWindowMessageSink implements MessageSink {
62 63
             final WritableFrameContainer source,
63 64
             final String[] patternMatches, final Date date,
64 65
             final String messageType, final Object... args) {
65
-        FrameContainer targetWindow = windowManager.findCustomWindow(source.getServer(), patternMatches[0]);
66
+        FrameContainer targetWindow = windowManager
67
+                .findCustomWindow((Server) source.getConnection(), patternMatches[0]);
66 68
 
67 69
         if (targetWindow == null) {
68 70
             targetWindow = new CustomWindow(patternMatches[0],
69
-                    patternMatches[0], source.getServer());
70
-            windowManager.addWindow(source.getServer(), targetWindow);
71
+                    patternMatches[0], (Server) source.getConnection());
72
+            windowManager.addWindow((Server) source.getConnection(), targetWindow);
71 73
         }
72 74
 
73 75
         targetWindow.addLine(messageType, date, args);

+ 3
- 2
src/com/dmdirc/messages/LastCommandMessageSink.java Vedi File

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.messages;
24 24
 
25 25
 import com.dmdirc.FrameContainer;
26
+import com.dmdirc.Server;
26 27
 import com.dmdirc.WritableFrameContainer;
27 28
 
28 29
 import java.util.ArrayList;
@@ -65,8 +66,8 @@ public class LastCommandMessageSink implements MessageSink {
65 66
 
66 67
         final List<FrameContainer> containers = new ArrayList<>();
67 68
 
68
-        containers.add(source.getServer());
69
-        containers.addAll(source.getServer().getChildren());
69
+        containers.add((Server) source.getConnection());
70
+        containers.addAll(((Server) source.getConnection()).getChildren());
70 71
 
71 72
         for (FrameContainer container : containers) {
72 73
             if (!(container instanceof WritableFrameContainer)) {

+ 2
- 1
src/com/dmdirc/messages/ServerMessageSink.java Vedi File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.messages;
24 24
 
25
+import com.dmdirc.Server;
25 26
 import com.dmdirc.WritableFrameContainer;
26 27
 
27 28
 import java.util.Date;
@@ -47,7 +48,7 @@ public class ServerMessageSink implements MessageSink {
47 48
             final WritableFrameContainer source,
48 49
             final String[] patternMatches, final Date date,
49 50
             final String messageType, final Object... args) {
50
-        source.getServer().addLine(messageType, date, args);
51
+        ((Server) source.getConnection()).addLine(messageType, date, args);
51 52
     }
52 53
 
53 54
 }

+ 1
- 1
test/com/dmdirc/actions/ActionSubstitutorTest.java Vedi File

@@ -74,7 +74,7 @@ public class ActionSubstitutorTest {
74 74
 
75 75
         final ChannelClientInfo clientInfo = mock(ChannelClientInfo.class);
76 76
 
77
-        when(channel.getServer()).thenReturn(server);
77
+        when(channel.getConnection()).thenReturn(server);
78 78
         when(channel.getConfigManager()).thenReturn(manager);
79 79
         when(server.getState()).thenReturn(ServerState.DISCONNECTED);
80 80
         when(server.getAwayMessage()).thenReturn("foo");

+ 1
- 1
test/com/dmdirc/commandparser/commands/channel/ModeTest.java Vedi File

@@ -53,7 +53,7 @@ public class ModeTest {
53 53
 
54 54
     @Before
55 55
     public void setUp() throws InvalidIdentityFileException {
56
-        when(channel.getServer()).thenReturn(server);
56
+        when(channel.getConnection()).thenReturn(server);
57 57
         when(server.getParser()).thenReturn(parser);
58 58
         when(channel.getChannelInfo()).thenReturn(channelinfo);
59 59
         when(channelinfo.getModes()).thenReturn("my mode string!");

+ 1
- 1
test/com/dmdirc/commandparser/commands/channel/NamesTest.java Vedi File

@@ -52,7 +52,7 @@ public class NamesTest {
52 52
 
53 53
     @Before
54 54
     public void setUp() throws InvalidIdentityFileException {
55
-        when(channel.getServer()).thenReturn(server);
55
+        when(channel.getConnection()).thenReturn(server);
56 56
         when(server.getParser()).thenReturn(parser);
57 57
         when(channel.getChannelInfo()).thenReturn(channelinfo);
58 58
         when(channelinfo.getName()).thenReturn("#chan");

+ 2
- 2
test/com/dmdirc/harness/TestWritableFrameContainer.java Vedi File

@@ -22,11 +22,11 @@
22 22
 
23 23
 package com.dmdirc.harness;
24 24
 
25
-import com.dmdirc.Server;
26 25
 import com.dmdirc.WritableFrameContainer;
27 26
 import com.dmdirc.commandparser.CommandManager;
28 27
 import com.dmdirc.commandparser.parsers.GlobalCommandParser;
29 28
 import com.dmdirc.interfaces.CommandController;
29
+import com.dmdirc.interfaces.Connection;
30 30
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
31 31
 import com.dmdirc.messages.MessageSinkManager;
32 32
 import com.dmdirc.ui.input.TabCompleter;
@@ -70,7 +70,7 @@ public class TestWritableFrameContainer extends WritableFrameContainer {
70 70
     }
71 71
 
72 72
     @Override
73
-    public Server getServer() {
73
+    public Connection getConnection() {
74 74
         return null;
75 75
     }
76 76
 

Loading…
Annulla
Salva