revert
This commit is contained in:
parent
e24f4575af
commit
483c41ddd5
3 changed files with 9 additions and 17 deletions
|
@ -267,7 +267,6 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
|
||||||
<< " microseconds.";
|
<< " microseconds.";
|
||||||
|
|
||||||
QList<Message> read_msgs, important_msgs;
|
QList<Message> read_msgs, important_msgs;
|
||||||
QHash<int, bool> loaded_filters;
|
|
||||||
|
|
||||||
for (int i = 0; i < msgs.size(); i++) {
|
for (int i = 0; i < msgs.size(); i++) {
|
||||||
Message msg_original(msgs[i]);
|
Message msg_original(msgs[i]);
|
||||||
|
@ -296,10 +295,7 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
|
||||||
tmr.restart();
|
tmr.restart();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MessageObject::FilteringAction decision =
|
MessageObject::FilteringAction decision = msg_filter->filterMessage(&filter_engine);
|
||||||
msg_filter->filterMessage(&filter_engine, !loaded_filters.contains(msg_filter->id()));
|
|
||||||
|
|
||||||
loaded_filters.insert(msg_filter->id(), true);
|
|
||||||
|
|
||||||
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Running filter script, it took " << tmr.nsecsElapsed() / 1000
|
qDebugNN << LOGSEC_FEEDDOWNLOADER << "Running filter script, it took " << tmr.nsecsElapsed() / 1000
|
||||||
<< " microseconds.";
|
<< " microseconds.";
|
||||||
|
|
|
@ -8,11 +8,8 @@
|
||||||
|
|
||||||
MessageFilter::MessageFilter(int id, QObject* parent) : QObject(parent), m_id(id) {}
|
MessageFilter::MessageFilter(int id, QObject* parent) : QObject(parent), m_id(id) {}
|
||||||
|
|
||||||
MessageObject::FilteringAction MessageFilter::filterMessage(QJSEngine* engine, bool evaluate_filter) {
|
MessageObject::FilteringAction MessageFilter::filterMessage(QJSEngine* engine) {
|
||||||
if (evaluate_filter) {
|
QJSValue filter_func = engine->evaluate(qApp->replaceUserDataFolderPlaceholder(m_script));
|
||||||
QJSValue filter_func =
|
|
||||||
engine->evaluate(qApp->replaceUserDataFolderPlaceholder(m_script).replace(QSL("filterMessage()"),
|
|
||||||
QSL("filterMessage%1()").arg(m_id)));
|
|
||||||
|
|
||||||
if (filter_func.isError()) {
|
if (filter_func.isError()) {
|
||||||
QJSValue::ErrorType error = filter_func.errorType();
|
QJSValue::ErrorType error = filter_func.errorType();
|
||||||
|
@ -20,9 +17,8 @@ MessageObject::FilteringAction MessageFilter::filterMessage(QJSEngine* engine, b
|
||||||
|
|
||||||
throw FilteringException(error, message);
|
throw FilteringException(error, message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
auto filter_output = engine->evaluate(QSL("filterMessage%1()").arg(m_id));
|
auto filter_output = engine->evaluate(QSL("filterMessage()"));
|
||||||
|
|
||||||
if (filter_output.isError()) {
|
if (filter_output.isError()) {
|
||||||
QJSValue::ErrorType error = filter_output.errorType();
|
QJSValue::ErrorType error = filter_output.errorType();
|
||||||
|
|
|
@ -16,7 +16,7 @@ class RSSGUARD_DLLSPEC MessageFilter : public QObject {
|
||||||
public:
|
public:
|
||||||
explicit MessageFilter(int id = -1, QObject* parent = nullptr);
|
explicit MessageFilter(int id = -1, QObject* parent = nullptr);
|
||||||
|
|
||||||
MessageObject::FilteringAction filterMessage(QJSEngine* engine, bool evaluate_filter = true);
|
MessageObject::FilteringAction filterMessage(QJSEngine* engine);
|
||||||
|
|
||||||
int id() const;
|
int id() const;
|
||||||
void setId(int id);
|
void setId(int id);
|
||||||
|
|
Loading…
Add table
Reference in a new issue