diff options
author | Wim <wim@42.be> | 2018-11-08 22:20:03 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2018-11-08 22:20:03 +0100 |
commit | b2a07aba3a4343087bdbaa2bb5ef7d703bca79e1 (patch) | |
tree | 33c5faa17e737159e8235d0c6b1b57f28e2188d5 /gateway/gateway.go | |
parent | 1e0bb3da954831d41ae958da22bf7294dbbe0822 (diff) | |
download | matterbridge-msglm-b2a07aba3a4343087bdbaa2bb5ef7d703bca79e1.tar.gz matterbridge-msglm-b2a07aba3a4343087bdbaa2bb5ef7d703bca79e1.tar.bz2 matterbridge-msglm-b2a07aba3a4343087bdbaa2bb5ef7d703bca79e1.zip |
Make goconst linter happy
Diffstat (limited to 'gateway/gateway.go')
-rw-r--r-- | gateway/gateway.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go index 3a6fa1e0..34cdd7fe 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -70,6 +70,10 @@ var bridgeMap = map[string]bridge.Factory{ "zulip": bzulip.New, } +const ( + apiProtocol = "api" +) + func init() { flog = log.WithFields(log.Fields{"prefix": "gateway"}) } @@ -158,7 +162,7 @@ RECONNECT: func (gw *Gateway) mapChannelConfig(cfg []config.Bridge, direction string) { for _, br := range cfg { if isApi(br.Account) { - br.Channel = "api" + br.Channel = apiProtocol } // make sure to lowercase irc channels in config #348 if strings.HasPrefix(br.Account, "irc.") { @@ -191,7 +195,7 @@ func (gw *Gateway) getDestChannel(msg *config.Message, dest bridge.Bridge) []con var channels []config.ChannelInfo // for messages received from the api check that the gateway is the specified one - if msg.Protocol == "api" && gw.Name != msg.Gateway { + if msg.Protocol == apiProtocol && gw.Name != msg.Gateway { return channels } @@ -310,7 +314,7 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM msg.ID = gw.getDestMsgID(origmsg.ID, dest, channel) // for api we need originchannel as channel - if dest.Protocol == "api" { + if dest.Protocol == apiProtocol { msg.Channel = originchannel } @@ -459,7 +463,7 @@ func (gw *Gateway) modifyMessage(msg *config.Message) { } // messages from api have Gateway specified, don't overwrite - if msg.Protocol != "api" { + if msg.Protocol != apiProtocol { msg.Gateway = gw.Name } } |