From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27038 invoked from network); 31 May 2021 18:23:53 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 31 May 2021 18:23:53 -0000 Received: from mout.gmx.net ([212.227.17.21]) by 1ess; Mon May 31 07:52:46 -0400 2021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1622461963; bh=1sFyYt7d4trIBotYsHBMLjEqEdMq5kR2+q8ZR4cUVy4=; h=X-UI-Sender-Class:From:Date:To:Subject:In-Reply-To; b=Y/yc2blwNsgdWNk4Xo/7xUjB+cScXGWsEsApms1zgVOnxTKMiTRWyf1JVw8OLFESD dy52s5RvL3bxPqmeOSlCMH0C+yMFVC5Ut2syawFEcAPGH16ZDmlL1nRVzO5TyrP4Mf pmy2bqdPYiyrOHI5XYZw/sS8A0vAx8pB2hdnDucY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from purple.my.domain ([84.248.3.213]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1M5fIQ-1lm2a11edG-007HI3; Mon, 31 May 2021 13:52:43 +0200 Message-ID: From: Risto Salminen Date: Mon, 31 May 2021 14:52:41 +0300 To: 9front@9front.org In-Reply-To: <971EAFFF76D75B465FE8AE28F208FAB9@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:p7i8ybKrcFk2Y0L2chfrDIc7IZ3uSk/newn+PNEx5QwagTLZ/pj xD9kkRfa2vwuGdy3hCWbz+VwEI/L/iHtwUwnsSF64yJCu0zdvVZ4N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FPwGWI2eoGW1ka81Zd/JoDbjZKji8CFKPJplqD5F7hskY/16JOy FwtFSeFFjAa7QwjyKM4LCpMsV4maHkttclk6sMsTAdmiJ6P6yipHlkOS8RBQNRS928bDZKF59 6Vr7BuWB2ZVvO/tW0FP+A7OrTZl9ML06Mt0LSMVXuoIPu66YBgR/3+wJ1xBH01CLqUIhfWcIk y3qtwTPSkX4eVnfCwKrn1ngQ8Sk1ekWbtWXqQp+yzNrmb0GW3AEIId5FGu4MGCXUUJomyizjV SR8eurdf+IRyAm37tDeZbiXPNg1Z2sA2Ks2N043VEqLE7Old2kTbowEhcGhD1jB7VgN+jAFZ0 kf6JIf1tSioac/MzI List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: lifecycle polling-scale solution Subject: Re: [9front] upas/nedmail: copy messages between IMAP folders Reply-To: 9front@9front.org Precedence: bulk Hello, this second iteration of the nedmail patch uses the functionality of moving messages between IMAP folders provided by the second iteration of the upas/fs patch. Would this be useful for the broader audience? Thanks, rsal diff -r 7c895ae504fa sys/man/1/nedmail =2D-- a/sys/man/1/nedmail Fri May 28 13:02:58 2021 +0200 +++ b/sys/man/1/nedmail Mon May 31 14:00:43 2021 +0300 @@ -184,6 +184,10 @@ but allow the user to type in text to be included with the forwarded message. .TP +.BI move " mbox +Move message to the named mailbox. +At the moment only supported with IMAP mailboxes. +.TP .B p Print message. An interrupt stops the printing. diff -r 7c895ae504fa sys/src/cmd/upas/ned/nedmail.c =2D-- a/sys/src/cmd/upas/ned/nedmail.c Fri May 28 13:02:58 2021 +0200 +++ b/sys/src/cmd/upas/ned/nedmail.c Mon May 31 14:00:43 2021 +0300 @@ -106,6 +106,7 @@ Mfn kcmd; Mfn mbcmd; Mfn mcmd; +Mfn movecmd; Mfn Pcmd; Mfn pcmd; Mfn pipecmd; @@ -143,6 +144,7 @@ { "m", 1, 1, mcmd, "m addr\t" "forward mail" }, { "M", 1, 0, mcmd, "M addr\t" "forward mail with message" }, { "mb", 1, 0, mbcmd, "mb mbox\t" "switch mailboxes" }, + { "move", 1, 1, movecmd, "move mbox\t" "move message to mailbox" }, { "p", 1, 0, pcmd, "p\t" "print the processed message" }, { "P", 0, 0, Pcmd, "P\t" "print the raw message" }, { "\"", 0, 0, quotecmd, "\"\t" "print a quoted version of msg" }, @@ -2406,6 +2408,44 @@ return m; } +Message* +movecmd(Cmd *c, Message *m) +{ + char buf[1024], *dest, *e, *p, *msg; + int fd; + + if(c->an !=3D 2){ + eprint("!usage: move mailbox\n"); + return nil; + } + dest =3D c->av[1]; + fd =3D open("/mail/fs/ctl", OWRITE); + if(fd < 0){ + eprint("can't open /mail/fs/ctl: %r\n"); + return nil; + } + while(m->parent !=3D &top) + m =3D m->parent; + msg =3D strrchr(m->path, '/'); + if(msg =3D=3D nil) + msg =3D m->path; + else + msg++; + p =3D buf; + e =3D buf + sizeof buf; + p =3D seprint(p, e, "move %s %s %s", mbname, msg, dest); + if(write(fd, buf, p - buf) < 0){ + eprint("!error %r\n"); + close(fd); + return nil; + } + eprint("!moved to %s\n", dest); + m->flags |=3D Fdeleted; + m->flags |=3D Fstored; + close(fd); + return m; +} + int appendtofile(Message *m, char *part, char *base, int mbox, int f) {