[PATCH 02/11] Integrate reply_part_content function into reply_part function.
authorJameson Graef Rollins <jrollins@finestructure.net>
Thu, 26 May 2011 01:01:11 +0000 (18:01 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:21 +0000 (09:38 -0800)
f5/65db9c018368a7a9dad176e6af8f9ef279d297 [new file with mode: 0644]

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