From 813ae5fa2d712aa9679b791c67c9c1c43d36ffe4 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 28 Mar 2017 11:40:44 +0200 Subject: 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 --- src/conversion.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/conversion.c') 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 -- cgit v1.2.3