Browse Source

Replace loads of servers with connections.

Change-Id: Ia569d12d8d53797ef7378ceab2ba1f5bda3affdc
Depends-On: I11efabb2757d8e62127b6487cbeb62d240cbd891
Reviewed-on: http://gerrit.dmdirc.com/3873
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
pull/1/head
Chris Smith 9 years ago
parent
commit
38b5e683a5

+ 12
- 12
src/com/dmdirc/commandparser/commands/context/ServerCommandContext.java View File

23
 package com.dmdirc.commandparser.commands.context;
23
 package com.dmdirc.commandparser.commands.context;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.CommandInfo;
26
 import com.dmdirc.commandparser.CommandInfo;
27
+import com.dmdirc.interfaces.Connection;
28
 
28
 
29
 /**
29
 /**
30
- * A command context for server commands.
30
+ * A command context for connection commands.
31
  *
31
  *
32
  * @since 0.6.4
32
  * @since 0.6.4
33
  */
33
  */
34
 public class ServerCommandContext extends CommandContext {
34
 public class ServerCommandContext extends CommandContext {
35
 
35
 
36
-    /** The server the command was executed for. */
37
-    private final Server server;
36
+    /** The connection the command was executed for. */
37
+    private final Connection connection;
38
 
38
 
39
     /**
39
     /**
40
-     * Creates a new server command context.
40
+     * Creates a new connection command context.
41
      *
41
      *
42
      * @param source      The source of the command
42
      * @param source      The source of the command
43
      * @param commandInfo The command info object which associated the command with the input
43
      * @param commandInfo The command info object which associated the command with the input
44
-     * @param server      The server associated with the command
44
+     * @param connection      The connection associated with the command
45
      */
45
      */
46
     public ServerCommandContext(final FrameContainer source, final CommandInfo commandInfo,
46
     public ServerCommandContext(final FrameContainer source, final CommandInfo commandInfo,
47
-            final Server server) {
47
+            final Connection connection) {
48
         super(source, commandInfo);
48
         super(source, commandInfo);
49
-        this.server = server;
49
+        this.connection = connection;
50
     }
50
     }
51
 
51
 
52
     /**
52
     /**
53
-     * Retrieves the server associated with this context.
53
+     * Retrieves the connection associated with this context.
54
      *
54
      *
55
-     * @return This context's server
55
+     * @return This context's connection
56
      */
56
      */
57
-    public Server getServer() {
58
-        return server;
57
+    public Connection getConnection() {
58
+        return connection;
59
     }
59
     }
60
 
60
 
61
 }
61
 }

+ 2
- 2
src/com/dmdirc/commandparser/commands/server/AllChannels.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35
 import com.dmdirc.interfaces.CommandController;
34
 import com.dmdirc.interfaces.CommandController;
35
+import com.dmdirc.interfaces.Connection;
36
 import com.dmdirc.ui.input.AdditionalTabTargets;
36
 import com.dmdirc.ui.input.AdditionalTabTargets;
37
 import com.dmdirc.ui.input.TabCompleterUtils;
37
 import com.dmdirc.ui.input.TabCompleterUtils;
38
 
38
 
62
     @Override
62
     @Override
