Skip to content

Commit

Permalink
add SASL login support
Browse files Browse the repository at this point in the history
  • Loading branch information
Habbie committed Feb 18, 2019
1 parent a415d78 commit aed2b91
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/irccat.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"nick": "irccat",
"realname": "IRCCat",
"identify_pass": "",
"sasl_login": "",
"sasl_pass": "",
"channels": ["#channel"],
"keys": {"#channel": "join_key"}
},
Expand Down
12 changes: 11 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
Expand Down

0 comments on commit aed2b91

Please sign in to comment.