From 2338c69d402ad3779f4e2a2f38ac800ceca656b9 Mon Sep 17 00:00:00 2001 From: Wim Date: Tue, 4 Jul 2017 01:34:02 +0200 Subject: Add UseInsecureURL option (telegram) --- bridge/config/config.go | 1 + bridge/telegram/telegram.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'bridge') diff --git a/bridge/config/config.go b/bridge/config/config.go index fc41fe02..69a13e43 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -77,6 +77,7 @@ type Protocol struct { UseSASL bool // IRC UseTLS bool // IRC UseFirstName bool // telegram + UseInsecureURL bool // telegram WebhookBindAddress string // mattermost, slack WebhookURL string // mattermost, slack WebhookUse string // mattermost, slack, discord diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 48ad672a..ce43b344 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -114,18 +114,18 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) { if username == "" { username = "unknown" } - if message.Sticker != nil { + if message.Sticker != nil && b.Config.UseInsecureURL { text = text + " " + b.getFileDirectURL(message.Sticker.FileID) } - if message.Video != nil { + if message.Video != nil && b.Config.UseInsecureURL { text = text + " " + b.getFileDirectURL(message.Video.FileID) } - if message.Photo != nil { + if message.Photo != nil && b.Config.UseInsecureURL { photos := *message.Photo // last photo is the biggest text = text + " " + b.getFileDirectURL(photos[len(photos)-1].FileID) } - if message.Document != nil { + if message.Document != nil && b.Config.UseInsecureURL { text = text + " " + message.Document.FileName + " : " + b.getFileDirectURL(message.Document.FileID) } if text != "" { -- cgit v1.2.3