nmh-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated


From: Ken Hornstein
Subject: [Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated. 907d56122e31657df15e9bc79460210deedaefd9
Date: Mon, 20 Feb 2012 01:00:37 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The nmh Mail Handling System".

The branch, master has been updated
       via  907d56122e31657df15e9bc79460210deedaefd9 (commit)
       via  6cd749f4e818af7d10dfd6b1de1bb37cb7915acd (commit)
      from  c9dc470a7982250085c721e3f1436add8110ef63 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=907d56122e31657df15e9bc79460210deedaefd9


commit 907d56122e31657df15e9bc79460210deedaefd9
Author: Ken Hornstein <address@hidden>
Date:   Sun Feb 19 19:59:06 2012 -0500

    Add support for "to", "cc", "from", and "fcc" components via command-line
    switches.

diff --git a/etc/components b/etc/components
index 95be90c..26d54c2 100644
--- a/etc/components
+++ b/etc/components
@@ -1,6 +1,6 @@
-From: %(localmbox)
-To:
-cc:
-Fcc: +outbox
+%<{from}%|%(void(localmbox))%>%(void(width))%(putaddr From: )
+%<{to}%(void(width))%(putaddr To: )%|To:%>
+%<{cc}%(void(width))%(putaddr cc: )%|cc:%>
+Fcc: %<{fcc}%(putstr)%|+outbox%>
 Subject:
 --------
diff --git a/man/comp.man b/man/comp.man
index 643c056..251619b 100644
--- a/man/comp.man
+++ b/man/comp.man
@@ -23,6 +23,16 @@ comp \- compose a message
 .RB [ \-editor
 .IR editor ]
 .RB [ \-noedit ]
+.RB [ \-width
+.IR columns ]
+.RB [ \-from
+.IR address ]
+.RB [ \-to
+.IR address ]
+.RB [ \-cc
+.IR address ]
+.RB [ \-fcc
+.IR +folder ]
 .RB [ \-whatnowproc
 .IR program ]
 .RB [ \-nowhatnowproc ]
@@ -37,11 +47,18 @@ the draft (unless
 .B \-noedit
 is given, in which case the initial edit is suppressed).
 .PP
-The default message form contains the following elements:
+The default message template \*(lqcomponents\*(rq will direct
+.B comp
+to construct the messgage draft as follows:
 .PP
 .RS 5
 .nf
-%components%
+From: {from switch} or <Local-Mailbox> or <address@hidden>
+To: {to switch} or blank
+cc: {cc switch} or blank
+Fcc: {fcc switch} or +outbox
+Subject:
+--------
 .fi
 .RE
 .PP
@@ -107,6 +124,43 @@ or
 switchs will NOT be processed with
 .BR mh\-format (5).
 .PP
+In addition to the standard
+.BR mh\-format (5)
+escapes,
+.B comp
+the following
+.I component
+escapes are either new or have an alternate meaning:
+.PP
+.RS 5
+.nf
+.ta \w'Escape  'u +\w'Returns  'u
+.I Escape       Returns Description
+fcc    string  Any folders specified with `\-fcc\ folder'
+from   string  Any addresses specified with `\-from\ address'
+to     string  Any addresses specified with `\-to\ address'
+cc     string  Any addresses specified with `\-cc\ address'
+.fi
+.RE
+.PP
+By default the \*(lqTo:\*(rq and \*(lqcc:\*(rq fields are empty.  You may
+add addresses to these fields with the
+.B \-to
+.I address
+and
+.B \-cc
+.I address
+switches.  You may give these switches multiple times to add multiple
+addresses.
+.PP
+By default the \*(lqFrom:\*(rq field has either the value of the
+.B Local\-Mailbox
+profile entry or a system default email address.  This default can be
+overridden by using the
+.B \-from
+.I address
+switch.
+.PP
 If the draft already exists,
 .B comp
 will ask you as to the disposition
diff --git a/uip/comp.c b/uip/comp.c
index a29bfcd..2eea08a 100644
--- a/uip/comp.c
+++ b/uip/comp.c
@@ -39,6 +39,16 @@ static struct swit switches[] = {
     { "version", 0 },
 #define        HELPSW                12
     { "help", 0 },
+#define TOSW                  13
+    { "to address", 0 },
+#define CCSW                  14
+    { "cc address", 0 },
+#define FROMSW                15
+    { "from address", 0 },
+#define FCCSW                 16
+    { "fcc mailbox", 0 },
+#define WIDTHSW                      17
+    { "width colums", 0 },
     { NULL, 0 }
 };
 
@@ -67,6 +77,11 @@ static struct swit aqrul[] = {
     { NULL, 0 }
 };
 
+/*
+ * Add an item to a comma seperated list
+ */
+
+static char *addlist(char *, char *); 
 
 int
 main (int argc, char **argv)
@@ -77,6 +92,7 @@ main (int argc, char **argv)
     char *cp, *cwd, *maildir, *dfolder = NULL;
     char *ed = NULL, *file = NULL, *form = NULL;
     char *folder = NULL, *msg = NULL, buf[BUFSIZ];
+    char *to = NULL, *from = NULL, *cc = NULL, *fcc = NULL, *dp;
     char drft[BUFSIZ], **argp, **arguments;
     struct msgs *mp = NULL;
     struct format *fmt;
@@ -167,6 +183,42 @@ main (int argc, char **argv)
                    dfolder = NULL;
                    isdf = NOTOK;
                    continue;
+
+               case TOSW:
+                   if (!(cp = *argp++) || *cp == '-')
+                       adios (NULL, "missing argument to %s", argp[-2]);
+                   to = addlist(to, cp);
+                   continue;
+
+               case CCSW:
+                   if (!(cp = *argp++) || *cp == '-')
+                       adios (NULL, "missing argument to %s", argp[-2]);
+                   cc = addlist(cc, cp);
+                   continue;
+
+               case FROMSW:
+                   if (!(cp = *argp++) || *cp == '-')
+                       adios (NULL, "missing argument to %s", argp[-2]);
+                   from = addlist(from, cp);
+                   continue;
+
+               case FCCSW:
+                   if (!(cp = *argp++) || *cp == '-')
+                       adios (NULL, "missing argument to %s", argp[-2]);
+                   dp = NULL;
+                   if (*cp == '@')
+                       cp = dp = path(cp + 1, TSUBCWF);
+                   fcc = addlist(fcc, cp);
+                   if (dp)
+                       free(dp);
+                   continue;
+
+               case WIDTHSW:
+                   if (!(cp = *argp++) || *cp == '-')
+                       adios (NULL, "missing argument to %s", argp[-2]);
+                   if ((outputlinelen = atoi(cp)) < 10)
+                       adios (NULL, "impossible width %d", outputlinelen);
+                   continue;
            }
        }
        if (*cp == '+' || *cp == '@') {
@@ -232,14 +284,38 @@ main (int argc, char **argv)
        if ((in = open (form = getcpy (m_name (mp->lowsel)), O_RDONLY)) == 
NOTOK)
            adios (form, "unable to open message");
     } else {
+       struct comp *cptr;
+
        if (! form)
            form = components;
 
         cp = new_fs(form, NULL, NULL);
        format_len = strlen(cp);
        ncomps = fmt_compile(cp, &fmt);
-       if (ncomps > 0) {
-           adios(NULL, "format components not supported when using comp");
+
+       /*
+        * Set up any components that were fed to us on the command line
+        */
+
+       if (from) {
+           FINDCOMP(cptr, "from");
+           if (cptr)
+               cptr->c_text = from;
+       }
+       if (to) {
+           FINDCOMP(cptr, "to");
+           if (cptr)
+               cptr->c_text = to;
+       }
+       if (cc) {
+           FINDCOMP(cptr, "cc");
+           if (cptr)
+               cptr->c_text = cc;
+       }
+       if (fcc) {
+           FINDCOMP(cptr, "fcc");
+           if (cptr)
+               cptr->c_text = fcc;
        }
     }
 
@@ -326,3 +402,16 @@ edit_it:
     done (1);
     return 1;
 }
+
+/*
+ * Append an item to a comma separated list
+ */
+
+static char *
+addlist (char *list, char *item)
+{
+    if (list)
+       list = add (", ", list);
+
+    return add (item, list);
+}

http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=6cd749f4e818af7d10dfd6b1de1bb37cb7915acd


commit 6cd749f4e818af7d10dfd6b1de1bb37cb7915acd
Author: Ken Hornstein <address@hidden>
Date:   Sun Feb 19 18:03:26 2012 -0500

    Fix a bug leftover from the Automake conversion; the AC_SUBST'd variable
    names are really editorpath and pagerpath, use those instead.

diff --git a/Makefile.am b/Makefile.am
index 7358c78..082c9c7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -457,8 +457,8 @@ sbr_libmh_a_CPPFLAGS = -I./sbr 
-DNMHETCDIR='"$(sysconfdir)"' \
                -DMAILSPOOL='"$(mailspool)"' \
                -DSENDMAILPATH='"$(sendmailpath)"' -DNMHBINDIR='"$(bindir)"' \
                -DNMHLIBDIR='"$(libdir)"' \
-               -DDEFAULT_EDITOR='"$(default_editor)"' \
-               -DDEFAULT_PAGER='"$(default_pager)"'
+               -DDEFAULT_EDITOR='"$(editorpath)"' \
+               -DDEFAULT_PAGER='"$(pagerpath)"'
 
 sbr_libdtimep_a_SOURCES = sbr/dtimep.l
 sbr_libdtimep_a_CFLAGS = $(sbr_libmh_a_CPPFLAGS) 
$(DISABLE_UNUSED_MACROS_WARNING)
@@ -486,8 +486,8 @@ man/man.sed: Makefile
        echo 's,%mandir%,$(mandir),g' >> $@
        echo 's,%mailspool%,$(mailspool),g' >> $@
        echo 's,%sendmailpath%,$(sendmailpath),g' >> $@
-       echo 's,%default_editor%,$(default_editor),g' >> $@
-       echo 's,%default_pager%,$(default_pager),g' >> $@
+       echo 's,%default_editor%,$(editorpath),g' >> $@
+       echo 's,%default_pager%,$(pagerpath),g' >> $@
        echo 's,%manext1%,$(manext1),g' >> $@
        echo 's,%manext5%,$(manext5),g' >> $@
        echo 's,%manext8%,$(manext8),g' >> $@

-----------------------------------------------------------------------

Summary of changes:
 Makefile.am    |    8 ++--
 etc/components |    8 ++--
 man/comp.man   |   58 +++++++++++++++++++++++++++++++++-
 uip/comp.c     |   93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 155 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
The nmh Mail Handling System



reply via email to

[Prev in Thread] Current Thread [Next in Thread]