Browse Source

New server network name behaviour

git-svn-id: http://svn.dmdirc.com/trunk@2492 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5.5
Chris Smith 16 years ago
parent
commit
056fa795c9
3 changed files with 306 additions and 223 deletions
  1. 258
    214
      src/com/dmdirc/Server.java
  2. 1
    9
      src/com/dmdirc/ServerEventHandler.java
  3. 47
    0
      test/com/dmdirc/ServerTest.java

+ 258
- 214
src/com/dmdirc/Server.java
File diff suppressed because it is too large
View File


+ 1
- 9
src/com/dmdirc/ServerEventHandler.java View File

41
 public final class ServerEventHandler implements IChannelSelfJoin,
41
 public final class ServerEventHandler implements IChannelSelfJoin,
42
         IPrivateMessage, IPrivateAction, IErrorInfo, IPrivateCTCP,
42
         IPrivateMessage, IPrivateAction, IErrorInfo, IPrivateCTCP,
43
         IPrivateCTCPReply, ISocketClosed, IPrivateNotice, IMOTDStart, IMOTDLine,
43
         IPrivateCTCPReply, ISocketClosed, IPrivateNotice, IMOTDStart, IMOTDLine,
44
-        IMOTDEnd, INumeric, IGotNetwork, IPingFailed, IPingSuccess, IAwayState,
44
+        IMOTDEnd, INumeric, IPingFailed, IPingSuccess, IAwayState,
45
         IConnectError, IAwayStateOther, INickInUse, IPost005, INoticeAuth,
45
         IConnectError, IAwayStateOther, INickInUse, IPost005, INoticeAuth,
46
         IUnknownNotice, IUserModeChanged, IInvite, IWallop, IWalluser,
46
         IUnknownNotice, IUserModeChanged, IInvite, IWallop, IWalluser,
47
         IWallDesync, INickChanged {
47
         IWallDesync, INickChanged {
201
         owner.onNumeric(numeric, token);
201
         owner.onNumeric(numeric, token);
202
     }
202
     }
203
     
203
     
204
-    /** {@inheritDoc} */
205
-    @Override
206
-    public void onGotNetwork(final IRCParser tParser, final String networkName,
207
-            final String ircdVersion, final String ircdType) {
208
-        checkParser(tParser);
209
-        owner.onGotNetwork(networkName, ircdType);
210
-    }
211
-    
212
     /** {@inheritDoc} */
204
     /** {@inheritDoc} */
213
     @Override
205
     @Override
214
     public void onPingFailed(final IRCParser tParser) {
206
     public void onPingFailed(final IRCParser tParser) {

+ 47
- 0
test/com/dmdirc/ServerTest.java View File

1
+/*
2
+ * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc;
24
+
25
+import org.junit.Test;
26
+import static org.junit.Assert.*;
27
+
28
+public class ServerTest {
29
+
30
+    @Test
31
+    public void getNetworkFromServerName() {
32
+        final String[][] tests = {
33
+            {"foo.com", "foo.com"},
34
+            {"bar.foo.com", "foo.com"},
35
+            {"irc.us.foo.com", "foo.com"},
36
+            {"irc.foo.co.uk", "foo.co.uk"},
37
+            {"com", "com"},
38
+            {"localhost", "localhost"},
39
+            {"foo.de", "foo.de"}
40
+        };
41
+        
42
+        for (String[] test : tests) {
43
+            assertEquals(test[1], Server.getNetworkFromServerName(test[0]));
44
+        }
45
+    }
46
+    
47
+}

Loading…
Cancel
Save