Bläddra i källkod

Parse the 005 NETWORK token

tags/v0.4.0
Chris Smith 5 år sedan
förälder
incheckning
d2e9476667

+ 1
- 0
CHANGELOG Visa fil

3
  * Added CtcpReceived and ActionReceived events
3
  * Added CtcpReceived and ActionReceived events
4
  * Added sendCtcp and sendAction message builders
4
  * Added sendCtcp and sendAction message builders
5
  * Fix issue with messages being sent out of order, which sometimes caused problems connecting to passworded servers
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
 v0.3.1
8
 v0.3.1
8
 
9
 

+ 2
- 0
src/main/kotlin/com/dmdirc/ktirc/model/ServerState.kt Visa fil

68
  * Describes a server feature determined from the 005 response.
68
  * Describes a server feature determined from the 005 response.
69
  */
69
  */
70
 sealed class ServerFeature<T : Any>(val name: String, val type: KClass<T>, val default: T? = null) {
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
     /** The case mapping the server uses, defaulting to RFC. */
73
     /** The case mapping the server uses, defaulting to RFC. */
72
     object ServerCaseMapping : ServerFeature<CaseMapping>("CASEMAPPING", CaseMapping::class, CaseMapping.Rfc)
74
     object ServerCaseMapping : ServerFeature<CaseMapping>("CASEMAPPING", CaseMapping::class, CaseMapping.Rfc)
73
     /** The mode prefixes the server uses, defaulting to ov/@+. */
75
     /** The mode prefixes the server uses, defaulting to ov/@+. */

+ 8
- 0
src/test/kotlin/com/dmdirc/ktirc/messages/ISupportProcessorTest.kt Visa fil

61
         assertEquals(ModePrefixMapping("ovd", "@+%"), events[0].serverFeatures[ServerFeature.ModePrefixes])
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
     @Test
72
     @Test
65
     fun `ISupportProcessor handles boolean features with no arguments`() {
73
     fun `ISupportProcessor handles boolean features with no arguments`() {
66
         val events = processor.process(IrcMessage(emptyMap(), "server.com".toByteArray(), "005",
74
         val events = processor.process(IrcMessage(emptyMap(), "server.com".toByteArray(), "005",

Laddar…
Avbryt
Spara