From 279256c27db776a6bfad39f6fd8e89fd50538827 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Sun, 21 Mar 2021 18:40:30 +0100 Subject: [PATCH] enable all js extensions --- resources/docs/Message-filters.md | 2 +- src/librssguard/core/messagefilter.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/docs/Message-filters.md b/resources/docs/Message-filters.md index 2425d529b..8a56550a0 100755 --- a/resources/docs/Message-filters.md +++ b/resources/docs/Message-filters.md @@ -73,7 +73,7 @@ Here is the reference of methods and properties of some types available in your |---|---|---| | `Accept` | 1 | Message is accepted and will be added to DB or updated in DB. | | `Ignore` | 2 | Message is ignored and will be **NOT** added to DB or updated in DB, but is not purged from DB if already exists. | -| `Purge` | 4 | Existing message is purged from the DB completely. | +| `Purge` | 4 | Existing message is purged from the DB completely. Behavior is the same as `Ignore` when there is new incoming message. | Note that `MessageObject` attributes which can be synchronized back to service are synchronized even if you return `Purge` or `Ignore`. In other words: even if you filter ignores the message you can still tweak its properties which will get synchronized back to your server. diff --git a/src/librssguard/core/messagefilter.cpp b/src/librssguard/core/messagefilter.cpp index d1096175c..9046de769 100755 --- a/src/librssguard/core/messagefilter.cpp +++ b/src/librssguard/core/messagefilter.cpp @@ -52,9 +52,10 @@ void MessageFilter::setScript(const QString& script) { } void MessageFilter::initializeFilteringEngine(QJSEngine& engine, MessageObject* message_wrapper) { - engine.installExtensions(QJSEngine::Extension::ConsoleExtension); + engine.installExtensions(QJSEngine::Extension::AllExtensions); engine.globalObject().setProperty(QSL("MSG_ACCEPT"), int(MessageObject::FilteringAction::Accept)); engine.globalObject().setProperty(QSL("MSG_IGNORE"), int(MessageObject::FilteringAction::Ignore)); + engine.globalObject().setProperty(QSL("MSG_PURGE"), int(MessageObject::FilteringAction::Purge)); // Register the wrapper. auto js_object = engine.newQObject(message_wrapper);