Unify away-notify and account-notify handling
This commit is contained in:
parent
455fef2421
commit
324d0fb0ac
@ -410,6 +410,10 @@ func (dc *downstreamConn) SendMessage(msg *irc.Message) {
|
||||
if msg.Command == "SETNAME" && !dc.caps["setname"] {
|
||||
return
|
||||
}
|
||||
if msg.Command == "AWAY" && !dc.caps["away-notify"] {
|
||||
// TODO: we can send AWAY if we just sent a PRIVMSG/NOTICE to this user
|
||||
return
|
||||
}
|
||||
if msg.Command == "ACCOUNT" && !dc.caps["account-notify"] {
|
||||
return
|
||||
}
|
||||
|
17
upstream.go
17
upstream.go
@ -1371,22 +1371,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
||||
Params: []string{dc.nick, dc.marshalEntity(uc.network, nick), reason},
|
||||
})
|
||||
})
|
||||
case "AWAY":
|
||||
if msg.Prefix == nil {
|
||||
return fmt.Errorf("expected a prefix")
|
||||
}
|
||||
|
||||
uc.forEachDownstream(func(dc *downstreamConn) {
|
||||
if !dc.caps["away-notify"] {
|
||||
return
|
||||
}
|
||||
dc.SendMessage(&irc.Message{
|
||||
Prefix: dc.marshalUserPrefix(uc.network, msg.Prefix),
|
||||
Command: "AWAY",
|
||||
Params: msg.Params,
|
||||
})
|
||||
})
|
||||
case "ACCOUNT":
|
||||
case "AWAY", "ACCOUNT":
|
||||
if msg.Prefix == nil {
|
||||
return fmt.Errorf("expected a prefix")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user