aboutsummaryrefslogtreecommitdiff
path: root/notmuch-reply.c
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2016-09-13 20:14:12 +0300
committerDavid Bremner <david@tethera.net>2016-09-17 08:53:11 -0300
commit208053b6845010aac08e00be50063ee890066584 (patch)
tree17858cee6744d39aa8d52b4c5e8a5a27ca1135b7 /notmuch-reply.c
parenta843fa48fedb7a3ce02af412404ba4359cdce5e0 (diff)
cli/reply: unify reply format functions
Prepare for further future unification by making the code similar. The only functional change is that errors in mime_node_open() also break execution in default reply format.
Diffstat (limited to 'notmuch-reply.c')
-rw-r--r--notmuch-reply.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 5adbab62..4b97ffa4 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -604,20 +604,20 @@ notmuch_reply_format_default(void *ctx,
unused (sprinter_t *sp))
{
GMimeMessage *reply;
- mime_node_t *root;
+ mime_node_t *node;
+
+ if (mime_node_open (ctx, message, &params->crypto, &node))
+ return 1;
reply = create_reply_message (ctx, config, message, reply_all);
if (!reply)
return 1;
show_reply_headers (reply);
+ format_part_reply (node);
g_object_unref (G_OBJECT (reply));
-
- if (mime_node_open (ctx, message, &params->crypto, &root) == NOTMUCH_STATUS_SUCCESS) {
- format_part_reply (root);
- talloc_free (root);
- }
+ talloc_free (node);
return 0;
}
@@ -633,7 +633,7 @@ notmuch_reply_format_sprinter(void *ctx,
GMimeMessage *reply;
mime_node_t *node;
- if (mime_node_open (ctx, message, &params->crypto, &node) != NOTMUCH_STATUS_SUCCESS)
+ if (mime_node_open (ctx, message, &params->crypto, &node))
return 1;
reply = create_reply_message (ctx, config, message, reply_all);
@@ -645,7 +645,6 @@ notmuch_reply_format_sprinter(void *ctx,
/* The headers of the reply message we've created */
sp->map_key (sp, "reply-headers");
format_headers_sprinter (sp, reply, TRUE);
- g_object_unref (G_OBJECT (reply));
/* Start the original */
sp->map_key (sp, "original");
@@ -654,6 +653,9 @@ notmuch_reply_format_sprinter(void *ctx,
/* End */
sp->end (sp);
+ g_object_unref (G_OBJECT (reply));
+ talloc_free (node);
+
return 0;
}