gmime-cleanup: use GMime 3.0 function names

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
This commit is contained in:
Daniel Kahn Gillmor 2019-05-02 09:19:44 -04:00 committed by David Bremner
parent 38240aafac
commit 582f255aeb
4 changed files with 14 additions and 18 deletions

View file

@ -357,7 +357,7 @@ _index_content_type (notmuch_message_t *message, GMimeObject *part)
{ {
GMimeContentType *content_type = g_mime_object_get_content_type (part); GMimeContentType *content_type = g_mime_object_get_content_type (part);
if (content_type) { if (content_type) {
char *mime_string = g_mime_content_type_to_string (content_type); char *mime_string = g_mime_content_type_get_mime_type (content_type);
if (mime_string) { if (mime_string) {
_notmuch_message_gen_terms (message, "mimetype", mime_string); _notmuch_message_gen_terms (message, "mimetype", mime_string);
g_free (mime_string); g_free (mime_string);
@ -493,7 +493,7 @@ _index_mime_part (notmuch_message_t *message,
} }
} }
wrapper = g_mime_part_get_content_object (GMIME_PART (part)); wrapper = g_mime_part_get_content (GMIME_PART (part));
if (wrapper) if (wrapper)
g_mime_data_wrapper_write_to_stream (wrapper, filter); g_mime_data_wrapper_write_to_stream (wrapper, filter);

View file

@ -75,10 +75,10 @@ format_part_reply (GMimeStream *stream, mime_node_t *node)
GMIME_DISPOSITION_ATTACHMENT) == 0) { GMIME_DISPOSITION_ATTACHMENT) == 0) {
const char *filename = g_mime_part_get_filename (GMIME_PART (node->part)); const char *filename = g_mime_part_get_filename (GMIME_PART (node->part));
g_mime_stream_printf (stream, "Attachment: %s (%s)\n", filename, g_mime_stream_printf (stream, "Attachment: %s (%s)\n", filename,
g_mime_content_type_to_string (content_type)); g_mime_content_type_get_mime_type (content_type));
} else { } else {
g_mime_stream_printf (stream, "Non-text part: %s\n", g_mime_stream_printf (stream, "Non-text part: %s\n",
g_mime_content_type_to_string (content_type)); g_mime_content_type_get_mime_type (content_type));
} }
} }
@ -209,7 +209,7 @@ scan_address_list (InternetAddressList *list,
if (user_from && *user_from == NULL) if (user_from && *user_from == NULL)
*user_from = addr; *user_from = addr;
} else if (message) { } else if (message) {
g_mime_message_add_recipient (message, type, name, addr); g_mime_message_add_mailbox (message, type, name, addr);
n++; n++;
} }
} }
@ -367,7 +367,7 @@ add_recipients_from_message (GMimeMessage *reply,
* of recipients so that the reply goes back to the user. * of recipients so that the reply goes back to the user.
*/ */
if (n == 0 && from_addr) if (n == 0 && from_addr)
g_mime_message_add_recipient (reply, GMIME_ADDRESS_TYPE_TO, NULL, from_addr); g_mime_message_add_mailbox (reply, GMIME_ADDRESS_TYPE_TO, NULL, from_addr);
return from_addr; return from_addr;
} }

View file

