diff options
author | Wim <wim@42.be> | 2017-02-18 23:10:22 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-02-18 23:13:46 +0100 |
commit | 73f01ad8d813505c6309fe568d0abc597cff8790 (patch) | |
tree | 426bc1779c1abcf2afe56e2dc2a2f43d70aae278 /gateway/gateway.go | |
parent | 930b639cc9cd2d2873302f30303378c0e53816a8 (diff) | |
download | matterbridge-msglm-73f01ad8d813505c6309fe568d0abc597cff8790.tar.gz matterbridge-msglm-73f01ad8d813505c6309fe568d0abc597cff8790.tar.bz2 matterbridge-msglm-73f01ad8d813505c6309fe568d0abc597cff8790.zip |
Add REST API support
Diffstat (limited to 'gateway/gateway.go')
-rw-r--r-- | gateway/gateway.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go index f965f8a6..5e85926e 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -86,6 +86,7 @@ func (gw *Gateway) handleReceive() { } } if !gw.ignoreMessage(&msg) { + msg.Timestamp = time.Now() for _, br := range gw.Bridges { gw.handleMessage(msg, br) } @@ -165,6 +166,10 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) { } log.Debugf("Sending %#v from %s (%s) to %s (%s)", msg, msg.Account, originchannel, dest.Account, channel) gw.modifyUsername(&msg, dest) + // for api we need originchannel as channel + if dest.Protocol == "api" { + msg.Channel = originchannel + } err := dest.Send(msg) if err != nil { fmt.Println(err) @@ -199,6 +204,7 @@ func (gw *Gateway) modifyMessage(msg *config.Message, dest *bridge.Bridge) { func (gw *Gateway) modifyUsername(msg *config.Message, dest *bridge.Bridge) { br := gw.Bridges[msg.Account] + msg.Protocol = br.Protocol nick := gw.Config.General.RemoteNickFormat if nick == "" { nick = dest.Config.RemoteNickFormat |