From: Kushal Kumaran Date: Tue, 4 Dec 2012 09:42:50 +0000 (+0530) Subject: using the List-Post header to reply to mailing lists X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=574069cad36ef2b92c22830aafda9eeb25b9697b;p=notmuch-archives.git using the List-Post header to reply to mailing lists --- diff --git a/ee/980266331ced4f76e83c88ec555569839ca1d4 b/ee/980266331ced4f76e83c88ec555569839ca1d4 new file mode 100644 index 000000000..48d65492b --- /dev/null +++ b/ee/980266331ced4f76e83c88ec555569839ca1d4 @@ -0,0 +1,216 @@ +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 5A524431FB6 + for ; Tue, 4 Dec 2012 01:42:58 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.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 tBvTCPWgo2bO for ; + Tue, 4 Dec 2012 01:42:57 -0800 (PST) +Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com + [209.85.220.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id A5C23431FAE + for ; Tue, 4 Dec 2012 01:42:57 -0800 (PST) +Received: by mail-pa0-f53.google.com with SMTP id hz1so2720336pad.26 + for ; Tue, 04 Dec 2012 01:42:56 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=sender:from:to:subject:user-agent:date:message-id:mime-version + :content-type; bh=DtnATiaPfUta2NiUFCsfruTt4XpISb+275heM/CvfeI=; + b=DSEOS+sa77FEdGTIi4uAwfRcoHOfofPn3lhCSShjN7AmPaGqovqgh5MPoJT0zItbNP + H2z3DZdYVKRfMLIM1qTlFQxJLWczw3UhMP+fHt9AhiefqwtJ6fHgOlfCrJ29t1bYu6ZY + GqNJo0Qny/SpsbR+/Lar2Cjnf05PxbBiisV+S2RjOrj32wyqN5sRE5ln3+YBNZrGXKFR + 5MqJWg84E9VND9gmRBwSWRPR9kN+34iuVxwgXi1dhLksFIQWaSFIYGk2KmruwR+rNmIF + 0YK1M+L42Vj5u5R6TgHyA9ejff/lv+aNTbJKh6FYkbcY2USgespBQ6wiDtZgm9EbDSI+ + xHFw== +Received: by 10.68.232.195 with SMTP id tq3mr37183050pbc.70.1354614176862; + Tue, 04 Dec 2012 01:42:56 -0800 (PST) +Received: from nitrogen ([117.219.4.209]) + by mx.google.com with ESMTPS id ay5sm534700pab.1.2012.12.04.01.42.54 + (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 04 Dec 2012 01:42:56 -0800 (PST) +Sender: Kushal Kumaran +Received: by nitrogen (Postfix, from userid 1000) + id 230581201C1; Tue, 4 Dec 2012 15:12:50 +0530 (IST) +From: Kushal Kumaran +To: notmuch@notmuchmail.org +Subject: using the List-Post header to reply to mailing lists +User-Agent: Notmuch/0.14+83~gae459a3 (http://notmuchmail.org) Emacs/24.1.1 + (x86_64-pc-linux-gnu) +Date: Tue, 04 Dec 2012 15:12:50 +0530 +Message-ID: <50bdc5a0.8557420a.08a9.324b@mx.google.com> +MIME-Version: 1.0 +Content-Type: text/plain +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: Tue, 04 Dec 2012 09:42:58 -0000 + +Hi, + +I've been using notmuch with emacs for a while now. I subscribe to a +few mailing lists where Reply-To-All is severely frowned upon, so I +wanted to be able to use the List-Post header (RFC2369) when replying to +mailing list posts. I've hacked notmuch-reply.c for my purposes, but I +was wondering how other people manage. + +As it stands, this patch is entirely unsuitable for merging. At least +the following issues will need to be resolved first: + +- should an additional command-line option be added to invoke this + behaviour? My personal preference is to just use the List-Post header + whenever possible, if --reply-to=all is not given. + +- should anything be done if the List-Post header has a URL which is not + a mailto: URL (start a web browser?). None of the mailing lists I'm + subscribed to puts anything other than mailto. The patch ignores the + header if the URL is not a mailto. + +- needs tests + +- needs documentation + +If anyone has alternatives to doing this kind of URL parsing, I'm +interested. Comments regarding my pathetic knowledge of gmime are also +welcome. If no one things notmuch needs this functionality, I will just +hold on to it for my personal use. + +--- + notmuch-reply.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 60 insertions(+), 8 deletions(-) + +diff --git a/notmuch-reply.c b/notmuch-reply.c +index e60a264..82f5a35 100644 +--- a/notmuch-reply.c ++++ b/notmuch-reply.c +@@ -172,6 +172,11 @@ address_is_users (const char *address, notmuch_config_t *config) + return address_match (address, config, STRING_IS_USER_ADDRESS) != NULL; + } + ++typedef enum { ++ rfc822, ++ url ++} address_format_t; ++ + /* Scan addresses in 'list'. + * + * If 'message' is non-NULL, then for each address in 'list' that is +@@ -231,6 +236,37 @@ scan_address_list (InternetAddressList *list, + return n; + } + ++InternetAddressList *list_post_url_to_address_list(const char *header_value) { ++ size_t recipients_len = strlen(header_value); ++ size_t list_post_prefix_len = strlen("