|
@@ -30,8 +30,8 @@ import uk.org.ownage.dmdirc.parser.callbacks.CallbackManager;
|
30
|
30
|
* IRCProcessor.
|
31
|
31
|
* Superclass for all IRCProcessor types.
|
32
|
32
|
*
|
33
|
|
- * @author Shane Mc Cormack
|
34
|
|
- * @version $Id$
|
|
33
|
+ * @author Shane Mc Cormack
|
|
34
|
+ * @version $Id$
|
35
|
35
|
*/
|
36
|
36
|
public abstract class IRCProcessor {
|
37
|
37
|
/** Reference to the IRCParser that owns this IRCProcessor. */
|
|
@@ -42,8 +42,6 @@ public abstract class IRCProcessor {
|
42
|
42
|
|
43
|
43
|
// Some functions from the main parser are useful, and having to use myParser.functionName
|
44
|
44
|
// is annoying, so we also implement them here (calling them again using myParser)
|
45
|
|
-
|
46
|
|
-
|
47
|
45
|
/**
|
48
|
46
|
* Create a new instance of the IRCProcessor Object.
|
49
|
47
|
*
|
|
@@ -54,13 +52,13 @@ public abstract class IRCProcessor {
|
54
|
52
|
this.myParser = parser;
|
55
|
53
|
this.myManager = manager;
|
56
|
54
|
}
|
57
|
|
-
|
|
55
|
+
|
58
|
56
|
/**
|
59
|
57
|
* Callback to all objects implementing the IErrorInfo Interface.
|
60
|
58
|
*
|
61
|
59
|
* @see uk.org.ownage.dmdirc.parser.callbacks.interfaces.IErrorInfo
|
62
|
60
|
* @param errorInfo ParserError object representing the error.
|
63
|
|
- * @return true if a method was called, false otherwise
|
|
61
|
+ * @return true if a method was called, false otherwise
|
64
|
62
|
*/
|
65
|
63
|
protected final boolean callErrorInfo(final ParserError errorInfo) {
|
66
|
64
|
return myParser.callErrorInfo(errorInfo);
|
|
@@ -73,7 +71,7 @@ public abstract class IRCProcessor {
|
73
|
71
|
* @param level Debugging Level (DEBUG_INFO, ndSocket etc)
|
74
|
72
|
* @param data Debugging Information
|
75
|
73
|
* @param args Formatting String Options
|
76
|
|
- * @return true if a method was called, false otherwise
|
|
74
|
+ * @return true if a method was called, false otherwise
|
77
|
75
|
*/
|
78
|
76
|
protected final boolean callDebugInfo(final int level, final String data, final Object... args) {
|
79
|
77
|
return myParser.callDebugInfo(level, String.format(data, args));
|
|
@@ -85,7 +83,7 @@ public abstract class IRCProcessor {
|
85
|
83
|
* @see uk.org.ownage.dmdirc.parser.callbacks.interfaces.IDebugInfo
|
86
|
84
|
* @param level Debugging Level (DEBUG_INFO, ndSocket etc)
|
87
|
85
|
* @param data Debugging Information
|
88
|
|
- * @return true if a method was called, false otherwise
|
|
86
|
+ * @return true if a method was called, false otherwise
|
89
|
87
|
*/
|
90
|
88
|
protected final boolean callDebugInfo(final int level, final String data) {
|
91
|
89
|
return myParser.callDebugInfo(level, data);
|
|
@@ -95,7 +93,7 @@ public abstract class IRCProcessor {
|
95
|
93
|
* Check if a channel name is valid .
|
96
|
94
|
*
|
97
|
95
|
* @param sChannelName Channel name to test
|
98
|
|
- * @return true if name is valid on the current connection, false otherwise. (Always false before noMOTD/MOTDEnd)
|
|
96
|
+ * @return true if name is valid on the current connection, false otherwise. (Always false before noMOTD/MOTDEnd)
|
99
|
97
|
*/
|
100
|
98
|
protected final boolean isValidChannelName(final String sChannelName) {
|
101
|
99
|
return myParser.isValidChannelName(sChannelName);
|
|
@@ -155,9 +153,9 @@ public abstract class IRCProcessor {
|
155
|
153
|
public abstract String[] handles();
|
156
|
154
|
|
157
|
155
|
/**
|
158
|
|
- * Get the name for this Processor.
|
159
|
|
- * @return the name of this processor
|
160
|
|
- */
|
|
156
|
+ * Get the name for this Processor.
|
|
157
|
+ * @return the name of this processor
|
|
158
|
+ */
|
161
|
159
|
public final String getName() {
|
162
|
160
|
final Package thisPackage = this.getClass().getPackage();
|
163
|
161
|
int packageLength = 0;
|
|
@@ -168,17 +166,17 @@ public abstract class IRCProcessor {
|
168
|
166
|
}
|
169
|
167
|
|
170
|
168
|
/**
|
171
|
|
- * Get the name for this Processor in lowercase.
|
172
|
|
- * @return lower case name of this processor
|
173
|
|
- */
|
|
169
|
+ * Get the name for this Processor in lowercase.
|
|
170
|
+ * @return lower case name of this processor
|
|
171
|
+ */
|
174
|
172
|
public final String getLowerName() {
|
175
|
173
|
return this.getName().toLowerCase();
|
176
|
174
|
}
|
177
|
175
|
|
178
|
176
|
/**
|
179
|
|
- * Get the name for this Processor.
|
180
|
|
- * @return the name of this processor
|
181
|
|
- */
|
|
177
|
+ * Get the name for this Processor.
|
|
178
|
+ * @return the name of this processor
|
|
179
|
+ */
|
182
|
180
|
public final String toString() { return this.getName(); }
|
183
|
181
|
|
184
|
182
|
/**
|