5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-26 04:21:38 +00:00

Add support for Quakenet auth (irc). Closes #263

This commit is contained in:
Wim 2017-09-20 22:47:26 +02:00
parent 4bda29cb38
commit b49fb2b69c
3 changed files with 14 additions and 0 deletions

View File

@ -58,6 +58,7 @@ type Protocol struct {
Nick string // all protocols Nick string // all protocols
NickFormatter string // mattermost, slack NickFormatter string // mattermost, slack
NickServNick string // IRC NickServNick string // IRC
NickServUsername string // IRC
NickServPassword string // IRC NickServPassword string // IRC
NicksPerRow int // mattermost, slack NicksPerRow int // mattermost, slack
NoHomeServerSuffix bool // matrix NoHomeServerSuffix bool // matrix

View File

@ -88,6 +88,7 @@ func (b *Birc) Connect() error {
i.Password = b.Config.Password i.Password = b.Config.Password
} }
i.AddCallback(ircm.RPL_WELCOME, b.handleNewConnection) i.AddCallback(ircm.RPL_WELCOME, b.handleNewConnection)
i.AddCallback(ircm.RPL_ENDOFMOTD, b.handleOtherAuth)
err := i.Connect(b.Config.Server) err := i.Connect(b.Config.Server)
if err != nil { if err != nil {
return err return err
@ -257,6 +258,13 @@ func (b *Birc) handleOther(event *irc.Event) {
flog.Debugf("%#v", event.Raw) 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) { func (b *Birc) handlePrivMsg(event *irc.Event) {
b.Nick = b.i.GetNick() b.Nick = b.i.GetNick()
// freenode doesn't send 001 as first reply // freenode doesn't send 001 as first reply

View File

@ -55,10 +55,15 @@ Nick="matterbot"
#If you registered your bot with a service like Nickserv on freenode. #If you registered your bot with a service like Nickserv on freenode.
#Also being used when UseSASL=true #Also being used when UseSASL=true
#
#Note: if you want do to quakenet auth, set NickServNick="Q@CServe.quakenet.org"
#OPTIONAL #OPTIONAL
NickServNick="nickserv" NickServNick="nickserv"
NickServPassword="secret" NickServPassword="secret"
#OPTIONAL only used for quakenet auth
NickServUsername="username"
#Flood control #Flood control
#Delay in milliseconds between each message send to the IRC server #Delay in milliseconds between each message send to the IRC server
#OPTIONAL (default 1300) #OPTIONAL (default 1300)