瀏覽代碼

Handle if SASL fails/not available.

(Like when services is down!)
Steve Thielemann 3 年之前
父節點
當前提交
36c6157d68
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      irc-client.go

+ 6 - 0
irc-client.go

@@ -416,6 +416,12 @@ func (Config *IRCConfig) ReaderRoutine() {
 				Config.PriorityWrite("AUTHENTICATE PLAIN")
 			}
 
+			if msg.Cmd == "CAP" && msg.Msg == "NAK" {
+				// SASL Authentication failed!
+				Config.PriorityWrite("CAP END")
+				Config.UseSASL = false
+			}
+
 			if (msg.MsgParts[0] == "AUTHENTICATE") && (msg.MsgParts[1] == "+") {
 				var userpass string = fmt.Sprintf("\x00%s\x00%s", Config.Nick, Config.Password)
 				var b64 string = base64.StdEncoding.EncodeToString([]byte(userpass))