Skip to content
This repository was archived by the owner on Nov 26, 2018. It is now read-only.

Commit 461b034

Browse files
committed
AUTHENTICATE + comes from the server, not client
1 parent dc22511 commit 461b034

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

network/irc/irc.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,13 @@ func (bot *ircBot) sendPassword() {
546546

547547
func (bot *ircBot) sendSaslStart() {
548548
bot.SendRaw("AUTHENTICATE PLAIN")
549+
550+
}
551+
552+
func (bot *ircBot) sendSaslPass() {
549553
out := bytes.Join([][]byte{[]byte(bot.nick), []byte(bot.nick), []byte(bot.password)}, []byte{0})
550554
encpass := base64.StdEncoding.EncodeToString(out)
551555
bot.SendRaw("AUTHENTICATE " + encpass)
552-
bot.SendRaw("AUTHENTICATE +")
553556
}
554557

555558
func (bot *ircBot) sendSaslEnd() {
@@ -617,6 +620,12 @@ func (bot *ircBot) act(theLine *line.Line) {
617620
return
618621
}
619622

623+
isAskingForSaslPass := theLine.User == "" && theLine.Raw == "AUTHENTICATE +"
624+
if isAskingForSaslPass {
625+
bot.sendSaslPass()
626+
return
627+
}
628+
620629
isSaslConfirm := theLine.User == "" && theLine.Content == "SASL authentication successful"
621630
// After SASL is accepted, join all the channels
622631
if isSaslConfirm {

0 commit comments

Comments
 (0)