|
@@ -102,6 +102,13 @@ func (s *Set) Strings(version Version, values Values, maxLen int) (result []stri
|
102
|
102
|
var capab Capability
|
103
|
103
|
asSlice := s[:]
|
104
|
104
|
for capab = 0; capab < numCapabs; capab++ {
|
|
105
|
+ // XXX clients that only support CAP LS 301 cannot handle multiline
|
|
106
|
+ // responses. omit some CAPs in this case, forcing the response to fit on
|
|
107
|
+ // a single line. this is technically buggy for CAP LIST (as opposed to LS)
|
|
108
|
+ // but it shouldn't matter
|
|
109
|
+ if version < Cap302 && !isAllowed301(capab) {
|
|
110
|
+ continue
|
|
111
|
+ }
|
105
|
112
|
// skip any capabilities that are not enabled
|
106
|
113
|
if !utils.BitsetGet(asSlice, uint(capab)) {
|
107
|
114
|
continue
|
|
@@ -122,3 +129,15 @@ func (s *Set) Strings(version Version, values Values, maxLen int) (result []stri
|
122
|
129
|
}
|
123
|
130
|
return
|
124
|
131
|
}
|
|
132
|
+
|
|
133
|
+// this is a fixed whitelist of caps that are eligible for display in CAP LS 301
|
|
134
|
+func isAllowed301(capab Capability) bool {
|
|
135
|
+ switch capab {
|
|
136
|
+ case AccountNotify, AccountTag, AwayNotify, Batch, ChgHost, Chathistory, EventPlayback,
|
|
137
|
+ Relaymsg, EchoMessage, Nope, ExtendedJoin, InviteNotify, LabeledResponse, MessageTags,
|
|
138
|
+ MultiPrefix, SASL, ServerTime, SetName, STS, UserhostInNames, ZNCSelfMessage, ZNCPlayback:
|
|
139
|
+ return true
|
|
140
|
+ default:
|
|
141
|
+ return false
|
|
142
|
+ }
|
|
143
|
+}
|