aboutsummaryrefslogtreecommitdiffstats
path: root/src/conversion.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-03-28 09:40:44 +0000
committerWerner Koch <[email protected]>2017-03-28 09:41:30 +0000
commit813ae5fa2d712aa9679b791c67c9c1c43d36ffe4 (patch)
tree21356c212fafd181ec0a270dc012100e80a07541 /src/conversion.c
parentqt: Disable testEncryptDecryptNowrap (diff)
downloadgpgme-813ae5fa2d712aa9679b791c67c9c1c43d36ffe4.tar.gz
gpgme-813ae5fa2d712aa9679b791c67c9c1c43d36ffe4.zip
core: Prepare for new key listing data send by gpg.
* src/gpgme.h.in (gpgme_user_id_t): New fields 'origin' and 'last_update'. (gpgme_key_t): New fields 'origin' and 'last_update'. * src/conversion.c (_gpgme_parse_timestamp_ul): New. * src/keylist.c (keylist_colon_handler): Parse fields 19 and 20. * tests/run-keylist.c (main): Print new fields. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/conversion.c')
-rw-r--r--src/conversion.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/conversion.c b/src/conversion.c
index 6dfabe7e..92dd2141 100644
--- a/src/conversion.c
+++ b/src/conversion.c
@@ -536,6 +536,25 @@ _gpgme_parse_timestamp (const char *timestamp, char **endp)
}
+/* This function is similar to _gpgme_parse_timestamp but returns an
+ * unsigned long and 0 on error. */
+unsigned long
+_gpgme_parse_timestamp_ul (const char *timestamp)
+{
+ time_t tim;
+ char *tail;
+
+ if (!*timestamp)
+ return 0; /* Shortcut empty strings. */
+
+ tim = _gpgme_parse_timestamp (timestamp, &tail);
+ if (tim == -1 || timestamp == tail || (*tail && *tail != ' '))
+ tim = 0; /* No time given or invalid engine. */
+
+ return (unsigned long)tim;
+}
+
+
/* The GPG backend uses OpenPGP algorithm numbers which we need to map
to our algorithm numbers. This function MUST not change ERRNO. */
int