From f691b8c0581509f088ac5f99635b1af3dc00843e Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sun, 11 Feb 2024 12:38:49 -0500 Subject: [PATCH] pull out max parameters constant in isupport impl --- irc/isupport/list.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/irc/isupport/list.go b/irc/isupport/list.go index baafa146a..36b30d376 100644 --- a/irc/isupport/list.go +++ b/irc/isupport/list.go @@ -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." + [up to 13 parameters] + */ + 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