From 01291ceadd86b4656d68d9b96cf2f2d0f1231954 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 1 Dec 2020 14:23:47 -0500 Subject: [PATCH] fix #1417 Allow `JOIN 0` with a confirmation code --- irc/handlers.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/irc/handlers.go b/irc/handlers.go index 8906e1e2..d31b44b3 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -1161,9 +1161,16 @@ func isonHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp // JOIN {,} [{,}] func joinHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool { - // kill JOIN 0 requests + // #1417: allow `JOIN 0` with a confirmation code if msg.Params[0] == "0" { - rb.Notice(client.t("JOIN 0 is not allowed")) + expectedCode := utils.ConfirmationCode("", rb.session.ctime) + if len(msg.Params) == 1 || msg.Params[1] != expectedCode { + rb.Notice(fmt.Sprintf(client.t("Warning: /JOIN 0 will remove you from all channels. To confirm, type: /JOIN 0 %s"), expectedCode)) + } else { + for _, channel := range client.Channels() { + channel.Part(client, "", rb) + } + } return false }