@ -278,14 +278,14 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
if (! g_mime_content_type_is_type (content_type, "text", "*")) if (! g_mime_content_type_is_type (content_type, "text", "*"))
INTERNAL_ERROR ("Illegal request to format non-text part (%s) as text.", INTERNAL_ERROR ("Illegal request to format non-text part (%s) as text.",
g_mime_content_type_to_string (content_type)); g_mime_content_type_get_mime_type (content_type));
if (stream_out == NULL) if (stream_out == NULL)
return; return;
charset = g_mime_object_get_content_type_parameter (part, "charset"); charset = g_mime_object_get_content_type_parameter (part, "charset");
charset = charset ? g_mime_charset_canon_name (charset) : NULL; charset = charset ? g_mime_charset_canon_name (charset) : NULL;
wrapper = g_mime_part_get_content_object (GMIME_PART (part)); wrapper = g_mime_part_get_content (GMIME_PART (part));
if (wrapper && charset && !g_ascii_strncasecmp (charset, "iso-8859-", 9)) { if (wrapper && charset && !g_ascii_strncasecmp (charset, "iso-8859-", 9)) {
GMimeStream *null_stream = NULL; GMimeStream *null_stream = NULL;
GMimeStream *null_stream_filter = NULL; GMimeStream *null_stream_filter = NULL;
@ -309,7 +309,7 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
} }
stream_filter = g_mime_stream_filter_new (stream_out); stream_filter = g_mime_stream_filter_new (stream_out);
crlf_filter = g_mime_filter_crlf_new (false, false); crlf_filter = g_mime_filter_dos2unix_new (false);
g_mime_stream_filter_add(GMIME_STREAM_FILTER (stream_filter), g_mime_stream_filter_add(GMIME_STREAM_FILTER (stream_filter),
crlf_filter); crlf_filter);
g_object_unref (crlf_filter); g_object_unref (crlf_filter);
@ -524,7 +524,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
if (cid) if (cid)
g_mime_stream_printf (stream, ", Content-id: %s", cid); g_mime_stream_printf (stream, ", Content-id: %s", cid);
content_string = g_mime_content_type_to_string (content_type); content_string = g_mime_content_type_get_mime_type (content_type);
g_mime_stream_printf (stream, ", Content-type: %s\n", content_string); g_mime_stream_printf (stream, ", Content-type: %s\n", content_string);
g_free (content_string); g_free (content_string);
} }
@ -566,7 +566,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
{ {
show_text_part_content (node->part, stream, 0); show_text_part_content (node->part, stream, 0);
} else { } else {
char *content_string = g_mime_content_type_to_string (content_type); char *content_string = g_mime_content_type_get_mime_type (content_type);
g_mime_stream_printf (stream, "Non-text part: %s\n", content_string); g_mime_stream_printf (stream, "Non-text part: %s\n", content_string);
g_free (content_string); g_free (content_string);
} }
@ -588,7 +588,7 @@ format_omitted_part_meta_sprinter (sprinter_t *sp, GMimeObject *meta, GMimePart
{ {
const char *content_charset = g_mime_object_get_content_type_parameter (meta, "charset"); const char *content_charset = g_mime_object_get_content_type_parameter (meta, "charset");
const char *cte = g_mime_object_get_header (meta, "content-transfer-encoding"); const char *cte = g_mime_object_get_header (meta, "content-transfer-encoding");
GMimeDataWrapper *wrapper = g_mime_part_get_content_object (part); GMimeDataWrapper *wrapper = g_mime_part_get_content (part);
GMimeStream *stream = g_mime_data_wrapper_get_stream (wrapper); GMimeStream *stream = g_mime_data_wrapper_get_stream (wrapper);
ssize_t content_length = g_mime_stream_length (stream); ssize_t content_length = g_mime_stream_length (stream);
@ -665,7 +665,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
} }
sp->map_key (sp, "content-type"); sp->map_key (sp, "content-type");
content_string = g_mime_content_type_to_string (content_type); content_string = g_mime_content_type_get_mime_type (content_type);
sp->string (sp, content_string); sp->string (sp, content_string);
g_free (content_string); g_free (content_string);
@ -851,7 +851,7 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
/* For leaf parts, we emit only the transfer-decoded /* For leaf parts, we emit only the transfer-decoded
* body. */ * body. */
GMimeDataWrapper *wrapper; GMimeDataWrapper *wrapper;
wrapper = g_mime_part_get_content_object (GMIME_PART (node->part)); wrapper = g_mime_part_get_content (GMIME_PART (node->part));
if (wrapper && stream_filter) if (wrapper && stream_filter)
g_mime_data_wrapper_write_to_stream (wrapper, stream_filter); g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);

View file

@ -9,15 +9,11 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void); GMimeStream *g_mime_stream_stdout_new(void);
#define g_mime_content_type_to_string(c) g_mime_content_type_get_mime_type (c)
#define g_mime_filter_crlf_new(encode,dots) g_mime_filter_dos2unix_new (FALSE)
#define g_mime_message_add_recipient(m,t,n,a) g_mime_message_add_mailbox (m,t,n,a)
#define g_mime_message_set_subject(m,s) g_mime_message_set_subject(m,s,NULL) #define g_mime_message_set_subject(m,s) g_mime_message_set_subject(m,s,NULL)
#define g_mime_multipart_signed_verify(mps,ctx,err) g_mime_multipart_signed_verify(mps, GMIME_ENCRYPT_NONE, err) #define g_mime_multipart_signed_verify(mps,ctx,err) g_mime_multipart_signed_verify(mps, GMIME_ENCRYPT_NONE, err)
#define g_mime_object_write_to_stream(o,s) g_mime_object_write_to_stream (o,NULL,s) #define g_mime_object_write_to_stream(o,s) g_mime_object_write_to_stream (o,NULL,s)
#define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL) #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_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_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt) #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_to_string(ia,encode) internet_address_to_string (ia,NULL,encode)
#define internet_address_list_parse_string(str) internet_address_list_parse (NULL,str) #define internet_address_list_parse_string(str) internet_address_list_parse (NULL,str)