forked from lug/matterbridge
		
	Merge pull request #12 from fdevibe/msgprefix
Add config option to prefix messages (IRC->MM) with nick
This commit is contained in:
		| @@ -56,6 +56,8 @@ SkipTLSVerify=true | |||||||
| nick="matterbot" | nick="matterbot" | ||||||
| channel="#matterbridge" | channel="#matterbridge" | ||||||
| UseSlackCircumfix=false | UseSlackCircumfix=false | ||||||
|  | #whether to prefix messages from IRC to mattermost with the sender's nick. Useful if username overrides for incoming webhooks isn't enabled on the mattermost server | ||||||
|  | PrefixMessagesWithNick=false | ||||||
|  |  | ||||||
| [mattermost] | [mattermost] | ||||||
| #url is your incoming webhook url (account settings - integrations - incoming webhooks) | #url is your incoming webhook url (account settings - integrations - incoming webhooks) | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ type Config struct { | |||||||
| 		Password               string | 		Password               string | ||||||
| 		Channel                string | 		Channel                string | ||||||
| 		UseSlackCircumfix      bool | 		UseSlackCircumfix      bool | ||||||
|  | 		PrefixMessagesWithNick bool | ||||||
| 	} | 	} | ||||||
| 	Mattermost struct { | 	Mattermost struct { | ||||||
| 		URL           string | 		URL           string | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ SkipTLSVerify=true | |||||||
| nick="matterbot" | nick="matterbot" | ||||||
| channel="#matterbridge" | channel="#matterbridge" | ||||||
| UseSlackCircumfix=false | UseSlackCircumfix=false | ||||||
|  | PrefixMessagesWithNick=false | ||||||
|  |  | ||||||
| [mattermost] | [mattermost] | ||||||
| url="http://yourdomain/hooks/yourhookkey" | url="http://yourdomain/hooks/yourhookkey" | ||||||
|   | |||||||
| @@ -92,8 +92,12 @@ func (b *Bridge) SendType(nick string, message string, channel string, mtype str | |||||||
| 	matterMessage := matterhook.OMessage{IconURL: b.Config.Mattermost.IconURL} | 	matterMessage := matterhook.OMessage{IconURL: b.Config.Mattermost.IconURL} | ||||||
| 	matterMessage.Channel = channel | 	matterMessage.Channel = channel | ||||||
| 	matterMessage.UserName = nick | 	matterMessage.UserName = nick | ||||||
| 	matterMessage.Text = message |  | ||||||
| 	matterMessage.Type = mtype | 	matterMessage.Type = mtype | ||||||
|  | 	if (b.Config.IRC.PrefixMessagesWithNick) { | ||||||
|  | 		matterMessage.Text = nick + ": " + message | ||||||
|  | 	} else { | ||||||
|  | 		matterMessage.Text = message | ||||||
|  | 	} | ||||||
| 	err := b.m.Send(matterMessage) | 	err := b.m.Send(matterMessage) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		log.Println(err) | 		log.Println(err) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 @42wim
					@42wim