summaryrefslogtreecommitdiffstats
path: root/bridge/config
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-09-21 22:35:21 +0200
committerWim <wim@42.be>2017-09-21 22:35:21 +0200
commitc4b75e5754c58758c920c79b0458171e98269961 (patch)
treea1070f27993de91489d26cea03f7e47ebccf9738 /bridge/config
parent6a7adb20a8f9f54d408f573763bc86d2670a0cf7 (diff)
downloadmatterbridge-msglm-c4b75e5754c58758c920c79b0458171e98269961.tar.gz
matterbridge-msglm-c4b75e5754c58758c920c79b0458171e98269961.tar.bz2
matterbridge-msglm-c4b75e5754c58758c920c79b0458171e98269961.zip
Download files from slack and reupload to mattermost (slack/mattermost). Closes #255
Refactor message.Extra to a map[string][]interface{} to have a bit more flexibility for stuffing extra stuff. For attached files from slack, files < 1MB size get downloaded (in memory), and get put into Extra["file"][]config.FileInfo (containing a pointer to the buffer and the filename). This is not async so slack channels with lots of attached files may suffer a slowdown. (the download timeout is set at 5 seconds).
Diffstat (limited to 'bridge/config')
-rw-r--r--bridge/config/config.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 2b678d2f..c6686a42 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -29,7 +29,12 @@ type Message struct {
Gateway string `json:"gateway"`
Timestamp time.Time `json:"timestamp"`
ID string `json:"id"`
- Extra []interface{}
+ Extra map[string][]interface{}
+}
+
+type FileInfo struct {
+ Name string
+ Data *[]byte
}
type ChannelInfo struct {