5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 03:30:26 +00:00

Add support for slack username circumfix. Closes #10

This commit is contained in:
Wim 2016-02-18 21:45:29 +01:00
parent 304dc2e25f
commit f914695801
4 changed files with 16 additions and 8 deletions

View File

@ -55,6 +55,7 @@ UseTLS=false
SkipTLSVerify=true
nick="matterbot"
channel="#matterbridge"
UseSlackCircumfix=false
[mattermost]
#url is your incoming webhook url (account settings - integrations - incoming webhooks)

View File

@ -8,13 +8,14 @@ import (
type Config struct {
IRC struct {
UseTLS bool
SkipTLSVerify bool
Server string
Port int
Nick string
Password string
Channel string
UseTLS bool
SkipTLSVerify bool
Server string
Port int
Nick string
Password string
Channel string
UseSlackCircumfix bool
}
Mattermost struct {
URL string

View File

@ -5,6 +5,7 @@ UseTLS=false
SkipTLSVerify=true
nick="matterbot"
channel="#matterbridge"
UseSlackCircumfix=false
[mattermost]
url="http://yourdomain/hooks/yourhookkey"

View File

@ -103,8 +103,13 @@ func (b *Bridge) SendType(nick string, message string, channel string, mtype str
}
func (b *Bridge) handleMatter() {
var username string
for {
message := b.m.Receive()
username = message.UserName + ": "
if b.Config.IRC.UseSlackCircumfix {
username = "<" + message.UserName + "> "
}
cmd := strings.Fields(message.Text)[0]
switch cmd {
case "!users":
@ -116,7 +121,7 @@ func (b *Bridge) handleMatter() {
}
texts := strings.Split(message.Text, "\n")
for _, text := range texts {
b.i.Privmsg(b.getIRCChannel(message.Token), message.UserName+": "+text)
b.i.Privmsg(b.getIRCChannel(message.Token), username+text)
}
}
}