Commit Graph

157 Commits

Author SHA1 Message Date
David Hill 0e2522279e Clean up various stuff (#508)
* various cleanups
2018-11-07 20:36:50 +01:00
Duco van Amstel a1bf37e457 Do not join Slack channel without API access (slack) (#563) 2018-11-07 17:25:00 +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
Duco van Amstel 1269be1d04 Prevent Slack API rate-limit overflow (#539) 2018-11-01 21:28:22 +01:00
Patrick Connolly d379118772 Fix bridge no longer POSTing username and avatar (slack) (#536)
* Fixed pointer/reference issue in populateUsers. [#536]

* Accepted codestyle suggestion.

* Update bridge/slack/helpers.go

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

* Update helpers.go
2018-10-24 21:12:20 +02:00
Duco van Amstel 6911458d15 Clean up message send logic (slack). (#531) 2018-10-22 19:43:57 +02:00
Duco van Amstel 6238effdc2 Clean up user and channel information management (slack) (#521) 2018-10-16 20:34:09 +02:00
Duco van Amstel 498377a230 Clean up code and strengthening (slack) (#519)
Changes include:
- Refactor of strings into package-wide constants.
- Predeclaration of regexps to be instantiated at package load time.
- Checking of unchecked errors.
- Structural changes:
  - Adding verifications to type-casting code.
  - Remove unnecessary 'len(X) > 0' checks before iterating over X.
  - Remove unnecessary 'else' clause after 'if' with 'return'.
  - Unexporting of public fields of Bridge struct.
- Formatting:
  - One-field-per-line struct definitions.
2018-10-13 01:02:14 +02:00
Duco van Amstel e15b0e04b8 Refactor slack bridge prelude (#517)
Distributing the source of the Slack bridge across multiple files to
increase readability and as a prelude to various refactors and
clean-ups.
2018-10-12 23:16:34 +02:00
Wim 52dbd702ad Get up to 1000 channels and private/mp/im channels (slack). Related to #489 2018-08-28 22:33:07 +02:00
Wim b51fdbce9f Add caching to fix issue with slack API changes (slack). #481 2018-08-18 00:12:05 +02:00
Wim 7690be1647 Fix slack file/image downloads after api changes (slack) 2018-08-10 00:39:07 +02:00
Wim d71850cef6 Use UserID to look for avatar instead of username (slack). Closes #472 2018-08-06 16:44:15 +02:00
Wim 618953c865 Remove ununsed function (slack) 2018-07-13 23:28:23 +02:00
Wim e04dd78624 Add support for slack channels by ID. Closes #436 2018-07-13 23:23:11 +02:00
Maxim 594492fbdd Add Title from attachment slack message (#446) 2018-06-13 21:58:51 +02:00
Patrick Connolly 045cb2058c Fix regexp in replaceMention (slack). (#435) 2018-05-29 22:49:10 +02:00
Wim 07885f5810 Fix iconurl regression (mattermost,slack,rocketchat). Closes #430 2018-05-27 22:30:17 +02:00
Wim 696c518550 Add error message about webhook (slack) 2018-05-27 22:14:31 +02:00
Wim 411ef2691c Use uuid instead of userid. Fixes #429 2018-05-27 21:50:00 +02:00
OyyoDams f6eefa4ecc Fix issue #432 - Avatar spoofing from Slack to Discord with uppercase in nick doesn't work (#433) 2018-05-26 13:25:26 +02:00
Jerry Heiselman 76af9cba5a Properly set Slack user who initiated slash command (#394)
* Properly set Slack user who initiated slash command
2018-04-25 21:27:34 +02:00
Wim 99ce68e9ba Use username if bot name is Slack API Tester (slack) 2018-04-20 01:01:45 +02:00
Wim 68fbed9281 Make our callbackid more unique. Fixes issue with running multiple matterbridge on the same channel (slack,mattermost) 2018-04-13 22:01:03 +02:00
Jerry Heiselman 76360f89c1 Strip markdown URLs with blank text (slack) (#392) 2018-03-22 22:28:27 +01:00
Wim 8c0b04b995 Ignore restricted_acton on channel join (slack). Closes #387 2018-03-12 21:14:13 +01:00
Wim e5989adf92 Add support for NoSendJoinPart. Closes #382 2018-03-06 21:35:47 +01:00
Wim ab94b5ca7a Update regex for usergroup matching. Closes #379 2018-03-05 20:56:33 +01:00
Wim 8d2ce56c37 Fix regression (slack). Closes #384 2018-03-05 20:19:43 +01:00
Wim f2f1d874e1 Use viper (github.com/spf13/viper) for configuration 2018-03-04 23:52:14 +01:00
Wim 79c4ad5015 Remove unused function 2018-03-03 11:08:39 +01:00
Wim e24f1c7c87 Use replaceVariable for usergroups (slack) #379 2018-03-02 22:32:27 +01:00
Wim 0bc9c70c66 Add usergroup support (slack). Closes #379 2018-02-28 22:54:47 +01:00
Wim 594d2155e3 Improve debug messages 2018-02-28 22:23:29 +01:00
Wim 2bac867382 Refactor using factory 2018-02-27 23:22:12 +01:00
Wim 1578ebb0e2 Refactor slack 2018-02-27 23:22:10 +01:00
Wim 78238c85d4 Add share support between slack instances. Closes #369 2018-02-23 00:49:32 +01:00
Wim f82a9cc7ac Fix Update userlist on join (slack). Closes #372 2018-02-22 23:56:00 +01:00
Wim cce7624ab8 Update userlist on join (slack). Closes #372 2018-02-22 23:36:22 +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 0bcd1e62f3 Add channel_purpose to ShowTopicChange. Ignore (un)pinned_item (slack). #353 2018-02-03 01:15:57 +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 78f1011f52 Add support for file comments (slack). Closes #346 2018-02-02 23:16:10 +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 9f15d38c1c Use upstream again (slack) 2018-01-08 22:41:58 +01:00
Wim 0b3a06d263 Log ConnectionErrorEvent (slack) 2018-01-03 14:06:28 +01:00
Wim 9a6249c4f5 Increase debug logging (slack) 2018-01-02 14:39:27 +01:00
Wim 50bd51e461 Use a better check to join channel (slack) 2018-01-02 14:31:44 +01:00
Wim d0c4fe78ee Allow specifying maximum download size of media using MediaDownloadSize (slack,telegram,matrix) 2017-12-19 23:44:13 +01:00
Wim 265457b451 Refactor and add MediaDownloadSize to General 2017-12-19 23:15:03 +01:00
Wim 0578b21270 Fix message sending (slack) 2017-11-13 19:50:18 +01:00
Wim 36a800c3f5 Add support for comments from slack file uploads (slack) 2017-11-13 00:20:31 +01:00
Wim 6f18790352 Add support to upload files to slack, from bridges with private urls like slack/mattermost/telegram. (slack) 2017-11-03 23:10:16 +01:00
Patrick Connolly bea0bbd0c2 Allow slack messages with variables (eg. @here) to be formatted correctly. (slack) (#288) 2017-11-03 20:32:28 +01:00
Patrick Connolly 4f8ae761a2 Resolve slack channel to human-readable name. (slack) (#282) 2017-11-02 21:21:46 +01:00
Wim b530e92834 Use DisplayName instead of deprecated username (slack). Closes #276 2017-11-02 17:11:42 +01:00
Patrick Connolly 76aafe1fa8 Allowed Slack bridge to extract simpler link format. (#287)
Links sometimes exist without bar delimiters.

See: https://api.slack.com/docs/message-formatting#linking_to_urls
2017-10-26 21:58:43 +02:00
Wim 4e1dc9f885 Use bot username if specified (slack). Closes #273 2017-10-12 20:33:37 +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 5f14141ec9 Try to not forward slack unfurls. Closes #266 2017-09-19 22:33:26 +02:00
Wim d59c51a94b Remove unnecessary check, make megacheck happy 2017-09-19 00:04:27 +02:00
Wim 1a40b0c1e9 Relay attachments from mattermost to slack (slack). Closes #260 2017-09-18 23:51:27 +02:00
Wim ed01820722 Add support for deleting messages across bridges.
Currently fully support mattermost,slack and discord.
Message deleted on the bridge or received from other bridges will be
deleted.

Partially support for Gitter.
Gitter bridge will delete messages received from other bridges.
But if you delete a message on gitter, this deletion will not be sent to
other bridges (this is a gitter API limitation, it doesn't propogate edits
or deletes via the API)
2017-09-11 22:45:15 +02:00
Wim 90a61f15cc Do not break messages on newline (slack). Closes #258 2017-09-10 18:19:33 +02:00
Wim a3470f8aec Send first message after connect (slack). Closes #252 2017-09-07 23:47:23 +02:00
Wim 9226252336 Replace mentions from other bridges. (slack). Closes #233 2017-08-29 23:34:50 +02:00
Wim 8b98f605bc Add support for editing messages (slack) 2017-08-28 20:29:02 +02:00
Wim 5a8d7b5f6d Modify Send() to return also a message id 2017-08-27 22:59:37 +02:00
Wim 43bd779fb7 Handle leave/join events (slack). Closes #246 2017-08-27 00:00:02 +02:00
Wim 28710d0bc7 Allow a webhookurl per channel (discord). #239 2017-08-12 14:51:41 +02:00
Wim f8e6a69d6e Add action support for slack,mattermost,irc,gitter,matrix,xmpp,discord. #199 2017-07-30 17:48:23 +02:00
Wim bd97357f8d Disable message from other bots when using webhooks (slack) 2017-07-22 20:03:40 +02:00
Wim dc8743e0c0 Tag messages we send ourself using CallbackID hack (slack). Closes #219 2017-07-17 21:28:31 +02:00
Jerry Heiselman cc5ce3d5ae Suppress parent message when child message is received (slack) (#218)
* Suppress parent message when child message is received

When a thread is started in Slack and a user makes a comment on the thread, matterbridge sends the original parent message again on each child comment. This change suppresses that.

* Update slack.go

Moved determination of ThreadTimestamp to handleSlackClient so the MMMessage struct doesn't need to be modified

* Ran 'go fmt'
2017-07-17 18:33:28 +02:00
Wim 778abea2d9 Add support for fallback/text in attachments (slack) 2017-07-16 18:08:26 +02:00
Wim 20a7ef33f1 Make sure bot doesn't loop now we relay bot messages (slack) 2017-07-16 15:03:46 +02:00
Wim 335ddf8db5 Fix lookup bot username (slack). #213 2017-07-16 14:18:33 +02:00
Wim 9dcd51fb80 Refactor connecting logic slack/mattermost. Fixes #216 2017-07-15 16:49:47 +02:00
Wim 6dee988b76 Fix megacheck / go vet issues 2017-07-14 00:35:01 +02:00
Wim 8411f2aa32 Lookup bot username (slack). #213 2017-07-10 21:58:43 +02:00
Wim b75cf2c189 Replace HTML entities (slack). #215 2017-07-09 14:26:56 +02:00
Wim 830361e48b Deprecate URL,useAPI,BindAddress (slack,mattermost,rocketchat) 2017-06-29 23:38:48 +02:00
Wim c268e90f49 Remove label from URLs (slack). Closes #205
If slack detects a text contains an url it changes it to <http://url|url>.
Strip the |url so that http://url remains.
2017-06-26 22:16:19 +02:00
Wim 2ddc4f7ae9 Add UserID to each message. Closes #200 2017-06-18 15:44:54 +02:00
Wim 87229bab13 Fix sending to different channels on same account (slack). Closes #177 2017-05-24 22:10:21 +02:00
Wim 246c8e4f74 Ignore error on private channel join (slack) Fixes #150 2017-04-17 18:01:24 +02:00
Wim 4d2207aba7 Add support for edited messages (slack) 2017-04-16 00:16:24 +02:00
Wim f935c573e9 Allow bot tokens for now without warning (slack). Closes #140 2017-03-27 20:15:05 +02:00
Wim 072cac0347 Do not relay slackbot messages (slack). Closes #119 2017-02-17 23:13:02 +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 2b0f178ba3 Fix receiving messages from private channels (slack). See #118 2017-02-03 16:40:15 +01:00
Wim 53e9664cde Add support for private channels (slack). Closes #118 2017-01-28 00:36:53 +01:00
Wim b3c3142bb2 Do not use API functions in webhook (slack). Closes #110 2017-01-12 00:40:50 +01:00
Wim d5845ce900 Replace id-mentions to usernames (slack). Closes #86 2016-11-20 22:40:09 +01:00
Wim 99d130d1ed Refactor 2016-11-13 23:06:37 +01:00
Wim a3dd0f1345 Add support for using avatars from discord,slack and gitter in slack 2016-11-06 00:46:32 +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 96620a3c2c Drop first received message on connection to avoid duplicates (slack). Fixes #55 2016-10-29 21:05:56 +02:00