summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--config.go17
-rw-r--r--matterbridge.conf.sample1
-rw-r--r--matterbridge.go6
4 files changed, 17 insertions, 9 deletions
diff --git a/README.md b/README.md
index f10f917e..a17f1b5c 100644
--- a/README.md
+++ b/README.md
@@ -56,6 +56,8 @@ SkipTLSVerify=true
nick="matterbot"
channel="#matterbridge"
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]
#url is your incoming webhook url (account settings - integrations - incoming webhooks)
diff --git a/config.go b/config.go
index d1038880..d0bf8044 100644
--- a/config.go
+++ b/config.go
@@ -8,14 +8,15 @@ import (
type Config struct {
IRC struct {
- UseTLS bool
- SkipTLSVerify bool
- Server string
- Port int
- Nick string
- Password string
- Channel string
- UseSlackCircumfix bool
+ UseTLS bool
+ SkipTLSVerify bool
+ Server string
+ Port int
+ Nick string
+ Password string
+ Channel string
+ UseSlackCircumfix bool
+ PrefixMessagesWithNick bool
}
Mattermost struct {
URL string
diff --git a/matterbridge.conf.sample b/matterbridge.conf.sample
index cf17e8a5..843402e0 100644
--- a/matterbridge.conf.sample
+++ b/matterbridge.conf.sample
@@ -6,6 +6,7 @@ SkipTLSVerify=true
nick="matterbot"
channel="#matterbridge"
UseSlackCircumfix=false
+PrefixMessagesWithNick=false
[mattermost]
url="http://yourdomain/hooks/yourhookkey"
diff --git a/matterbridge.go b/matterbridge.go
index 6cf4ea2d..4302cf17 100644
--- a/matterbridge.go
+++ b/matterbridge.go
@@ -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.Channel = channel
matterMessage.UserName = nick
- matterMessage.Text = message
matterMessage.Type = mtype
+ if (b.Config.IRC.PrefixMessagesWithNick) {
+ matterMessage.Text = nick + ": " + message
+ } else {
+ matterMessage.Text = message
+ }
err := b.m.Send(matterMessage)
if err != nil {
log.Println(err)