show_reply_headers (GMimeStream *stream, GMimeMessage *message)
{
/* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */
show_reply_headers (GMimeStream *stream, GMimeMessage *message)
{
/* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */
- if (g_mime_object_write_to_stream (GMIME_OBJECT(message), stream) < 0) {
- INTERNAL_ERROR("failed to write headers to stdout\n");
+ if (g_mime_object_write_to_stream (GMIME_OBJECT (message), NULL, stream) < 0) {
+ INTERNAL_ERROR ("failed to write headers to stdout\n");
GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (node->part);
if (g_mime_content_type_is_type (content_type, "application", "pgp-encrypted") ||
GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (node->part);
if (g_mime_content_type_is_type (content_type, "application", "pgp-encrypted") ||
- g_mime_content_type_is_type (content_type, "application", "pgp-signature")) {
- /* Ignore PGP/MIME cruft parts */
+ g_mime_content_type_is_type (content_type, "application", "pgp-signature") ||
+ g_mime_content_type_is_type (content_type, "application", "pkcs7-mime")) {
+ /* Ignore PGP/MIME and S/MIME cruft parts */
show_text_part_content (node->part, stream, NOTMUCH_SHOW_TEXT_PART_REPLY);
} else if (disposition &&
strcasecmp (g_mime_content_disposition_get_disposition (disposition),
GMIME_DISPOSITION_ATTACHMENT) == 0) {
const char *filename = g_mime_part_get_filename (GMIME_PART (node->part));
g_mime_stream_printf (stream, "Attachment: %s (%s)\n", filename,
show_text_part_content (node->part, stream, NOTMUCH_SHOW_TEXT_PART_REPLY);
} else if (disposition &&
strcasecmp (g_mime_content_disposition_get_disposition (disposition),
GMIME_DISPOSITION_ATTACHMENT) == 0) {
const char *filename = g_mime_part_get_filename (GMIME_PART (node->part));
g_mime_stream_printf (stream, "Attachment: %s (%s)\n", filename,
- g_mime_message_add_recipient (message, type, name, addr);
+ g_mime_message_add_mailbox (message, type, name, addr);
{
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) {
{
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
* being A Bad Thing, see
* http://marc.merlins.org/netrants/reply-to-harmful.html
* Some mailing lists munge the Reply-To header despite it
* being A Bad Thing, see
* http://marc.merlins.org/netrants/reply-to-harmful.html
- { get_sender, GMIME_ADDRESS_TYPE_TO },
- { get_to, GMIME_ADDRESS_TYPE_TO },
- { get_cc, GMIME_ADDRESS_TYPE_CC },
- { get_bcc, GMIME_ADDRESS_TYPE_BCC },
+ { get_sender, GMIME_ADDRESS_TYPE_TO },
+ { get_to, GMIME_ADDRESS_TYPE_TO },
+ { get_cc, GMIME_ADDRESS_TYPE_CC },
+ { get_bcc, GMIME_ADDRESS_TYPE_BCC },
n += scan_address_list (recipients, config, reply,
reply_to_map[i].recipient_type, &from_addr);
n += scan_address_list (recipients, config, reply,
reply_to_map[i].recipient_type, &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);
-create_reply_message(void *ctx,
- notmuch_config_t *config,
- notmuch_message_t *message,
- GMimeMessage *mime_message,
- bool reply_all,
- bool limited)
+create_reply_message (void *ctx,
+ notmuch_config_t *config,
+ notmuch_message_t *message,
+ GMimeMessage *mime_message,
+ bool reply_all,
+ bool limited)
{
const char *subject, *from_addr = NULL;
const char *in_reply_to, *orig_references, *references;
{
const char *subject, *from_addr = NULL;
const char *in_reply_to, *orig_references, *references;
in_reply_to = talloc_asprintf (ctx, "<%s>",
notmuch_message_get_message_id (message));
in_reply_to = talloc_asprintf (ctx, "<%s>",
notmuch_message_get_message_id (message));
- g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to);
+ g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to, NULL);
orig_references = notmuch_message_get_header (message, "references");
if (orig_references && *orig_references)
orig_references = notmuch_message_get_header (message, "references");
if (orig_references && *orig_references)
- g_mime_object_set_header (GMIME_OBJECT (reply), "References", references);
+ g_mime_object_set_header (GMIME_OBJECT (reply), "References", references, NULL);
from_addr = add_recipients_from_message (reply, config,
mime_message, reply_all);
from_addr = add_recipients_from_message (reply, config,
mime_message, reply_all);
from_addr = talloc_asprintf (ctx, "%s <%s>",
notmuch_config_get_user_name (config),
from_addr);
from_addr = talloc_asprintf (ctx, "%s <%s>",
notmuch_config_get_user_name (config),
from_addr);
- g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr);
+ g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr, NULL);
if (subject) {
if (strncasecmp (subject, "Re:", 3))
subject = talloc_asprintf (ctx, "Re: %s", subject);
if (subject) {
if (strncasecmp (subject, "Re:", 3))
subject = talloc_asprintf (ctx, "Re: %s", subject);
-static int do_reply(notmuch_config_t *config,
- notmuch_query_t *query,
- notmuch_show_params_t *params,
- int format,
- bool reply_all)
+static int
+do_reply (notmuch_config_t *config,
+ notmuch_query_t *query,
+ notmuch_show_params_t *params,
+ int format,
+ bool reply_all)
message = notmuch_messages_get (messages);
if (mime_node_open (config, message, ¶ms->crypto, &node))
message = notmuch_messages_get (messages);
if (mime_node_open (config, message, ¶ms->crypto, &node))
reply = create_reply_message (config, config, message,
GMIME_MESSAGE (node->part), reply_all,
format == FORMAT_HEADERS_ONLY);
reply = create_reply_message (config, config, message,
GMIME_MESSAGE (node->part), reply_all,
format == FORMAT_HEADERS_ONLY);
/* The headers of the reply message we've created */
sp->map_key (sp, "reply-headers");
/* The headers of the reply message we've created */
sp->map_key (sp, "reply-headers");
- format_headers_sprinter (sp, reply, true);
+ /* FIXME: send msg_crypto here to avoid killing the
+ * subject line on reply to encrypted messages! */
+ format_headers_sprinter (sp, reply, true, NULL);
format_part_reply (stream_stdout, node);
}
g_mime_stream_flush (stream_stdout);
format_part_reply (stream_stdout, node);
}
g_mime_stream_flush (stream_stdout);
notmuch_opt_desc_t options[] = {
{ .opt_keyword = &format, .name = "format", .keywords =
notmuch_opt_desc_t options[] = {
{ .opt_keyword = &format, .name = "format", .keywords =
- (notmuch_keyword_t []){ { "default", FORMAT_DEFAULT },
- { "json", FORMAT_JSON },
- { "sexp", FORMAT_SEXP },
- { "headers-only", FORMAT_HEADERS_ONLY },
- { 0, 0 } } },
+ (notmuch_keyword_t []){ { "default", FORMAT_DEFAULT },
+ { "json", FORMAT_JSON },
+ { "sexp", FORMAT_SEXP },
+ { "headers-only", FORMAT_HEADERS_ONLY },
+ { 0, 0 } } },
{ .opt_int = ¬much_format_version, .name = "format-version" },
{ .opt_keyword = &reply_all, .name = "reply-to", .keywords =
{ .opt_int = ¬much_format_version, .name = "format-version" },
{ .opt_keyword = &reply_all, .name = "reply-to", .keywords =
- (notmuch_keyword_t []){ { "all", true },
- { "sender", false },
- { 0, 0 } } },
- { .opt_keyword = (int*)(¶ms.crypto.decrypt), .name = "decrypt",
+ (notmuch_keyword_t []){ { "all", true },
+ { "sender", false },
+ { 0, 0 } } },
+ { .opt_keyword = (int *) (¶ms.crypto.decrypt), .name = "decrypt",
- (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE },
- { "auto", NOTMUCH_DECRYPT_AUTO },
- { "true", NOTMUCH_DECRYPT_NOSTASH },
- { 0, 0 } } },
+ (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE },
+ { "auto", NOTMUCH_DECRYPT_AUTO },
+ { "true", NOTMUCH_DECRYPT_NOSTASH },
+ { 0, 0 } } },
if (query_string == NULL) {
fprintf (stderr, "Out of memory\n");
return EXIT_FAILURE;
if (query_string == NULL) {
fprintf (stderr, "Out of memory\n");
return EXIT_FAILURE;