mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
cli: replace use of g_mime_message_get_reply_to
This function changes signature in gmime 3.0, so we provide two new functions, one for each signature.
This commit is contained in:
parent
67dbd24ece
commit
d7fea36916
4 changed files with 56 additions and 7 deletions
|
@ -268,12 +268,11 @@ reply_to_header_is_redundant (GMimeMessage *message,
|
||||||
|
|
||||||
static InternetAddressList *get_sender(GMimeMessage *message)
|
static InternetAddressList *get_sender(GMimeMessage *message)
|
||||||
{
|
{
|
||||||
const char *reply_to;
|
InternetAddressList *reply_to_list;
|
||||||
|
|
||||||
reply_to = g_mime_message_get_reply_to (message);
|
|
||||||
if (reply_to && *reply_to) {
|
|
||||||
InternetAddressList *reply_to_list;
|
|
||||||
|
|
||||||
|
reply_to_list = g_mime_message_get_reply_to_list (message);
|
||||||
|
if (reply_to_list &&
|
||||||
|
internet_address_list_length (reply_to_list) > 0) {
|
||||||
/*
|
/*
|
||||||
* Some mailing lists munge the Reply-To header despite it
|
* Some mailing lists munge the Reply-To header despite it
|
||||||
* being A Bad Thing, see
|
* being A Bad Thing, see
|
||||||
|
@ -287,7 +286,6 @@ static InternetAddressList *get_sender(GMimeMessage *message)
|
||||||
* to the list. Note that the address in the Reply-To header
|
* to the list. Note that the address in the Reply-To header
|
||||||
* will always appear in the reply if reply_all is true.
|
* will always appear in the reply if reply_all is true.
|
||||||
*/
|
*/
|
||||||
reply_to_list = internet_address_list_parse_string (reply_to);
|
|
||||||
if (! reply_to_header_is_redundant (message, reply_to_list))
|
if (! reply_to_header_is_redundant (message, reply_to_list))
|
||||||
return reply_to_list;
|
return reply_to_list;
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,7 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
|
||||||
InternetAddressList *recipients;
|
InternetAddressList *recipients;
|
||||||
char *recipients_string;
|
char *recipients_string;
|
||||||
const char *reply_to_string;
|
const char *reply_to_string;
|
||||||
|
void *local = talloc_new (sp);
|
||||||
|
|
||||||
sp->begin_map (sp);
|
sp->begin_map (sp);
|
||||||
|
|
||||||
|
@ -237,7 +238,7 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
|
||||||
g_free (recipients_string);
|
g_free (recipients_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
reply_to_string = g_mime_message_get_reply_to (message);
|
reply_to_string = g_mime_message_get_reply_to_string (local, message);
|
||||||
if (reply_to_string) {
|
if (reply_to_string) {
|
||||||
sp->map_key (sp, "Reply-To");
|
sp->map_key (sp, "Reply-To");
|
||||||
sp->string (sp, reply_to_string);
|
sp->string (sp, reply_to_string);
|
||||||
|
@ -255,6 +256,7 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
|
||||||
}
|
}
|
||||||
|
|
||||||
sp->end (sp);
|
sp->end (sp);
|
||||||
|
talloc_free (local);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write a MIME text part out to the given stream.
|
/* Write a MIME text part out to the given stream.
|
||||||
|
|
|
@ -39,6 +39,28 @@ g_mime_message_get_date_string (void *ctx, GMimeMessage *message)
|
||||||
return g_string_talloc_strdup (ctx, date);
|
return g_string_talloc_strdup (ctx, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InternetAddressList *
|
||||||
|
g_mime_message_get_reply_to_list (GMimeMessage *message)
|
||||||
|
{
|
||||||
|
const char *reply_to;
|
||||||
|
|
||||||
|
reply_to = g_mime_message_get_reply_to (message);
|
||||||
|
if (reply_to && *reply_to)
|
||||||
|
return internet_address_list_parse_string (reply_to);
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return talloc allocated reply-to string
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message)
|
||||||
|
{
|
||||||
|
return talloc_strdup(ctx, g_mime_message_get_reply_to (message));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#else /* GMime >= 3.0 */
|
#else /* GMime >= 3.0 */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -52,4 +74,19 @@ g_mime_message_get_date_string (void *ctx, GMimeMessage *message)
|
||||||
return talloc_strdup(ctx, "Thu, 01 Jan 1970 00:00:00 +0000");
|
return talloc_strdup(ctx, "Thu, 01 Jan 1970 00:00:00 +0000");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InternetAddressList *
|
||||||
|
g_mime_message_get_reply_to_list(GMimeMessage *message)
|
||||||
|
{
|
||||||
|
return g_mime_message_get_reply_to (message);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message)
|
||||||
|
{
|
||||||
|
InternetAddressList *list = g_mime_message_get_reply_to (message);
|
||||||
|
return g_string_talloc_strdup (ctx, internet_address_list_to_string (list, NULL, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,5 +10,17 @@ GMimeStream *g_mime_stream_stdout_new(void);
|
||||||
* return talloc allocated date string
|
* return talloc allocated date string
|
||||||
*/
|
*/
|
||||||
char *g_mime_message_get_date_string (void *ctx, GMimeMessage *message);
|
char *g_mime_message_get_date_string (void *ctx, GMimeMessage *message);
|
||||||
|
InternetAddressList * g_mime_message_get_reply_to_list (GMimeMessage *message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return talloc allocated reply-to string
|
||||||
|
*/
|
||||||
|
char * g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return glib allocated reply-to list
|
||||||
|
*/
|
||||||
|
InternetAddressList * g_mime_message_get_reply_to_list (GMimeMessage *message);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue