ソースを参照

Merge pull request #129 from csmith/master

Add method to set output queue.
pull/130/head
Greg Holmes 8年前
コミット
8ac6628938
1個のファイルの変更16行の追加1行の削除
  1. 16
    1
      irc/src/com/dmdirc/parser/irc/IRCParser.java

+ 16
- 1
irc/src/com/dmdirc/parser/irc/IRCParser.java ファイルの表示

@@ -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.

読み込み中…
キャンセル
保存