From 455fef2421912f87efb63376622d79c1ca39120a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 17 Oct 2021 21:49:37 +0200 Subject: [PATCH] Add support for account-notify --- downstream.go | 12 ++++++++---- upstream.go | 12 ++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/downstream.go b/downstream.go index 53ed31d..50e46f1 100644 --- a/downstream.go +++ b/downstream.go @@ -131,10 +131,11 @@ 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-tag": "", - "away-notify": "", - "extended-join": "", - "multi-prefix": "", + "account-notify": "", + "account-tag": "", + "away-notify": "", + "extended-join": "", + "multi-prefix": "", } // passthroughIsupport is the set of ISUPPORT tokens that are directly passed @@ -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) } diff --git a/upstream.go b/upstream.go index 104f330..4e835a8 100644 --- a/upstream.go +++ b/upstream.go @@ -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 {