mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
cli/reply: only pass gmime message to add recipients to reply message
The notmuch message is no longer needed. Simplify.
This commit is contained in:
parent
e20a7a2fbc
commit
87119b130b
1 changed files with 14 additions and 23 deletions
|
@ -272,12 +272,11 @@ reply_to_header_is_redundant (GMimeMessage *message,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static InternetAddressList *get_sender(unused(notmuch_message_t *message),
|
static InternetAddressList *get_sender(GMimeMessage *message)
|
||||||
GMimeMessage *mime_message)
|
|
||||||
{
|
{
|
||||||
const char *reply_to;
|
const char *reply_to;
|
||||||
|
|
||||||
reply_to = g_mime_message_get_reply_to (mime_message);
|
reply_to = g_mime_message_get_reply_to (message);
|
||||||
if (reply_to && *reply_to) {
|
if (reply_to && *reply_to) {
|
||||||
InternetAddressList *reply_to_list;
|
InternetAddressList *reply_to_list;
|
||||||
|
|
||||||
|
@ -295,35 +294,29 @@ static InternetAddressList *get_sender(unused(notmuch_message_t *message),
|
||||||
* 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);
|
reply_to_list = internet_address_list_parse_string (reply_to);
|
||||||
if (! reply_to_header_is_redundant (mime_message, reply_to_list))
|
if (! reply_to_header_is_redundant (message, reply_to_list))
|
||||||
return reply_to_list;
|
return reply_to_list;
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (reply_to_list));
|
g_object_unref (G_OBJECT (reply_to_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
return internet_address_list_parse_string (
|
return internet_address_list_parse_string (
|
||||||
g_mime_message_get_sender (mime_message));
|
g_mime_message_get_sender (message));
|
||||||
}
|
}
|
||||||
|
|
||||||
static InternetAddressList *get_to(unused(notmuch_message_t *message),
|
static InternetAddressList *get_to(GMimeMessage *message)
|
||||||
GMimeMessage *mime_message)
|
|
||||||
{
|
{
|
||||||
return g_mime_message_get_recipients (mime_message,
|
return g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
|
||||||
GMIME_RECIPIENT_TYPE_TO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static InternetAddressList *get_cc(unused(notmuch_message_t *message),
|
static InternetAddressList *get_cc(GMimeMessage *message)
|
||||||
GMimeMessage *mime_message)
|
|
||||||
{
|
{
|
||||||
return g_mime_message_get_recipients (mime_message,
|
return g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_CC);
|
||||||
GMIME_RECIPIENT_TYPE_CC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static InternetAddressList *get_bcc(unused(notmuch_message_t *message),
|
static InternetAddressList *get_bcc(GMimeMessage *message)
|
||||||
GMimeMessage *mime_message)
|
|
||||||
{
|
{
|
||||||
return g_mime_message_get_recipients (mime_message,
|
return g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_BCC);
|
||||||
GMIME_RECIPIENT_TYPE_BCC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Augment the recipients of 'reply' from the "Reply-to:", "From:",
|
/* Augment the recipients of 'reply' from the "Reply-to:", "From:",
|
||||||
|
@ -341,13 +334,11 @@ static InternetAddressList *get_bcc(unused(notmuch_message_t *message),
|
||||||
static const char *
|
static const char *
|
||||||
add_recipients_from_message (GMimeMessage *reply,
|
add_recipients_from_message (GMimeMessage *reply,
|
||||||
notmuch_config_t *config,
|
notmuch_config_t *config,
|
||||||
notmuch_message_t *message,
|
GMimeMessage *message,
|
||||||
GMimeMessage *mime_message,
|
|
||||||
notmuch_bool_t reply_all)
|
notmuch_bool_t reply_all)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
InternetAddressList * (*get_header)(notmuch_message_t *message,
|
InternetAddressList * (*get_header)(GMimeMessage *message);
|
||||||
GMimeMessage *mime_message);
|
|
||||||
GMimeRecipientType recipient_type;
|
GMimeRecipientType recipient_type;
|
||||||
} reply_to_map[] = {
|
} reply_to_map[] = {
|
||||||
{ get_sender, GMIME_RECIPIENT_TYPE_TO },
|
{ get_sender, GMIME_RECIPIENT_TYPE_TO },
|
||||||
|
@ -362,7 +353,7 @@ add_recipients_from_message (GMimeMessage *reply,
|
||||||
for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
|
for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
|
||||||
InternetAddressList *recipients;
|
InternetAddressList *recipients;
|
||||||
|
|
||||||
recipients = reply_to_map[i].get_header (message, mime_message);
|
recipients = reply_to_map[i].get_header (message);
|
||||||
|
|
||||||
n += scan_address_list (recipients, config, reply,
|
n += scan_address_list (recipients, config, reply,
|
||||||
reply_to_map[i].recipient_type, &from_addr);
|
reply_to_map[i].recipient_type, &from_addr);
|
||||||
|
@ -567,7 +558,7 @@ create_reply_message(void *ctx,
|
||||||
|
|
||||||
g_mime_object_set_header (GMIME_OBJECT (reply), "References", references);
|
g_mime_object_set_header (GMIME_OBJECT (reply), "References", references);
|
||||||
|
|
||||||
from_addr = add_recipients_from_message (reply, config, message,
|
from_addr = add_recipients_from_message (reply, config,
|
||||||
mime_message, reply_all);
|
mime_message, reply_all);
|
||||||
|
|
||||||
/* The above is all that is needed for limited headers. */
|
/* The above is all that is needed for limited headers. */
|
||||||
|
|
Loading…
Reference in a new issue