Relay self-WHO/WHOIS in single-upstream mode

In multi-upstream mode, we can't relay WHO/WHOIS messages for the
current user, because we can't decide which upstream server the
message should be relayed to.

In single-upstream server, we do know which upstream server to use,
so we can just blindly relay the message.

This allows users to send a self-WHO/WHOIS to check their cloak and
other information.
This commit is contained in:
Simon Ser 2021-05-20 11:13:14 +02:00
parent c8a54235d0
commit ec26117c08
1 changed files with 3 additions and 2 deletions

View File

@ -1382,6 +1382,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
}) })
}) })
} else { } else {
// TODO: only do this in multi-upstream mode
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: irc.RPL_UMODEIS, Command: irc.RPL_UMODEIS,
@ -1557,7 +1558,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
entity := msg.Params[0] entity := msg.Params[0]
entityCM := casemapASCII(entity) entityCM := casemapASCII(entity)
if entityCM == dc.nickCM { if dc.network == nil && entityCM == dc.nickCM {
// TODO: support AWAY (H/G) in self WHO reply // TODO: support AWAY (H/G) in self WHO reply
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
@ -1622,7 +1623,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
mask = mask[:i] mask = mask[:i]
} }
if casemapASCII(mask) == dc.nickCM { if dc.network == nil && casemapASCII(mask) == dc.nickCM {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: irc.RPL_WHOISUSER, Command: irc.RPL_WHOISUSER,