ソースを参照

Add getMap() to Parser and IRCParser. Fixes issue 3206

Add getMap() to ChannelInfo and make getMap() in IRCChannelInfo behave the same way as in IRCClientInfo and IRCChannelClientInfo

Change-Id: I2cdce2eb87e77139520254eec98b51288510f043
Reviewed-on: http://gerrit.dmdirc.com/125
Tested-by: Shane Mc Cormack <shane@dmdirc.com>
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
tags/0.6.3
Shane Mc Cormack 14年前
コミット
0e1eb49b56

+ 9
- 0
src/com/dmdirc/parser/interfaces/ChannelInfo.java ファイルの表示

24
 
24
 
25
 import com.dmdirc.parser.common.ChannelListModeItem;
25
 import com.dmdirc.parser.common.ChannelListModeItem;
26
 import java.util.Collection;
26
 import java.util.Collection;
27
+import java.util.Map;
27
 
28
 
28
 /**
29
 /**
29
  * Holds information about a channel and allows various operations to be
30
  * Holds information about a channel and allows various operations to be
183
      */
184
      */
184
     int getChannelClientCount();
185
     int getChannelClientCount();
185
 
186
 
187
+    /**
188
+     * Retrieves a {@link Map} which can be used to store arbitrary data
189
+     * about the channel client.
190
+     *
191
+     * @return A map used for storing arbitrary data
192
+     */
193
+    Map<Object, Object> getMap();
194
+
186
     /**
195
     /**
187
      * Retrieves the parser which created this ChannelInfo.
196
      * Retrieves the parser which created this ChannelInfo.
188
      *
197
      *

+ 9
- 0
src/com/dmdirc/parser/interfaces/Parser.java ファイルの表示

28
 import com.dmdirc.parser.common.QueuePriority;
28
 import com.dmdirc.parser.common.QueuePriority;
29
 import java.net.URI;
29
 import java.net.URI;
30
 import java.util.Collection;
30
 import java.util.Collection;
31
+import java.util.Map;
31
 
32
 
32
 /**
33
 /**
33
  * A parser connects to a back-end chat system and handles all communication
34
  * A parser connects to a back-end chat system and handles all communication
90
      */
91
      */
91
     void setBindIP(String ip);
92
     void setBindIP(String ip);
92
 
93
 
94
+    /**
95
+     * Retrieves a {@link Map} which can be used to store arbitrary data
96
+     * about the client.
97
+     *
98
+     * @return A map used for storing arbitrary data
99
+     */
100
+    Map<Object, Object> getMap();
101
+
93
     /**
102
     /**
94
      * Determines the maximimum length a message of the specified type may be.
103
      * Determines the maximimum length a message of the specified type may be.
95
      *
104
      *

+ 5
- 8
src/com/dmdirc/parser/irc/IRCChannelInfo.java ファイルの表示

86
     /** Modes waiting to be sent to the server. */
86
     /** Modes waiting to be sent to the server. */
87
     private final List<String> lModeQueue = new LinkedList<String>();
87
     private final List<String> lModeQueue = new LinkedList<String>();
88
     /** A Map to allow applications to attach misc data to this object */
88
     /** A Map to allow applications to attach misc data to this object */
89
-    private Map myMap;
89
+    private Map<Object, Object> myMap;
90
     
90
     
91
     /** Queue of requested list modes */
91
     /** Queue of requested list modes */
92
     private final Queue<Character> listModeQueue = new LinkedList<Character>();
92
     private final Queue<Character> listModeQueue = new LinkedList<Character>();
244
      *
244
      *
245
      * @param newMap New Map to attatch.
245
      * @param newMap New Map to attatch.
246
      */
246
      */
247
-    public void setMap(final Map newMap) {
247
+    public void setMap(final Map<Object, Object> newMap) {
248
         myMap = newMap;
248
         myMap = newMap;
249
     }
249
     }
250
     
250
     
251
-    /**
252
-     * Get the Map object attatched to this object.
253
-     *
254
-     * @return Map to attatched to this.
255
-     */
256
-    public Map getMap() {
251
+    /** {@inheritDoc} */
252
+    @Override
253
+    public Map<Object, Object> getMap() {
257
         return myMap;
254
         return myMap;
258
     }
255
     }
259
     
256
     

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

55
 import java.security.cert.X509Certificate;
55
 import java.security.cert.X509Certificate;
56
 import java.util.Arrays;
56
 import java.util.Arrays;
57
 import java.util.Collection;
57
 import java.util.Collection;
58
+import java.util.HashMap;
58
 import java.util.Hashtable;
59
 import java.util.Hashtable;
59
 import java.util.LinkedList;
60
 import java.util.LinkedList;
60
 import java.util.List;
61
 import java.util.List;
232
     /** Current Socket State. */
233
     /** Current Socket State. */
233
     protected SocketState currentSocketState = SocketState.NULL;
234
     protected SocketState currentSocketState = SocketState.NULL;
234
 
235
 
236
+    /** Map to store arbitrary data. */
237
+    private Map<Object, Object> myMap = new HashMap<Object, Object>();
238
+
235
     /** This is the socket used for reading from/writing to the IRC server. */
239
     /** This is the socket used for reading from/writing to the IRC server. */
236
     private Socket socket;
240
     private Socket socket;
237
     /** Used for writing to the server. */
241
     /** Used for writing to the server. */
334
     @Override
338
     @Override
335
     public URI getURI() { return server.getURI(); }
339
     public URI getURI() { return server.getURI(); }
336
 
340
 
341
+    /** {@inheritDoc} */
342
+    @Override
343
+    public Map<Object, Object> getMap() { return myMap; }
344
+
337
     /**
345
     /**
338
      * Get the current Value of createFake.
346
      * Get the current Value of createFake.
339
      *
347
      *

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