Ver código fonte

correctly account for nickname in CAP LS arithmetic

The arithmetic was assuming that the nickname is * (which it is
pre-registration). However, we were sending the actual nickname
post-registration. It would be simpler to always send *, but it
appears that the nickname is actually required by the spec:

>Replies from the server must [sic] contain the client identifier name or
>asterisk if one is not yet available.
devel+resume2
Shivaram Lingamneni 2 anos atrás
pai
commit
42aafc1f0c
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3
    3
      irc/handlers.go

+ 3
- 3
irc/handlers.go Ver arquivo

@@ -488,9 +488,9 @@ func capHandler(server *Server, client *Client, msg ircmsg.Message, rb *Response
488 488
 		// 1. WeeChat 1.4 won't accept the CAP reply unless it contains the server.name source
489 489
 		// 2. old versions of Kiwi and The Lounge can't parse multiline CAP LS 302 (#661),
490 490
 		// so try as hard as possible to get the response to fit on one line.
491
-		// :server.name CAP * LS * :<tokens>
492
-		// 1           7         4
493
-		maxLen := (MaxLineLen - 2) - 1 - len(server.name) - 7 - len(subCommand) - 4
491
+		// :server.name CAP nickname LS * :<tokens>\r\n
492
+		// 1           [5  ]        1  [4 ]        [2 ]
493
+		maxLen := (MaxLineLen - 2) - 1 - len(server.name) - 5 - len(details.nick) - 1 - len(subCommand) - 4
494 494
 		capLines := cset.Strings(version, values, maxLen)
495 495
 		for i, capStr := range capLines {
496 496
 			if version >= caps.Cap302 && i < len(capLines)-1 {

Carregando…
Cancelar
Salvar