Commit ca9b12cf authored by Sandro Knauß's avatar Sandro Knauß 🐝
Browse files

send also for know issues a nearexpiry message.

parent bcdfa234
......@@ -722,7 +722,11 @@ QVector<MessageComposer::Composer *> ComposerViewBase::generateCryptoMessages(bo
connect(nearExpiryChecker.data(),
&NearExpiryChecker::expiryMessage,
this,
[&canceled](const GpgME::Key &key, QString msg, NearExpiryChecker::ExpiryInformation info) {
[&canceled](const GpgME::Key &key, QString msg, NearExpiryChecker::ExpiryInformation info, bool isNewMessage) {
if (!isNewMessage) {
return;
}
if (canceled) {
return;
}
......
......@@ -311,9 +311,8 @@ void NearExpiryChecker::checkKeyNearExpiry(const GpgME::Key &key, bool isOwnKey,
return;
}
const GpgME::Subkey subkey = key.subkey(0);
if (d->alreadyWarnedFingerprints.count(subkey.fingerprint())) {
return; // already warned about this one (and so about it's issuers)
}
const bool newMessage = !d->alreadyWarnedFingerprints.count(subkey.fingerprint());
if (subkey.neverExpires()) {
return;
......@@ -324,7 +323,7 @@ void NearExpiryChecker::checkKeyNearExpiry(const GpgME::Key &key, bool isOwnKey,
const QString msg = key.protocol() == GpgME::OpenPGP ? formatOpenPGPMessage(key, secsTillExpiry, isOwnKey, isSigningKey)
: formatSMIMEMessage(key, orig_key, secsTillExpiry, isOwnKey, isSigningKey, ca);
d->alreadyWarnedFingerprints.insert(subkey.fingerprint());
Q_EMIT expiryMessage(key, msg, isOwnKey ? OwnKeyExpired : OtherKeyExpired);
Q_EMIT expiryMessage(key, msg, isOwnKey ? OwnKeyExpired : OtherKeyExpired, newMessage);
} else {
const int daysTillExpiry = 1 + int(secsTillExpiry / secsPerDay);
const int threshold = ca
......@@ -335,7 +334,7 @@ void NearExpiryChecker::checkKeyNearExpiry(const GpgME::Key &key, bool isOwnKey,
const QString msg = key.protocol() == GpgME::OpenPGP ? formatOpenPGPMessage(key, secsTillExpiry, isOwnKey, isSigningKey)
: formatSMIMEMessage(key, orig_key, secsTillExpiry, isOwnKey, isSigningKey, ca);
d->alreadyWarnedFingerprints.insert(subkey.fingerprint());
Q_EMIT expiryMessage(key, msg, isOwnKey ? OwnKeyNearExpiry : OtherKeyNearExpiry);
Q_EMIT expiryMessage(key, msg, isOwnKey ? OwnKeyNearExpiry : OtherKeyNearExpiry, newMessage);
}
}
if (key.isRoot()) {
......
......@@ -51,7 +51,7 @@ public:
void checkKey(const GpgME::Key &key) const;
Q_SIGNALS:
void expiryMessage(const GpgME::Key &key, QString msg, MessageComposer::NearExpiryChecker::ExpiryInformation info) const;
void expiryMessage(const GpgME::Key &key, QString msg, MessageComposer::NearExpiryChecker::ExpiryInformation info, bool isNewMessage) const;
private:
friend class ::NearExpiryCheckerTest;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment