Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 8af0db3e6ccb7727483c099b690c8634ede01681 Author: Wim <wim@42.be> Date: Wed Sep 20 22:47:26 2017 +0000 Add support for Quakenet auth (irc). Closes #263 diff --git a/bridge/config/config.go b/bridge/config/config.go index 229cbef..2b678d2 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -586 +587 @@ type Protocol struct {   Nick string // all protocols   NickFormatter string // mattermost, slack   NickServNick string // IRC + NickServUsername string // IRC   NickServPassword string // IRC   NicksPerRow int // mattermost, slack   NoHomeServerSuffix bool // matrix diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index 1e0101f..3276eab 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -886 +887 @@ func (b *Birc) Connect() error {   i.Password = b.Config.Password   }   i.AddCallback(ircm.RPL_WELCOME, b.handleNewConnection) + i.AddCallback(ircm.RPL_ENDOFMOTD, b.handleOtherAuth)   err := i.Connect(b.Config.Server)   if err != nil {   return err @@ -2576 +25813 @@ func (b *Birc) handleOther(event *irc.Event) {   flog.Debugf("%#v", event.Raw)  }   +func (b *Birc) handleOtherAuth(event *irc.Event) { + if strings.EqualFold(b.Config.NickServNick, "Q@CServe.quakenet.org") { + flog.Debugf("Authenticating %s against %s", b.Config.NickServUsername, b.Config.NickServNick) + b.i.Privmsg(b.Config.NickServNick, "AUTH "+b.Config.NickServUsername+" "+b.Config.NickServPassword) + } +} +  func (b *Birc) handlePrivMsg(event *irc.Event) {   b.Nick = b.i.GetNick()   // freenode doesn't send 001 as first reply diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index 0e612d2..81bf1cc 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -5510 +5515 @@ Nick="matterbot"    #If you registered your bot with a service like Nickserv on freenode.  #Also being used when UseSASL=true +# +#Note: if you want do to quakenet auth, set NickServNick="Q@CServe.quakenet.org"  #OPTIONAL  NickServNick="nickserv"  NickServPassword="secret"   +#OPTIONAL only used for quakenet auth +NickServUsername="username" +  #Flood control  #Delay in milliseconds between each message send to the IRC server  #OPTIONAL (default 1300)