aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp/src/key.cpp
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2018-04-19 08:44:01 +0000
committerAndre Heinecke <[email protected]>2018-04-19 08:46:34 +0000
commit0adaf7bafd352f1c3a1e797493780150e3bb0adc (patch)
tree5d6ebe94de32a44eb1f8e4ffe2532a49a698fb0f /lang/cpp/src/key.cpp
parentcore: Remove leftover debug output. (diff)
downloadgpgme-0adaf7bafd352f1c3a1e797493780150e3bb0adc.tar.gz
gpgme-0adaf7bafd352f1c3a1e797493780150e3bb0adc.zip
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.
Diffstat (limited to 'lang/cpp/src/key.cpp')
-rw-r--r--lang/cpp/src/key.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 0e86a19e..838033c5 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(";