mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-29 16:49:34 +01:00
samecustomid
This commit is contained in:
parent
c44d46e15d
commit
b35c977545
@ -158,6 +158,7 @@ Note that `MessageObject` attributes which can be synchronized back to service a
|
||||
| `SameAuthor` | 4 | Check if message has same author as some another messages. |
|
||||
| `SameDateCreated` | 8 | Check if message has same date of creation as some another messages. |
|
||||
| `AllFeedsSameAccount` | 16 | Perform the check across all feeds from your account, not just "current" feed. |
|
||||
| `SameCustomId` | 32 | Check if message with same custom ID exists in RSS Guard's DB. |
|
||||
|
||||
#### `utils` object
|
||||
| Method | How to call | Description |
|
||||
|
@ -44,6 +44,11 @@ bool MessageObject::isDuplicateWithAttribute(MessageObject::DuplicationAttribute
|
||||
bind_values.append({ QSL(":date_created"), created().toMSecsSinceEpoch() });
|
||||
}
|
||||
|
||||
if ((attribute_check& DuplicationAttributeCheck::SameCustomId) == DuplicationAttributeCheck::SameCustomId) {
|
||||
where_clauses.append(QSL("custom_id = :custom_id"));
|
||||
bind_values.append({ QSL(":custom_id"), customId() });
|
||||
}
|
||||
|
||||
where_clauses.append(QSL("account_id = :account_id"));
|
||||
bind_values.append({ QSL(":account_id"), accountId() });
|
||||
|
||||
@ -219,6 +224,14 @@ int MessageObject::accountId() const {
|
||||
return m_accountId;
|
||||
}
|
||||
|
||||
QString MessageObject::customId() const {
|
||||
return m_message->m_customId;
|
||||
}
|
||||
|
||||
int MessageObject::id() const {
|
||||
return m_message->m_id;
|
||||
}
|
||||
|
||||
QList<Label*> MessageObject::assignedLabels() const {
|
||||
return m_message->m_assignedLabels;
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ class MessageObject : public QObject {
|
||||
Q_PROPERTY(QList<Label*> availableLabels READ availableLabels)
|
||||
Q_PROPERTY(QString feedCustomId READ feedCustomId)
|
||||
Q_PROPERTY(int accountId READ accountId)
|
||||
Q_PROPERTY(int id READ id)
|
||||
Q_PROPERTY(QString customId READ customId)
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle)
|
||||
Q_PROPERTY(QString url READ url WRITE setUrl)
|
||||
Q_PROPERTY(QString author READ author WRITE setAuthor)
|
||||
@ -56,7 +58,10 @@ class MessageObject : public QObject {
|
||||
// Compare with all messages from the account not only with messages from same feed.
|
||||
// Note that this value must be used via bitwise OR with other values,
|
||||
// for example 2 | 4 | 16.
|
||||
AllFeedsSameAccount = 16
|
||||
AllFeedsSameAccount = 16,
|
||||
|
||||
// Messages with same custom ID as provided by feed/service.
|
||||
SameCustomId = 32
|
||||
};
|
||||
|
||||
Q_ENUM(DuplicationAttributeCheck)
|
||||
@ -91,8 +96,13 @@ class MessageObject : public QObject {
|
||||
|
||||
// Generic Message's properties bindings.
|
||||
QString feedCustomId() const;
|
||||
|
||||
int accountId() const;
|
||||
|
||||
QString customId() const;
|
||||
|
||||
int id() const;
|
||||
|
||||
QString title() const;
|
||||
void setTitle(const QString& title);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user