mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 11:58:10 +01:00
lib/cli: replace use of g_mime_message_get_sender
This function changes semantics in gmime-3.0 so make a new function that provides the same functionality in both
This commit is contained in:
parent
d7fea36916
commit
cbb2d5608e
6 changed files with 38 additions and 15 deletions
|
@ -490,7 +490,7 @@ _notmuch_message_index_file (notmuch_message_t *message,
|
||||||
{
|
{
|
||||||
GMimeMessage *mime_message;
|
GMimeMessage *mime_message;
|
||||||
InternetAddressList *addresses;
|
InternetAddressList *addresses;
|
||||||
const char *from, *subject;
|
const char *subject;
|
||||||
notmuch_status_t status;
|
notmuch_status_t status;
|
||||||
|
|
||||||
status = _notmuch_message_file_get_mime_message (message_file,
|
status = _notmuch_message_file_get_mime_message (message_file,
|
||||||
|
@ -498,9 +498,7 @@ _notmuch_message_index_file (notmuch_message_t *message,
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
from = g_mime_message_get_sender (mime_message);
|
addresses = g_mime_message_get_from (mime_message);
|
||||||
|
|
||||||
addresses = internet_address_list_parse_string (from);
|
|
||||||
if (addresses) {
|
if (addresses) {
|
||||||
_index_address_list (message, "from", addresses);
|
_index_address_list (message, "from", addresses);
|
||||||
g_object_unref (addresses);
|
g_object_unref (addresses);
|
||||||
|
|
|
@ -46,7 +46,7 @@ NOTMUCH_BEGIN_DECLS
|
||||||
|
|
||||||
#include <talloc.h>
|
#include <talloc.h>
|
||||||
|
|
||||||
#include <gmime/gmime.h>
|
#include "gmime-extra.h"
|
||||||
|
|
||||||
#include "xutil.h"
|
#include "xutil.h"
|
||||||
#include "error_util.h"
|
#include "error_util.h"
|
||||||
|
|
|
@ -47,9 +47,9 @@ format_part_reply (GMimeStream *stream, mime_node_t *node)
|
||||||
InternetAddressList *recipients;
|
InternetAddressList *recipients;
|
||||||
char *recipients_string;
|
char *recipients_string;
|
||||||
|
|
||||||
g_mime_stream_printf (stream, "> From: %s\n", g_mime_message_get_sender (message));
|
|
||||||
recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
|
recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
|
||||||
recipients_string = internet_address_list_to_string (recipients, 0);
|
recipients_string = internet_address_list_to_string (recipients, 0);
|
||||||
|
g_mime_stream_printf (stream, "> From: %s\n", g_mime_message_get_from_string (message));
|
||||||
if (recipients_string)
|
if (recipients_string)
|
||||||
g_mime_stream_printf (stream, "> To: %s\n",
|
g_mime_stream_printf (stream, "> To: %s\n",
|
||||||
recipients_string);
|
recipients_string);
|
||||||
|
@ -292,8 +292,7 @@ static InternetAddressList *get_sender(GMimeMessage *message)
|
||||||
g_object_unref (G_OBJECT (reply_to_list));
|
g_object_unref (G_OBJECT (reply_to_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
return internet_address_list_parse_string (
|
return g_mime_message_get_from (message);
|
||||||
g_mime_message_get_sender (message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static InternetAddressList *get_to(GMimeMessage *message)
|
static InternetAddressList *get_to(GMimeMessage *message)
|
||||||
|
|
|
@ -212,7 +212,7 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
|
||||||
sp->string (sp, g_mime_message_get_subject (message));
|
sp->string (sp, g_mime_message_get_subject (message));
|
||||||
|
|
||||||
sp->map_key (sp, "From");
|
sp->map_key (sp, "From");
|
||||||
sp->string (sp, g_mime_message_get_sender (message));
|
sp->string (sp, g_mime_message_get_from_string (message));
|
||||||
|
|
||||||
recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
|
recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
|
||||||
recipients_string = internet_address_list_to_string (recipients, 0);
|
recipients_string = internet_address_list_to_string (recipients, 0);
|
||||||
|
@ -520,9 +520,9 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
|
||||||
if (node->envelope_file)
|
if (node->envelope_file)
|
||||||
g_mime_stream_printf (stream, "%s\n", _get_one_line_summary (ctx, node->envelope_file));
|
g_mime_stream_printf (stream, "%s\n", _get_one_line_summary (ctx, node->envelope_file));
|
||||||
g_mime_stream_printf (stream, "Subject: %s\n", g_mime_message_get_subject (message));
|
g_mime_stream_printf (stream, "Subject: %s\n", g_mime_message_get_subject (message));
|
||||||
g_mime_stream_printf (stream, "From: %s\n", g_mime_message_get_sender (message));
|
|
||||||
recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
|
recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
|
||||||
recipients_string = internet_address_list_to_string (recipients, 0);
|
recipients_string = internet_address_list_to_string (recipients, 0);
|
||||||
|
g_mime_stream_printf (stream, "From: %s\n", g_mime_message_get_from_string (message));
|
||||||
if (recipients_string)
|
if (recipients_string)
|
||||||
g_mime_stream_printf (stream, "To: %s\n", recipients_string);
|
g_mime_stream_printf (stream, "To: %s\n", recipients_string);
|
||||||
g_free (recipients_string);
|
g_free (recipients_string);
|
||||||
|
|
|
@ -39,6 +39,17 @@ 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_from (GMimeMessage *message)
|
||||||
|
{
|
||||||
|
return internet_address_list_parse_string (g_mime_message_get_sender (message));
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
g_mime_message_get_from_string (GMimeMessage *message) {
|
||||||
|
return g_mime_message_get_sender (message);
|
||||||
|
}
|
||||||
|
|
||||||
InternetAddressList *
|
InternetAddressList *
|
||||||
g_mime_message_get_reply_to_list (GMimeMessage *message)
|
g_mime_message_get_reply_to_list (GMimeMessage *message)
|
||||||
{
|
{
|
||||||
|
@ -81,6 +92,12 @@ g_mime_message_get_reply_to_list(GMimeMessage *message)
|
||||||
return g_mime_message_get_reply_to (message);
|
return g_mime_message_get_reply_to (message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
g_mime_message_get_from_string (GMimeMessage *message)
|
||||||
|
{
|
||||||
|
return g_mime_object_get_header (GMIME_OBJECT (message), "From");
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message)
|
g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,21 @@ 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* glib allocated list of From: addresses
|
||||||
|
*/
|
||||||
|
|
||||||
|
InternetAddressList * g_mime_message_get_from (GMimeMessage *message);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return string for From: address
|
||||||
|
* (owned by gmime)
|
||||||
|
*/
|
||||||
|
const char * g_mime_message_get_from_string (GMimeMessage *message);
|
||||||
|
|
||||||
InternetAddressList * g_mime_message_get_reply_to_list (GMimeMessage *message);
|
InternetAddressList * g_mime_message_get_reply_to_list (GMimeMessage *message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,9 +32,4 @@ InternetAddressList * g_mime_message_get_reply_to_list (GMimeMessage *message);
|
||||||
char * g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message);
|
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