Add support for account-notify

This commit is contained in:
Simon Ser 2021-10-17 21:49:37 +02:00
parent 2f495e9768
commit 455fef2421
2 changed files with 20 additions and 4 deletions

View File

@ -131,6 +131,7 @@ var permanentDownstreamCaps = map[string]string{
// needAllDownstreamCaps is the list of downstream capabilities that
// require support from all upstreams to be enabled
var needAllDownstreamCaps = map[string]string{
"account-notify": "",
"account-tag": "",
"away-notify": "",
"extended-join": "",
@ -409,6 +410,9 @@ func (dc *downstreamConn) SendMessage(msg *irc.Message) {
if msg.Command == "SETNAME" && !dc.caps["setname"] {
return
}
if msg.Command == "ACCOUNT" && !dc.caps["account-notify"] {
return
}
dc.conn.SendMessage(msg)
}

View File

@ -1386,6 +1386,18 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
Params: msg.Params,
})
})
case "ACCOUNT":
if msg.Prefix == nil {
return fmt.Errorf("expected a prefix")
}
uc.forEachDownstream(func(dc *downstreamConn) {
dc.SendMessage(&irc.Message{
Prefix: dc.marshalUserPrefix(uc.network, msg.Prefix),
Command: msg.Command,
Params: msg.Params,
})
})
case irc.RPL_BANLIST, irc.RPL_INVITELIST, irc.RPL_EXCEPTLIST:
var channel, mask string
if err := parseMessageParams(msg, nil, &channel, &mask); err != nil {