Commit Graph

871 Commits (master)

Author SHA1 Message Date
Qais Patankar 6cadf12260
Add a prefix handler for unthreaded messages (discord) (#1346) 3 years ago
Wim 19d47784bd
Add threading support with token (discord) (#1342)
Webhooks don't support the threading yet, so this is token only.
In discord you can reply on each message of a thread, but this is not possible in mattermost (so some changes added there to make sure we always answer on the rootID of the thread).

Also needs some more testing with slack.

update : It now also uses the token when replying to a thread (even if webhooks are enabled), until webhooks have support for threads.
3 years ago
Qais Patankar b89102c5fc
Fix 'webook' typo in discord/webhook.go (#1344) 3 years ago
James Lu a9f89dbc64
Add support for stateless bridging via draft/relaymsg (irc) (#1339)
* irc: add support for stateless bridging via draft/relaymsg

As discussed at https://github.com/42wim/matterbridge/issues/667#issuecomment-634214165

* irc: handle the draft/relaymsg tag in spoofed messages too

* Apply suggestions from code review

Co-authored-by: Wim <wim@42.be>

* Run gofmt on irc.go

* Document relaymsg in matterbridge.toml.sample

Co-authored-by: Wim <wim@42.be>
3 years ago
Qais Patankar 6de4c7e971
Update webhook documentation (discord) (#1335) 4 years ago
Qais Patankar 03dc51ffa2 Split Bdiscord.Send into handleEventWebhook and handleEventBotUser (discord) 4 years ago
Qais Patankar aef2dcdfdd Move webhook specific logic to its own file (discord) 4 years ago
Qais Patankar 0494119bf4 Extract maybeGetLocalAvatar into its own function (discord) 4 years ago
Qais Patankar 0a17e21119 Remove WebhookURL support (discord) 4 years ago
Qais Patankar 52e2f926f4 Add initial transmitter implementation (discord)
This has been tested with one webhook in one channel.

Sends, edits and deletions work fine
4 years ago
Qais Patankar 611fb279bc Revert "Disable webhook editing (#1296)" (discord)
This reverts commit c23252ab53.
4 years ago
Gary Kim 41b4e64be9
Update go-nc-talk (nctalk) (#1333)
Signed-off-by: Gary Kim <gary@garykim.dev>
4 years ago
Wim 4913766d58
Parse fencedcode in ParseMarkdown. Fixes #1127 (#1329) 4 years ago
Wim 92da8c7044
Mark messages as read (matrix). Fixes #1317 (#1328) 4 years ago
Wim 2d3c26a4b2
Implement ratelimiting (matrix). Fixes #1238 (#1326) 4 years ago
Wim 8eba2d3e50
Make handlers run async (irc) (#1325)
This makes the handlers run in a seperate go-routine in girc, and makes
sure that girc isn't blocked on executing PONG requests when
matterbridge takes a long time handling the incoming message.

This can happen when another bridge is in a backoff state where the
backoff time exceeds the IRC ping timeout.
4 years ago
Qais Patankar c42167c6f4
Refactor guild finding code (discord) (#1319) 4 years ago
Sebastian P 44d182e2f9
Add nil checks to text message handling (mumble) (#1321) 4 years ago
Wim ad95e35687 Rename jfif to jpg (whatsapp). Fixes #1292 4 years ago
Wim 640a9995f4 Refactor handleTextMessage (whatsapp) 4 years ago
Wim 95625f6871 Refactor image downloads (whatsapp) 4 years ago
Wim 2c20f72a9c Handle audio downloads (whatsapp) 4 years ago
Wim 5ad788e768 Handle video downloads (whatsapp) 4 years ago
Wim ed98c586c6 Add support for deleting messages (whatsapp) 4 years ago
Wim 3e865708d6 Refactor/cleanup code (whatsapp) 4 years ago
Simon THOBY 29e29439ee
Show mxids in case of clashing usernames (matrix) (#1309)
Fixes #1302.
4 years ago
Wim 0c19716f44
Join on invite (irc). Fixes #1231 (#1306) 4 years ago
Wim b24e1bafa1
Add support for irc to irc notice (irc). Fixes #754 (#1305) 4 years ago
Wim 64b899ac89
Retry until we have contacts (whatsapp). Fixes #1122 (#1304) 4 years ago
Wim c23252ab53
Disable webhook editing (discord) (#1296)
See https://github.com/42wim/matterbridge/issues/1255 and
https://github.com/qaisjp/go-discord-irc/issues/57

Webhook edits gets ratelimited which cause other problems with
matterbridge. Disabling for now.
4 years ago
Simon THOBY 1a3c57a031
Send the display name instead of the user name (matrix) (#1282)
* matrix: send the display name (the nickname in matrix parlance) instead of the user name

There is also the option UseUserName (already in use by the discord bridge) to turn back to the old behavior.

* matrix: update displayNames on join events

* matrix: introduce a helper.go file to keep matrix.go size reasonable
4 years ago
Simon THOBY cbb46293ab
Update webhook messages via new endpoint (discord)
When using the webhook, the previous method to edit a message was to
delete the old one via the classical API, and to create a new message
via the webhook. While this works, this means that editing "old" messages
lead to a mess where the chronological order is no longer respected.

This uses an hidden API explained in https://support.discord.com/hc/en-us/community/posts/360034557771
to achieve a proper edition using the webhook API.

The obvious downside of this approach is that since it is an
undocumented API for now, so there is no stability guarantee :/
4 years ago
George 765e00c949
Add NoTLS option to allow plaintext XMPP connections (#1288)
Co-authored-by: George <zhoreeq@users.noreply.github.com>
4 years ago
Simon THOBY 662359908b
Allow message edits on matrix (#1286)
based on https://github.com/Half-Shot/matrix-doc/blob/hs/1695-message-edits-proposal/proposals/1695-message-edits.md
4 years ago
Wim 4f8b19c686
Add PingDelay option (irc) (#1269) 4 years ago
Dellle 3188a9ffe6
Add username formatting for all events (matrix) (#1233) 4 years ago
Wim 61569a8610
Add even more debug for irc (#1266) 4 years ago
Gary Kim 950f2759bd
Add support for downloading files (nctalk) (#1249)
Signed-off-by: Gary Kim <gary@garykim.dev>
4 years ago
Wim 25c82ddf02
Use vendored whatsapp version (#1258) 4 years ago
Gary Kim 219a5453f9
Append a suffix if user is a guest user (nctalk) (#1250)
Signed-off-by: Gary Kim <gary@garykim.dev>
4 years ago
Sebastian P 214a6a1386
Add Mumble support (#1245) 4 years ago
Dellle a42e488e58
Add username for images from WhatsApp (#1232) 4 years ago
Ben Wiederhake 06eb89b05b
Matrix: Permit uploading files of other mimetypes (#1237)
This includes at least c-source-files, cpp-source-files,
markdown-files, Rust-files, and plaintext files.
We already allow uploading arbitrary executables. (And javascript-files,
coincidentally.) Not permitting these other text files would be highly unexpected.
4 years ago
Wim cec63546ff
Check location of avatarURL (zulip). Fixes #1214 (#1227) 4 years ago
Tilo Spannagel 712385ffd5
Format rich object strings (nctalk) (#1222)
Signed-off-by: Tilo Spannagel <development@tilosp.de>
4 years ago
Tilo Spannagel f9928c9e25
Switch to upstream gomatrix (#1219)
Signed-off-by: Tilo Spannagel <development@tilosp.de>
4 years ago
Gary Kim a0741d99b8
Add TLSConfig to nctalk (#1195)
Signed-off-by: Gary Kim <gary@garykim.dev>
4 years ago
NikkyAI c63f08c811
Sent loopback messages to other websockets as well (api) (#1216) 4 years ago
escoand 58b6c4d277
Handle broadcasts as groups in Whatsapp (#1213)
The current way to get the correct JID of a WhatsApp group is to dump all JIDs to the log and grab the right one. This is working for for groups fine but not for broadcast, as they are not print out.

According to https://www.npmjs.com/package/@noamalffasy/js-whatsapp we have these possibilities:
* Chats: `[country code][phone number]@s.whatsapp.net`
* Groups: `[country code][phone number of creator]-[timestamp of group creation]@g.us`
* Broadcast Channels: `[timestamp of group creation]@broadcast`

But the bridge does currently interprets (and prints) the only second option.
4 years ago
NikkyAI 27c02549c8
Replace gorilla with melody for websocket API (#1205) 4 years ago
Wim d5feda5c8a
Fix error loop (zulip) (#1210)
Fixes #1047
4 years ago
Wim 2f506425c2
Update whatsapp vendor and fix a panic (#1209)
* Fix another whatsapp panic

* Update whatsapp vendor
4 years ago
Wim 56159b9bce
Sleep when ratelimited on joins (matrix). Fixes #1201 (#1206) 4 years ago
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.
4 years ago
Dellle 63a1847cdc
Remove HTML formatting for push messages (#1188) (#1189)
When there is a valid HTML formatting then remove this in the cleartext
field of the matrix client. This leads to nicer push messages on
smartphone apps.

Fix #1188
4 years ago
Wim 4e50fd8649
Use mattermost v5 module (#1192) 4 years ago
Wim ebd2073144
Handle panic in whatsapp. Fixes #1180 (#1184) 4 years ago
Gary Kim 71a5b72aff
Add Nextcloud Talk support (#1167)
Signed-off-by: Gary Kim <gary@garykim.dev>
4 years ago
z3bra 213bf349c3
Add an option to log into a file rather than stdout (#1168)
Use Logfile option in the `[general]` section
4 years ago
Andrey Groshev a94fe55886
Fix MarkdownV2 support in Telegram (#1169) 4 years ago
haykam821 9b22f16497
Add websocket to API (#970)
Co-authored-by: Qais Patankar <qaisjp@gmail.com>
4 years ago
Nathanaël 1fee323247
Reload user information when a new contact is detected (whatsapp) (#1160)
Before returning an empty string, we refresh the WhatsApp contacts and if we found the one we wanted, we can return a real name. Fixes #796
4 years ago
Qais Patankar a41accd033
Add sane RemoteNickFormat default for API (#1157) 4 years ago
James Lu 37f7caf7f3
Skip gIRC built-in rate limiting (irc) (#1164)
By default, gIRC rate limits all outgoing messages. 
Since matterbridge already implements message throttling, this is extra layer of throttling is not necessary.
4 years ago
TheHolyRoger 5847f7758c
Only colour IRC nicks if there is one. (#1161) 4 years ago
Wim 7f7ca697a0
Ignore non-user messages (msteams). Fixes #1141 (#1149)
Ignore these messages for now, also add a extra
debug option for msteams so we can dump the whole
message.
4 years ago
Alexander 900375679b
Prevent re-requesting avatar data (xmpp) (#1117)
Prevent asking the server again and again for a
user's avatar if the server does not respond to
our initial request.
4 years ago
Wim 393f9e998b
Update dependencies / vendor (#1146) 4 years ago
Wim ba0bfe70a8
Add StripMarkdown option (irc). (#1145)
Enable `StripMarkdown` to strip markdown for irc.
4 years ago
Wim 3c4a3e3f75
Implement xep-0245 (xmpp). Closes #1137 (#1144) 4 years ago
Wim 274fb09ed4
Fix forward from hidden users (telegram). Closes #1131 (#1143)
Use ForwardDate to check if a message is forwarded.
If we have a nil ForwardedFrom then make this an unknown user.
4 years ago
Wim d44598a900
Add an option to disable sending HTML to matrix. Fixes #1022 (#1135) 4 years ago
Wim c9cfa59f54
Do not use webhooks when token is configured (slack) (fixes #1123) (#1134) 4 years ago
Tiago Epifânio 7062234331
Avoid creating invalid url when the user doesn't have an avatar (matrix) (#1130) 4 years ago
Qais Patankar 9754569525
Fix webhook EventUserAction messages being skipped (discord) (#1133)
Fixes #1132
4 years ago
Qais Patankar 52a071e34d
Fix #1049: missing space before embeds (discord) (#1124) 4 years ago
Qais Patankar 2d8f749e36
Fix #1120: replaceAction "_" crash (discord) (#1121) 4 years ago
Wim eaf92fca4d
Add an ID cache (discord). Fixes #1106 (#1111)
When a webhook "edits" a message, it does this by deleting the message
and creating a new one with the new content.

On creation of this new message, we'll get another ID then already is
know by the gateway in its id cache. So we add it in our own cache and
replace it whenever we want to edit/delete it again.
4 years ago
Wim d99c54343a
Remove panics and retry polling on failure (msteams). Fixes #1104 (#1105) 4 years ago
Wim e564c555d7
Clip too long messages on 3000 length (slack). Fixes #1081 (#1102) 4 years ago
Wim f7ec9af9e8
Add extra space before colon in attachments (irc). Fixes #1089 (#1101) 4 years ago
Wim 4d93a774ce
Ignore non-critical errors (whatsapp). Fixes #1094 (#1100) 4 years ago
Wim 9190365289
Add JoinDelay option (irc). Fixes #1084 (#1098) 4 years ago
Wim 57794b3b9f
Prevent image/message looping (slack). Fixes #1088 (#1096)
Also check for our matterbridge ID in Blocks set in SubMessages.
4 years ago
ldruschk 8e6ddadba2
Relay Joins/Topic changes in RocketChat bridge (#1085)
This pull request properly sets the events EventJoinLeave and EventTopicChange for messages from the RocketChat bridge and drops messages which are neither one of those events nor plain messages.
4 years ago
Alexander 7183095a28
Implement User Avatar spoofing of XMPP users (#1090)
* Implement User Avatar spoofing of XMPP users
4 years ago
Wim 8950575bfb
Update Rhymen/go-whatsapp vendor and whatsapp version (#1078) 4 years ago
Wim 8d08e348a9
Reset start timestamp on reconnect (whatsapp). Fixes #1059 (#1064) 4 years ago
Wim 29f658fd3c Use DebugWriter after upstream changes (xmpp) 4 years ago
Wim 0df2539641
Use upstream yaegashi/msgraph.go/msauth (msteams) (#1067) 4 years ago
Wim 1aa662f763
Update client version whatsapp. Fixes #1061 (#1062)
See https://github.com/Rhymen/go-whatsapp/issues/305
4 years ago
Qais Patankar 98033b1ba7
Don't transmit typing events from ourselves (slack/discord) (#1056) 4 years ago
Qais Patankar af0acf0dae
Strip extra info from emotes (discord) (#1052) 4 years ago
Qais Patankar 802c80f40c Update vendor yaegashi/msgraph.go to v0.1.2 (1) 4 years ago
Wim 281016a501
Fix duplicate separator on empty description/url (discord). Fixes #1008 (#1035)
Make this work for all possible cases.
Add tests
4 years ago
Qais Patankar d4acdf2f89
Use blocks not attachments (slack) (#1048)
This removes the extra space below messages, as shown in
https://user-images.githubusercontent.com/923242/77235190-a3359980-6bab-11ea-8b7b-697d730ae5c1.png
4 years ago
Qais Patankar 0951e75c85
Fix #1039: messages sent to Slack being synced back (#1046)
This is a regression from https://github.com/42wim/matterbridge/pull/581#issuecomment-562937576

Behaves the same as 95190f11bf
4 years ago
Jakub 6b017b226a
Support JSON and YAML config formats (#1045)
Signed-off-by: Jakub Sokołowski <jakub@status.im>
4 years ago
Qais Patankar 9e3bd7398c
Fix #1027: warning when handling inbound webhooks (discord) (#1044) 4 years ago
Qais Patankar 79f764c7a8 Refactor webhook permission checks 4 years ago
Qais Patankar b5dc4353fb Fix #1040: spotty webhook permission verification 4 years ago
Qais Patankar 2fbac73c29
Ignore ConnectingEvent (slack) (#1041) 4 years ago
Wim 9785edd263
Remove replace directives and use own fork to make go get work again (#1028)
See https://github.com/golang/go/issues/30354
go get doesn't honor the go.mod replace options.
4 years ago
Wim 3f06a40bd5 Support code snippets from msteams 4 years ago
Wim 68f43985ad Add scopes again 4 years ago
Wim 915ca8f817 Make linter happy and cleanup (msteams) 4 years ago
Wim a65a81610b Support threading from other bridges to msteams 4 years ago
Wim 8eb6ed5639 Support receiving attachments from msteams 4 years ago
Wim 795a8705c3 Add initial Microsoft Teams support
Documentation on https://github.com/42wim/matterbridge/wiki/MS-Teams-setup
4 years ago
Wim 250b3bb579
Use upstream slack-go/slack again (#1018) 4 years ago
Wim e343db6f72
Make avatars download work with mediaserverdownload (telegram). Fixes #920 (#1012) 4 years ago
Wim 54ed6320c2 Add support for avatars from matrix. #984 (#1007) 4 years ago
Wim 1985873494 Implement basic reconnect (whatsapp). Fixes #987 (#1003) 4 years ago
Qais Patankar 8ae5917659
Be less lossy when throttling IRC messages (#1004)
Note that msg.Text and chucking it through a chan is OK: https://play.golang.org/p/MTfT3YSsgPX
4 years ago
Qais Patankar c91bfd08d8 Add ability to procure avatars from the destination bridge (#1000)
* remote_avatar: add UseLocalAvatar

* remote_avatar: make sure msg.Protocol is always set correctly

* remote_avatars: support msg.Account

* remote_avatar: add to matterbridge.toml.sample

* remote_avatar: clarify something
4 years ago
Wim c01c8edeb8 Fix go-keybase-chat-bot api changes 4 years ago
Qais Patankar 1420f68050 Check only bridged channels for PermManageWebhooks (discord) (#1001)
* Check only bridged channels for PermManageWebhooks

* add note
4 years ago
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
4 years ago
Wim 1bf46b7711
Fix duplicated messages (sshchat). Fixes #950 (#996) 4 years ago
Wim b85bae31d9
Show file comment in webhook if normal message is empty (discord). Fixes #962 (#995) 4 years ago
Wim f8ad877601
Add DisableWebPagePreview option (telegram). Closes #980 (#994) 4 years ago
Wim 585d1556c1
Disable smartypants in markdown parser. Fixes #989, #983 (#993) 4 years ago
Wim 7486555875
Fail with message instead of panic. #988 (#991) 4 years ago
Humorhenker fc30b1bacc
Add QuoteLengthLimit option (telegram) fixes #963 (#985)
* QuoteLengthLimit option added to limit max. quoted message length if QuoteLengthLimit = 0 the whole message will be quoted
4 years ago
Wim 4c44515f9d
Fix channel ID problem with multiple gateways (discord). Fixes #953 (#977) 4 years ago
Guillaume Lazzara c9d5f4c898 Add support for WhatsApp media (jpeg/png/gif) bridging (#974)
* Whatsapp image bridging

* Prevent double message in telegram when media with caption received

Co-authored-by: imShara <shara@protonmail.com>
4 years ago
c0ncord2 810c150781 move stripCustomoji logic to default Tengo script (#973)
*  move stripCustomoji logic to default Tengo script 

Removing the image ID from the message (without any possibility of recovering it later) is a loss of valuable data that prevents users from giving support to custom emoji via Tengo scripts.

* bugfix - do send colors to other irc bridges

"if we're not sending to an irc bridge we strip the IRC colors"

Co-authored-by: c0ncord <59654954+c0ncord@users.noreply.github.com>
4 years ago
Wim 1f830963f6
Return when we have only WebhookURL (mattermost). Fixes #954 (#960) 5 years ago
Benjamin 0917dc8766 Update markdown parsing library to github.com/gomarkdown/markdown (#944) 5 years ago
Gonçalo Ribeiro c394de0c88 Add support for receiving attachments (keybase) (#923) 5 years ago
Wim 0bc159341d
Update vendor (#932)
* Update vendor

* Fix godiscord api change
5 years ago
Wim 45bf1fd63a
Convert slack bold/strike to correct markdown (slack). Fixes #918 (#930) 5 years ago
Wim ff0de85817
Remove obsolete file upload links (discord). Fixes #908 (#931)
Since v1.16.0 we now can upload files via webhook.
Old way of showing files with webhook only setup can be removed.
5 years ago
Wim 727fa9f929
Add support for uploading application/x and audio/x (matrix). Fixes #925 (#929) 5 years ago
Wim 00967a98ac
Fix panic on WebhookURL only setting (mattermost). Closes #916 (#917) 5 years ago
Qais Patankar 1d708ab351 Suppress unhandled HelloEvent message (slack) (#913) 5 years ago
Qais Patankar ba6759010b Add UserTypingSupport (discord) (#914)
* Add Discord to UserTypingSupport

* discord: start typing in a channel on EventUserTyping receive

* discord: emit EventUserTyping to gateway
5 years ago
Wim 0abf4d5d5d
Specify correct GuildID on unknown user query (discord). Fixes #879 (#894) 5 years ago
Michal Suchánek 9b320cd43f Add token support (RocketChat) (#892)
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
5 years ago
Wim 28783a4146
Do configuration validation on start-up. Fixes #888 (#889)
Fail if:
* we don't have any gateways configured
* we have gateways configured but with non-existing bridge configuration
* we have gateways configured without any configuration
5 years ago
Wim a3bee01e0a
Update dependencies (#886) 5 years ago
Wim 3562d4220c
Bail if incorrect Jid (xmpp). Fixes #869 (#883) 5 years ago
Wim f66d5f1e58 Add extra debug info (discord) 5 years ago
MOZGIII cec086994e Add support for sending files via webhook (discord) (#872) 5 years ago
cori hudson 921f2dfcdf Add initial Keybase Chat support (#877)
* initial work on native keybase bridging

* Hopefully make a functional keybase bridge

* add keybase to bridgemap

* send to right channel, try to figure out received msgs

* add account and userid

* i am a Dam Fool

* Fix formatting for messages, handle /me

* update vendors, ran golint and goimports

* move handlers to handlers.go, clean up unused config options

* add sample config, fix inconsistent remote nick handling

* Update readme with keybase links

* Resolve fixmie errors

* Error -> Errorf

* fix linting errors in go.mod and go.sum

* explicitly join channels, ignore messages from non-specified channels

* check that team names match before bridging message
5 years ago
Wim 79a006c8de
Fix regression (discord). Closes #864 (#866) 5 years ago
Wim 7d2e440c83
Add support for discord category channels (discord) (#863)
This adds support for the discord category option that can be used
to group channels in. This means we can have multiple channels with
the same name.

We add the option to specify a category in the channel option of a
discord account under [[gateway]]

Besides channel="channel" or channel="ID:channelID", now also
channel="category/channel" can be specified.

This change remains backwards compatible with people that haven't
specified the category and incorporates the fix in #861
5 years ago
Qais Patankar 5551f9d56f Fix discord channel & category name clash. #860 (#861) 5 years ago
Wim 1fb91c6316
Fix panic by checking slice bounds in handleEntities (telegram). Fixes #857 (#858)
Besides the bound checking, this now also use utf16 as suggested by
https://github.com/go-telegram-bot-api/telegram-bot-api/issues/231
5 years ago
Qais Patankar e60949ff3f Support webhook message deletions (discord) (#853)
* Support webhook message deletions (discord)

Messages sent via webhook can now be deleted. It seems it can do this
without any special permissions.

This copies discordgo.WebhookExecute and makes it support the returning
of discordgo.Message.

A pull request has been sent upstream, so we should use that if
@bwmariin accepts the pull request:

https://github.com/bwmarrin/discordgo/pull/663

Changes in behaviour (webhook mode only):
- Previously messages *edited* on other platforms would just be
retransmitted as a brand new message to Discord.
- Message *edits* will now be ignored.
- Debug: message edits will now print out a "permission error".

In the future it may be good to send an "message edited" react to those
webhook messages, so at least people know that the message was edited on
other platforms. (Even though it can't actually show the new message.)

Alternatively, message edits could just send a brand new message with a
link back to the old one. This is a little ugly but it would ensure that
Discord users are able to see the edited message. These "message edit
notifications" would be sent from the bot user (not from a webhook), so
we could edit the "edit notification" if subsequent edits to the
original message are made.
5 years ago
Wim cf3cddafab Keep connection state. Fixes #856
Actually check if we're connected when trying to Send() a message.
Messages now will get dropped when not connected.

TODO: Ideally this should be in a ring buffer to retransmit when the
connection comes back up.
5 years ago
Joona Hoikkala 80b4cec87a Add an option to skip the Mattermost server version check (#849)
Adds SkipVersionCheck bool option for mattermost
5 years ago
Qais Patankar 76c7b69e4e Support bulk deletions (discord) 5 years ago
Nick 7a3bb0e55c Verify TLS against JID domain, not the host. (xmpp) (#834)
Partially fixes #820.

A full fix requires patching https://github.com/matterbridge/go-xmpp to use DNS SRV records.
5 years ago
Wim 6e8f535e8b Fix logic (xmpp) 5 years ago
Wim 5619a75b05
Fix regression in autojoining with legacy tokens (slack). Fixes #651 (#848) 5 years ago
Wim 53dfb78215
Allow messages with timestamp (xmpp). Fixes #835 (#847) 5 years ago
Wim 8e97cbab1e Fix noisy whatsapp error logging 5 years ago
Wim ce7b749fd5 Update github.com/Rhymen/go-whatsapp vendor. Fixes #843 5 years ago
Wim 6617bd6609 Revert xmpp to orig behaviour. Closes #844 5 years ago
Wim e610fb3201 Make config parse errors readable 5 years ago
Wim 40f1d35415 Fix go mod issue by removing whatsapp-ext 5 years ago
Duco van Amstel 3724cc3a15 Clean-up XMPP handling code (#831) 5 years ago
Wim 3418e8c9af
Use upstream whatsapp again (#809) 5 years ago
Wim 1829dc3d9f Allow messages from other bots (discord). Fixes #816 5 years ago
Wim 65781b9316
Disable user lookups on delete messages (slack) (#812) 5 years ago
Duco van Amstel 9be0be0316 Add lacking clean-up in Slack synchronisation (#811) 5 years ago
Wim fed77cccf3 Handle unthreaded messages (mattermost). Fixes #803 5 years ago
Wim 9b520dfb78 Fix panic on nil message.Post (mattermost). Fixes #804 5 years ago
Wim 2d277a15f5
Add scripting (tengo) support for every outgoing message (#806)
Adds a new key OutMessage under [tengo] table, which specifies the location of the script that
will be invoked on each message being sent to a bridge and can be used to modify the Username
and the Text of that message.

The script will have the following global variables:
read-only:
inAccount, inProtocol, inChannel, inGateway
outAccount, outProtocol, outChannel, outGateway

read-write:
msgText, msgUsername

The script is reloaded on every message, so you can modify the script on the fly.

The default script in https://github.com/42wim/matterbridge/tree/master/internal/tengo/outmessage.tengo
is compiled in and will be executed if no script is specified.
5 years ago
chotaire 6b47e29583 Add verbose IRC joins/parts (ident@host) (#805)
New configuration setting: VerboseJoinPart (default is false)
5 years ago
Wim 380c38674c Fix deadlock on reconnect (irc). Closes #757 5 years ago
Wim 5677c912a8
Add useraction support (rocketchat). Closes #772 (#794) 5 years ago
Wim 7a24de15e4
Add tengo support to RemoteNickFormat (#793)
This commit add support for using the result of a tengo script in RemoteNickFormat using {TENGO}
Also adds a new toml table [tengo] with key RemoteNickFormat and value location of the script.
This also moves the TengoModifyMessage from [general] to Message in [tengo]

Documentation:

RemoteNickFormat allows you to specify the location of a tengo (https://github.com/d5/tengo/) script.
The script will have the following global variables:
to modify: result
to read: channel, bridge, gateway, protocol, nick

The result will be set in {TENGO} in the RemoteNickFormat key of every bridge where {TENGO} is specified
The script is reloaded on every message, so you can modify the script on the fly.
Example script can be found in https://github.com/42wim/matterbridge/tree/master/contrib/remotenickformat.tengo

[tengo]
RemoteNickFormat="remotenickformat.tengo"
5 years ago
Wim 8a875f292e Revert fix for #722. Closes #781
Revert "Fix typo"

This reverts commit dffd67eb31.

Revert "Handle quit message relay better on gateways with one channel on the irc bridge #722"

This reverts commit 240559581a.

Revert "Support quits from irc correctly. Fixes #722 (#724)"

This reverts commit d76a04bd0a.
5 years ago
Wim 60a85621ea Return when not connected and drop a message (irc). Fixes #786 5 years ago
Wim cdf33e5748 Use default nick if none specified (irc). Fixes #785 5 years ago
Wim 01d0a9f412 Handle nil message (telegram). Fixes #777 5 years ago
Wim 8cc2d3b4fe Revert "Bail if any vars are nil, not if all (telegram) (#778)"
This reverts commit efd2c99862.
5 years ago
Wim 64b57f2da3
Ignore message_replied and hidden messages (slack). Fixes #709 (#779) 5 years ago
David Hill efd2c99862 Bail if any vars are nil, not if all (telegram) (#778) 5 years ago
Wim 16763b715a
Look up #channel too (rocketchat). Fix #773 (#775) 5 years ago
David Hill 97f9d4be67 Fix double unlock (slack) (#771) 5 years ago
Wim 77516c97db
Allow the # in rocketchat channels (backward compatible) (#769) 5 years ago
Duco van Amstel 8b754017ca Fix race-condition in populateUser() (#767)
Fix the root-cause of #759 by introducing synchronisation points for
individual user fetches.
5 years ago
Wim a27600046e
Fix regression for legacy slack by #766 (#768) 5 years ago
Duco van Amstel fb2667631d Refactor channel and user management (slack) (#766) 5 years ago
Duco van Amstel b638f7037a Force Slack link unfurling (#763) 5 years ago
Duco van Amstel 74699a8262 Split-out Slack user and channel management (#762) 5 years ago
Wim e955a056e2
Trim <p> and </p> tags (matrix). Closes #686 (#753) 5 years ago
Wim 53aa076555
Do not send duplicate messages (rocketchat). Fixes #745 (#752)
For an unknown reason we get duplicate messages (from the same channel)
using the realtime API when we have > 1 channel subscribed on.
Solution for now is caching the message ID in a LRU cache and ignoring
the duplicates.

This should be reviewed when we have actual editing support from the
realtime API
5 years ago
Wim f57370f33a
Add support for URL in messageEntities (telegram). Fixes #735 (#736) 5 years ago
Wim c557d51b6f
Need to specify /topic:mytopic for channel configuration (zulip). (#751)
Breaking change for zulip channel configuration.

For zulip the channel configuration will now need to specify also
the topic with /topic:yourtopic.

Example:
[[gateway.inout]]
account="zulip.streamchat"
channel="general/topic:mytopic"

This fixes the incorrect PR #701 which didn't work with multiple
gateways.
5 years ago
Wim df3fdc26a0
Use whatsapp forks (#750) 5 years ago
Wim af00c34aac
Do not relay any bot messages (discord) (#743) 5 years ago
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
5 years ago
Wim b09a73040f
Print errors as string instead of %#v (#738) 5 years ago
Wim 740b5f2602
Keep reconnecting until succeed (zulip) (#737) 5 years ago
Wim 96841c70c7 Fix regression in HTML handling (telegram). Closes #734
* Revert back to blackfriday v1
* Add testing
5 years ago
Wim a775b57134
Do not send topic changes on connect (xmpp). Fixes #732 (#733)
This checks if we get a topic change < 5 seconds after connection.
If that's the case, ignore it.
Also this PR makes the topic change an actual EventTopicChange.
5 years ago