Browse Source

fix #1417

Allow `JOIN 0` with a confirmation code
tags/v2.5.0-rc1
Shivaram Lingamneni 3 years ago
parent
commit
01291ceadd
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      irc/handlers.go

+ 9
- 2
irc/handlers.go View File

@@ -1161,9 +1161,16 @@ func isonHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
1161 1161
 
1162 1162
 // JOIN <channel>{,<channel>} [<key>{,<key>}]
1163 1163
 func joinHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
1164
-	// kill JOIN 0 requests
1164
+	// #1417: allow `JOIN 0` with a confirmation code
1165 1165
 	if msg.Params[0] == "0" {
1166
-		rb.Notice(client.t("JOIN 0 is not allowed"))
1166
+		expectedCode := utils.ConfirmationCode("", rb.session.ctime)
1167
+		if len(msg.Params) == 1 || msg.Params[1] != expectedCode {
1168
+			rb.Notice(fmt.Sprintf(client.t("Warning: /JOIN 0 will remove you from all channels. To confirm, type: /JOIN 0 %s"), expectedCode))
1169
+		} else {
1170
+			for _, channel := range client.Channels() {
1171
+				channel.Part(client, "", rb)
1172
+			}
1173
+		}
1167 1174
 		return false
1168 1175
 	}
1169 1176
 

Loading…
Cancel
Save