Request invite-notify to upstreams
... and do not forward INVITEs to downstreams that do not support the capability. The downstream capability can be permanent because there is no way for a client to get the list of people invited to a channel, thus no state can be corrupted.
This commit is contained in:
parent
62f1207437
commit
5aa15d5628
@ -64,12 +64,13 @@ const illegalNickChars = " :@!*?"
|
|||||||
// permanentDownstreamCaps is the list of always-supported downstream
|
// permanentDownstreamCaps is the list of always-supported downstream
|
||||||
// capabilities.
|
// capabilities.
|
||||||
var permanentDownstreamCaps = map[string]string{
|
var permanentDownstreamCaps = map[string]string{
|
||||||
"batch": "",
|
"batch": "",
|
||||||
"cap-notify": "",
|
"cap-notify": "",
|
||||||
"echo-message": "",
|
"echo-message": "",
|
||||||
"message-tags": "",
|
"invite-notify": "",
|
||||||
"sasl": "PLAIN",
|
"message-tags": "",
|
||||||
"server-time": "",
|
"sasl": "PLAIN",
|
||||||
|
"server-time": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
// needAllDownstreamCaps is the list of downstream capabilities that
|
// needAllDownstreamCaps is the list of downstream capabilities that
|
||||||
|
@ -27,6 +27,7 @@ var permanentUpstreamCaps = map[string]bool{
|
|||||||
"away-notify": true,
|
"away-notify": true,
|
||||||
"batch": true,
|
"batch": true,
|
||||||
"extended-join": true,
|
"extended-join": true,
|
||||||
|
"invite-notify": true,
|
||||||
"labeled-response": true,
|
"labeled-response": true,
|
||||||
"message-tags": true,
|
"message-tags": true,
|
||||||
"multi-prefix": true,
|
"multi-prefix": true,
|
||||||
@ -1279,7 +1280,12 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
weAreInvited := nick == uc.nick
|
||||||
|
|
||||||
uc.forEachDownstream(func(dc *downstreamConn) {
|
uc.forEachDownstream(func(dc *downstreamConn) {
|
||||||
|
if !weAreInvited && !dc.caps["invite-notify"] {
|
||||||
|
return
|
||||||
|
}
|
||||||
dc.SendMessage(&irc.Message{
|
dc.SendMessage(&irc.Message{
|
||||||
Prefix: dc.marshalUserPrefix(uc.network, msg.Prefix),
|
Prefix: dc.marshalUserPrefix(uc.network, msg.Prefix),
|
||||||
Command: "INVITE",
|
Command: "INVITE",
|
||||||
|
Loading…
Reference in New Issue
Block a user