Browse Source

Add method to set output queue.

Needed for DFBnc.
pull/129/head
Chris Smith 7 years ago
parent
commit
fe441fde15
1 changed files with 16 additions and 1 deletions
  1. 16
    1
      irc/src/com/dmdirc/parser/irc/IRCParser.java

+ 16
- 1
irc/src/com/dmdirc/parser/irc/IRCParser.java View File

@@ -84,6 +84,8 @@ import javax.net.ssl.TrustManager;
84 84
 
85 85
 import dagger.ObjectGraph;
86 86
 
87
+import static com.google.common.base.Preconditions.checkNotNull;
88
+
87 89
 /**
88 90
  * IRC Parser.
89 91
  */
@@ -210,7 +212,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
210 212
      */
211 213
     private Socket rawSocket;
212 214
     /** Used for writing to the server. */
213
-    private final OutputQueue out;
215
+    private OutputQueue out;
214 216
     /** The encoder to use to encode incoming lines. */
215 217
     private Encoder encoder = new SystemEncoder();
216 218
     /** Used for reading from the server. */
@@ -299,6 +301,19 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
299 301
         return out;
300 302
     }
301 303
 
304
+    /**
305
+     * Sets the output queue that this parser will use.
306
+     *
307
+     * <p>Any existing items in the queue will be removed.
308
+     *
309
+     * @param queue The queue to be added.
310
+     */
311
+    public void setOutputQueue(final OutputQueue queue) {
312
+        checkNotNull(queue);
313
+        out.clearQueue();
314
+        out = queue;
315
+    }
316
+
302 317
     @Override
303 318
     public boolean compareURI(final URI uri) {
304 319
         // Get the old URI.

Loading…
Cancel
Save