From 90250f5be5f55e417877fd5aaaab81ee2efd1ca4 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 29 Jun 2020 18:09:48 +0200 Subject: [PATCH] Reply to WHO BouncerServ Closes: https://todo.sr.ht/~emersion/soju/75 --- downstream.go | 13 +++++++++++++ service.go | 1 + upstream.go | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/downstream.go b/downstream.go index 9bd3c5d..007e96c 100644 --- a/downstream.go +++ b/downstream.go @@ -1336,6 +1336,19 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error { }) return nil } + if entity == serviceNick { + dc.SendMessage(&irc.Message{ + Prefix: dc.srv.prefix(), + Command: irc.RPL_WHOREPLY, + Params: []string{serviceNick, "*", servicePrefix.User, servicePrefix.Host, dc.srv.Hostname, serviceNick, "H", "0 " + serviceRealname}, + }) + dc.SendMessage(&irc.Message{ + Prefix: dc.srv.prefix(), + Command: irc.RPL_ENDOFWHO, + Params: []string{dc.nick, serviceNick, "End of /WHO list"}, + }) + return nil + } uc, upstreamName, err := dc.unmarshalEntity(entity) if err != nil { diff --git a/service.go b/service.go index 78c67c4..ede46e6 100644 --- a/service.go +++ b/service.go @@ -27,6 +27,7 @@ import ( ) const serviceNick = "BouncerServ" +const serviceRealname = "soju bouncer service" var servicePrefix = &irc.Prefix{ Name: serviceNick, diff --git a/upstream.go b/upstream.go index 4d93221..22b63fe 100644 --- a/upstream.go +++ b/upstream.go @@ -1337,7 +1337,7 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error { // Ignore case irc.ERR_PASSWDMISMATCH, irc.ERR_ERRONEUSNICKNAME, irc.ERR_NICKNAMEINUSE, irc.ERR_NICKCOLLISION, irc.ERR_UNAVAILRESOURCE: if !uc.registered { - return fmt.Errorf("registration failed: %v", msg.Params[len(msg.Params) - 1]) + return fmt.Errorf("registration failed: %v", msg.Params[len(msg.Params)-1]) } fallthrough default: