forked from lug/matterbridge
		
	This commit is contained in:
		| @@ -109,6 +109,7 @@ type Protocol struct { | |||||||
| 	ReplaceMessages        [][]string // all protocols | 	ReplaceMessages        [][]string // all protocols | ||||||
| 	ReplaceNicks           [][]string // all protocols | 	ReplaceNicks           [][]string // all protocols | ||||||
| 	RemoteNickFormat       string     // all protocols | 	RemoteNickFormat       string     // all protocols | ||||||
|  | 	RunCommands            []string   // irc | ||||||
| 	Server                 string     // IRC,mattermost,XMPP,discord | 	Server                 string     // IRC,mattermost,XMPP,discord | ||||||
| 	ShowJoinPart           bool       // all protocols | 	ShowJoinPart           bool       // all protocols | ||||||
| 	ShowTopicChange        bool       // slack | 	ShowTopicChange        bool       // slack | ||||||
|   | |||||||
| @@ -365,6 +365,7 @@ func (b *Birc) handleOther(client *girc.Client, event girc.Event) { | |||||||
|  |  | ||||||
| func (b *Birc) handleOtherAuth(client *girc.Client, event girc.Event) { | func (b *Birc) handleOtherAuth(client *girc.Client, event girc.Event) { | ||||||
| 	b.handleNickServ() | 	b.handleNickServ() | ||||||
|  | 	b.handleRunCommands() | ||||||
| 	// we are now fully connected | 	// we are now fully connected | ||||||
| 	b.connected <- nil | 	b.connected <- nil | ||||||
| } | } | ||||||
| @@ -471,6 +472,15 @@ func (b *Birc) formatnicks(nicks []string) string { | |||||||
| 	return strings.Join(nicks, ", ") + " currently on IRC" | 	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() { | func (b *Birc) handleNickServ() { | ||||||
| 	if !b.GetBool("UseSASL") && b.GetString("NickServNick") != "" && b.GetString("NickServPassword") != "" { | 	if !b.GetBool("UseSASL") && b.GetString("NickServNick") != "" && b.GetString("NickServPassword") != "" { | ||||||
| 		b.Log.Debugf("Sending identify to nickserv %s", b.GetString("NickServNick")) | 		b.Log.Debugf("Sending identify to nickserv %s", b.GetString("NickServNick")) | ||||||
|   | |||||||
| @@ -96,6 +96,11 @@ RejoinDelay=0 | |||||||
| #Only works in IRC right now. | #Only works in IRC right now. | ||||||
| ColorNicks=false | ColorNicks=false | ||||||
|  |  | ||||||
|  | #RunCommands allows you to send RAW irc commands after connection | ||||||
|  | #Array of strings | ||||||
|  | #OPTIONAL (default empty) | ||||||
|  | RunCommands=["PRIVMSG user hello","PRIVMSG chanserv something"] | ||||||
|  |  | ||||||
| #Nicks you want to ignore.  | #Nicks you want to ignore.  | ||||||
| #Messages from those users will not be sent to other bridges. | #Messages from those users will not be sent to other bridges. | ||||||
| #OPTIONAL | #OPTIONAL | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Wim
					Wim