diff options
author | Neal H. Walfield <neal@g10code.com> | 2015-11-03 16:26:25 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@g10code.com> | 2015-11-03 16:33:01 +0100 |
commit | 621afac37e5555fd68054531e611ead444b62928 (patch) | |
tree | 7a7b18388d7121de699a6d9b024012c78f2113a8 | |
parent | gpg: Split a utility function out of a large function. (diff) | |
download | gnupg2-621afac37e5555fd68054531e611ead444b62928.tar.xz gnupg2-621afac37e5555fd68054531e611ead444b62928.zip |
gpg: Also show when the most recently signed message was observed.
* g10/tofu.c (show_statistics): Also show when the most recently
signed message was observed.
--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
Suggested-by: MFPA <2014-667rhzu3dc-lists-groups@riseup.net>
-rw-r--r-- | g10/tofu.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/g10/tofu.c b/g10/tofu.c index 06183ed74..4dcaa111d 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -2377,6 +2377,7 @@ show_statistics (struct dbs *dbs, const char *fingerprint, char *tail = NULL; signed long messages; signed long first_seen_ago; + signed long most_recent_seen_ago; assert (strlist_length (strlist) == 3); @@ -2392,7 +2393,10 @@ show_statistics (struct dbs *dbs, const char *fingerprint, if (messages == 0 && *strlist->next->d == '\0') /* min(NULL) => NULL => "". */ - first_seen_ago = -1; + { + first_seen_ago = -1; + most_recent_seen_ago = -1; + } else { errno = 0; @@ -2405,6 +2409,17 @@ show_statistics (struct dbs *dbs, const char *fingerprint, strlist->next->d, strerror (errno)); first_seen_ago = 0; } + + errno = 0; + most_recent_seen_ago = strtol (strlist->next->next->d, &tail, 0); + if (errno || *tail != '\0') + /* Abort. */ + { + log_debug ("%s:%d: Couldn't convert %s (most_recent_seen) to an int: %s.\n", + __func__, __LINE__, + strlist->next->next->d, strerror (errno)); + most_recent_seen_ago = 0; + } } if (messages == -1 || first_seen_ago == 0) @@ -2428,6 +2443,8 @@ show_statistics (struct dbs *dbs, const char *fingerprint, else { char *first_seen_ago_str = time_ago_str (first_seen_ago); + char *most_recent_seen_ago_str = + time_ago_str (most_recent_seen_ago); es_fprintf (fp, _("Verified %ld messages signed by \"%s\"" @@ -2436,8 +2453,13 @@ show_statistics (struct dbs *dbs, const char *fingerprint, fingerprint_pp, tofu_policy_str (policy), first_seen_ago_str); + if (messages > 1) + es_fprintf (fp, + _(" The most recent message was verified %s ago."), + most_recent_seen_ago_str); xfree (first_seen_ago_str); + xfree (most_recent_seen_ago_str); } es_fputc (0, fp); |