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,6 +11,12 @@ import (
11 11
 
12 12
 const (
13 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 22
 // List holds a list of ISUPPORT tokens
@@ -95,7 +101,7 @@ func (il *List) GetDifference(newil *List) [][]string {
95 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 105
 			replies = append(replies, cache)
100 106
 			cache = make([]string, 0)
101 107
 			length = 0
@@ -138,7 +144,7 @@ func (il *List) RegenerateCachedReply() (err error) {
138 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 148
 			il.CachedReply = append(il.CachedReply, cache)
143 149
 			cache = make([]string, 0)
144 150
 			length = 0

Loading…
Cancel
Save