[git] GPGME - branch, master, updated. gpgme-1.7.0-40-g54f94b1

by Andre Heinecke cvs at cvs.gnupg.org
Tue Oct 11 14:14:57 CEST 2016


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  54f94b14e2bb9b38ffd89f509406bfbd012da632 (commit)
      from  e7ceb83a5969581f5e1b0b6a69d18a93b594f6d4 (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 54f94b14e2bb9b38ffd89f509406bfbd012da632
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Oct 11 14:13:15 2016 +0200

    cpp: Add API for gpgme_addrspec_from_uid
    
    * lang/cpp/src/key.cpp (UserID::addrSpecFromString): New static
    function to expose addrspec from uid.
    (UserID::addrSpec): New. Get addrSpec from Userid.
    * NEWS: Update accordingly.

diff --git a/NEWS b/NEWS
index dff8e47..72f6f77 100644
--- a/NEWS
+++ b/NEWS
@@ -13,7 +13,9 @@ Noteworthy changes in version 1.7.1 (unreleased) [C26/A15/R_]
 
  * cpp Interface changes relative to the 1.7.0 release:
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Signature::key(bool, bool)      NEW.
+ Signature::key(bool, bool)              NEW.
+ UserID::addrSpecFromString(const char*) NEW.
+ UserID::addrSpec()                      NEW.
 
 Noteworthy changes in version 1.7.0 (2016-09-21) [C26/A15/R0]
 ------------------------------------------------
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 4531a2b..947405f 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -878,6 +878,22 @@ const char *UserID::Signature::policyURL() const
     return 0;
 }
 
+std::string UserID::addrSpecFromString(const char *userid)
+{
+    if (!userid) {
+        return std::string();
+    }
+    char *normalized = gpgme_addrspec_from_uid (userid);
+    std::string ret(normalized);
+    gpgme_free(normalized);
+    return ret;
+}
+
+std::string UserID::addrSpec() const
+{
+    return addrSpecFromString(email());
+}
+
 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 f193093..3f596a8 100644
--- a/lang/cpp/src/key.h
+++ b/lang/cpp/src/key.h
@@ -320,6 +320,21 @@ public:
      * @returns The TOFU stats or a null TofuInfo.
      */
     GpgME::TofuInfo tofuInfo() const;
+
+    /*! Wrapper around gpgme_addrspec_from_uid.
+     *
+     * The input string should match the format of
+     * a user id string.
+     *
+     * @returns a normalized mail address if found
+     * or an empty string. */
+    static std::string addrSpecFromString(const char *uid);
+
+    /*! Wrapper around gpgme_addrspec_from_uid.
+     *
+     * @returns a normalized mail address for this userid
+     * or an empty string. */
+    std::string addrSpec() const;
 private:
     shared_gpgme_key_t key;
     gpgme_user_id_t uid;

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

Summary of changes:
 NEWS                 |  4 +++-
 lang/cpp/src/key.cpp | 16 ++++++++++++++++
 lang/cpp/src/key.h   | 15 +++++++++++++++
 3 files changed, 34 insertions(+), 1 deletion(-)


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




More information about the Gnupg-commits mailing list