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 C7EDA6DE597A for ; Sun, 14 Aug 2016 07:35:42 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.579 X-Spam-Level: X-Spam-Status: No, score=-0.579 tagged_above=-999 required=5 tests=[AWL=0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] 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 lj-HbP3oZFSz for ; Sun, 14 Aug 2016 07:35:35 -0700 (PDT) Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by arlo.cworth.org (Postfix) with ESMTPS id 2D5B96DE7237 for ; Sun, 14 Aug 2016 06:47:24 -0700 (PDT) Received: by mail-wm0-f45.google.com with SMTP id o80so59122292wme.1 for ; Sun, 14 Aug 2016 06:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=/ctPQAywCT0RKYePjJirp7xE2ziZiA+bcisfsCHf7F4=; b=Vvtqd8li7VjFRQvyZ3Mejv0+u3eqz4FppgBRFxsVujQX6GNvxoX/YI0fGtenMJQw9G 43mlMCKm6DZGfCbmN6osbX1pYKO32ACJLmi6iLIaQeLrnjgZj23XYQYCZMgda8zOAfqn utOyaDPjVceceNRjZcvOJeJ8fdQeB97ssQmOqWGvUSOFmSLXILypLnjKCa0TszusAX8p YVeeJZnnP+rvI2pddIWCBq+S/sHrd2VQiNCgy8muF70f+KNqW+q1xcEVQrbfLAUUt0TR CLswOq/1DqD8gmsyaCfqXz0B3Dxf08ocX2MSr2OMS+btYNvRbrYXXFBQA4e566pHPmT8 RjEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=/ctPQAywCT0RKYePjJirp7xE2ziZiA+bcisfsCHf7F4=; b=AozkeiUMMdzr7qrLDV8pgFjf0y7P2c6zbx6zN13iIzOLuaU+X/JHmIpDUkPhgUeWy5 b+5EUIlQUTDEzSg84end0CNV4Qderc0g+YmDnoF6RVmXE352CkCIiIoA9Gx95D5GEoLq Vb7XbXD5WmakQIyG9uh14+o9at7ihFAVy/IKEPw4xabjpxTaI5ijUt7lKGGfqdcp5Vyy l9Ty4hHJlmf+pQH9BczSqvsLbQIdbfIMjn7bdNaP1y3glyKffOrTfa2vInV5P0eg7i7c rNfwnCAgDh8ni5vvz7HtA/MBLqRt0Xeqp0XleM/h85E+T2HjpDtUeNk8aG5Cbli0Qrnk msyw== X-Gm-Message-State: AEkoouuMdyzeh2GkDvhjIOnGByXuRh0SAZtzRjDbtci3Mrtn+xDjsUfson4x3Clp5DLB/g== X-Received: by 10.194.149.133 with SMTP id ua5mr24547490wjb.79.1471182433670; Sun, 14 Aug 2016 06:47:13 -0700 (PDT) Received: from localhost (mobile-access-bcee63-250.dhcp.inet.fi. [188.238.99.250]) by smtp.gmail.com with ESMTPSA id uo4sm16706922wjc.36.2016.08.14.06.47.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Aug 2016 06:47:12 -0700 (PDT) From: Jani Nikula To: Shea Levy , notmuch@notmuchmail.org Subject: Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email In-Reply-To: <874m6no4mm.fsf@nikula.org> References: <1470776118-5070-1-git-send-email-shea@shealevy.com> <87k2fk98yh.fsf@nikula.org> <87oa4vtta4.fsf@shlevy-laptop.i-did-not-set--mail-host-address--so-tickle-me> <874m6no4mm.fsf@nikula.org> Date: Sun, 14 Aug 2016 16:45:47 +0300 Message-ID: <871t1ro450.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 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: Sun, 14 Aug 2016 14:35:43 -0000 On Sun, 14 Aug 2016, Jani Nikula wrote: > I think we should use gmime for this, and expect the configuration to be > a comma separated list of addresses, specifically in the format that > internet_address_list_parse_string() parses [2]. Here's a little sample to get started and play around. Build using something along the lines of: gcc $(pkg-config --cflags gmime-2.6 --libs gmime-2.6) internetaddress.c You can try e.g. $ ./a.out "J. Random Hacker , dude@example.org, \"Hacker, J. Random\" " name[0]: J. Random Hacker addr[0]: jrh@example.org name[1]: (null) addr[1]: dude@example.org name[2]: Hacker, J. Random addr[2]: hacker@example.com ----------->%---------- #include #include #include #include int main(int argc, char *argv[]) { InternetAddressList *list; InternetAddress *mailbox; int i; if (argc != 2) { fprintf(stderr, "usage: %s address-list\n", argv[0]); return EXIT_FAILURE; } list = internet_address_list_parse_string(argv[1]); for (i = 0; i < internet_address_list_length(list); i++) { InternetAddress *addr; InternetAddressMailbox *mbox; addr = internet_address_list_get_address(list, i); if (INTERNET_ADDRESS_IS_GROUP(addr)) { printf("[%d] is a group, ignoring\n", i); continue; } mbox = INTERNET_ADDRESS_MAILBOX(addr); printf("name[%d]: %s\n", i, internet_address_get_name(addr)); printf("addr[%d]: %s\n", i, internet_address_mailbox_get_addr(mbox)); } return EXIT_SUCCESS; }