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 D22A6431FD7 for ; Sat, 11 May 2013 13:15:57 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 I6Zb-hQTOHa6 for ; Sat, 11 May 2013 13:15:52 -0700 (PDT) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 30B25431FBC for ; Sat, 11 May 2013 13:15:52 -0700 (PDT) Received: by mail-wi0-f172.google.com with SMTP id hm14so1676730wib.11 for ; Sat, 11 May 2013 13:15:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=Omh3ywOPV++u7FR9fGbjMYdYcyRLCPf0rCy+EaConHE=; b=QtBfaeTMg6Jf/GaJqkMZwyh+OogKOtAa2dLeUicFPZOXk2iZk/IKOfEvDnrfABpdp3 EOBRTojMie/sDYMcwVlnfiviDZTJaC2pD9zpnrkwGo/NES2POglQ/1EBqHanzxUOr53d VtpxtCAkcVC9lIMi/jrB5yJHv5hdBBrHpQIDfFn0zcn7TYLwlJAzzr0do+u7WHyQ2Cla feIgWWdcCMLLkwDk076w4G452NAYVADiNQ6GEJiULOWa7z+HFJL15Gp4J90ZieW15ytV nN44E7889CFmmhiROx0E8JUht/hedc7xtmdm6Vs00Fwo3oSfYAfDE4Wgkk2fx9e4tYmM ersw== X-Received: by 10.194.158.37 with SMTP id wr5mr31340241wjb.23.1368303351131; Sat, 11 May 2013 13:15:51 -0700 (PDT) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id e8sm5791628wic.5.2013.05.11.13.15.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 11 May 2013 13:15:50 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH 1/3] cli: show: separate out the printing of recipient headers Date: Sat, 11 May 2013 21:15:42 +0100 Message-Id: <1368303344-13713-2-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1368303344-13713-1-git-send-email-markwalters1009@gmail.com> References: <1368303344-13713-1-git-send-email-markwalters1009@gmail.com> 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: Sat, 11 May 2013 20:15:58 -0000 This splits out the sprinter printing of recipient headers so that notmuch-reply can call it directly. This will be used when reply outputs header for reply-all and reply-to-sender. --- notmuch-client.h | 3 +++ notmuch-show.c | 35 +++++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/notmuch-client.h b/notmuch-client.h index 45749a6..d55d4c0 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -223,6 +223,9 @@ void format_headers_sprinter (struct sprinter *sp, GMimeMessage *message, notmuch_bool_t reply); +void +format_headers_recipients_sprinter (struct sprinter *sp, GMimeMessage *message); + typedef enum { NOTMUCH_SHOW_TEXT_PART_REPLY = 1 << 0, } notmuch_show_text_part_flags; diff --git a/notmuch-show.c b/notmuch-show.c index 62178f7..8b9ab61 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -213,23 +213,10 @@ _is_from_line (const char *line) } void -format_headers_sprinter (sprinter_t *sp, GMimeMessage *message, - notmuch_bool_t reply) +format_headers_recipients_sprinter (sprinter_t *sp, GMimeMessage *message) { - /* Any changes to the JSON or S-Expression format should be - * reflected in the file devel/schemata. */ - InternetAddressList *recipients; const char *recipients_string; - const char *reply_to_string; - - sp->begin_map (sp); - - sp->map_key (sp, "Subject"); - sp->string (sp, g_mime_message_get_subject (message)); - - sp->map_key (sp, "From"); - sp->string (sp, g_mime_message_get_sender (message)); recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO); recipients_string = internet_address_list_to_string (recipients, 0); @@ -251,6 +238,26 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message, sp->map_key (sp, "Bcc"); sp->string (sp, recipients_string); } +} + +void +format_headers_sprinter (sprinter_t *sp, GMimeMessage *message, + notmuch_bool_t reply) +{ + /* Any changes to the JSON or S-Expression format should be + * reflected in the file devel/schemata. */ + + const char *reply_to_string; + + sp->begin_map (sp); + + sp->map_key (sp, "Subject"); + sp->string (sp, g_mime_message_get_subject (message)); + + sp->map_key (sp, "From"); + sp->string (sp, g_mime_message_get_sender (message)); + + format_headers_recipients_sprinter (sp, message); reply_to_string = g_mime_message_get_reply_to (message); if (reply_to_string) { -- 1.7.9.1