From 38240aafac531e350f6819103cd1d974d4c75d47 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Thu, 2 May 2019 09:19:43 -0400 Subject: [PATCH] gmime-cleanup: use GMime 3.0 data types Signed-off-by: Daniel Kahn Gillmor --- notmuch-reply.c | 4 ++-- notmuch-show.c | 8 ++++---- util/gmime-extra.h | 11 +++-------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/notmuch-reply.c b/notmuch-reply.c index fa91c5de..48fdbc92 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -176,7 +176,7 @@ static unsigned int scan_address_list (InternetAddressList *list, notmuch_config_t *config, GMimeMessage *message, - GMimeRecipientType type, + GMimeAddressType type, const char **user_from) { InternetAddress *address; @@ -325,7 +325,7 @@ add_recipients_from_message (GMimeMessage *reply, { struct { InternetAddressList * (*get_header)(GMimeMessage *message); - GMimeRecipientType recipient_type; + GMimeAddressType recipient_type; } reply_to_map[] = { { get_sender, GMIME_ADDRESS_TYPE_TO }, { get_to, GMIME_ADDRESS_TYPE_TO }, diff --git a/notmuch-show.c b/notmuch-show.c index 730a91f8..dc587108 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -363,13 +363,13 @@ signature_status_to_string (GMimeSignatureStatus status) /* Print signature flags */ struct key_map_struct { - GMimeSignatureError bit; + GMimeSignatureStatus bit; const char * string; }; static void do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map, - unsigned int array_map_len, GMimeSignatureError errors) { + unsigned int array_map_len, GMimeSignatureStatus errors) { sp->map_key (sp, "errors"); sp->begin_map (sp); @@ -386,7 +386,7 @@ do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map, static void format_signature_errors (sprinter_t *sp, GMimeSignature *signature) { - GMimeSignatureError errors = g_mime_signature_get_errors (signature); + GMimeSignatureStatus errors = g_mime_signature_get_status (signature); if (!(errors & GMIME_SIGNATURE_STATUS_ERROR_MASK)) return; @@ -465,7 +465,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist) } if (notmuch_format_version <= 3) { - GMimeSignatureError errors = g_mime_signature_get_errors (signature); + GMimeSignatureStatus errors = g_mime_signature_get_status (signature); if (g_mime_signature_status_error (errors)) { sp->map_key (sp, "errors"); sp->integer (sp, errors); diff --git a/util/gmime-extra.h b/util/gmime-extra.h index e646efee..a183952d 100644 --- a/util/gmime-extra.h +++ b/util/gmime-extra.h @@ -18,15 +18,10 @@ GMimeStream *g_mime_stream_stdout_new(void); #define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL) #define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ()) #define g_mime_part_get_content_object(p) g_mime_part_get_content (p) -#define g_mime_signature_get_errors(sig) g_mime_signature_get_status (sig) #define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt) #define internet_address_to_string(ia,encode) internet_address_to_string (ia,NULL,encode) #define internet_address_list_parse_string(str) internet_address_list_parse (NULL,str) -typedef GMimeAddressType GMimeRecipientType; - -typedef GMimeSignatureStatus GMimeSignatureError; - /** * Get last 16 hex digits of fingerprint ("keyid") */ @@ -35,9 +30,9 @@ 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 */ -char *g_mime_message_get_address_string (GMimeMessage *message, GMimeRecipientType type); +char *g_mime_message_get_address_string (GMimeMessage *message, GMimeAddressType type); -InternetAddressList * g_mime_message_get_addresses (GMimeMessage *message, GMimeRecipientType type); +InternetAddressList * g_mime_message_get_addresses (GMimeMessage *message, GMimeAddressType type); /** * return talloc allocated date string @@ -71,7 +66,7 @@ gboolean g_mime_signature_status_good (GMimeSignatureStatus status); gboolean g_mime_signature_status_bad (GMimeSignatureStatus status); -gboolean g_mime_signature_status_error (GMimeSignatureError status); +gboolean g_mime_signature_status_error (GMimeSignatureStatus status); gint64 g_mime_utils_header_decode_date_unix (const char *date);