From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 9A2C76DE0ED6 for ; Sat, 9 Nov 2019 09:44:32 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.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, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id giOXHanb1quC for ; Sat, 9 Nov 2019 09:44:30 -0800 (PST) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by arlo.cworth.org (Postfix) with ESMTPS id 7211B6DE0C6B for ; Sat, 9 Nov 2019 09:44:30 -0800 (PST) Received: by mail-lj1-f195.google.com with SMTP id m9so9480119ljh.8 for ; Sat, 09 Nov 2019 09:44:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UYh1Xh0sVpa+dgCyovtzSosQYg640jkm5bjFSMn0RRo=; b=MPhq8fxgyccLBElbZcnmVO9pEfBRJj/zxQXE0wJ/9Ecv9kIG1Otoi1KYvFbOGwP9xj +W+clx4sSNkw+alptiiaub7LqJbJM4r+UQKYLIpQe6QuWYyK3DIzJ2xGueHYZkzsfsNY Jj3QfG+E9hjaY/98iHv5mNTBcWLIllPTImkowHaFJPBPKMYPLqIQQskctUcXO0mAD3xe XvwqQUplIiSokdt7Zl4Sz4D0UbaQcKyieRpSU/OQx5SvgK4Xm+pE2R9BqfOXiWcIYcss 5/2G0caffW+oOXeZAtsEvaz+73o+vgutib7d+vlYC0Ch9DnCpgMB9+9+XP3SARWtv8yV 1ndg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UYh1Xh0sVpa+dgCyovtzSosQYg640jkm5bjFSMn0RRo=; b=iY3kcukca6U/546ai2hWNbI/ioes1UkOFaBpw0yvxMQxTH7C4C7y/GxuhL/TF054Ep tMy34lTMuA6vSEC7YOppC1fP06N9qGsdk016m0Fs+8eOFFW1mYI7ZSvSoAj7+8MhvP+D AdoTAm0/YGQv/mKFNj82ttNVKd5Rn0voZrYj68z+IT8kReJ0gLHBYvRWJFffn9m181nA MwnyhT/osBK+6mD8n85Dt3m9fp3bnd70OAsrwG8m796ImTCoixN/3lVj22F/3zAiedCz iQF8zLJisSH0U+lbsAqdXIA4VIlSd7RsRBW1UDRmRRbNYy1kNLbh6aNT1l9nYIwWjDAU YqtQ== X-Gm-Message-State: APjAAAXG00Qf+pta6o00HnHgpF7K4NyPC3YqfXfhTbr+xL61IQWw3jdQ SNFvqrgWXfRtwKtI7wphVXdj6zBb4KI= X-Google-Smtp-Source: APXvYqy2HuksG3DRad0OmEEu3VDNaOtGBdEyZwz6zb7hWZu41oK5TyO28G+2DfDRAReOuH1/YRKcTg== X-Received: by 2002:a2e:9e97:: with SMTP id f23mr10849994ljk.89.1573321467183; Sat, 09 Nov 2019 09:44:27 -0800 (PST) Received: from localhost.localdomain (h88-129-82-160.cust.a3fiber.se. [88.129.82.160]) by smtp.gmail.com with ESMTPSA id t7sm4150969ljg.59.2019.11.09.09.44.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Nov 2019 09:44:26 -0800 (PST) From: Johan Parin X-Google-Original-From: Johan Parin To: notmuch@notmuchmail.org Cc: Johan Parin Subject: [PATCH] Fix format_headers_sprinter to return all headers Date: Sat, 9 Nov 2019 18:44:13 +0100 Message-Id: <20191109174413.97663-1-johan.parin@gmail.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sat, 09 Nov 2019 09:51:29 -0800 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 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, 09 Nov 2019 17:44:32 -0000 Modify format_headers_sprinter so that it returns all headers in the sexp, instead of a fixed set of headers. This is required in order for the elisp variable `notmuch-message-headers' to work. See this bug report: https://notmuchmail.org/pipermail/notmuch/2017/026069.html --- notmuch-show.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/notmuch-show.c b/notmuch-show.c index 21792a57..9652ed09 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -205,6 +205,15 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message, char *recipients_string; const char *reply_to_string; void *local = talloc_new (sp); + GMimeHeaderList *header_list; + GMimeHeader *header; + int header_count; + /* Headers requiring some special treatment in formatting */ + const char* special_headers[] = {"Subject", "From", "To", "Cc", "Bcc", + "Reply-To", "In-reply-to", "References", + "Date"}; + const int special_header_count = sizeof(special_headers) / sizeof(char *); + bool special; sp->begin_map (sp); @@ -255,6 +264,24 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message, sp->string (sp, g_mime_message_get_date_string (sp, message)); } + header_list = g_mime_object_get_header_list (GMIME_OBJECT(message)); + header_count = g_mime_header_list_get_count(header_list); + + for (int i = 0; i < header_count; i++) { + header = g_mime_header_list_get_header_at(header_list, i); + special = false; + for (int k = 0; k < special_header_count; k++) + if (!STRNCMP_LITERAL(g_mime_header_get_name(header), + special_headers[k])) { + special = true; + break; + } + if (special) + continue; + sp->map_key (sp, g_mime_header_get_name(header)); + sp->string (sp, g_mime_header_get_value(header)); + } + sp->end (sp); talloc_free (local); } -- 2.21.0 (Apple Git-122)