Commit Graph

38 Commits

Author SHA1 Message Date
Wim d23f2560d5
Make the cgo lottie a build tag (-tag cgolottie) (#1955)
This should fix #1906 as we don't have any cgo dependencies anymore by
default.
2023-01-29 00:34:27 +01:00
Jair Sanchez 3ad5deaff1
Fix empty messages on IRC (#1897) 2022-11-26 23:53:48 +01:00
Wim 6438a3dba3
Add support for deleting files from slack to discord. Fixes #1705 (#1709)
We create a new event EventFileDelete which will be used to delete
specific uploaded files using the Extra["file"] in the config.Message.

We also add a new NativeID key to the FileInfo struct which will contain
the native file ID of the sending bridge.

When a new file is added to the config.Message.Extra["file"] map, now
the bridge native file ID should be added here.

When the receiving bridge receives such a message, it should keep an
internal mapping of NativeID <> bridge fileid/message id. In the case of
discord we map it to the resulted discord message ID after uploading it.

Now when a bridge deletes a file, it should send a EventFileDelete and
setting the ID to the native file ID of the bridge.

When the receiving bridge will get this event it'll look into the
NativeID <> bridge id mapping to find their internal ID and use it to
delete the specific file on their side.

For now this is implemented for slack to discord but this will be add to
other bridges where useful.
2022-02-05 14:45:54 +01:00
Wim b56f80b1b8 Add support for mattermost v6 2021-10-16 23:23:24 +02:00
Benau 53cafa9f3d
Convert .tgs with go libraries (and cgo) (telegram) (#1569)
This commit adds support for go/cgo tgs conversion when building with the -tags `cgo`
The default binaries are still "pure" go and uses the old way of converting.

* Move lottie_convert.py conversion code to its own file

* Add optional libtgsconverter

* Update vendor

* Apply suggestions from code review

* Update bridge/helper/libtgsconverter.go

Co-authored-by: Wim <wim@42.be>
2021-08-24 22:32:50 +02:00
Wim c86137449e
Add a MessageClipped option to set your own clipped message. Closes #1359 (#1487) 2021-05-27 21:45:23 +02:00
Ben Wiederhake 0450482e6e
Make lottie_convert work on platforms without /dev/stdout (#1424)
Fixes #1423.
2021-03-20 22:42:41 +01:00
Tadeo Kondrak c147ba1da1
Handle Rocket.Chat attachments (#1395) 2021-02-15 22:34:14 +01:00
Wim 4913766d58
Parse fencedcode in ParseMarkdown. Fixes #1127 (#1329) 2020-12-06 19:38:32 +01:00
Ben Wiederhake b2af76e7dc
Support Telegram animated stickers (tgs) format (#1173)
This is half a fix for #874

This patch introduces a new config flag:
- MediaConvertTgs

These need to be treated independently from the existing
MediaConvertWebPToPNG flag because Tgs→WebP results in an
*animated* WebP, and the WebP→PNG converter can't handle
animated WebP files yet.

Furthermore, some platforms (like discord) don't even support
animated WebP files, so the user may want to fall back to
static PNGs (not APNGs).

The final reason why this is only half a fix is that this
introduces an external dependency, namely lottie, to be
installed like this:

$ pip3 install lottie cairosvg

This patch works by writing the tgs to a temporary file in /tmp,
calling lottie to convert it (this conversion may take several seconds!),
and then deleting the temporary file.
The temporary file is absolutely necessary, as lottie refuses to
work on non-seekable files.
If anyone comes up with a reasonable use case where /tmp is
unavailable, I can add yet another config option for that, if desired.

Telegram will bail out if the option is configured but lottie isn't found.
2020-08-23 22:34:28 +02:00
Martijn Braam c0be3e585a
Enable intra-word emphasis supression in markdown (#999)
This fixes plain links sent to Matrix being broken if they contain
underscores. Fixes issue #997
2020-02-04 13:22:05 +01:00
Wim 585d1556c1
Disable smartypants in markdown parser. Fixes #989, #983 (#993) 2020-02-02 18:35:43 +01:00
Benjamin 0917dc8766 Update markdown parsing library to github.com/gomarkdown/markdown (#944) 2019-11-17 21:18:01 +01:00
Wim e955a056e2
Trim <p> and </p> tags (matrix). Closes #686 (#753) 2019-03-03 00:29:29 +01:00
Wim 26a7e35f27
Add MediaConvertWebPToPNG option (telegram). (#741)
* Add MediaConvertWebPToPNG option (telegram).

When enabled matterbridge will convert .webp files to .png files
before uploading them to the mediaserver of the other bridges.

Fixes #398
2019-02-27 00:41:50 +01:00
Wim bf21604d42
Make all loggers derive from non-default instance (#728) 2019-02-23 22:51:27 +01:00
Wim 04567c765e
Add support for markdown to HTML conversion (matrix). Closes #663 (#670)
This uses our own gomatrix lib with the SendHTML function which
adds HTML to formatted_body in matrix.
golang-commonmark is used to convert markdown into valid HTML.
2019-01-06 22:25:19 +01:00
Duco van Amstel da8e415ae1 Use logrus imports instead of log (#662) 2018-12-26 15:16:09 +01:00
Duco van Amstel ce21ba1545 Fix golint linter issues and enable it in CI (#593) 2018-11-15 20:43:43 +01:00
Duco van Amstel 85564a35fd Fix IRC line splitting. Closes #584 (#587) 2018-11-14 22:43:52 +01:00
Wim 399789811e Make gocritic linter happy 2018-11-08 00:46:34 +01:00
Duco van Amstel d2a1dc792f Refactor and clean-up handlers. (slack) (#533) 2018-11-07 21:35:59 +01:00
Wim 2597c9bfac Clip too long messages sent to discord (discord). Closes #440 2018-07-22 00:28:17 +02:00
Wim e4b72136b8 Fix possible panic. #448 2018-06-19 22:53:45 +02:00
Wim bd9ea7a88d Add MediaDownloadBlacklist option. Closes #442 2018-06-09 14:35:02 +02:00
Liam Stanley 51327a4056 Reconnect on quit. (irc) See #431 (#445)
* potential fixes for #431
* go: fix formatting/gofmt/goreturns
2018-06-09 12:47:40 +02:00
Wim 8a8b95228c Remove message newline (telegram). #399 2018-04-19 22:05:00 +02:00
Wim 31a752fa21 Add missing import 2018-04-19 13:04:12 +02:00
Wim a83831e68d Remove empty newlines from messages (telegram) #399 2018-04-19 12:53:49 +02:00
Wim 1578ebb0e2 Refactor slack 2018-02-27 23:22:10 +01:00
Wim bd2a672c14 Refactor mattermost 2018-02-27 23:22:09 +01:00
Wim 4c506f7cc3 Use MediaServerDownload instead of MediaServerUpload for avatars 2018-02-20 17:15:54 +01:00
Wim 7886f05e88 Download (and upload) avatar images from mattermost and telegram when mediaserver is configured. Closes #362
An extra avatarMap (cache) is created for mattermost and telegram.
If MediaServerUpload is configured, the avatar images of users are downloaded the first time a
user sends a message.
If this download succeeds a message with EVENT_AVATAR_DOWNLOAD is sent to the originating protocol.
This message also contains a SHA field (in msg.Extra["file"]), if this is not empty, the sha will
be added to the avatarMap. (so we now have a userid-sha cache)

Next time this user sends a message, the MediaServerUpload/sha/userid.png URL will be used as the
avatar field.
2018-02-20 01:15:25 +01:00
Wim 2b15739b48 Remove double close 2018-02-07 00:05:10 +01:00
Wim 3480c88e90 Do not close body on err. Closes #364 2018-02-07 00:04:02 +01:00
Wim 80822b7fff Send chat notification if media is too big to be re-uploaded to MediaServer. See #359 2018-02-03 01:11:11 +01:00
Wim e0cbb69a4f Add MessageSplit option to split messages on MessageLength (irc). Closes #281 2017-11-24 23:29:00 +01:00
Wim ba5649d259 Add helper 2017-11-04 14:55:25 +01:00