Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pull out max parameters constant in isupport impl #2127

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions irc/isupport/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading