diff --git a/irc/client.go b/irc/client.go index 236f1bc9..1e0b5515 100644 --- a/irc/client.go +++ b/irc/client.go @@ -596,8 +596,10 @@ func (client *Client) LoggedIntoAccount() bool { // RplISupport outputs our ISUPPORT lines to the client. This is used on connection and in VERSION responses. func (client *Client) RplISupport() { + translatedISupport := client.t("are supported by this server") for _, tokenline := range client.server.ISupport().CachedReply { // ugly trickery ahead + tokenline = append(tokenline, translatedISupport) client.Send(nil, client.server.name, RPL_ISUPPORT, append([]string{client.nick}, tokenline...)...) } } diff --git a/irc/isupport/list.go b/irc/isupport/list.go index 82f11f64..402e8265 100644 --- a/irc/isupport/list.go +++ b/irc/isupport/list.go @@ -8,7 +8,6 @@ import "sort" const ( maxLastArgLength = 400 - supportedString = "are supported by this server" ) // List holds a list of ISUPPORT tokens @@ -89,7 +88,6 @@ func (il *List) GetDifference(newil *List) [][]string { } if len(cache) == 13 || len(token)+length >= maxLastArgLength { - cache = append(cache, supportedString) replies = append(replies, cache) cache = make([]string, 0) length = 0 @@ -97,7 +95,6 @@ func (il *List) GetDifference(newil *List) [][]string { } if len(cache) > 0 { - cache = append(cache, supportedString) replies = append(replies, cache) } @@ -130,7 +127,6 @@ func (il *List) RegenerateCachedReply() { } if len(cache) == 13 || len(token)+length >= maxLastArgLength { - cache = append(cache, supportedString) il.CachedReply = append(il.CachedReply, cache) cache = make([]string, 0) length = 0 @@ -138,7 +134,6 @@ func (il *List) RegenerateCachedReply() { } if len(cache) > 0 { - cache = append(cache, supportedString) il.CachedReply = append(il.CachedReply, cache) } } diff --git a/irc/isupport/list_test.go b/irc/isupport/list_test.go index 055b8f5d..4172760a 100644 --- a/irc/isupport/list_test.go +++ b/irc/isupport/list_test.go @@ -29,8 +29,8 @@ func TestISUPPORT(t *testing.T) { tListLong.RegenerateCachedReply() longReplies := [][]string{ - {"1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "are supported by this server"}, - {"E", "F", "are supported by this server"}, + {"1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D"}, + {"E", "F"}, } if !reflect.DeepEqual(tListLong.CachedReply, longReplies) { @@ -46,7 +46,7 @@ func TestISUPPORT(t *testing.T) { tList1.Add("RANDKILL", "whenever") tList1.RegenerateCachedReply() - expected := [][]string{{"CASEMAPPING=rfc1459-strict", "EXTBAN", "INVEX=i", "RANDKILL=whenever", "SASL=yes", "are supported by this server"}} + expected := [][]string{{"CASEMAPPING=rfc1459-strict", "EXTBAN", "INVEX=i", "RANDKILL=whenever", "SASL=yes"}} if !reflect.DeepEqual(tList1.CachedReply, expected) { t.Error("tList1's cached reply does not match expected cached reply") } @@ -60,14 +60,14 @@ func TestISUPPORT(t *testing.T) { tList2.AddNoValue("STABLEKILL") tList2.RegenerateCachedReply() - expected = [][]string{{"CASEMAPPING=ascii", "EXTBAN=TestBah", "INVEX", "SASL=yes", "STABLEKILL", "are supported by this server"}} + expected = [][]string{{"CASEMAPPING=ascii", "EXTBAN=TestBah", "INVEX", "SASL=yes", "STABLEKILL"}} if !reflect.DeepEqual(tList2.CachedReply, expected) { t.Error("tList2's cached reply does not match expected cached reply") } // compare lists actual := tList1.GetDifference(tList2) - expected = [][]string{{"-RANDKILL", "CASEMAPPING=ascii", "EXTBAN=TestBah", "INVEX", "STABLEKILL", "are supported by this server"}} + expected = [][]string{{"-RANDKILL", "CASEMAPPING=ascii", "EXTBAN=TestBah", "INVEX", "STABLEKILL"}} if !reflect.DeepEqual(actual, expected) { t.Error("difference reply does not match expected difference reply") } diff --git a/languages/example-irc.lang.json b/languages/example-irc.lang.json index 112825da..42e271a6 100644 --- a/languages/example-irc.lang.json +++ b/languages/example-irc.lang.json @@ -137,6 +137,7 @@ "You're not a channel operator": "You're not a channel operator", "You're not on that channel": "You're not on that channel", "Your host is %[1]s, running version %[2]s": "Your host is %[1]s, running version %[2]s", + "are supported by this server": "are supported by this server", "can speak these languages": "can speak these languages", "has client certificate fingerprint %s": "has client certificate fingerprint %s", "is a $bBot$b on %s": "is a $bBot$b on %s",