Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id DB921431FB6 for ; Wed, 25 May 2011 18:01:40 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.921 X-Spam-Level: X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5 tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8KKm9hTbbjJB for ; Wed, 25 May 2011 18:01:39 -0700 (PDT) Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu [131.215.239.19]) by olra.theworths.org (Postfix) with ESMTP id D82D3429E3D for ; Wed, 25 May 2011 18:01:34 -0700 (PDT) Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1]) by earth-doxen-postvirus (Postfix) with ESMTP id 6D35E66E04A3; Wed, 25 May 2011 18:01:33 -0700 (PDT) X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new Received: from servo.finestructure.net (gwave-104.ligo.caltech.edu [131.215.114.104]) (Authenticated sender: jrollins) by earth-doxen-submit (Postfix) with ESMTP id 8FE7866E04A6; Wed, 25 May 2011 18:01:25 -0700 (PDT) Received: by servo.finestructure.net (Postfix, from userid 1000) id 720F17BF; Wed, 25 May 2011 18:01:26 -0700 (PDT) From: Jameson Graef Rollins To: notmuch@notmuchmail.org Subject: [PATCH 02/11] Integrate reply_part_content function into reply_part function. Date: Wed, 25 May 2011 18:01:11 -0700 Message-Id: <1306371680-19441-3-git-send-email-jrollins@finestructure.net> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1306371680-19441-1-git-send-email-jrollins@finestructure.net> References: <1306371680-19441-1-git-send-email-jrollins@finestructure.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2011 01:01:41 -0000 After the last patch to eliminate some redundant code paths in reply_part, the reply_part_content function was only being called once. Disolving the function and integrating its contents into the reply_part function makes things a little simpler, and frees up some name space that will be needed in the next patch. --- notmuch-reply.c | 52 +++++++++++++++++++++++----------------------------- 1 files changed, 23 insertions(+), 29 deletions(-) diff --git a/notmuch-reply.c b/notmuch-reply.c index 5d72b1f..8c5e76c 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -38,34 +38,6 @@ static const notmuch_show_format_t format_reply = { }; static void -reply_part_content (GMimeObject *part) -{ - GMimeStream *stream_stdout = NULL, *stream_filter = NULL; - GMimeDataWrapper *wrapper; - const char *charset; - - charset = g_mime_object_get_content_type_parameter (part, "charset"); - stream_stdout = g_mime_stream_file_new (stdout); - if (stream_stdout) { - g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE); - stream_filter = g_mime_stream_filter_new(stream_stdout); - if (charset) { - g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter), - g_mime_filter_charset_new(charset, "UTF-8")); - } - } - g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter), - g_mime_filter_reply_new(TRUE)); - wrapper = g_mime_part_get_content_object (GMIME_PART (part)); - if (wrapper && stream_filter) - g_mime_data_wrapper_write_to_stream (wrapper, stream_filter); - if (stream_filter) - g_object_unref(stream_filter); - if (stream_stdout) - g_object_unref(stream_stdout); -} - -static void show_reply_headers (GMimeMessage *message) { GMimeStream *stream_stdout = NULL, *stream_filter = NULL; @@ -94,7 +66,29 @@ reply_part (GMimeObject *part, if (g_mime_content_type_is_type (content_type, "text", "*") && !g_mime_content_type_is_type (content_type, "text", "html")) { - reply_part_content (part); + GMimeStream *stream_stdout = NULL, *stream_filter = NULL; + GMimeDataWrapper *wrapper; + const char *charset; + + charset = g_mime_object_get_content_type_parameter (part, "charset"); + stream_stdout = g_mime_stream_file_new (stdout); + if (stream_stdout) { + g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE); + stream_filter = g_mime_stream_filter_new(stream_stdout); + if (charset) { + g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter), + g_mime_filter_charset_new(charset, "UTF-8")); + } + } + g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter), + g_mime_filter_reply_new(TRUE)); + wrapper = g_mime_part_get_content_object (GMIME_PART (part)); + if (wrapper && stream_filter) + g_mime_data_wrapper_write_to_stream (wrapper, stream_filter); + if (stream_filter) + g_object_unref(stream_filter); + if (stream_stdout) + g_object_unref(stream_stdout); } else { -- 1.7.4.4