From fd74dca175d0abf2dec28f7c996b6789fec9c6b7 Mon Sep 17 00:00:00 2001 From: Bert Mertens Date: Wed, 27 Jan 2016 20:09:06 +0100 Subject: [PATCH] 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. --- config.go | 1 + matterbridge.go | 3 +++ 2 files changed, 4 insertions(+) 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)