diff --git a/examples/irccat.json b/examples/irccat.json index 758a651..1df1dd0 100644 --- a/examples/irccat.json +++ b/examples/irccat.json @@ -26,6 +26,8 @@ "nick": "irccat", "realname": "IRCCat", "identify_pass": "", + "sasl_login": "", + "sasl_pass": "", "channels": ["#channel"], "keys": {"#channel": "join_key"} }, diff --git a/main.go b/main.go index dbcfaeb..24946b2 100644 --- a/main.go +++ b/main.go @@ -86,8 +86,18 @@ func (i *IRCCat) signalHandler() { func (i *IRCCat) connectIRC() error { irccon := irc.IRC(viper.GetString("irc.nick"), viper.GetString("irc.realname")) i.irc = irccon - irccon.RequestCaps = []string{"away-notify", "account-notify", "draft/message-tags-0.2"} + // requesting any caps breaks SASL + // irccon.RequestCaps = []string{"away-notify", "account-notify", "draft/message-tags-0.2"} irccon.UseTLS = viper.GetBool("irc.tls") + if viper.IsSet("irc.sasl_pass") && viper.GetString("irc.sasl_pass") != "" { + if viper.IsSet("irc.sasl_login") && viper.GetString("irc.sasl_login") != "" { + irccon.SASLLogin = viper.GetString("irc.sasl_login") + } else { + irccon.SASLLogin = viper.GetString("irc.nick") + } + irccon.SASLPassword = viper.GetString("irc.sasl_pass") + irccon.UseSASL = true + } if viper.GetBool("irc.tls_skip_verify") { irccon.TLSConfig = &tls.Config{InsecureSkipVerify: true} }