summaryrefslogtreecommitdiffstats
path: root/gateway
diff options
context:
space:
mode:
authorQais Patankar <qaisjp@gmail.com>2020-02-09 21:07:26 +0000
committerGitHub <noreply@github.com>2020-02-09 22:07:26 +0100
commitc91bfd08d855d07eccf5319e8881c816edf598ea (patch)
tree886c0d59e048135ccb98290df6af874ab10a41c9 /gateway
parent49110a58729fcbecaffcb0202f9a9474d98c9cde (diff)
downloadmatterbridge-msglm-c91bfd08d855d07eccf5319e8881c816edf598ea.tar.gz
matterbridge-msglm-c91bfd08d855d07eccf5319e8881c816edf598ea.tar.bz2
matterbridge-msglm-c91bfd08d855d07eccf5319e8881c816edf598ea.zip
Add ability to procure avatars from the destination bridge (#1000)
* remote_avatar: add UseLocalAvatar * remote_avatar: make sure msg.Protocol is always set correctly * remote_avatars: support msg.Account * remote_avatar: add to matterbridge.toml.sample * remote_avatar: clarify something
Diffstat (limited to 'gateway')
-rw-r--r--gateway/gateway.go3
-rw-r--r--gateway/router.go3
2 files changed, 4 insertions, 2 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go
index e265e62b..1e958a86 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -306,8 +306,6 @@ func (gw *Gateway) ignoreMessage(msg *config.Message) bool {
}
func (gw *Gateway) modifyUsername(msg *config.Message, dest *bridge.Bridge) string {
- br := gw.Bridges[msg.Account]
- msg.Protocol = br.Protocol
if dest.GetBool("StripNick") {
re := regexp.MustCompile("[^a-zA-Z0-9]+")
msg.Username = re.ReplaceAllString(msg.Username, "")
@@ -315,6 +313,7 @@ func (gw *Gateway) modifyUsername(msg *config.Message, dest *bridge.Bridge) stri
nick := dest.GetString("RemoteNickFormat")
// loop to replace nicks
+ br := gw.Bridges[msg.Account]
for _, outer := range br.GetStringSlice2D("ReplaceNicks") {
search := outer[0]
replace := outer[1]
diff --git a/gateway/router.go b/gateway/router.go
index 56573f74..b07e5781 100644
--- a/gateway/router.go
+++ b/gateway/router.go
@@ -132,6 +132,9 @@ func (r *Router) handleReceive() {
r.handleEventFailure(&msg)
r.handleEventRejoinChannels(&msg)
+ // Set message protocol based on the account it came from
+ msg.Protocol = r.getBridge(msg.Account).Protocol
+
filesHandled := false
for _, gw := range r.Gateways {
// record all the message ID's of the different bridges