From bd7c1e3e3c7fa92c4f1ad7ab296ffc819d54aab8 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 29 Nov 2015 00:28:10 +0100 Subject: [PATCH] Set type join_leave for irc JOIN/PART messages send to mattermost --- matterbridge.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/matterbridge.go b/matterbridge.go index 8e669c54..1ab3eacd 100644 --- a/matterbridge.go +++ b/matterbridge.go @@ -56,7 +56,7 @@ func (b *Bridge) handlePrivMsg(event *irc.Event) { } func (b *Bridge) handleJoinPart(event *irc.Event) { - b.Send(b.Config.IRC.Nick, "irc-"+event.Nick+" "+strings.ToLower(event.Code)+"s "+event.Message()) + b.SendType(b.Config.IRC.Nick, "irc-"+event.Nick+" "+strings.ToLower(event.Code)+"s "+event.Message(), "join_leave") } func (b *Bridge) handleOther(event *irc.Event) { @@ -67,9 +67,14 @@ func (b *Bridge) handleOther(event *irc.Event) { } func (b *Bridge) Send(nick string, message string) error { + return b.SendType(nick, message, "") +} + +func (b *Bridge) SendType(nick string, message string, mtype string) error { matterMessage := matterhook.OMessage{IconURL: b.Config.Mattermost.IconURL} matterMessage.UserName = nick matterMessage.Text = message + matterMessage.Type = mtype err := b.m.Send(matterMessage) if err != nil { log.Println(err)