~emersion/public-inbox

Do not panic if BouncerServ command without handler is sent v1 APPLIED

fox.cpp: 1
 Do not panic if BouncerServ command without handler is sent

 1 files changed, 14 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/10952/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] Do not panic if BouncerServ command without handler is sent Export this patch

---
 service.go | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/service.go b/service.go
index 1aab5e5..c7faa8c 100644
--- a/service.go
+++ b/service.go
@@ -71,6 +71,20 @@ func handleServicePRIVMSG(dc *downstreamConn, text string) {
		return
	}

	if cmd.handle == nil {
		if len(cmd.children) > 0 {
			var l []string
			appendServiceCommandSetHelp(cmd.children, words, &l)
			sendServicePRIVMSG(dc, "available commands: "+strings.Join(l, ", "))
		} else {
			// Pretend the command does not exist if it has neither children nor handler.
			// This is obviously a bug but it is better to not die anyway.
			dc.logger.Printf("command without handler and subcommands invoked:", words[0])
			sendServicePRIVMSG(dc, fmt.Sprintf("command %q not found", words[0]))
		}
		return
	}

	if err := cmd.handle(dc, params); err != nil {
		sendServicePRIVMSG(dc, fmt.Sprintf("error: %v", err))
	}
-- 
2.27.0
Woops, I forgot to include this in Subject. It is a patch for soju.
Pushed, thanks!