Commit 594c4212 authored by Ingo Klöcker's avatar Ingo Klöcker

Use uidhash only if it's available

parent 27bfea40
Pipeline #39777 failed with stage
in 11 minutes and 11 seconds
...@@ -30,6 +30,11 @@ ...@@ -30,6 +30,11 @@
#include "kleopatra_debug.h" #include "kleopatra_debug.h"
#include <gpgme++/gpgmepp_version.h>
#if GPGMEPP_VERSION >= 0x10E00 // 1.14.0
# define GPGME_HAS_UIDHASH
#endif
using namespace Kleo; using namespace Kleo;
namespace { namespace {
...@@ -70,9 +75,11 @@ bool CertificationKeyFilter::matches(const GpgME::Key &key, Kleo::KeyFilter::Mat ...@@ -70,9 +75,11 @@ bool CertificationKeyFilter::matches(const GpgME::Key &key, Kleo::KeyFilter::Mat
static bool uidsAreEqual(const GpgME::UserID &lhs, const GpgME::UserID &rhs) static bool uidsAreEqual(const GpgME::UserID &lhs, const GpgME::UserID &rhs)
{ {
// use uidhash if available // use uidhash if available
#ifdef GPGME_HAS_UIDHASH
if (lhs.uidhash() && rhs.uidhash()) { if (lhs.uidhash() && rhs.uidhash()) {
return strcmp(lhs.uidhash(), rhs.uidhash()) == 0; return strcmp(lhs.uidhash(), rhs.uidhash()) == 0;
} }
#endif
// compare actual user ID string and primary key; this is not unique, but it's all we can do if uidhash is missing // compare actual user ID string and primary key; this is not unique, but it's all we can do if uidhash is missing
return qstrcmp(lhs.id(), rhs.id()) == 0 return qstrcmp(lhs.id(), rhs.id()) == 0
&& qstrcmp(lhs.parent().primaryFingerprint(), rhs.parent().primaryFingerprint()) == 0; && qstrcmp(lhs.parent().primaryFingerprint(), rhs.parent().primaryFingerprint()) == 0;
......
Markdown is supported
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