Ken Hornstein <[email protected]> wrote:
    >> Michael Richardson <[email protected]> wrote:
    >> > So, new "whatnowproc" is $HOME/bin/senddraft, which contains "send 
-draft"
    >> > and I think this works for me.
    >>
    >> So, no.
    >> I think that it only works if a draftfile is provided on the cmdline.
    >> And when used as a whatnowproc, the draftfile is implicit?
    >>
    >> I poked at uip/send.c to understand, seeing:
    >>
    >> case DRAFTSW:
    >> msgs[msgp++] = draft;
    >> continue;
    >>
    >> I guess "draft" is a global?

    > Huh, yes.  It's in sbr/globals.h.  sbr/globals.c shows:

    > char *draft = "draft";

    > A lot of that metadata is communicated via environment variables; see
    > what_now() in uip/whatnowproc.c

The -draft option adds this "default" value to the msgs[] array.
That's wrong if mh-drafts is being used.
I found the draft message number in the environment variable $mhdraft.
The Use mechanism is not invoked if mh-drafts is enabled, but send does not
know this since it didn't (yet?) read .mh_profile.

1. I changed send.c, to do:
   +               case DRAFTSW:
   +                   dontask=1;

if a if(!dontask) before the Use.. query.

2. handing /home/mcr/Mail/drafts/42 on the send cmd-line, as the file to
send, does not work.  It wants a msg number for mh-draft mode.

My "senddraft" whatnowproc is now:
#!/bin/sh

msgnum=`basename $mhdraft`
send -draft -draftfolder +drafts $msgnum $@

I guess I could drop -draft, if I have +draftfolder, and my patch.
I'm not sure if fixing -draft makes sense.
(Lots of trailing spaces in source code)

--
]               Never tell me the odds!                 | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works        |    IoT architect   [
]     [email protected]  http://www.sandelman.ca/        |   ruby on rails    [


Reply via email to