Browse Source

Raw windows now have proper command parsers

Remove pointless RawCommandParser as it doesn't add any functionality
over the ServerCommandParser.

Fixes issue 4091

Change-Id: I2e76979d0752c591f9643509b025e4d28860a989
Reviewed-on: http://gerrit.dmdirc.com/1202
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4rc1
Chris Smith 14 years ago
parent
commit
0f3ae3503e

+ 4
- 2
src/com/dmdirc/Raw.java View File

@@ -22,7 +22,7 @@
22 22
 
23 23
 package com.dmdirc;
24 24
 
25
-import com.dmdirc.commandparser.parsers.RawCommandParser;
25
+import com.dmdirc.commandparser.parsers.ServerCommandParser;
26 26
 import com.dmdirc.logger.ErrorLevel;
27 27
 import com.dmdirc.logger.Logger;
28 28
 import com.dmdirc.parser.interfaces.Parser;
@@ -51,10 +51,12 @@ public final class Raw extends WritableFrameContainer<InputWindow>
51 51
      */
52 52
     public Raw(final Server newServer) {
53 53
         super("raw", "Raw", "(Raw log)", InputWindow.class,
54
-                newServer.getConfigManager(), new RawCommandParser());
54
+                newServer.getConfigManager(), new ServerCommandParser());
55 55
 
56 56
         this.server = newServer;
57 57
 
58
+        getCommandParser().setOwner(server);
59
+
58 60
         WindowManager.addWindow(server, this);
59 61
     }
60 62
 

+ 0
- 63
src/com/dmdirc/commandparser/parsers/RawCommandParser.java View File

@@ -1,63 +0,0 @@
1
-/*
2
- * 
3
- * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
- * 
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- * 
12
- * The above copyright notice and this permission notice shall be included in
13
- * all copies or substantial portions of the Software.
14
- * 
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
-
24
-package com.dmdirc.commandparser.parsers;
25
-
26
-import com.dmdirc.FrameContainer;
27
-import com.dmdirc.Server;
28
-
29
-/**
30
- * Command parser for raw windows, sends lines directly to the parser.
31
- */
32
-public class RawCommandParser extends ServerCommandParser {
33
-
34
-    /**
35
-     * A version number for this class. It should be changed whenever the class
36
-     * structure is changed (or anything else that would prevent serialized
37
-     * objects being unserialized with the new class).
38
-     */
39
-    private static final long serialVersionUID = 1;
40
-
41
-    /** The container that owns this parser. */
42
-    private FrameContainer<?> owner;
43
-
44
-    /**
45
-     * Creates a new raw command parser for the specified server.
46
-     */
47
-    public RawCommandParser() {
48
-        super();
49
-    }
50
-
51
-    /** {@inheritDoc} */
52
-    @Override
53
-    public void setOwner(final FrameContainer<?> owner) {
54
-        this.owner = owner;
55
-    }
56
-
57
-    /** {@inheritDoc} */
58
-    @Override
59
-    protected void handleNonCommand(final FrameContainer<?> origin, final String line) {
60
-        owner.getServer().getParser().sendRawMessage(line);
61
-    }
62
-
63
-}

+ 1
- 1
src/com/dmdirc/commandparser/parsers/ServerCommandParser.java View File

@@ -60,7 +60,7 @@ public class ServerCommandParser extends CommandParser {
60 60
     /** {@inheritDoc} */
61 61
     @Override
62 62
     public void setOwner(final FrameContainer<?> owner) {
63
-        if (server == null) {
63
+        if (server == null && owner instanceof Server) {
64 64
             server = (Server) owner;
65 65
         }
66 66
     }

Loading…
Cancel
Save