Browse Source

Parse the 005 NETWORK token

tags/v0.4.0
Chris Smith 5 years ago
parent
commit
d2e9476667

+ 1
- 0
CHANGELOG View File

@@ -3,6 +3,7 @@ vNEXT (in development)
3 3
  * Added CtcpReceived and ActionReceived events
4 4
  * Added sendCtcp and sendAction message builders
5 5
  * Fix issue with messages being sent out of order, which sometimes caused problems connecting to passworded servers
6
+ * Added 'network' server feature
6 7
 
7 8
 v0.3.1
8 9
 

+ 2
- 0
src/main/kotlin/com/dmdirc/ktirc/model/ServerState.kt View File

@@ -68,6 +68,8 @@ data class ModePrefixMapping(val modes: String, val prefixes: String) {
68 68
  * Describes a server feature determined from the 005 response.
69 69
  */
70 70
 sealed class ServerFeature<T : Any>(val name: String, val type: KClass<T>, val default: T? = null) {
71
+    /** The network the server says it belongs to. */
72
+    object Network : ServerFeature<String>("NETWORK", String::class)
71 73
     /** The case mapping the server uses, defaulting to RFC. */
72 74
     object ServerCaseMapping : ServerFeature<CaseMapping>("CASEMAPPING", CaseMapping::class, CaseMapping.Rfc)
73 75
     /** The mode prefixes the server uses, defaulting to ov/@+. */

+ 8
- 0
src/test/kotlin/com/dmdirc/ktirc/messages/ISupportProcessorTest.kt View File

@@ -61,6 +61,14 @@ internal class ISupportProcessorTest {
61 61
         assertEquals(ModePrefixMapping("ovd", "@+%"), events[0].serverFeatures[ServerFeature.ModePrefixes])
62 62
     }
63 63
 
64
+    @Test
65
+    fun `ISupportProcessor handles network arguments`() {
66
+        val events = processor.process(IrcMessage(emptyMap(), "server.com".toByteArray(), "005",
67
+                listOf("nickname", "NETWORK=gibson", "are supported blah blah").map { it.toByteArray() }))
68
+
69
+        assertEquals("gibson", events[0].serverFeatures[ServerFeature.Network])
70
+    }
71
+
64 72
     @Test
65 73
     fun `ISupportProcessor handles boolean features with no arguments`() {
66 74
         val events = processor.process(IrcMessage(emptyMap(), "server.com".toByteArray(), "005",

Loading…
Cancel
Save