[git] GPGME - branch, master, updated. gpgme-1.11.0-4-g0adaf7b

by Andre Heinecke cvs at cvs.gnupg.org
Thu Apr 19 10:46:59 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  0adaf7bafd352f1c3a1e797493780150e3bb0adc (commit)
      from  b52a91f5a6818db6b3dd7ce86c01b5d5f6700d0d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0adaf7bafd352f1c3a1e797493780150e3bb0adc
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Apr 19 10:44:01 2018 +0200

    cpp: Add origin and last_update
    
    * NEWS: mention interface change.
    * lang/cpp/src/key.cpp (Key::origin, Key::lastUpdate): New.
    * lang/cpp/src/key.h (Key::Origin): New enum.

diff --git a/NEWS b/NEWS
index cfe5502..9d6bd0a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,10 @@
 Noteworthy changes in version 1.11.1 (unreleased)
 -------------------------------------------------
 
+ * Interface changes relative to the 1.10.0 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ cpp: Key::origin                     NEW.
+ cpp: Key::lastUpdate                 NEW.
 
 Noteworthy changes in version 1.11.0 (2018-04-18)
 -------------------------------------------------
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 0e86a19..838033c 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -981,6 +981,37 @@ Error Key::addUid(const char *uid)
     return ret;
 }
 
+Key::Origin Key::origin() const
+{
+    if (isNull()) {
+        return OriginUnknown;
+    }
+    switch (key->origin) {
+        case GPGME_KEYORG_KS:
+            return OriginKS;
+        case GPGME_KEYORG_DANE:
+            return OriginDane;
+        case GPGME_KEYORG_WKD:
+            return OriginWKD;
+        case GPGME_KEYORG_URL:
+            return OriginURL;
+        case GPGME_KEYORG_FILE:
+            return OriginFile;
+        case GPGME_KEYORG_SELF:
+            return OriginSelf;
+        case GPGME_KEYORG_OTHER:
+            return OriginOther;
+        case GPGME_KEYORG_UNKNOWN:
+        default:
+            return OriginUnknown;
+    }
+}
+
+time_t Key::lastUpdate() const
+{
+    return static_cast<time_t>(key ? key->last_update : 0);
+}
+
 std::ostream &operator<<(std::ostream &os, const UserID &uid)
 {
     os << "GpgME::UserID(";
diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h
index c3c711c..07ddc25 100644
--- a/lang/cpp/src/key.h
+++ b/lang/cpp/src/key.h
@@ -178,6 +178,27 @@ public:
      */
     static Key locate(const char *mbox);
 
+    /* @enum Origin
+     * @brief The Origin of the key. */
+    enum Origin : unsigned int {
+        OriginUnknown = 0,
+        OriginKS = 1,
+        OriginDane = 3,
+        OriginWKD = 4,
+        OriginURL = 5,
+        OriginFile = 6,
+        OriginSelf = 7,
+        OriginOther = 31,
+    };
+    /*! Get the origin of the key.
+     *
+     * @returns the Origin. */
+    Origin origin() const;
+
+    /*! Get the last update time.
+     *
+     * @returns the last update time. */
+    time_t lastUpdate() const;
 private:
     gpgme_key_t impl() const
     {

-----------------------------------------------------------------------

Summary of changes:
 NEWS                 |  4 ++++
 lang/cpp/src/key.cpp | 31 +++++++++++++++++++++++++++++++
 lang/cpp/src/key.h   | 21 +++++++++++++++++++++
 3 files changed, 56 insertions(+)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list