Browse Source

Merge pull request #2127 from slingamn/isupport_thirteen

pull out max parameters constant in isupport impl
pull/2131/head
Shivaram Lingamneni 2 months ago
parent
commit
52d15a483c
No account linked to committer's email address
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      irc/isupport/list.go

+ 8
- 2
irc/isupport/list.go View File

11
 
11
 
12
 const (
12
 const (
13
 	maxLastArgLength = 400
13
 	maxLastArgLength = 400
14
+
15
+	/* Modern: "As the maximum number of message parameters to any reply is 15,
16
+	the maximum number of RPL_ISUPPORT tokens that can be advertised is 13."
17
+	<nickname> [up to 13 parameters] <human-readable trailing>
18
+	*/
19
+	maxParameters = 13
14
 )
20
 )
15
 
21
 
16
 // List holds a list of ISUPPORT tokens
22
 // List holds a list of ISUPPORT tokens
95
 			length += len(token)
101
 			length += len(token)
96
 		}
102
 		}
97
 
103
 
98
-		if len(cache) == 13 || len(token)+length >= maxLastArgLength {
104
+		if len(cache) == maxParameters || len(token)+length >= maxLastArgLength {
99
 			replies = append(replies, cache)
105
 			replies = append(replies, cache)
100
 			cache = make([]string, 0)
106
 			cache = make([]string, 0)
101
 			length = 0
107
 			length = 0
138
 			length += len(token)
144
 			length += len(token)
139
 		}
145
 		}
140
 
146
 
141
-		if len(cache) == 13 || len(token)+length >= maxLastArgLength {
147
+		if len(cache) == maxParameters || len(token)+length >= maxLastArgLength {
142
 			il.CachedReply = append(il.CachedReply, cache)
148
 			il.CachedReply = append(il.CachedReply, cache)
143
 			cache = make([]string, 0)
149
 			cache = make([]string, 0)
144
 			length = 0
150
 			length = 0

Loading…
Cancel
Save