Rearchitect the module to allow for many gateways

This commit is contained in:
Neil Hanlon 2021-02-01 16:47:09 -05:00
parent 883f551bc1
commit f5b86671a5
Signed by: neil
GPG Key ID: 705BC21EC3C70F34

View File

@ -3,17 +3,18 @@
################################################################### ###################################################################
[irc] [irc]
[irc.{{ mbridge_bridge_name }}] [irc.{{ matterbridge_config['bridge_name'] }}]
Server="{{ mbridge_irc_network_server }}" Server="{{ matterbridge_config['irc']['server'] }}"
UseTLS=true UseTLS={{ matterbridge_config['irc']['use_tls'] }}
SkipTLSVerify=false SkipTLSVerify={{ matterbridge_config['irc']['skip_tls_verify'] }}
Nick="{{ mbridge_bot_nick }}" Nick="{{ matterbridge_config['bot_nick'] }}"
UseSASL=true UseSASL={{ matterbridge_config['use_sasl'] }}
NickServNick="{{ mbridge_bot_nick }}" NickServNick="{{ matterbridge_config['bot_nick'] }}"
NickServPassword="{{ mbridge_irc_bot_pass }}" NickServPassword="{{ mbridge_irc_bot_pass }}"
Label="{{ mbridge_irc_label }}" Label="{{ matterbridge_config['irc']['label'] }}"
# StripMarkdown=true
StripMarkdown="{{ matterbridge_config['irc']['strip_markdown'] }}"
## RELOADABLE SETTINGS ## RELOADABLE SETTINGS
## Settings below can be reloaded by editing the file ## Settings below can be reloaded by editing the file
@ -21,26 +22,26 @@ Label="{{ mbridge_irc_label }}"
#Split messages on MessageLength instead of showing the <message clipped> #Split messages on MessageLength instead of showing the <message clipped>
#WARNING: this could lead to flooding #WARNING: this could lead to flooding
#OPTIONAL (default false) #OPTIONAL (default false)
MessageSplit=true MessageSplit={{ matterbridge_config['irc']['message_split'] }}
#ColorNicks will show each nickname in a different color. #ColorNicks will show each nickname in a different color.
#Only works in IRC right now. #Only works in IRC right now.
ColorNicks=true ColorNicks={{ matterbridge_config['irc']['color_nicks'] }}
#Nicks you want to ignore. #Nicks you want to ignore.
#Messages from those users will not be sent to other bridges. #Messages from those users will not be sent to other bridges.
#OPTIONAL #OPTIONAL
IgnoreNicks="{{ mbridge_irc_ignore_nicks }}" IgnoreNicks="{{ matterbridge_config['irc']['ignore_nicks'] | join(',') }}"
#Enable to show users joins/parts from other bridges #Enable to show users joins/parts from other bridges
#Currently works for messages from the following bridges: irc, mattermost, slack #Currently works for messages from the following bridges: irc, mattermost, slack
#OPTIONAL (default false) #OPTIONAL (default false)
ShowJoinPart=false ShowJoinPart={{ matterbridge_config['irc']['show_join_part'] }}
#Enable to show topic changes from other bridges #Enable to show topic changes from other bridges
#Only works hiding/show topic changes from slack bridge for now #Only works hiding/show topic changes from slack bridge for now
#OPTIONAL (default false) #OPTIONAL (default false)
ShowTopicChange=true ShowTopicChange={{ matterbridge_config['irc']['show_topic_change'] }}
################################################################### ###################################################################
@ -51,9 +52,9 @@ ShowTopicChange=true
#In this example we use [mattermost.work] #In this example we use [mattermost.work]
#REQUIRED #REQUIRED
[mattermost.{{ mbridge_bridge_name }}] [mattermost.{{ matterbridge_config['bridge_name'] }}]
Server="{{ mbridge_mattermost_server }}" Server="{{ matterbridge_config['mattermost']['server'] }}"
Team="{{ mbridge_mattermost_team }}" Team="{{ matterbridge_config['mattermost']['team'] }}"
Token="{{ mbridge_mattermost_token }}" Token="{{ mbridge_mattermost_token }}"
NoTLS=false NoTLS=false
@ -101,7 +102,7 @@ IgnoreNicks="{{ mbridge_mattermost_ignore_nicks }}"
#Messages you want to ignore. #Messages you want to ignore.
#Messages matching these regexp will be ignored and not sent to other bridges #Messages matching these regexp will be ignored and not sent to other bridges
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info #See https://regex-golang.appspot.com/assets/html/index.html for more regex info
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword matterbridge_config['mattermost']['toke#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
IgnoreMessages="" IgnoreMessages=""
#messages you want to replace. #messages you want to replace.
@ -134,7 +135,7 @@ ExtractNicks=[ ]
#extra label that can be used in the RemoteNickFormat #extra label that can be used in the RemoteNickFormat
#optional (default empty) #optional (default empty)
Label="{{ mbridge_mattermost_label }}" Label="{{ matterbridge_config['mattermost']['label'] }}"
#Enable to show users joins/parts from other bridges #Enable to show users joins/parts from other bridges
#Currently works for messages from the following bridges: irc, mattermost, slack, discord #Currently works for messages from the following bridges: irc, mattermost, slack, discord
@ -213,15 +214,17 @@ RemoteNickFormat="<{NICK}> "
################################################################### ###################################################################
#Gateway configuration #Gateway configuration
################################################################### ###################################################################
{% for gateway in in matterbridge_config['gateways'] %}
[[gateway]] [[gateway]]
name="{{ mbridge_bridge_name }}" name="{{ matterbridge_config['bridge_name'] }}.{{ gateway['mattermost_channel'] }}"
enable=true enable=true
[[gateway.inout]] [[gateway.inout]]
account="irc.{{ mbridge_bridge_name }}" account="irc.{{ matterbridge_config['bridge_name'] }}"
channel="{{ mbridge_irc_channel }}" channel="{{ gateway['irc_channel'] }}"
[[gateway.inout]] [[gateway.inout]]
account="mattermost.{{ mbridge_bridge_name }}" account="mattermost.{{ matterbridge_config['bridge_name'] }}"
channel="{{ mbridge_mattermost_channel }}" channel="{{ gateway['mattermost_channel'] }}"
{% endfor %}