3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-15 00:19:29 +01:00

Merge pull request #2127 from slingamn/isupport_thirteen

pull out max parameters constant in isupport impl
This commit is contained in:
Shivaram Lingamneni 2024-02-12 23:40:54 -05:00 committed by GitHub
commit 52d15a483c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,6 +11,12 @@ import (
const (
maxLastArgLength = 400
/* Modern: "As the maximum number of message parameters to any reply is 15,
the maximum number of RPL_ISUPPORT tokens that can be advertised is 13."
<nickname> [up to 13 parameters] <human-readable trailing>
*/
maxParameters = 13
)
// List holds a list of ISUPPORT tokens
@ -95,7 +101,7 @@ func (il *List) GetDifference(newil *List) [][]string {
length += len(token)
}
if len(cache) == 13 || len(token)+length >= maxLastArgLength {
if len(cache) == maxParameters || len(token)+length >= maxLastArgLength {
replies = append(replies, cache)
cache = make([]string, 0)
length = 0
@ -138,7 +144,7 @@ func (il *List) RegenerateCachedReply() (err error) {
length += len(token)
}
if len(cache) == 13 || len(token)+length >= maxLastArgLength {
if len(cache) == maxParameters || len(token)+length >= maxLastArgLength {
il.CachedReply = append(il.CachedReply, cache)
cache = make([]string, 0)
length = 0