summaryrefslogtreecommitdiffstats
path: root/bridge/helper/helper.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-02-03 01:11:11 +0100
committerWim <wim@42.be>2018-02-03 01:11:11 +0100
commit80822b7fff85647ad5852b00ec36d046959aed92 (patch)
treef3f15769f5b75b53f97c3bedf1bbf6a1f9a909c8 /bridge/helper/helper.go
parent78f1011f529981bab58556d9847488db04d00388 (diff)
downloadmatterbridge-msglm-80822b7fff85647ad5852b00ec36d046959aed92.tar.gz
matterbridge-msglm-80822b7fff85647ad5852b00ec36d046959aed92.tar.bz2
matterbridge-msglm-80822b7fff85647ad5852b00ec36d046959aed92.zip
Send chat notification if media is too big to be re-uploaded to MediaServer. See #359
Diffstat (limited to 'bridge/helper/helper.go')
-rw-r--r--bridge/helper/helper.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go
index 0b6be4f4..bfa9e64b 100644
--- a/bridge/helper/helper.go
+++ b/bridge/helper/helper.go
@@ -2,6 +2,8 @@ package helper
import (
"bytes"
+ "fmt"
+ "github.com/42wim/matterbridge/bridge/config"
"io"
"net/http"
"time"
@@ -38,3 +40,18 @@ func SplitStringLength(input string, length int) string {
}
return str
}
+
+// handle all the stuff we put into extra
+func HandleExtra(msg *config.Message, general *config.Protocol) []config.Message {
+ extra := msg.Extra
+ rmsg := []config.Message{}
+ if len(extra[config.EVENT_FILE_FAILURE_SIZE]) > 0 {
+ for _, f := range extra[config.EVENT_FILE_FAILURE_SIZE] {
+ fi := f.(config.FileInfo)
+ text := fmt.Sprintf("file %s too big to download (%#v > allowed size: %#v)", fi.Name, fi.Size, general.MediaDownloadSize)
+ rmsg = append(rmsg, config.Message{Text: text, Username: "<system> ", Channel: msg.Channel})
+ }
+ return rmsg
+ }
+ return rmsg
+}