summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert Mertens <bertmertens@gmail.com>2016-01-27 20:09:06 +0100
committerBert Mertens <bertmertens@gmail.com>2016-01-27 20:09:06 +0100
commitfd74dca175d0abf2dec28f7c996b6789fec9c6b7 (patch)
tree86c2b3753101f21f5777f408829037acbd5bb365
parentc7ace91bf68fc84d7d9d03f0d5a89666d00dd6eb (diff)
downloadmatterbridge-msglm-fd74dca175d0abf2dec28f7c996b6789fec9c6b7.tar.gz
matterbridge-msglm-fd74dca175d0abf2dec28f7c996b6789fec9c6b7.tar.bz2
matterbridge-msglm-fd74dca175d0abf2dec28f7c996b6789fec9c6b7.zip
Add PASS support as per RFC1459
Provide a connection password via the protocol's PASS command. Imported irc.go supports it as a simple parameter: https://github.com/thoj/go-ircevent/blob/master/irc.go#L381 See https://tools.ietf.org/html/rfc1459#section-4.1 for full details.
-rw-r--r--config.go1
-rw-r--r--matterbridge.go3
2 files changed, 4 insertions, 0 deletions
diff --git a/config.go b/config.go
index f9873766..32187d2b 100644
--- a/config.go
+++ b/config.go
@@ -13,6 +13,7 @@ type Config struct {
Server string
Port int
Nick string
+ Password string
Channel string
}
Mattermost struct {
diff --git a/matterbridge.go b/matterbridge.go
index 59165dfa..a07ab303 100644
--- a/matterbridge.go
+++ b/matterbridge.go
@@ -41,6 +41,9 @@ func (b *Bridge) createIRC(name string) *irc.Connection {
i := irc.IRC(b.Config.IRC.Nick, b.Config.IRC.Nick)
i.UseTLS = b.Config.IRC.UseTLS
i.TLSConfig = &tls.Config{InsecureSkipVerify: b.Config.IRC.SkipTLSVerify}
+ if b.Config.IRC.Password != "" {
+ i.Password = b.Config.IRC.Password
+ }
i.Connect(b.Config.IRC.Server + ":" + strconv.Itoa(b.Config.IRC.Port))
time.Sleep(time.Second)
log.Println("Joining", b.Config.IRC.Channel, "as", b.Config.IRC.Nick)