mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
cli: make keyid from fingerprint in gmime 3.0
The "key_id" field seems to used for userid in gmime-3.0, while the keyid is dropped in the fingerprint field if the full fingerprint is not available.
This commit is contained in:
parent
4ce7591610
commit
2b3224a6c4
3 changed files with 16 additions and 1 deletions
|
@ -458,7 +458,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, mime_node_t *node)
|
|||
}
|
||||
}
|
||||
} else if (certificate) {
|
||||
const char *key_id = g_mime_certificate_get_key_id (certificate);
|
||||
const char *key_id = g_mime_certificate_get_fpr16 (certificate);
|
||||
if (key_id) {
|
||||
sp->map_key (sp, "keyid");
|
||||
sp->string (sp, key_id);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "gmime-extra.h"
|
||||
#include <string.h>
|
||||
|
||||
GMimeStream *
|
||||
g_mime_stream_stdout_new()
|
||||
|
@ -106,6 +107,15 @@ g_mime_utils_header_decode_date_unix (const char *date) {
|
|||
|
||||
#else /* GMime >= 3.0 */
|
||||
|
||||
const char*
|
||||
g_mime_certificate_get_fpr16 (GMimeCertificate *cert) {
|
||||
const char *fpr = g_mime_certificate_get_fingerprint (cert);
|
||||
if (!fpr || strlen (fpr) < 16)
|
||||
return fpr;
|
||||
|
||||
return fpr + (strlen (fpr) - 16);
|
||||
}
|
||||
|
||||
char *
|
||||
g_mime_message_get_address_string (GMimeMessage *message, GMimeAddressType type)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ GMimeStream *g_mime_stream_stdout_new(void);
|
|||
#define GMIME_ADDRESS_TYPE_BCC GMIME_RECIPIENT_TYPE_BCC
|
||||
|
||||
#define g_mime_2_6_unref(obj) g_object_unref (obj)
|
||||
#define g_mime_certificate_get_fpr16(cert) g_mime_certificate_get_key_id (cert)
|
||||
|
||||
#else /* GMime >= 3.0 */
|
||||
typedef GMimeAddressType GMimeRecipientType;
|
||||
|
@ -56,6 +57,10 @@ typedef GMimeTrust GMimeCertificateTrust;
|
|||
#define g_mime_2_6_unref(obj) /*ignore*/
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get last 16 hex digits of fingerprint ("keyid")
|
||||
*/
|
||||
const char *g_mime_certificate_get_fpr16 (GMimeCertificate *cert);
|
||||
/**
|
||||
* Return the contents of the appropriate address header as a string
|
||||
* Should be freed using g_free
|
||||
|
|
Loading…
Reference in a new issue