From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <9front-bounces@9front.inri.net> X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: from 9front.inri.net (9front.inri.net [168.235.81.73]) by inbox.vuxu.org (Postfix) with ESMTP id C2031266B0 for ; Wed, 8 May 2024 09:28:30 +0200 (CEST) Received: from pb-smtp20.pobox.com ([173.228.157.52]) by 9front; Wed May 8 03:26:25 -0400 2024 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 026A71AFD5 for <9front@9front.org>; Wed, 8 May 2024 03:26:21 -0400 (EDT) (envelope-from unobe@cpan.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=message-id :from:date:subject:to:mime-version:content-type :content-transfer-encoding; s=sasl; bh=VGfhHOMso1PeuEACNWMqdXtKM Ii41wDIYPXHNWbTNvs=; b=Pm5TERKBoOtT6EjEf0HVwv+i4IVfkxOHVxyUB1vcr GvDo23jJuOaLTRXpaMQC2sVVb0swxWgdm4WkEq60hd9lUz1yCJi/ez98xGhG5ZZA AJmWod5YtdbPdcSqJsX/uMYrjnfsvG/OlzzO9trlaopfxzs2TA5NqB70T7yrHCQM qo= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id EEDE31AFD4 for <9front@9front.org>; Wed, 8 May 2024 03:26:20 -0400 (EDT) (envelope-from unobe@cpan.org) Received: from strider.localdomain (unknown [47.37.156.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 2756B1AFD3 for <9front@9front.org>; Wed, 8 May 2024 03:26:17 -0400 (EDT) (envelope-from unobe@cpan.org) Message-ID: <11AEA4EE6266EBCACF531DE32D2AA5B8@smtp.pobox.com> From: Romano Date: Wed, 08 May 2024 07:22:16 +0000 To: 9front@9front.org MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Pobox-Relay-ID: 4222BD92-0D0C-11EF-A9EA-F515D2CDFF5E-09620299!pb-smtp20.pobox.com List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: singleton YAML out-scaling template Subject: [9front] [PATCH] upas: allow send to parse e-mail descriptions like marshal Reply-To: 9front@9front.org Precedence: bulk upas/marshal/marshal.c:/^printfrom parses an e-mail with a description (e.g., "A Name ") and sets the from to just the e-mail address portion. This does the same for upas/send so that upasname='A name ' can be used to both set the From: in marshal with a description and to match the correct from in send for sending via smtp. --- diff a327175a3c01d18e3e4c061ce4579cc420ee3561 daebe6f5e2a6df18729e08319c0ab70aad8e1666 --- a/sys/src/cmd/upas/send/message.c +++ b/sys/src/cmd/upas/send/message.c @@ -1,6 +1,7 @@ #include "common.h" #include "send.h" #include +#include #include "../smtp/smtp.h" #include "../smtp/rfc822.tab.h" @@ -18,6 +19,24 @@ static String* getstring(Node *p); static String* getaddr(Node *p); +char * +userfrom(char *cp) +{ + char *s, *r; + int n; + + if((n = strlen(cp)) > 4 && cp[n-1] == '>'){ + if((s = strrchr(cp, '<')) != nil && s != cp && isspace(s[-1])) { + s++; + strncpy(r, s, n - sizeof s); + r[strlen(s)-1] = '\0'; + return r; + } + } + + return cp; +} + int default_from(message *mp) { @@ -32,7 +51,7 @@ return -1; } if(cp && *cp) - s_append(mp->sender, cp); + s_append(mp->sender, userfrom(cp)); else s_append(mp->sender, lp); free(cp);