From 359d0f2910d52e0eaba6ee62dd9179bcc0097a9d Mon Sep 17 00:00:00 2001 From: Wim Date: Wed, 7 Jun 2017 23:54:50 +0200 Subject: Allow reuse of api in different gateways. See #189 --- bridge/api/api.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bridge/api/api.go') 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) } -- cgit v1.2.3