Commit Graph

130 Commits

Author SHA1 Message Date
Patrick Connolly
ccadda3ec2 Extracted translation code in separate files. 2018-10-24 01:10:10 +08:00
Patrick Connolly
fc8fe48b49 Cleaned up logic around knowing whether message is translated. 2018-10-23 22:41:58 +08:00
Patrick Connolly
c0b64573a5 Created handleTranslation func. Added IsTranslation key to Message struct. 2018-10-23 20:17:42 +08:00
Patrick Connolly
c42a4db10b Moved Google Translate client to Router. 2018-10-23 19:34:47 +08:00
Patrick Connolly
3b0a91d3ee Fixed poor trimming of translation source text. 2018-10-20 19:48:36 +08:00
Patrick Connolly
21c8dcb1ba Show untranslated text in attachment when using Slack. 2018-10-20 18:09:59 +08:00
Patrick Connolly
1ba7385175 Fixed updating of html2md pkg. 2018-10-20 17:49:59 +08:00
Patrick Connolly
c36a6ad984 Reset msg.Text back to original for each channel's message handling. 2018-10-15 09:28:53 +08:00
Patrick Connolly
ae5c3f02ee Added lots of debug output while working on PR. 2018-10-15 08:40:35 +08:00
Patrick Connolly
ea89e62a96 Don't contact google to translate empty messages. 2018-10-15 08:35:34 +08:00
Patrick Connolly
03e2b90a24 Merge branch 'master' into 499-google-translation 2018-10-15 07:09:37 +08:00
Patrick Connolly
f32e7a9c35 Moved translation attribute into toml config. Now using origmsg var for msg text. 2018-10-15 06:48:14 +08:00
Patrick Connolly
4eaa59c594 Went back to using <pre> for multiline code. 2018-10-15 04:38:35 +08:00
Patrick Connolly
b339e21526 Added ability to render slackdown bold. 2018-10-15 04:10:23 +08:00
Patrick Connolly
ddda1aad1a Cleaned up language checks. 2018-10-15 03:52:06 +08:00
Patrick Connolly
aeb06c7478 Moved translation client from bridge to router. 2018-10-15 03:50:44 +08:00
Patrick Connolly
3e036b370a Fixed list parsing. 2018-10-15 03:07:02 +08:00
Patrick Connolly
02c99569d8 Use close brackets in br tags etc. 2018-10-15 03:06:24 +08:00
Patrick Connolly
8808ee4e39 Allowed preservation of codeblock formatting between translations. 2018-10-15 01:07:39 +08:00
Patrick Connolly
9cdb44d919 Added ability to handle strikethrough after slackdown parsing. (Updated html2md pkg.) 2018-10-14 23:11:52 +08:00
Patrick Connolly
3253bf2d47 First pass at preserving slackdown format through translation. 2018-10-14 23:07:45 +08:00
Patrick Connolly
93f252c223 Sorted @usernames and #channels by length so translation protections happens correctly. 2018-10-14 22:26:55 +08:00
Patrick Connolly
170b42c1ad Added the better HTML strip library. 2018-10-14 22:12:17 +08:00
Patrick Connolly
c975ac0ff3 Fixed url matching to protect from translation. 2018-10-14 17:53:34 +08:00
Patrick Connolly
44e6f99e62 Added fix for Google Translate bug. 2018-10-14 17:30:01 +08:00
Patrick Connolly
6d4be25037 Simplified emoji replacement in Google Translate. 2018-10-14 17:00:58 +08:00
Patrick Connolly
0185e86e74 Initialized Google Translation during bridge init. 2018-10-14 14:45:40 +08:00
Duco van Amstel
3dd4ec57ff Fix race in gateway test. (#520) 2018-10-13 00:47:18 +02:00
Patrick Connolly
468c64049f Ignored emoji during translation. 2018-10-11 17:50:16 +08:00
Patrick Connolly
1d07b1faee Added origin CHANNEL to RemoteNickFormat. Updated config docs. [Fixes #515] 2018-10-11 14:59:26 +08:00
Patrick Connolly
49f2e77f84 Allowed translation attribution text to be customized. 2018-10-11 14:16:23 +08:00
Patrick Connolly
ee7d9c8fb8 Fixed attribution conditional logic. 2018-10-11 14:02:42 +08:00
Patrick Connolly
f67b601900 Only add Google Translate attribution on translated messages. 2018-10-11 13:44:50 +08:00
Patrick Connolly
e76a61e82b Ignore translation of @usernames and #channelnames. 2018-10-09 03:15:59 +08:00
Patrick Connolly
aac7cffbdf Allow credentials to be set from base64 encoded envvar, instead of filesystem. 2018-10-08 17:55:20 +08:00
Patrick Connolly
7e1d9ed8c2 Translation works with no error checking! 2018-10-08 17:01:26 +08:00
Patrick Connolly
6dc3375c97 Transformed message. bugfix 2018-10-08 14:48:25 +08: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
Patrick Connolly
8e6e8fa8ed Added debugging to test translation. 2018-09-28 18:04:45 +08: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