Commit Graph

13 Commits

Author SHA1 Message Date
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
2019-09-09 23:48:00 +02:00
Wim
bf21604d42
Make all loggers derive from non-default instance (#728) 2019-02-23 22:51:27 +01:00
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
2019-02-23 16:39:44 +01:00
Wim
4525fa31aa
Allow regexs in ignoreNicks. Closes #690 (#720) 2019-02-17 21:49:28 +01:00
Duco van Amstel
da8e415ae1 Use logrus imports instead of log (#662) 2018-12-26 15:16:09 +01:00
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
2018-12-12 23:57:17 +01:00
Patrick Connolly
f2088a687e Extract bridgeMap into own package to improve testability (#601) 2018-11-30 23:53:00 +01:00
Wim
b2a07aba3a Make goconst linter happy 2018-11-08 22:20:03 +01:00
Duco van Amstel
3dd4ec57ff Fix race in gateway test. (#520) 2018-10-13 00:47:18 +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
Wim
98027446c8 Fix tests and make megacheck happy 2018-03-05 00:30:46 +01:00
Wim
5b191f78a0 Update tests with gofmt 2017-07-25 20:20:55 +02:00
Wim
83ef61287e Refactor. Add tests 2017-07-25 20:11:52 +02:00