Commit Graph

131 Commits (af00c34aaccb3521b8dbf0bd8876a5b38d5d42f4)

Author SHA1 Message Date
Wim 120bf39f55
Handle file upload/download only once for each message (#742) 6 years ago
Wim 7f1d86b338
Fail gracefully on incorrect human input. Fixes #739 (#740) 6 years ago
Wim bf21604d42
Make all loggers derive from non-default instance (#728) 6 years ago
Wim 1bb39eba87
Add scripting (tengo) support for every incoming message (#731)
TengoModifyMessage allows you to specify the location of a tengo (https://github.com/d5/tengo/) script.
This script will receive every incoming message and can be used to modify the Username and the Text of that message.
The script will have the following global variables:
to modify: msgUsername and msgText
to read: msgChannel and msgAccount

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/gateway/bench.tengo
and https://github.com/42wim/matterbridge/tree/master/contrib/example.tengo

The example below will check if the text contains blah and if so, it'll replace the text and the username of that message.
text := import("text")
if text.re_match("blah",msgText) {
    msgText="replaced by this"
    msgUsername="fakeuser"
}

More information about tengo on: https://github.com/d5/tengo/blob/master/docs/tutorial.md and
https://github.com/d5/tengo/blob/master/docs/stdlib.md
6 years ago
Wim 3190703dc8
Support rewriting messages from relaybots using ExtractNicks. Fixes #466 (#730)
some examples:
this replaces a message like "Relaybot: <relayeduser> something interesting" to "relayeduser: something interesting"
ExtractNicks=[ [ "Relaybot", "<(.*?)>\\s+" ] ]
you can use multiple entries for multiplebots
this also replaces a message like "otherbot: (relayeduser) something else" to "relayeduser: something else"
ExtractNicks=[ [ "Relaybot", "<(.*?)>\\s+" ],[ "otherbot","\\((.*?)\\)\\s+" ]
OPTIONAL (default empty)
ExtractNicks=[ ["otherbot","<(.*?)>\\s+" ] ]
6 years ago
Wim 42276ea7d0 Disable updateChannelMembers for now 6 years ago
Wim dffd67eb31 Fix typo 6 years ago
Krzysiek Madejski 55e79063d6 Add initial WhatsApp support (#711) 6 years ago
Wim 240559581a Handle quit message relay better on gateways with one channel on the irc bridge #722 6 years ago
Wim eef654de98 Fix bug in #721 6 years ago
Wim d76a04bd0a
Support quits from irc correctly. Fixes #722 (#724) 6 years ago
Wim 0bcb0b882f
Support join/leaves from discord. Closes #654 (#721) 6 years ago
Wim 4525fa31aa
Allow regexs in ignoreNicks. Closes #690 (#720) 6 years ago
Wim 57f156be83
Hint at thread replies when messages are unthreaded (slack) (#684) 6 years ago
Wim 707db950c8 Send GetChannelMembers event only to slack for now 6 years ago
Wim fb713ed91b
Add initial support for getting ChannelMember info of all bridges (#678)
* Add initial support for getting ChannelMember info of all bridges.

Adds an EventGetChannelMembers event, which gets send every x time to
all bridges. Bridges should respond on this event with a Message
containing ChannelMembers in the EventGetChannelMembers key in the
Extra field.

handleEventGetChannelMembers will handle this Message and sets the
contained ChannelMembers to the Bridge struct.

* Add ChannelMembers support to the slack bridge
6 years ago
Wim 56749dfb20 Fail if channel starts with hashtag (mattermost). Closes #625 6 years ago
Duco van Amstel da8e415ae1 Use logrus imports instead of log (#662) 6 years ago
Wim ccd55d2a28
Refactor gateway (#648)
* Decrease complexity of handleMessage, handleReceive, handleFiles
* Move handlers to handlers.go
* Split ignoreMessage up in ignoreTextEmpty, ignoreNicks and IgnoreTexts
* Add ignoreEvent
* Add testcase for ignoreTextEmpty, ignoreNicks, ignoreTexts and ignoreEvent
6 years ago
Duco van Amstel af7a00d030 Enable gosec linter (#645) 6 years ago
Patrick Connolly 47d29ecf63 Tidy up fetching of config values. (#616) 6 years ago
Patrick Connolly f2088a687e Extract bridgeMap into own package to improve testability (#601) 6 years ago
Patrick Connolly f5659d455d Sync channel topics between Slack bridges (#585)
Added logic to allow for configurable synchronisation of topics and purposes of channels between Slack bridges.
6 years ago
Wim f4d4dc91b1
Add option to ignore failing bridge on start. Fixes #455 (#603) 6 years ago
Wim ae32bae791
Add protocol to msg.ID in cache (#596) 6 years ago
Duco van Amstel ce21ba1545 Fix golint linter issues and enable it in CI (#593) 6 years ago
Duco van Amstel 16d5aeac7c Make config.Config more unit-test friendly (#586) 6 years ago
Duco van Amstel e19ba5a06a Add new Slack connection and forked legacy Slack bridge (#582) 6 years ago
Wim 730ccdd456 Add support for mattermost matterbridge plugin 6 years ago
Wim 9be0f8f000 Make gochecknoinits linter happy 6 years ago
Wim 78401214b0 Make scopelint happy 6 years ago
Wim b2a07aba3a Make goconst linter happy 6 years ago
Patrick Connolly 3d281b3316 Add ability to show when user is typing across Slack bridges (#559) 6 years ago
Wim 399789811e Make gocritic linter happy 6 years ago
Wim 1794922263 Make unparam linter happy 6 years ago
David Hill 0e2522279e Clean up various stuff (#508)
* various cleanups
6 years ago
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 7 years ago
Wim a284a228a3 Get the correct config values (gateway) 7 years ago
Wim fdd5ada98c Fix panic on empty config. Closes #386 7 years ago
Wim 98027446c8 Fix tests and make megacheck happy 7 years ago
Wim f2f1d874e1 Use viper (github.com/spf13/viper) for configuration 7 years ago