63
     public void execute(@Nonnull final FrameContainer origin,
63
     public void execute(@Nonnull final FrameContainer origin,
64
             final CommandArguments args, final CommandContext context) {
64
             final CommandArguments args, final CommandContext context) {
65
-        final Server server = ((ServerCommandContext) context).getServer();
65
+        final Connection server = ((ServerCommandContext) context).getConnection();
66
         final String command = args.getArgumentsAsString();
66
         final String command = args.getArgumentsAsString();
67
 
67
 
68
         for (String channel : server.getChannels()) {
68
         for (String channel : server.getChannels()) {

+ 4
- 4
src/com/dmdirc/commandparser/commands/server/Away.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35
 import com.dmdirc.interfaces.CommandController;
34
 import com.dmdirc.interfaces.CommandController;
35
+import com.dmdirc.interfaces.Connection;
36
 
36
 
37
 import javax.annotation.Nonnull;
37
 import javax.annotation.Nonnull;
38
 import javax.inject.Inject;
38
 import javax.inject.Inject;
60
     @Override
60
     @Override
61
     public void execute(@Nonnull final FrameContainer origin,
61
     public void execute(@Nonnull final FrameContainer origin,
62
             final CommandArguments args, final CommandContext context) {
62
             final CommandArguments args, final CommandContext context) {
63
-        final Server server = ((ServerCommandContext) context).getServer();
63
+        final Connection connection = ((ServerCommandContext) context).getConnection();
64
         final String line = args.getArgumentsAsString();
64
         final String line = args.getArgumentsAsString();
65
 
65
 
66
         if (line.isEmpty()) {
66
         if (line.isEmpty()) {
67
-            server.getParser().getLocalClient().setBack();
67
+            connection.getParser().getLocalClient().setBack();
68
         } else {
68
         } else {
69
-            server.getParser().getLocalClient().setAway(line);
69
+            connection.getParser().getLocalClient().setAway(line);
70
         }
70
         }
71
     }
71
     }
72
 
72
 

+ 3
- 3
src/com/dmdirc/commandparser/commands/server/Back.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
34
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36
 import com.dmdirc.interfaces.CommandController;
35
 import com.dmdirc.interfaces.CommandController;
36
+import com.dmdirc.interfaces.Connection;
37
 import com.dmdirc.ui.input.AdditionalTabTargets;
37
 import com.dmdirc.ui.input.AdditionalTabTargets;
38
 
38
 
39
 import javax.annotation.Nonnull;
39
 import javax.annotation.Nonnull;
62
     @Override
62
     @Override
63
     public void execute(@Nonnull final FrameContainer origin,
63
     public void execute(@Nonnull final FrameContainer origin,
64
             final CommandArguments args, final CommandContext context) {
64
             final CommandArguments args, final CommandContext context) {
65
-        final Server server = ((ServerCommandContext) context).getServer();
66
-        server.getParser().getLocalClient().setBack();
65
+        final Connection connection = ((ServerCommandContext) context).getConnection();
66
+        connection.getParser().getLocalClient().setBack();
67
     }
67
     }
68
 
68
 
69
     @Override
69
     @Override

+ 3
- 3
src/com/dmdirc/commandparser/commands/server/ChangeServer.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
32
 import com.dmdirc.commandparser.commands.context.CommandContext;
31
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
32
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34
 import com.dmdirc.interfaces.CommandController;
33
 import com.dmdirc.interfaces.CommandController;
34
+import com.dmdirc.interfaces.Connection;
35
 import com.dmdirc.util.InvalidURIException;
35
 import com.dmdirc.util.InvalidURIException;
36
 import com.dmdirc.util.URIParser;
36
 import com.dmdirc.util.URIParser;
37
 
37
 
74
         }
74
         }
75
 
75
 
76
         try {
76
         try {
77
-            final Server server = ((ServerCommandContext) context).getServer();
77
+            final Connection connection = ((ServerCommandContext) context).getConnection();
78
             final URI address = uriParser.parseFromText(args.getArgumentsAsString());
78
             final URI address = uriParser.parseFromText(args.getArgumentsAsString());
79
-            server.connect(address, server.getProfile());
79
+            connection.connect(address, connection.getProfile());
80
         } catch (InvalidURIException ex) {
80
         } catch (InvalidURIException ex) {
81
             origin.addLine(FORMAT_ERROR, "Invalid URI: " + ex.getMessage()
81
             origin.addLine(FORMAT_ERROR, "Invalid URI: " + ex.getMessage()
82
                     + (ex.getCause() == null ? "" : ": " + ex.getCause().getMessage()));
82
                     + (ex.getCause() == null ? "" : ": " + ex.getCause().getMessage()));

+ 3
- 3
src/com/dmdirc/commandparser/commands/server/Ctcp.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
34
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36
 import com.dmdirc.interfaces.CommandController;
35
 import com.dmdirc.interfaces.CommandController;
36
+import com.dmdirc.interfaces.Connection;
37
 import com.dmdirc.ui.input.AdditionalTabTargets;
37
 import com.dmdirc.ui.input.AdditionalTabTargets;
38
 import com.dmdirc.ui.input.TabCompletionType;
38
 import com.dmdirc.ui.input.TabCompletionType;
39
 
39
 
64
     @Override
64
     @Override
65
     public void execute(@Nonnull final FrameContainer origin,
65
     public void execute(@Nonnull final FrameContainer origin,
66
             final CommandArguments args, final CommandContext context) {
66
             final CommandArguments args, final CommandContext context) {
67
-        final Server server = ((ServerCommandContext) context).getServer();
67
+        final Connection connection = ((ServerCommandContext) context).getConnection();
68
         if (args.getArguments().length < 2) {
68
         if (args.getArguments().length < 2) {
69
             showUsage(origin, args.isSilent(), "ctcp", "<target> <type> [arguments]");
69
             showUsage(origin, args.isSilent(), "ctcp", "<target> <type> [arguments]");
70
         } else {
70
         } else {
71
-            server.getParser().sendCTCP(args.getArguments()[0],
71
+            connection.getParser().sendCTCP(args.getArguments()[0],
72
                     args.getArguments()[1], args.getArgumentsAsString(2));
72
                     args.getArguments()[1], args.getArgumentsAsString(2));
73
             sendLine(origin, args.isSilent(), "selfCTCP", args.getArguments()[0],
73
             sendLine(origin, args.isSilent(), "selfCTCP", args.getArguments()[0],
74
                     args.getArgumentsAsString(1));
74
                     args.getArgumentsAsString(1));

+ 3
- 3
src/com/dmdirc/commandparser/commands/server/Disconnect.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
32
 import com.dmdirc.commandparser.commands.context.CommandContext;
31
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
32
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34
 import com.dmdirc.interfaces.CommandController;
33
 import com.dmdirc.interfaces.CommandController;
34
+import com.dmdirc.interfaces.Connection;
35
 
35
 
36
 import javax.annotation.Nonnull;
36
 import javax.annotation.Nonnull;
37
 import javax.inject.Inject;
37
 import javax.inject.Inject;
59
     @Override
59
     @Override
60
     public void execute(@Nonnull final FrameContainer origin,
60
     public void execute(@Nonnull final FrameContainer origin,
61
             final CommandArguments args, final CommandContext context) {
61
             final CommandArguments args, final CommandContext context) {
62
-        final Server server = ((ServerCommandContext) context).getServer();
62
+        final Connection connection = ((ServerCommandContext) context).getConnection();
63
         final String line;
63
         final String line;
64
 
64
 
65
         if (args.getArguments().length == 0) {
65
         if (args.getArguments().length == 0) {
68
             line = args.getArgumentsAsString();
68
             line = args.getArgumentsAsString();
69
         }
69
         }
70
 
70
 
71
-        server.disconnect(line);
71
+        connection.disconnect(line);
72
     }
72
     }
73
 
73
 
74
 }
74
 }

+ 21
- 21
src/com/dmdirc/commandparser/commands/server/Ignore.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35
 import com.dmdirc.interfaces.CommandController;
34
 import com.dmdirc.interfaces.CommandController;
35
+import com.dmdirc.interfaces.Connection;
36
 import com.dmdirc.parser.common.IgnoreList;
36
 import com.dmdirc.parser.common.IgnoreList;
37
 import com.dmdirc.ui.input.AdditionalTabTargets;
37
 import com.dmdirc.ui.input.AdditionalTabTargets;
38
 import com.dmdirc.ui.input.TabCompletionType;
38
 import com.dmdirc.ui.input.TabCompletionType;
67
     @Override
67
     @Override
68
     public void execute(@Nonnull final FrameContainer origin,
68
     public void execute(@Nonnull final FrameContainer origin,
69
             final CommandArguments args, final CommandContext context) {
69
             final CommandArguments args, final CommandContext context) {
70
-        final Server server = ((ServerCommandContext) context).getServer();
70
+        final Connection connection = ((ServerCommandContext) context).getConnection();
71
 
71
 
72
         if (args.getArguments().length == 0) {
72
         if (args.getArguments().length == 0) {
73
-            executeView(origin, server, args.isSilent(), args, false);
73
+            executeView(origin, connection, args.isSilent(), args, false);
74
         } else if ("--remove".equalsIgnoreCase(args.getArguments()[0])) {
74
         } else if ("--remove".equalsIgnoreCase(args.getArguments()[0])) {
75
-            executeRemove(origin, server, args.isSilent(), args);
75
+            executeRemove(origin, connection, args.isSilent(), args);
76
         } else if ("--regex".equalsIgnoreCase(args.getArguments()[0])) {
76
         } else if ("--regex".equalsIgnoreCase(args.getArguments()[0])) {
77
-            executeRegex(origin, server, args.isSilent(), args);
77
+            executeRegex(origin, connection, args.isSilent(), args);
78
         } else {
78
         } else {
79
-            executeAdd(origin, server, args.isSilent(), args);
79
+            executeAdd(origin, connection, args.isSilent(), args);
80
         }
80
         }
81
     }
81
     }
82
 
82
 
83
-    protected void executeView(final FrameContainer origin, final Server server,
83
+    protected void executeView(final FrameContainer origin, final Connection connection,
84
             final boolean isSilent, final CommandArguments args, final boolean forceRegex) {
84
             final boolean isSilent, final CommandArguments args, final boolean forceRegex) {
85
-        final IgnoreList ignoreList = server.getIgnoreList();
85
+        final IgnoreList ignoreList = connection.getIgnoreList();
86
 
86
 
87
         if (ignoreList.count() == 0) {
87
         if (ignoreList.count() == 0) {
88
             sendLine(origin, args.isSilent(), FORMAT_ERROR,
88
             sendLine(origin, args.isSilent(), FORMAT_ERROR,
108
         }
108
         }
109
     }
109
     }
110
 
110
 
111
-    protected void executeAdd(final FrameContainer origin, final Server server,
111
+    protected void executeAdd(final FrameContainer origin, final Connection connection,
112
             final boolean isSilent, final CommandArguments args) {
112
             final boolean isSilent, final CommandArguments args) {
113
-        final IgnoreList ignoreList = server.getIgnoreList();
113
+        final IgnoreList ignoreList = connection.getIgnoreList();
114
         final String target = args.getArgumentsAsString();
114
         final String target = args.getArgumentsAsString();
115
 
115
 
116
         ignoreList.addSimple(target);
116
         ignoreList.addSimple(target);
117
-        server.saveIgnoreList();
117
+        connection.saveIgnoreList();
118
         sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Added " + target + " to the ignore list.");
118
         sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Added " + target + " to the ignore list.");
119
     }
119
     }
120
 
120
 
121
-    protected void executeRegex(final FrameContainer origin, final Server server,
121
+    protected void executeRegex(final FrameContainer origin, final Connection connection,
122
             final boolean isSilent, final CommandArguments args) {
122
             final boolean isSilent, final CommandArguments args) {
123
         if (args.getArguments().length == 1) {
123
         if (args.getArguments().length == 1) {
124
-            executeView(origin, server, args.isSilent(), args, true);
124
+            executeView(origin, connection, args.isSilent(), args, true);
125
             return;
125
             return;
126
         }
126
         }
127
 
127
 
128
-        final IgnoreList ignoreList = server.getIgnoreList();
128
+        final IgnoreList ignoreList = connection.getIgnoreList();
129
         final String target = args.getArgumentsAsString(1);
129
         final String target = args.getArgumentsAsString(1);
130
 
130
 
131
         try {
131
         try {
138
         }
138
         }
139
 
139
 
140
         ignoreList.add(target);
140
         ignoreList.add(target);
141
-        server.saveIgnoreList();
141
+        connection.saveIgnoreList();
142
         sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Added " + target + " to the ignore list.");
142
         sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Added " + target + " to the ignore list.");
143
     }
143
     }
144
 
144
 
145
-    protected void executeRemove(final FrameContainer origin, final Server server,
145
+    protected void executeRemove(final FrameContainer origin, final Connection connection,
146
             final boolean isSilent, final CommandArguments args) {
146
             final boolean isSilent, final CommandArguments args) {
147
         if (args.getArguments().length == 1) {
147
         if (args.getArguments().length == 1) {
148
             showUsage(origin, args.isSilent(), "ignore", "--remove <host>");
148
             showUsage(origin, args.isSilent(), "ignore", "--remove <host>");
149
             return;
149
             return;
150
         }
150
         }
151
 
151
 
152
-        final IgnoreList ignoreList = server.getIgnoreList();
152
+        final IgnoreList ignoreList = connection.getIgnoreList();
153
         final String host = args.getArgumentsAsString(1);
153
         final String host = args.getArgumentsAsString(1);
154
 
154
 
155
         if (ignoreList.canConvert() && ignoreList.getSimpleList().contains(host)) {
155
         if (ignoreList.canConvert() && ignoreList.getSimpleList().contains(host)) {
156
             ignoreList.remove(ignoreList.getSimpleList().indexOf(host));
156
             ignoreList.remove(ignoreList.getSimpleList().indexOf(host));
157
-            server.saveIgnoreList();
157
+            connection.saveIgnoreList();
158
             sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Removed " + host
158
             sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Removed " + host
159
                     + " from the ignore list.");
159
                     + " from the ignore list.");
160
             return;
160
             return;
162
 
162
 
163
         if (ignoreList.getRegexList().contains(host)) {
163
         if (ignoreList.getRegexList().contains(host)) {
164
             ignoreList.remove(ignoreList.getRegexList().indexOf(host));
164
             ignoreList.remove(ignoreList.getRegexList().indexOf(host));
165
-            server.saveIgnoreList();
165
+            connection.saveIgnoreList();
166
             sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Removed " + host
166
             sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Removed " + host
167
                     + " from the ignore list.");
167
                     + " from the ignore list.");
168
             return;
168
             return;
183
             targets.add("--remove");
183
             targets.add("--remove");
184
             targets.include(TabCompletionType.CHANNEL_NICK);
184
             targets.include(TabCompletionType.CHANNEL_NICK);
185
             targets.include(TabCompletionType.QUERY_NICK);
185
             targets.include(TabCompletionType.QUERY_NICK);
186
-        } else if (arg == 1 && context.getPreviousArgs().get(0).equals("--remove")) {
186
+        } else if (arg == 1 && "--remove".equals(context.getPreviousArgs().get(0))) {
187
             final IgnoreList ignoreList = context.getWindow().getConnection()
187
             final IgnoreList ignoreList = context.getWindow().getConnection()
188
                     .getIgnoreList();
188
                     .getIgnoreList();
189
             if (ignoreList.canConvert()) {
189
             if (ignoreList.canConvert()) {
195
                 targets.add(entry);
195
                 targets.add(entry);
196
             }
196
             }
197
 
197
 
198
-        } else if (arg == 1 && context.getPreviousArgs().get(0).equals("--regex")) {
198
+        } else if (arg == 1 && "--regex".equals(context.getPreviousArgs().get(0))) {
199
             targets.include(TabCompletionType.CHANNEL_NICK);
199
             targets.include(TabCompletionType.CHANNEL_NICK);
200
             targets.include(TabCompletionType.QUERY_NICK);
200
             targets.include(TabCompletionType.QUERY_NICK);
201
         }
201
         }

+ 2
- 3
src/com/dmdirc/commandparser/commands/server/JoinChannelCommand.java View File

24
 
24
 
25
 import com.dmdirc.DMDircMBassador;
25
 import com.dmdirc.DMDircMBassador;
26
 import com.dmdirc.FrameContainer;
26
 import com.dmdirc.FrameContainer;
27
-import com.dmdirc.Server;
28
 import com.dmdirc.commandparser.BaseCommandInfo;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
29
 import com.dmdirc.commandparser.CommandArguments;
28
 import com.dmdirc.commandparser.CommandArguments;
30
 import com.dmdirc.commandparser.CommandInfo;
29
 import com.dmdirc.commandparser.CommandInfo;
82
     @Override
81
     @Override
83
     public void execute(@Nonnull final FrameContainer origin,
82
     public void execute(@Nonnull final FrameContainer origin,
84
             final CommandArguments args, final CommandContext context) {
83
             final CommandArguments args, final CommandContext context) {
85
-        final Server server = ((ServerCommandContext) context).getServer();
84
+        final Connection connection = ((ServerCommandContext) context).getConnection();
86
         if (args.getArguments().length == 0) {
85
         if (args.getArguments().length == 0) {
87
             showUsage(origin, args.isSilent(), "join", "join <channel [key]>[,channel [key]...]");
86
             showUsage(origin, args.isSilent(), "join", "join <channel [key]>[,channel [key]...]");
88
             return;
87
             return;
101
             }
100
             }
102
         }
101
         }
103
 
102
 
104
-        server.join(!args.isSilent(), channels.toArray(new ChannelJoinRequest[channels.size()]));
103
+        connection.join(!args.isSilent(), channels.toArray(new ChannelJoinRequest[channels.size()]));
105
     }
104
     }
106
 
105
 
107
     @Handler
106
     @Handler

+ 9
- 9
src/com/dmdirc/commandparser/commands/server/Message.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
35
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
 import com.dmdirc.commandparser.commands.context.CommandContext;
36
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
37
 import com.dmdirc.interfaces.CommandController;
36
 import com.dmdirc.interfaces.CommandController;
37
+import com.dmdirc.interfaces.Connection;
38
 import com.dmdirc.parser.interfaces.Parser;
38
 import com.dmdirc.parser.interfaces.Parser;
39
 import com.dmdirc.ui.input.AdditionalTabTargets;
39
 import com.dmdirc.ui.input.AdditionalTabTargets;
40
 import com.dmdirc.ui.input.TabCompletionType;
40
 import com.dmdirc.ui.input.TabCompletionType;
67
     @Override
67
     @Override
68
     public void execute(@Nonnull final FrameContainer origin,
68
     public void execute(@Nonnull final FrameContainer origin,
69
             final CommandArguments args, final CommandContext context) {
69
             final CommandArguments args, final CommandContext context) {
70
-        final Server server = ((ServerCommandContext) context).getServer();
70
+        final Connection connection = ((ServerCommandContext) context).getConnection();
71
         if (args.getArguments().length < 2) {
71
         if (args.getArguments().length < 2) {
72
             showUsage(origin, args.isSilent(), "msg", "<target> <message>");
72
             showUsage(origin, args.isSilent(), "msg", "<target> <message>");
73
         } else {
73
         } else {
77
 
77
 
78
             // If this is a known server or channel, and this is not a silent
78
             // If this is a known server or channel, and this is not a silent
79
             // invocation, use sendLine, else send it raw to the parser.
79
             // invocation, use sendLine, else send it raw to the parser.
80
-            if (!args.isSilent() && server.hasChannel(target)) {
81
-                server.getChannel(target).sendLine(message);
82
-            } else if (!args.isSilent() && server.hasQuery(target)) {
83
-                server.getQuery(target).sendLine(message, target);
80
+            if (!args.isSilent() && connection.hasChannel(target)) {
81
+                connection.getChannel(target).sendLine(message);
82
+            } else if (!args.isSilent() && connection.hasQuery(target)) {
83
+                connection.getQuery(target).sendLine(message, target);
84
             } else {
84
             } else {
85
-                final Parser parser = server.getParser();
85
+                final Parser parser = connection.getParser();
86
 
86
 
87
                 if (parser == null) {
87
                 if (parser == null) {
88
                     // This can happen if the server gets disconnected after
88
                     // This can happen if the server gets disconnected after
116
     public int getLineCount(final FrameContainer origin, final CommandArguments arguments) {
116
     public int getLineCount(final FrameContainer origin, final CommandArguments arguments) {
117
         if (arguments.getArguments().length >= 2) {
117
         if (arguments.getArguments().length >= 2) {
118
             final String target = arguments.getArguments()[0];
118
             final String target = arguments.getArguments()[0];
119
-            return ((Server) origin.getConnection()).getNumLines("PRIVMSG "
120
-                    + target + " :" + arguments.getArgumentsAsString(1));
119
+            return origin.getConnection().getWindowModel().getNumLines(
120
+                    "PRIVMSG " + target + " :" + arguments.getArgumentsAsString(1));
121
         } else {
121
         } else {
122
             return 1;
122
             return 1;
123
         }
123
         }

+ 3
- 3
src/com/dmdirc/commandparser/commands/server/Nick.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
34
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36
 import com.dmdirc.interfaces.CommandController;
35
 import com.dmdirc.interfaces.CommandController;
36
+import com.dmdirc.interfaces.Connection;
37
 import com.dmdirc.ui.input.AdditionalTabTargets;
37
 import com.dmdirc.ui.input.AdditionalTabTargets;
38
 import com.dmdirc.ui.input.TabCompletionType;
38
 import com.dmdirc.ui.input.TabCompletionType;
39
 
39
 
64
     @Override
64
     @Override
65
     public void execute(@Nonnull final FrameContainer origin,
65
     public void execute(@Nonnull final FrameContainer origin,
66
             final CommandArguments args, final CommandContext context) {
66
             final CommandArguments args, final CommandContext context) {
67
-        final Server server = ((ServerCommandContext) context).getServer();
67
+        final Connection connection = ((ServerCommandContext) context).getConnection();
68
         if (args.getArguments().length == 0) {
68
         if (args.getArguments().length == 0) {
69
             showUsage(origin, args.isSilent(), "nick", "<new nickname>");
69
             showUsage(origin, args.isSilent(), "nick", "<new nickname>");
70
             return;
70
             return;
71
         }
71
         }
72
 
72
 
73
-        server.getParser().getLocalClient().setNickname(args.getArguments()[0]);
73
+        connection.getParser().getLocalClient().setNickname(args.getArguments()[0]);
74
     }
74
     }
75
 
75
 
76
     @Override
76
     @Override

+ 3
- 3
src/com/dmdirc/commandparser/commands/server/Notice.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
34
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36
 import com.dmdirc.interfaces.CommandController;
35
 import com.dmdirc.interfaces.CommandController;
36
+import com.dmdirc.interfaces.Connection;
37
 import com.dmdirc.ui.input.AdditionalTabTargets;
37
 import com.dmdirc.ui.input.AdditionalTabTargets;
38
 import com.dmdirc.ui.input.TabCompletionType;
38
 import com.dmdirc.ui.input.TabCompletionType;
39
 
39
 
64
     @Override
64
     @Override
65
     public void execute(@Nonnull final FrameContainer origin,
65
     public void execute(@Nonnull final FrameContainer origin,
66
             final CommandArguments args, final CommandContext context) {
66
             final CommandArguments args, final CommandContext context) {
67
-        final Server server = ((ServerCommandContext) context).getServer();
67
+        final Connection connection = ((ServerCommandContext) context).getConnection();
68
         if (args.getArguments().length < 2) {
68
         if (args.getArguments().length < 2) {
69
             showUsage(origin, args.isSilent(), "notice", "<target> <message>");
69
             showUsage(origin, args.isSilent(), "notice", "<target> <message>");
70
         } else {
70
         } else {
71
-            server.getParser().sendNotice(args.getArguments()[0],
71
+            connection.getParser().sendNotice(args.getArguments()[0],
72
                     args.getArgumentsAsString(1));
72
                     args.getArgumentsAsString(1));
73
             sendLine(origin, args.isSilent(), "selfNotice", args.getArguments()[0],
73
             sendLine(origin, args.isSilent(), "selfNotice", args.getArguments()[0],
74
                     args.getArgumentsAsString(1));
74
                     args.getArgumentsAsString(1));

+ 5
- 5
src/com/dmdirc/commandparser/commands/server/OpenQuery.java View File

24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
 import com.dmdirc.Query;
26
 import com.dmdirc.Query;
27
-import com.dmdirc.Server;
28
 import com.dmdirc.commandparser.BaseCommandInfo;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
29
 import com.dmdirc.commandparser.CommandArguments;
28
 import com.dmdirc.commandparser.CommandArguments;
30
 import com.dmdirc.commandparser.CommandInfo;
29
 import com.dmdirc.commandparser.CommandInfo;
35
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
 import com.dmdirc.commandparser.commands.context.CommandContext;
36
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
37
 import com.dmdirc.interfaces.CommandController;
36
 import com.dmdirc.interfaces.CommandController;
37
+import com.dmdirc.interfaces.Connection;
38
 import com.dmdirc.ui.input.AdditionalTabTargets;
38
 import com.dmdirc.ui.input.AdditionalTabTargets;
39
 import com.dmdirc.ui.input.TabCompletionType;
39
 import com.dmdirc.ui.input.TabCompletionType;
40
 import com.dmdirc.ui.messages.Styliser;
40
 import com.dmdirc.ui.messages.Styliser;
71
             return;
71
             return;
72
         }
72
         }
73
 
73
 
74
-        final Server server = ((ServerCommandContext) context).getServer();
75
-        if (server.getParser().isValidChannelName(args.getArguments()[0])) {
74
+        final Connection connection = ((ServerCommandContext) context).getConnection();
75
+        if (connection.getParser().isValidChannelName(args.getArguments()[0])) {
76
             sendLine(origin, args.isSilent(), FORMAT_ERROR, "You can't open a query "
76
             sendLine(origin, args.isSilent(), FORMAT_ERROR, "You can't open a query "
77
                     + "with a channel; maybe you meant " + Styliser.CODE_FIXED
77
                     + "with a channel; maybe you meant " + Styliser.CODE_FIXED
78
                     + Styliser.CODE_BOLD
78
                     + Styliser.CODE_BOLD
83
             return;
83
             return;
84
         }
84
         }
85
 
85
 
86
-        final Query query = server.getQuery(args.getArguments()[0], !args.isSilent());
86
+        final Query query = connection.getQuery(args.getArguments()[0], !args.isSilent());
87
 
87
 
88
         if (args.getArguments().length > 1) {
88
         if (args.getArguments().length > 1) {
89
             query.sendLine(args.getArgumentsAsString(1), args.getArguments()[0]);
89
             query.sendLine(args.getArgumentsAsString(1), args.getArguments()[0]);
113
     public int getLineCount(final FrameContainer origin, final CommandArguments arguments) {
113
     public int getLineCount(final FrameContainer origin, final CommandArguments arguments) {
114
         if (arguments.getArguments().length >= 2) {
114
         if (arguments.getArguments().length >= 2) {
115
             final String target = arguments.getArguments()[0];
115
             final String target = arguments.getArguments()[0];
116
-            return ((Server) origin.getConnection()).getNumLines("PRIVMSG "
116
+            return ((Connection) origin.getConnection()).getWindowModel().getNumLines("PRIVMSG "
117
                     + target + " :" + arguments.getArgumentsAsString(1));
117
                     + target + " :" + arguments.getArgumentsAsString(1));
118
         } else {
118
         } else {
119
             return 1;
119
             return 1;

+ 3
- 3
src/com/dmdirc/commandparser/commands/server/Raw.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35
 import com.dmdirc.interfaces.CommandController;
34
 import com.dmdirc.interfaces.CommandController;
35
+import com.dmdirc.interfaces.Connection;
36
 
36
 
37
 import javax.annotation.Nonnull;
37
 import javax.annotation.Nonnull;
38
 import javax.inject.Inject;
38
 import javax.inject.Inject;
61
     @Override
61
     @Override
62
     public void execute(@Nonnull final FrameContainer origin,
62
     public void execute(@Nonnull final FrameContainer origin,
63
             final CommandArguments args, final CommandContext context) {
63
             final CommandArguments args, final CommandContext context) {
64
-        final Server server = ((ServerCommandContext) context).getServer();
64
+        final Connection connection = ((ServerCommandContext) context).getConnection();
65
         final String line = args.getArgumentsAsString();
65
         final String line = args.getArgumentsAsString();
66
 
66
 
67
-        server.getParser().sendRawMessage(line);
67
+        connection.getParser().sendRawMessage(line);
68
         sendLine(origin, args.isSilent(), "rawCommand", line);
68
         sendLine(origin, args.isSilent(), "rawCommand", line);
69
     }
69
     }
70
 
70
 

+ 4
- 3
src/com/dmdirc/commandparser/commands/server/RawServerCommand.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.CommandArguments;
26
 import com.dmdirc.commandparser.CommandArguments;
28
 import com.dmdirc.commandparser.CommandInfo;
27
 import com.dmdirc.commandparser.CommandInfo;
29
 import com.dmdirc.commandparser.CommandType;
28
 import com.dmdirc.commandparser.CommandType;
32
 import com.dmdirc.commandparser.commands.context.CommandContext;
31
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
32
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34
 import com.dmdirc.interfaces.CommandController;
33
 import com.dmdirc.interfaces.CommandController;
34
+import com.dmdirc.interfaces.Connection;
35
 
35
 
36
 import javax.annotation.Nonnull;
36
 import javax.annotation.Nonnull;
37
 
37
 
58
     @Override
58
     @Override
59
     public void execute(@Nonnull final FrameContainer origin,
59
     public void execute(@Nonnull final FrameContainer origin,
60
             final CommandArguments args, final CommandContext context) {
60
             final CommandArguments args, final CommandContext context) {
61
-        final Server server = ((ServerCommandContext) context).getServer();
62
-        server.getParser().sendRawMessage(myName.toUpperCase() + " " + args.getArgumentsAsString());
61
+        final Connection connection = ((ServerCommandContext) context).getConnection();
62
+        connection.getParser().sendRawMessage(myName.toUpperCase() + ' '
63
+                + args.getArgumentsAsString());
63
     }
64
     }
64
 
65
 
65
     @Override
66
     @Override

+ 3
- 3
src/com/dmdirc/commandparser/commands/server/Reconnect.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
26
 import com.dmdirc.commandparser.BaseCommandInfo;
28
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.CommandArguments;
29
 import com.dmdirc.commandparser.CommandInfo;
28
 import com.dmdirc.commandparser.CommandInfo;
32
 import com.dmdirc.commandparser.commands.context.CommandContext;
31
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
32
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34
 import com.dmdirc.interfaces.CommandController;
33
 import com.dmdirc.interfaces.CommandController;
34
+import com.dmdirc.interfaces.Connection;
35
 
35
 
36
 import javax.annotation.Nonnull;
36
 import javax.annotation.Nonnull;
37
 import javax.inject.Inject;
37
 import javax.inject.Inject;
59
     @Override
59
     @Override
60
     public void execute(@Nonnull final FrameContainer origin,
60
     public void execute(@Nonnull final FrameContainer origin,
61
             final CommandArguments args, final CommandContext context) {
61
             final CommandArguments args, final CommandContext context) {
62
-        final Server server = ((ServerCommandContext) context).getServer();
62
+        final Connection connection = ((ServerCommandContext) context).getConnection();
63
         final String line;
63
         final String line;
64
 
64
 
65
         if (args.getArguments().length == 0) {
65
         if (args.getArguments().length == 0) {
68
             line = args.getArgumentsAsString();
68
             line = args.getArgumentsAsString();
69
         }
69
         }
70
 
70
 
71
-        server.reconnect(line);
71
+        connection.reconnect(line);
72
     }
72
     }
73
 
73
 
74
 }
74
 }

+ 5
- 5
src/com/dmdirc/commandparser/commands/server/Umode.java View File

23
 package com.dmdirc.commandparser.commands.server;
23
 package com.dmdirc.commandparser.commands.server;
24
 
24
 
25
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
26
-import com.dmdirc.Server;
27
 import com.dmdirc.ServerState;
26
 import com.dmdirc.ServerState;
28
 import com.dmdirc.commandparser.BaseCommandInfo;
27
 import com.dmdirc.commandparser.BaseCommandInfo;
29
 import com.dmdirc.commandparser.CommandArguments;
28
 import com.dmdirc.commandparser.CommandArguments;
34
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36
 import com.dmdirc.interfaces.CommandController;
35
 import com.dmdirc.interfaces.CommandController;
36
+import com.dmdirc.interfaces.Connection;
37
 
37
 
38
 import javax.annotation.Nonnull;
38
 import javax.annotation.Nonnull;
39
 import javax.inject.Inject;
39
 import javax.inject.Inject;
62
     @Override
62
     @Override
63
     public void execute(@Nonnull final FrameContainer origin,
63
     public void execute(@Nonnull final FrameContainer origin,
64
             final CommandArguments args, final CommandContext context) {
64
             final CommandArguments args, final CommandContext context) {
65
-        final Server server = ((ServerCommandContext) context).getServer();
66
-        if (server.getState() != ServerState.CONNECTED) {
65
+        final Connection connection = ((ServerCommandContext) context).getConnection();
66
+        if (connection.getState() != ServerState.CONNECTED) {
67
             sendLine(origin, args.isSilent(), FORMAT_ERROR, "Not connected");
67
             sendLine(origin, args.isSilent(), FORMAT_ERROR, "Not connected");
68
             return;
68
             return;
69
         }
69
         }
70
 
70
 
71
-        server.getParser().sendRawMessage("MODE "
72
-                + server.getParser().getLocalClient().getNickname()
71
+        connection.getParser().sendRawMessage("MODE "
72
+                + connection.getParser().getLocalClient().getNickname()
73
                 + " " + args.getArgumentsAsString());
73
                 + " " + args.getArgumentsAsString());
74
     }
74
     }
75
 
75
 

+ 2
- 1
src/com/dmdirc/interfaces/Connection.java View File

33
 import com.dmdirc.parser.common.IgnoreList;
33
 import com.dmdirc.parser.common.IgnoreList;
34
 import com.dmdirc.parser.interfaces.ChannelInfo;
34
 import com.dmdirc.parser.interfaces.ChannelInfo;
35
 import com.dmdirc.parser.interfaces.Parser;
35
 import com.dmdirc.parser.interfaces.Parser;
36
+import com.dmdirc.parser.interfaces.ProtocolDescription;
36
 import com.dmdirc.tls.CertificateProblemListener;
37
 import com.dmdirc.tls.CertificateProblemListener;
37
 
38
 
38
 import java.net.URI;
39
 import java.net.URI;
409
      * Parses the specified hostmask in a manner prescribed by the protocol currently used by this
410
      * Parses the specified hostmask in a manner prescribed by the protocol currently used by this
410
      * server.
411
      * server.
411
      *
412
      *
412
-     * @see com.dmdirc.parser.interfaces.ProtocolDescription#parseHostmask(java.lang.String)
413
+     * @see ProtocolDescription#parseHostmask(String)
413
      * @param hostmask The hostmask to be parsed
414
      * @param hostmask The hostmask to be parsed
414
      *
415
      *
415
      * @return An array containing the nickname, username and hostname
416
      * @return An array containing the nickname, username and hostname

+ 9
- 8
test/com/dmdirc/commandparser/commands/global/NewServerTest.java View File

22
 package com.dmdirc.commandparser.commands.global;
22
 package com.dmdirc.commandparser.commands.global;
23
 
23
 
24
 import com.dmdirc.FrameContainer;
24
 import com.dmdirc.FrameContainer;
25
-import com.dmdirc.Server;
26
 import com.dmdirc.commandparser.CommandArguments;
25
 import com.dmdirc.commandparser.CommandArguments;
27
 import com.dmdirc.commandparser.commands.context.CommandContext;
26
 import com.dmdirc.commandparser.commands.context.CommandContext;
28
 import com.dmdirc.interfaces.CommandController;
27
 import com.dmdirc.interfaces.CommandController;
28
+import com.dmdirc.interfaces.Connection;
29
 import com.dmdirc.interfaces.ConnectionFactory;
29
 import com.dmdirc.interfaces.ConnectionFactory;
30
 import com.dmdirc.interfaces.config.ConfigProvider;
30
 import com.dmdirc.interfaces.config.ConfigProvider;
31
 import com.dmdirc.interfaces.config.IdentityController;
31
 import com.dmdirc.interfaces.config.IdentityController;
34
 
34
 
35
 import java.net.URI;
35
 import java.net.URI;
36
 import java.net.URISyntaxException;
36
 import java.net.URISyntaxException;
37
-import java.util.Arrays;
37
+import java.util.Collections;
38
 
38
 
39
 import org.junit.Before;
39
 import org.junit.Before;
40
 import org.junit.Test;
40
 import org.junit.Test;
58
     @Mock private FrameContainer container;
58
     @Mock private FrameContainer container;
59
     @Mock private PluginManager pluginManager;
59
     @Mock private PluginManager pluginManager;
60
     @Mock private ConnectionFactory factory;
60
     @Mock private ConnectionFactory factory;
61
-    @Mock private Server server;
61
+    @Mock private Connection connection;
62
     private NewServer command;
62
     private NewServer command;
63
 
63
 
64
     @Before
64
     @Before
65
     public void setup() {
65
     public void setup() {
66
-        when(factory.createServer(any(URI.class), any(ConfigProvider.class))).thenReturn(server);
67
-        when(identityController.getProvidersByType("profile")).thenReturn(Arrays.asList(new ConfigProvider[] { identity }));
66
+        when(factory.createServer(any(URI.class), any(ConfigProvider.class))).thenReturn(connection);
67
+        when(identityController.getProvidersByType("profile")).thenReturn(
68
+                Collections.singletonList(identity));
68
         command = new NewServer(controller, factory, pluginManager, identityController, new URIParser());
69
         command = new NewServer(controller, factory, pluginManager, identityController, new URIParser());
69
     }
70
     }
70
 
71
 
74
                 new CommandContext(null, NewServer.INFO));
75
                 new CommandContext(null, NewServer.INFO));
75
 
76
 
76
         verify(factory).createServer(eq(new URI("irc://irc.foo.com")), any(ConfigProvider.class));
77
         verify(factory).createServer(eq(new URI("irc://irc.foo.com")), any(ConfigProvider.class));
77
-        verify(server).connect();
78
+        verify(connection).connect();
78
     }
79
     }
79
 
80
 
80
     @Test
81
     @Test
83
                 new CommandContext(null, NewServer.INFO));
84
                 new CommandContext(null, NewServer.INFO));
84
 
85
 
85
         verify(factory).createServer(eq(new URI("irc://irc.foo.com:1234")), any(ConfigProvider.class));
86
         verify(factory).createServer(eq(new URI("irc://irc.foo.com:1234")), any(ConfigProvider.class));
86
-        verify(server).connect();
87
+        verify(connection).connect();
87
     }
88
     }
88
 
89
 
89
     @Test
90
     @Test
92
                 new CommandContext(null, NewServer.INFO));
93
                 new CommandContext(null, NewServer.INFO));
93
 
94
 
94
         verify(factory).createServer(eq(new URI("otheruri://foo.com:123/blah")), any(ConfigProvider.class));
95
         verify(factory).createServer(eq(new URI("otheruri://foo.com:123/blah")), any(ConfigProvider.class));
95
-        verify(server).connect();
96
+        verify(connection).connect();
96
     }
97
     }
97
 
98
 
98
     @Test
99
     @Test

Loading…
Cancel
Save