mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-22 09:20:27 +00:00
Move new config parameters from IRC to Mattermost.
PrefixMessagesWithNick, NickFormatter and NicksPerRow.
This commit is contained in:
parent
e0379ca5af
commit
a63433e41b
12
README.md
12
README.md
@ -56,12 +56,6 @@ 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
|
|
||||||
#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]
|
[mattermost]
|
||||||
#url is your incoming webhook url (account settings - integrations - incoming webhooks)
|
#url is your incoming webhook url (account settings - integrations - incoming webhooks)
|
||||||
@ -76,6 +70,12 @@ showjoinpart=true #show irc users joining and parting
|
|||||||
token=yourtokenfrommattermost
|
token=yourtokenfrommattermost
|
||||||
#disable certificate checking (selfsigned certificates)
|
#disable certificate checking (selfsigned certificates)
|
||||||
#SkipTLSVerify=true
|
#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
|
#multiple channel config
|
||||||
#token you can find in your outgoing webhook
|
#token you can find in your outgoing webhook
|
||||||
|
@ -16,9 +16,6 @@ type Config struct {
|
|||||||
Password string
|
Password string
|
||||||
Channel string
|
Channel string
|
||||||
UseSlackCircumfix bool
|
UseSlackCircumfix bool
|
||||||
PrefixMessagesWithNick bool
|
|
||||||
NicksPerRow int
|
|
||||||
NickFormatter string
|
|
||||||
}
|
}
|
||||||
Mattermost struct {
|
Mattermost struct {
|
||||||
URL string
|
URL string
|
||||||
@ -29,6 +26,9 @@ type Config struct {
|
|||||||
SkipTLSVerify bool
|
SkipTLSVerify bool
|
||||||
BindAddress string
|
BindAddress string
|
||||||
Channel string
|
Channel string
|
||||||
|
PrefixMessagesWithNick bool
|
||||||
|
NicksPerRow int
|
||||||
|
NickFormatter string
|
||||||
}
|
}
|
||||||
Token map[string]*struct {
|
Token map[string]*struct {
|
||||||
IRCChannel string
|
IRCChannel string
|
||||||
|
@ -6,9 +6,6 @@ SkipTLSVerify=true
|
|||||||
nick="matterbot"
|
nick="matterbot"
|
||||||
channel="#matterbridge"
|
channel="#matterbridge"
|
||||||
UseSlackCircumfix=false
|
UseSlackCircumfix=false
|
||||||
PrefixMessagesWithNick=false
|
|
||||||
NickFormatter=plain
|
|
||||||
NicksPerRow=4
|
|
||||||
|
|
||||||
[mattermost]
|
[mattermost]
|
||||||
url="http://yourdomain/hooks/yourhookkey"
|
url="http://yourdomain/hooks/yourhookkey"
|
||||||
@ -19,6 +16,9 @@ token=yourtokenfrommattermost
|
|||||||
IconURL="http://youricon.png"
|
IconURL="http://youricon.png"
|
||||||
#SkipTLSVerify=true
|
#SkipTLSVerify=true
|
||||||
#BindAddress="0.0.0.0"
|
#BindAddress="0.0.0.0"
|
||||||
|
PrefixMessagesWithNick=false
|
||||||
|
NickFormatter=plain
|
||||||
|
NicksPerRow=4
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
GiphyAPIKey=dc6zaTOxFJmzC
|
GiphyAPIKey=dc6zaTOxFJmzC
|
||||||
|
@ -108,11 +108,11 @@ func plainformatter (nicks string, nicksPerRow int) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Bridge) formatnicks (nicks string) string {
|
func (b *Bridge) formatnicks (nicks string) string {
|
||||||
switch (b.Config.IRC.NickFormatter) {
|
switch (b.Config.Mattermost.NickFormatter) {
|
||||||
case "table":
|
case "table":
|
||||||
return tableformatter(nicks, b.Config.IRC.NicksPerRow)
|
return tableformatter(nicks, b.Config.Mattermost.NicksPerRow)
|
||||||
default:
|
default:
|
||||||
return plainformatter(nicks, b.Config.IRC.NicksPerRow)
|
return plainformatter(nicks, b.Config.Mattermost.NicksPerRow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ func (b *Bridge) SendType(nick string, message string, channel string, mtype str
|
|||||||
matterMessage.Channel = channel
|
matterMessage.Channel = channel
|
||||||
matterMessage.UserName = nick
|
matterMessage.UserName = nick
|
||||||
matterMessage.Type = mtype
|
matterMessage.Type = mtype
|
||||||
if (b.Config.IRC.PrefixMessagesWithNick) {
|
if (b.Config.Mattermost.PrefixMessagesWithNick) {
|
||||||
matterMessage.Text = nick + ": " + message
|
matterMessage.Text = nick + ": " + message
|
||||||
} else {
|
} else {
|
||||||
matterMessage.Text = message
|
matterMessage.Text = message
|
||||||
|
Loading…
Reference in New Issue
Block a user