diff options
-rw-r--r-- | connector/irc/config.go | 14 | ||||
-rw-r--r-- | connector/irc/irc.go | 22 |
2 files changed, 32 insertions, 4 deletions
diff --git a/connector/irc/config.go b/connector/irc/config.go index 0b36473..b95ea25 100644 --- a/connector/irc/config.go +++ b/connector/irc/config.go @@ -32,6 +32,20 @@ func init() { IsBoolean: true, Default: "false", }, + &ConfigEntry{ + Name: "server_pass", + Description: "Server password (authenticate with PASS command)", + IsPassword: true, + }, + &ConfigEntry{ + Name: "sasl_user", + Description: "Username for SASL authentication", + }, + &ConfigEntry{ + Name: "sasl_pass", + Description: "Password for SASL authentication", + IsPassword: true, + }, }, }) } diff --git a/connector/irc/irc.go b/connector/irc/irc.go index bee2bca..19e73fc 100644 --- a/connector/irc/irc.go +++ b/connector/irc/irc.go @@ -62,11 +62,25 @@ func (irc *IRC) Configure(c Configuration) error { return err } + server_pass, _ := c.GetString("server_pass", "") + sasl_user, _ := c.GetString("sasl_user", "") + sasl_pass, _ := c.GetString("sasl_pass", "") + + var sasl girc.SASLMech + if sasl_user != "" && sasl_pass != "" { + sasl = &girc.SASLPlain{ + User: sasl_user, + Pass: sasl_pass, + } + } + client := girc.New(girc.Config{ - Server: irc.server, - Port: port, - Nick: irc.nick, - User: irc.nick, + Server: irc.server, + ServerPass: server_pass, + Port: port, + Nick: irc.nick, + User: irc.nick, + SASL: sasl, //Out: os.Stderr, SSL: ssl, }) |