Commit Graph

95 Commits (141a42a75b47b0a05f5b360ff5711819d3727a75)

Author SHA1 Message Date
Patrick Connolly a20b7895a9 Preserve threading between Slack instances (#529)
* Opportunistically preserve Slack threading when parent thread in cache. [#529]

* Removed slack-specific processing from gateway.

* Added docs.

* Add option to enable threading, with default to off.

* Did cleanup on @42wim's comments.

* Update gateway/gateway.go

Co-Authored-By: patcon <patrick.c.connolly@gmail.com>

* Suggestion from @42wim :)

* Suggestions from @42wim.

* More suggestions.
6 years ago
Patrick Connolly 291594b99c Allow origin CHANNEL to be used in RemoteNickFormat (#515)
* Added origin CHANNEL to RemoteNickFormat. Updated config docs. [Fixes #515]

* Update matterbridge.toml.sample

Co-Authored-By: patcon <patrick.c.connolly@gmail.com>
6 years ago
Duco van Amstel 3dd4ec57ff Fix race in gateway test. (#520) 6 years ago
Duco van Amstel 69646a160d Add Gateway's name to RemoteNickFormat (#501)
In order to support extra use cases we should add the `{GATEWAY}` tag to the `RemoteNickFormat` string which would be replaced by the value of the `name=` field from a gateway's configuration.

This is _very_ useful when you are forwarding, for example, multiple channels from one chat to a single channel on another one (one-way). It will help you identify the source channel of a message on the target chat.
6 years ago
Liam Stanley 51327a4056 Reconnect on quit. (irc) See #431 (#445)
* potential fixes for #431
* go: fix formatting/gofmt/goreturns
6 years ago
Remi Reuvekamp 33bd60528b Add config option MediaDownloadPath (#443)
* Add config option MediaUploadPath

MediaDownloadPath can be used instead of MediaServerUpload, for when your
webserver is on the same system as matterbridge and matterbridge has
write access to the serve dir.

* Limit length of hash in MediaServer urls to 8chars

Full SHA256 is unnecessary for uniqueness.
Also; if a file has the same first 8 charachters of the SHA256 hash,
it's still not a problem, as long as the filename is not the same.
6 years ago
Wim 45296100df Add initial zulip support 6 years ago
Wim c6c92e273d Use only alphanumeric for file uploads to mediaserver. Closes #416 6 years ago
Wim 467b373c43 Fix crash on invalid filenames 6 years ago
Wim 9e5da2f9d7 Fix regression on empty text with files attached 6 years ago
Wim a284a228a3 Get the correct config values (gateway) 6 years ago
Wim fdd5ada98c Fix panic on empty config. Closes #386 6 years ago
Wim 98027446c8 Fix tests and make megacheck happy 6 years ago
Wim f2f1d874e1 Use viper (github.com/spf13/viper) for configuration 6 years ago
Wim 594d2155e3 Improve debug messages 6 years ago
Wim 02a5bc096f Do some small cleanups 6 years ago
Wim 2110db6f0c Add environment override back 6 years ago
Wim 2bac867382 Refactor using factory 6 years ago
Wim 82396e73f5 Allow empty messages with file urls (irc) 6 years ago
Wim d1227b5fc9 Use prefixed-formatter for better logging 6 years ago
Wim 6ea368c383 Move Sirupsen => sirupsen 6 years ago
Wim e622587db4 Add label support in RemoteNickFormat 6 years ago
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.
6 years ago
Wim f58be0d1c1 Add SHA to FileInfo 6 years ago
Wim 80822b7fff Send chat notification if media is too big to be re-uploaded to MediaServer. See #359 7 years ago
Wim 67f6257617 Add ShowTopicChange option. Allow/disable topic change messages (currently only from slack). Closes #353 7 years ago
Wim 6bd808ce91 Lowercase irc channels in config. Closes #348 7 years ago
Wim a5c143bc46 Allow xmpp to receive the extra messages when text is empty. #295 7 years ago
Wim 6523494e83 Obey the Gateway value from the json (api). Closes #344 7 years ago
Wim a4d5c94d9b Make edits/delete work for bridges that gets reused. Closes #342 7 years ago
Wim 7631d43c48 Change RemoteNickFormat replacement order. Closes #336 7 years ago
Wim 1efe40add5 Add initial support for an external mediaserver. #278
Add 2 extra options `MediaServerUpload` and `MediaServerDownload`, where
the URL for upload and download can be specified.

See https://github.com/42wim/matterbridge/wiki/Mediaserver-setup-%5Badvanced%5D
for an example with caddy
7 years ago
Wim cbd73ee313 Add support for uploaded images/video/files (matrix) 7 years ago
Wim cd4c9b194f Add support for ReplaceNicks using regexp to replace nicks. Closes #269 7 years ago
Wim aff3964078 Add support for ReplaceMessages using regexp to replace messages. #269 7 years ago
Wim f1e9833310 Do not ignore empty messages with files for bridges that support it 7 years ago
Wim 41aa8ad799 Add StripNick option, only allow alphanumerical nicks. Closes #285 7 years ago
Patrick Connolly 915a8fbad7 Make [general] settings default, not total override (specifically RemoteNickFormat) (#279)
* Use general settings as default, that specific protocols override.

* Fixed tab formatting.

* Clarified override precedence of [general] config.
7 years ago
Wim c4b75e5754 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).
7 years ago
Wim 1a40b0c1e9 Relay attachments from mattermost to slack (slack). Closes #260 7 years ago
Wim 2f7df2df43 Do not add messages without ID to cache 7 years ago
Wim ad3a753718 Remove debug message 7 years ago
Wim 7c773ebae0 Add support for editing messages across bridges. Currently mattermost/discord.
Our Message type has an extra ID field which contains the message ID of the specific bridge.
The Send() function has been modified to return a msg ID (after the message to that specific
bridge has been created).

There is a lru cache of 5000 entries (message IDs). All in memory, so editing messages
will only work for messages the bot has seen.

Currently we go out from the idea that every message ID is unique, so we don't keep
the ID separate for each bridge. (we do for each gateway though)

If there's a new message from a bridge, we put that message ID in the LRU cache as key
and the []*BrMsgID as value (this slice contains the message ID's of each bridge that
received the new message)

If there's a new message and this message ID already exists in the cache, it must be
an updated message. The value from the cache gets checked for each bridge and if there
is a message ID for this bridge, the ID will be added to the Message{} sent to that
bridge. If the bridge sees that the ID isn't empty, it'll know it has to update the
message with that specific ID instead of creating a new message.
7 years ago
Wim 5a8d7b5f6d Modify Send() to return also a message id 7 years ago
Wim 54216cec4b Remove unused function 7 years ago
Wim 12989bbd99 Handle same account in multiple gateways better 7 years ago
Wim 5b191f78a0 Update tests with gofmt 7 years ago
Wim 83ef61287e Refactor. Add tests 7 years ago
Wim c1c7961dd6 Fix in/out logic. Closes #224 7 years ago
Wim d3eef051b1 Fix message modification 7 years ago