4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 16:39:24 +00:00

Add option to send RAW commands after connection (irc). Fixes #490 (#604)

This commit is contained in:
Wim
2018-11-25 19:32:16 +01:00
committed by GitHub
parent 8869e253ca
commit 9f66f93641
3 changed files with 16 additions and 0 deletions

View File

@ -365,6 +365,7 @@ func (b *Birc) handleOther(client *girc.Client, event girc.Event) {
func (b *Birc) handleOtherAuth(client *girc.Client, event girc.Event) {
b.handleNickServ()
b.handleRunCommands()
// we are now fully connected
b.connected <- nil
}
@ -471,6 +472,15 @@ func (b *Birc) formatnicks(nicks []string) string {
return strings.Join(nicks, ", ") + " currently on IRC"
}
func (b *Birc) handleRunCommands() {
for _, cmd := range b.GetStringSlice("RunCommands") {
if err := b.i.Cmd.SendRaw(cmd); err != nil {
b.Log.Errorf("RunCommands %s failed: %s", cmd, err)
}
time.Sleep(time.Second)
}
}
func (b *Birc) handleNickServ() {
if !b.GetBool("UseSASL") && b.GetString("NickServNick") != "" && b.GetString("NickServPassword") != "" {
b.Log.Debugf("Sending identify to nickserv %s", b.GetString("NickServNick"))