summaryrefslogtreecommitdiffstats
path: root/bridge/api
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-06-07 23:54:50 +0200
committerWim <wim@42.be>2017-06-07 23:54:50 +0200
commit359d0f2910d52e0eaba6ee62dd9179bcc0097a9d (patch)
tree91d567d29e1def2194158635a6534be339b33403 /bridge/api
parentad3cb0386b72a7f9d46b4a2068ff947570fa67ff (diff)
downloadmatterbridge-msglm-359d0f2910d52e0eaba6ee62dd9179bcc0097a9d.tar.gz
matterbridge-msglm-359d0f2910d52e0eaba6ee62dd9179bcc0097a9d.tar.bz2
matterbridge-msglm-359d0f2910d52e0eaba6ee62dd9179bcc0097a9d.zip
Allow reuse of api in different gateways. See #189
Diffstat (limited to 'bridge/api')
-rw-r--r--bridge/api/api.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/bridge/api/api.go b/bridge/api/api.go
index 48715c50..eb27b2c1 100644
--- a/bridge/api/api.go
+++ b/bridge/api/api.go
@@ -22,6 +22,7 @@ type ApiMessage struct {
Text string `json:"text"`
Username string `json:"username"`
Avatar string `json:"avatar"`
+ Gateway string `json:"gateway"`
}
var flog *log.Entry
@@ -76,12 +77,15 @@ func (b *Api) handlePostMessage(c echo.Context) error {
if err := c.Bind(message); err != nil {
return err
}
+ flog.Debugf("Sending message from %s on %s to gateway", message.Username, "api")
b.Remote <- config.Message{
Text: message.Text,
Username: message.Username,
Channel: "api",
Avatar: message.Avatar,
Account: b.Account,
+ Gateway: message.Gateway,
+ Protocol: "api",
}
return c.JSON(http.StatusOK, message)
}