5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-24 22:21:36 +00:00
Commit Graph

138 Commits

Author SHA1 Message Date
David Hill
0e2522279e Clean up various stuff (#508)
* various cleanups
2018-11-07 20:36:50 +01:00
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.
2018-11-07 09:14:31 +01:00
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>
2018-10-23 21:53:11 +02:00
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.
2018-10-07 15:22:15 +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
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.
2018-06-08 22:30:35 +02:00
Wim
45296100df Add initial zulip support 2018-05-07 21:35:48 +02:00
Wim
c6c92e273d Use only alphanumeric for file uploads to mediaserver. Closes #416 2018-05-06 20:32:09 +02:00
Wim
467b373c43 Fix crash on invalid filenames 2018-05-06 20:14:16 +02:00
Wim
9e5da2f9d7 Fix regression on empty text with files attached 2018-03-06 21:30:59 +01:00
Wim
a284a228a3 Get the correct config values (gateway) 2018-03-06 21:19:00 +01:00
Wim
fdd5ada98c Fix panic on empty config. Closes #386 2018-03-05 22:23:01 +01:00
Wim
98027446c8 Fix tests and make megacheck happy 2018-03-05 00:30:46 +01:00
Wim
f2f1d874e1 Use viper (github.com/spf13/viper) for configuration 2018-03-04 23:52:14 +01:00
Wim
594d2155e3 Improve debug messages 2018-02-28 22:23:29 +01:00
Wim
02a5bc096f Do some small cleanups 2018-02-27 23:22:12 +01:00
Wim
2110db6f0c Add environment override back 2018-02-27 23:22:12 +01:00
Wim
2bac867382 Refactor using factory 2018-02-27 23:22:12 +01:00
Wim
82396e73f5 Allow empty messages with file urls (irc) 2018-02-25 00:40:07 +01:00
Wim
d1227b5fc9 Use prefixed-formatter for better logging 2018-02-21 00:20:25 +01:00
Wim
6ea368c383 Move Sirupsen => sirupsen 2018-02-20 23:41:09 +01:00
Wim
e622587db4 Add label support in RemoteNickFormat 2018-02-20 18:57:46 +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
f58be0d1c1 Add SHA to FileInfo 2018-02-15 23:18:58 +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
67f6257617 Add ShowTopicChange option. Allow/disable topic change messages (currently only from slack). Closes #353 2018-02-02 21:08:13 +01:00
Wim
6bd808ce91 Lowercase irc channels in config. Closes #348 2018-01-28 19:15:13 +01:00
Wim
a5c143bc46 Allow xmpp to receive the extra messages when text is empty. #295 2018-01-27 16:32:38 +01:00
Wim
6523494e83 Obey the Gateway value from the json (api). Closes #344 2018-01-21 12:21:55 +01:00
Wim
a4d5c94d9b Make edits/delete work for bridges that gets reused. Closes #342 2018-01-20 21:58:59 +01:00
Wim
7631d43c48 Change RemoteNickFormat replacement order. Closes #336 2018-01-14 16:55:32 +01:00
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
2017-11-24 22:36:19 +01:00
Wim
cbd73ee313 Add support for uploaded images/video/files (matrix) 2017-11-22 00:28:40 +01:00
Wim
cd4c9b194f Add support for ReplaceNicks using regexp to replace nicks. Closes #269 2017-11-20 23:27:27 +01:00
Wim
aff3964078 Add support for ReplaceMessages using regexp to replace messages. #269 2017-11-15 23:33:00 +01:00
Wim
f1e9833310 Do not ignore empty messages with files for bridges that support it 2017-11-12 18:34:16 +01:00
Wim
41aa8ad799 Add StripNick option, only allow alphanumerical nicks. Closes #285 2017-10-27 00:07:33 +02:00
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.
2017-10-20 20:58:39 +02:00
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).
2017-09-21 22:35:21 +02:00
Wim
1a40b0c1e9 Relay attachments from mattermost to slack (slack). Closes #260 2017-09-18 23:51:27 +02:00
Wim
2f7df2df43 Do not add messages without ID to cache 2017-08-29 20:28:44 +02:00
Wim
ad3a753718 Remove debug message 2017-08-28 23:07:13 +02:00
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.
2017-08-28 00:33:17 +02:00
Wim
5a8d7b5f6d Modify Send() to return also a message id 2017-08-27 22:59:37 +02:00
Wim
12989bbd99 Handle same account in multiple gateways better 2017-07-30 16:09:05 +02:00
Wim
83ef61287e Refactor. Add tests 2017-07-25 20:11:52 +02:00
Wim
c1c7961dd6 Fix in/out logic. Closes #224 2017-07-22 17:25:22 +02:00
Wim
d3eef051b1 Fix message modification 2017-07-21 17:04:03 +02:00
Wim
6dee988b76 Fix megacheck / go vet issues 2017-07-14 00:35:01 +02:00
Wim
6256c066f1 Replace :emoji: with unicode chars. #215
Add vendor github.com/peterhellberg/emojilib
2017-07-09 14:00:28 +02:00
Wim
1b1a9ce250 Fix samechannel gateway issue. Closes #207 2017-06-27 00:28:18 +02:00
Wim
2ddc4f7ae9 Add UserID to each message. Closes #200 2017-06-18 15:44:54 +02:00
Wim
25b1af1e11 Add option IgnoreMessages to ignore messages based on regexp. (all). Closes #70 2017-06-18 01:08:11 +02:00
Wim
3bc219167a Remove need for channel when using api. Closes #195 2017-06-15 00:40:23 +02:00
Wim
8a55c97b4e Fix utf-8 issues #193 2017-06-15 00:07:12 +02:00
Wim
359d0f2910 Allow reuse of api in different gateways. See #189 2017-06-07 23:54:50 +02:00
Wim
5f30a98bc1 Add gateway name to messages 2017-06-05 23:12:19 +02:00
Wim
c791423dd5 Add NOPINGNICK option. Closes #175 2017-05-30 00:11:53 +02:00
Wim
87229bab13 Fix sending to different channels on same account (slack). Closes #177 2017-05-24 22:10:21 +02:00
Wim
b469c8ddbd Rejoin channel when kicked (irc). Closes #146 2017-04-08 00:42:37 +02:00
Wim
eee0036c7f Modify iconurl correctly (mattermost). Closes #145 2017-04-08 00:16:46 +02:00
Wim
33dffd5ea8 Fix join/leave regression (irc) 2017-04-03 22:18:29 +02:00
Wim
a16ad8bf3b Reuse connection when using same bridge with another gateway. See #87 2017-04-01 17:24:19 +02:00
Wim
2e4d58cb92 Refactor 2017-03-28 23:56:58 +02:00
Wim
fd8cfb11fb Fail when bridge is unable to join a channel (general) 2017-03-16 23:05:11 +01:00
Wim
35025e164a Do not forward empty message from any bridge (general). Closes #128 2017-03-02 23:51:19 +01:00
Wim
73f01ad8d8 Add REST API support 2017-02-18 23:13:46 +01:00
Wim
62b165c0b4 Refactor samechannelgateway 2017-02-17 22:08:30 +01:00
Wim
dc37232100 Refactor. Make extra options easier for other protocols 2017-02-14 23:52:45 +01:00
Wim
163f55f9c2 Refactor to handle disconnects/reconnects better.
Now try to reconnect every 60 seconds until forever.
2017-02-14 21:12:02 +01:00
Wim
991183e514 Fix IgnoreNicks (global). Closes #115 2017-01-21 21:00:40 +01:00
Wim
7685fe1724 Add channel key support (irc). Closes #27 2017-01-04 14:10:35 +01:00
Wim
e1641b2c2e Add support for RemoteNickFormat in general configuration 2016-11-20 23:33:41 +01:00
Wim
e0e1e4be80 Add gateway.inout config for bidirectional bridges. Closes #85 2016-11-20 23:01:44 +01:00
Wim
449ed31e25 Fix ShowJoinPart from irc bridge. Closes #72 2016-11-14 22:53:06 +01:00
Wim
99d130d1ed Refactor 2016-11-13 23:06:37 +01:00
Wim
14830d9f1c Refactor gateway 2016-11-08 23:44:16 +01:00
Wim
2dbe0eb557 Add support for dynamic IconURL (slack). Closes #43 2016-11-05 01:11:51 +01:00
Wim
c3a8b7a997 Refactor modifyMessage 2016-11-04 23:03:31 +01:00
Wim
e93847a95e Launch every account only once. Fixes #48 2016-10-23 22:23:20 +02:00
Wim
47d38192b2 Only send to channels defined in config. Fixes #53 2016-10-23 20:58:04 +02:00
Wim
db0e4ba8c5 Add error message about non-existing channels (slack) 2016-10-08 21:57:03 +02:00
Wim
2d6ed51d94 Bail out on samechannel gateway when a bridge fails to start 2016-10-03 09:23:55 +02:00
Wim
1accee1653 Bail out when a bridge fails to start 2016-10-01 20:07:04 +02:00
Wim
d02a737e0c Cleanup debug messages 2016-09-20 00:21:14 +02:00
Wim
4737442185 Connect only once to each bridge 2016-09-19 23:05:49 +02:00
Wim
a0b84beb9b Add Discord support 2016-09-19 20:53:26 +02:00
Wim
7baf386ede Refactor for more flexibility
* Move from gcfg to toml configuration because gcfg was too restrictive
* Implemented gateway which has support multiple in and out bridges.
* Allow for bridging the same bridges, which means eg you can now bridge between multiple mattermosts.
* Support multiple gateways
2016-09-18 19:21:15 +02:00