summaryrefslogtreecommitdiffstats
path: root/gateway/gateway.go
diff options
context:
space:
mode:
authorPatrick Connolly <patrick.c.connolly@gmail.com>2018-12-01 07:24:07 +0800
committerWim <wim@42.be>2018-12-01 00:24:07 +0100
commit47d29ecf63be89fff5c2ecb9e354dc6cca70c5f0 (patch)
tree132766bba7ebdcd3ebb210d811961b92e6d870ec /gateway/gateway.go
parentf2088a687edd53e9e797f3b8941210ca3650cc45 (diff)
downloadmatterbridge-msglm-47d29ecf63be89fff5c2ecb9e354dc6cca70c5f0.tar.gz
matterbridge-msglm-47d29ecf63be89fff5c2ecb9e354dc6cca70c5f0.tar.bz2
matterbridge-msglm-47d29ecf63be89fff5c2ecb9e354dc6cca70c5f0.zip
Tidy up fetching of config values. (#616)
Diffstat (limited to 'gateway/gateway.go')
-rw-r--r--gateway/gateway.go18
1 files changed, 6 insertions, 12 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go
index 674179fb..2874ef24 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -233,14 +233,14 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
}
// only relay join/part when configured
- if msg.Event == config.EventJoinLeave && !gw.Bridges[dest.Account].GetBool("ShowJoinPart") {
+ if msg.Event == config.EventJoinLeave && !dest.GetBool("ShowJoinPart") {
return brMsgIDs
}
// only relay topic change when used in some way on other side
if msg.Event == config.EventTopicChange &&
- !gw.Bridges[dest.Account].GetBool("ShowTopicChange") &&
- !gw.Bridges[dest.Account].GetBool("SyncTopic") {
+ dest.GetBool("ShowTopicChange") &&
+ dest.GetBool("SyncTopic") {
return brMsgIDs
}
@@ -252,7 +252,7 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
// Get the ID of the parent message in thread
var canonicalParentMsgID string
- if msg.ParentID != "" && (gw.BridgeValues().General.PreserveThreading || dest.GetBool("PreserveThreading")) {
+ if msg.ParentID != "" && dest.GetBool("PreserveThreading") {
canonicalParentMsgID = gw.FindCanonicalMsgID(msg.Protocol, msg.ParentID)
}
@@ -364,14 +364,11 @@ 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 gw.BridgeValues().General.StripNick || dest.GetBool("StripNick") {
+ if dest.GetBool("StripNick") {
re := regexp.MustCompile("[^a-zA-Z0-9]+")
msg.Username = re.ReplaceAllString(msg.Username, "")
}
nick := dest.GetString("RemoteNickFormat")
- if nick == "" {
- nick = gw.BridgeValues().General.RemoteNickFormat
- }
// loop to replace nicks
for _, outer := range br.GetStringSlice2D("ReplaceNicks") {
@@ -409,10 +406,7 @@ func (gw *Gateway) modifyUsername(msg config.Message, dest *bridge.Bridge) strin
}
func (gw *Gateway) modifyAvatar(msg config.Message, dest *bridge.Bridge) string {
- iconurl := gw.BridgeValues().General.IconURL
- if iconurl == "" {
- iconurl = dest.GetString("IconURL")
- }
+ iconurl := dest.GetString("IconURL")
iconurl = strings.Replace(iconurl, "{NICK}", msg.Username, -1)
if msg.Avatar == "" {
msg.Avatar = iconurl