Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit a63433e41bad06a9ef8132082b8ef40d91d07aec Author: Fredrik de Vibe <fdv@ifi.uio.no> Date: Fri Mar 18 15:54:14 2016 +0000 Move new config parameters from IRC to Mattermost. PrefixMessagesWithNick, NickFormatter and NicksPerRow. diff --git a/README.md b/README.md index 688b8b7..5875f1f 100644 --- a/README.md +++ b/README.md @@ -5612 +566 @@ 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 -#how to format the list of IRC nicks when displayed in mattermost. Possible options are "table" and "plain" -NickFormatter=plain -#how many nicks to list per row for formatters that support this -NicksPerRow=4    [mattermost]  #url is your incoming webhook url (account settings - integrations - incoming webhooks) @@ -766 +7012 @@ showjoinpart=true #show irc users joining and parting  token=yourtokenfrommattermost  #disable certificate checking (selfsigned certificates)  #SkipTLSVerify=true +#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 +#how to format the list of IRC nicks when displayed in mattermost. Possible options are "table" and "plain" +NickFormatter=plain +#how many nicks to list per row for formatters that support this +NicksPerRow=4    #multiple channel config  #token you can find in your outgoing webhook diff --git a/config.go b/config.go index 5732d05..e3fba6c 100644 --- a/config.go +++ b/config.go @@ -828 +828 @@ import (    type Config struct {   IRC struct { - UseTLS bool - SkipTLSVerify bool - Server string + UseTLS bool + SkipTLSVerify bool + Server string + Port int + Nick string + Password string + Channel string + UseSlackCircumfix bool + } + Mattermost struct { + URL string   Port int - Nick string - Password string + ShowJoinPart bool + Token string + IconURL string + SkipTLSVerify bool + BindAddress string   Channel string - UseSlackCircumfix bool   PrefixMessagesWithNick bool   NicksPerRow int   NickFormatter string   } - Mattermost struct { - URL string - Port int - ShowJoinPart bool - Token string - IconURL string - SkipTLSVerify bool - BindAddress string - Channel string - }   Token map[string]*struct {   IRCChannel string   MMChannel string diff --git a/matterbridge.conf.sample b/matterbridge.conf.sample index 4caf6c8..0420a1c 100644 --- a/matterbridge.conf.sample +++ b/matterbridge.conf.sample @@ -69 +66 @@ SkipTLSVerify=true  nick="matterbot"  channel="#matterbridge"  UseSlackCircumfix=false -PrefixMessagesWithNick=false -NickFormatter=plain -NicksPerRow=4    [mattermost]  url="http://yourdomain/hooks/yourhookkey" @@ -196 +169 @@ token=yourtokenfrommattermost  IconURL="http://youricon.png"  #SkipTLSVerify=true  #BindAddress="0.0.0.0" +PrefixMessagesWithNick=false +NickFormatter=plain +NicksPerRow=4    [general]  GiphyAPIKey=dc6zaTOxFJmzC diff --git a/matterbridge.go b/matterbridge.go index d2b996a..6638c2c 100644 --- a/matterbridge.go +++ b/matterbridge.go @@ -10811 +10811 @@ func plainformatter (nicks string, nicksPerRow int) string {  }    func (b *Bridge) formatnicks (nicks string) string { - switch (b.Config.IRC.NickFormatter) { + switch (b.Config.Mattermost.NickFormatter) {   case "table": - return tableformatter(nicks, b.Config.IRC.NicksPerRow) + return tableformatter(nicks, b.Config.Mattermost.NicksPerRow)   default: - return plainformatter(nicks, b.Config.IRC.NicksPerRow) + return plainformatter(nicks, b.Config.Mattermost.NicksPerRow)   }  }   @@ -1367 +1367 @@ func (b *Bridge) SendType(nick string, message string, channel string, mtype str   matterMessage.Channel = channel   matterMessage.UserName = nick   matterMessage.Type = mtype - if (b.Config.IRC.PrefixMessagesWithNick) { + if (b.Config.Mattermost.PrefixMessagesWithNick) {   matterMessage.Text = nick + ": " + message   } else {   matterMessage.Text = message