diff options
| author | 2019-12-10 05:27:35 +0000 | |
|---|---|---|
| committer | 2019-12-10 05:27:35 +0000 | |
| commit | 638eee0d685c06d258cb55287204ca97bca7c344 (patch) | |
| tree | 33442439317ae2846f1efb7674b7a3758c8990a1 /src/core_modules/strip_otr.py | |
| parent | move sys.exit() codes to an enum in utils.consts (diff) | |
| signature | ||
move core modules to src/core_modules, make them uneffected by white/black list
Diffstat (limited to 'src/core_modules/strip_otr.py')
| -rw-r--r-- | src/core_modules/strip_otr.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core_modules/strip_otr.py b/src/core_modules/strip_otr.py new file mode 100644 index 00000000..bdb273a5 --- /dev/null +++ b/src/core_modules/strip_otr.py @@ -0,0 +1,15 @@ +from src import EventManager, ModuleManager, utils + +# Strip magic whitespace string from the end of messages. +# OTR uses this string to advertise, over plaintext, that the sending user +# supports OTR. + +MAGIC = " \t \t\t\t\t \t \t \t \t\t \t \t" + +class Module(ModuleManager.BaseModule): + @utils.hook("raw.received.privmsg") + @utils.kwarg("priority", EventManager.PRIORITY_HIGH) + def on_message(self, event): + message = event["line"].args.get(1) + if message.endswith(MAGIC): + event["line"].args[1] = message.rsplit(MAGIC, 1)[0] |
