diff options
Diffstat (limited to 'lang')
-rw-r--r-- | lang/cpp/src/key.cpp | 49 | ||||
-rw-r--r-- | lang/cpp/src/key.h | 31 | ||||
-rw-r--r-- | lang/python/README | 12 | ||||
-rw-r--r-- | lang/python/README.org | 9 | ||||
-rwxr-xr-x | lang/python/setup.py.in | 19 |
5 files changed, 91 insertions, 29 deletions
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp index 0e86a19e..034286f0 100644 --- a/lang/cpp/src/key.cpp +++ b/lang/cpp/src/key.cpp @@ -967,6 +967,42 @@ Error UserID::revoke() return ret; } +static Key::Origin gpgme_origin_to_pp_origin (const unsigned int origin) +{ + switch (origin) { + case GPGME_KEYORG_KS: + return Key::OriginKS; + case GPGME_KEYORG_DANE: + return Key::OriginDane; + case GPGME_KEYORG_WKD: + return Key::OriginWKD; + case GPGME_KEYORG_URL: + return Key::OriginURL; + case GPGME_KEYORG_FILE: + return Key::OriginFile; + case GPGME_KEYORG_SELF: + return Key::OriginSelf; + case GPGME_KEYORG_OTHER: + return Key::OriginOther; + case GPGME_KEYORG_UNKNOWN: + default: + return Key::OriginUnknown; + } +} + +Key::Origin UserID::origin() const +{ + if (isNull()) { + return Key::OriginUnknown; + } + return gpgme_origin_to_pp_origin(uid->origin); +} + +time_t UserID::lastUpdate() const +{ + return static_cast<time_t>(uid ? uid->last_update : 0); +} + Error Key::addUid(const char *uid) { if (isNull()) { @@ -981,6 +1017,19 @@ Error Key::addUid(const char *uid) return ret; } +Key::Origin Key::origin() const +{ + if (isNull()) { + return OriginUnknown; + } + return gpgme_origin_to_pp_origin(key->origin); +} + +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 c3c711c1..76a0d4f4 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 { @@ -371,6 +392,16 @@ public: * * @returns an error on error.*/ Error revoke(); + + /*! Get the origin of the key. + * + * @returns the Origin. */ + Key::Origin origin() const; + + /*! Get the last update time. + * + * @returns the last update time. */ + time_t lastUpdate() const; private: shared_gpgme_key_t key; gpgme_user_id_t uid; diff --git a/lang/python/README b/lang/python/README index 49e88205..99da4dd7 100644 --- a/lang/python/README +++ b/lang/python/README @@ -1,6 +1,6 @@ - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - GPG - GPGME BINDINGS FOR PYTHON - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + GPG - GPGME BINDINGS FOR PYTHON + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Table of Contents @@ -13,7 +13,7 @@ Table of Contents The "gpg" module is a python interface to the GPGME library: -[https://www.gnupg.org/related_software/gpgme/] +[https://www.gnupg.org/software/gpgme/] "gpg" offers two interfaces, one is a high-level, curated, and idiomatic interface that is implemented as a shim on top of the low-level @@ -36,8 +36,8 @@ functionality of the underlying library. 2 Bugs ══════ - Please report bugs using our bug tracker using the category 'gpgme', - and topic 'python': [https://bugs.gnupg.org/gnupg/] + Please report bugs using our bug tracker [https://bugs.gnupg.org] with + tag (aka project) 'gpgme'. 3 Authors diff --git a/lang/python/README.org b/lang/python/README.org index 22e7d1f8..cba99669 100644 --- a/lang/python/README.org +++ b/lang/python/README.org @@ -1,8 +1,8 @@ #+TITLE: gpg - GPGME bindings for Python - +#+OPTIONS: author:nil The "gpg" module is a python interface to the GPGME library: -https://www.gnupg.org/related_software/gpgme/ +[[https://www.gnupg.org/software/gpgme/]] "gpg" offers two interfaces, one is a high-level, curated, and idiomatic interface that is implemented as a shim on top of the @@ -21,9 +21,8 @@ https://lists.gnupg.org/mailman/listinfo/gnupg-devel * Bugs -Please report bugs using our bug tracker using the category 'gpgme', -and topic 'python': -https://bugs.gnupg.org/gnupg/ +Please report bugs using our bug tracker +[[https://bugs.gnupg.org]] with tag (aka project) 'gpgme'. * Authors diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in index f9dda20f..2595073f 100755 --- a/lang/python/setup.py.in +++ b/lang/python/setup.py.in @@ -152,25 +152,8 @@ class BuildExtFirstHack(build): sink.write(content) def _generate_gpgme_h(self, source_name, sink_name): - if up_to_date(source_name, sink_name): - return - print("Using gpgme.h from {}".format(source_name)) - - deprec_func = re.compile(r'^(.*typedef.*|.*\(.*\)|[^#]+\s+.+)' - + r'\s*_GPGME_DEPRECATED(_OUTSIDE_GPGME)?\(.*\);\s*', - re.S) - line_break = re.compile(';|\\$|\\x0c|^\s*#|{') - - with open(sink_name, "w") as sink, open(source_name) as source: - text = '' - for line in source: - text += re.sub(' class ', ' _py_obsolete_class ', line) - if line_break.search(line): - if not deprec_func.search(text): - sink.write(text) - text = '' - sink.write(text) + shutil.copy2(source_name, sink_name) def _generate_errors_i(self): |