From: Austin Clements Date: Wed, 22 Apr 2015 01:28:26 +0000 (+2000) Subject: Re: notmuch_thread_get_authors X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0faf9013e0b109d18cecc265e18acdfbb541514d;p=notmuch-archives.git Re: notmuch_thread_get_authors --- diff --git a/ab/91fe744133a9a6d321f9c692e64b43aae5fdb5 b/ab/91fe744133a9a6d321f9c692e64b43aae5fdb5 new file mode 100644 index 000000000..cf7a8f897 --- /dev/null +++ b/ab/91fe744133a9a6d321f9c692e64b43aae5fdb5 @@ -0,0 +1,106 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 9A18F6DE1A2F + for ; Tue, 21 Apr 2015 18:40:28 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.622 +X-Spam-Level: +X-Spam-Status: No, score=-0.622 tagged_above=-999 required=5 tests=[AWL=2.229, + RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-0.55, 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 2P1u7_FK1_5N for ; + Tue, 21 Apr 2015 18:40:25 -0700 (PDT) +X-Greylist: delayed 713 seconds by postgrey-1.35 at arlo; + Tue, 21 Apr 2015 18:40:24 PDT +Received: from outgoing.csail.mit.edu (outgoing.csail.mit.edu [128.30.2.149]) + by arlo.cworth.org (Postfix) with ESMTP id C635C6DE1A2E + for ; Tue, 21 Apr 2015 18:40:24 -0700 (PDT) +Received: from [104.131.20.129] (helo=awakeningjr) + by outgoing.csail.mit.edu with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) + (Exim 4.72) (envelope-from ) + id 1YkjSl-0008Qn-Ln; Tue, 21 Apr 2015 21:28:27 -0400 +Received: from amthrax by awakeningjr with local (Exim 4.84) + (envelope-from ) + id 1YkjSk-0007Bx-Sd; Tue, 21 Apr 2015 21:28:26 -0400 +From: Austin Clements +To: Ronny Chevalier , + David Bremner +Subject: Re: notmuch_thread_get_authors +In-Reply-To: + +References: + + <87618qfk5l.fsf@maritornes.cs.unb.ca> + +User-Agent: Notmuch/0.19+38~g8fb1cbc (http://notmuchmail.org) Emacs/24.4.1 + (x86_64-pc-linux-gnu) +Date: Tue, 21 Apr 2015 21:28:26 -0400 +Message-ID: <87lhhlhryd.fsf@csail.mit.edu> +MIME-Version: 1.0 +Content-Type: text/plain +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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: Wed, 22 Apr 2015 01:40:28 -0000 + +On Tue, 21 Apr 2015, Ronny Chevalier wrote: +> On Tue, Apr 21, 2015 at 1:35 AM, David Bremner wrote: +>> Ronny Chevalier writes: +> Austin Clements wrote: +>> And I think there's a fairly easy way to do it in C code that will +>> also prevent library interface bloat: instead of introducing new +>> library APIs to get at this information, just use the existing +>> notmuch_thread_get_messages API and construct the matched and +>> non-matched lists in the CLI. Doing it in the CLI wouldn't require +>> the library to export yet another string list structure, which is +>> always a huge pain (thanks C!), and wouldn't introduce more "helper" +>> functions into the library API. +> +> I disagree with what Austin said. Because this does not solve the +> issue at all (or I misunderstood). The issue is with the notmuch API, +> if someone is using this library there no way it can parse properly +> the authors. +> In my case I am not using the CLI but the notmuch library, fixing this +> in the CLI is just an hack, and it does not fix the issue for the +> library users. + +My suggestion was in no way specific to the CLI. That was the context of +the discussion at the time, but for the purposes of this discussion, the +CLI is just another library user. + +You're completely right that there's no way to reliably parse the +authors list returned by notmuch_thread_get_authors. So don't do +that. Just use notmuch_thread_get_messages, walk the messages list, and +build your own authors list. There's no need to introduce additional +complexity and surface area into the library API for this specific use +case (IMO, even notmuch_thread_get_authors shouldn't exist, but it's +there for legacy reasons.) Then you can get author lists for matched, +non-matched, matching a specific tag, just the to, just the from, counts +of how many times each author appeared, whatever you want. + +> Furthermore, I do not see why providing a string list NULL-terminated +> in C is a huge pain? + +See the notmuch_tags_* and notmuch_filesnames_* APIs. Those are just +string lists. + +> Otherwise, I agree with Mark Walters comments on the patch. +> +> If no one is working to fix this at the moment, I can send a patch? +> +> Ronny