Removed the draft message in favor for a consistent draft folder facility
[mmh] / uip / forw.c
index 8a7ed34..6e33dc3 100644 (file)
@@ -21,83 +21,55 @@ static struct swit switches[] = {
        { "annotate", 0 },
 #define NANNOSW  1
        { "noannotate", 0 },
-#define DFOLDSW  2
-       { "draftfolder +folder", 0 },
-#define DMSGSW  3
-       { "draftmessage msg", 0 },
-#define NDFLDSW  4
-       { "nodraftfolder", 0 },
-#define EDITRSW  5
+#define EDITRSW  2
        { "editor editor", 0 },
-#define NEDITSW  6
+#define NEDITSW  3
        { "noedit", 0 },
-#define FILTSW  7
+#define FILTSW  4
        { "filter filterfile", 0 },
-#define FORMSW  8
+#define FORMSW  5
        { "form formfile", 0 },
-#define FRMTSW  9
+#define FRMTSW  6
        { "format", 5 },
-#define NFRMTSW  10
+#define NFRMTSW  7
        { "noformat", 7 },
-#define INPLSW  11
+#define INPLSW  8
        { "inplace", 0 },
-#define NINPLSW  12
+#define NINPLSW  9
        { "noinplace", 0 },
-#define MIMESW  13
+#define MIMESW  10
        { "mime", 0 },
-#define NMIMESW  14
+#define NMIMESW  11
        { "nomime", 0 },
-#define DGSTSW  15
+#define DGSTSW  12
        { "digest list", 0 },
-#define ISSUESW  16
+#define ISSUESW  13
        { "issue number", 0 },
-#define VOLUMSW  17
+#define VOLUMSW  14
        { "volume number", 0 },
-#define WHATSW  18
+#define WHATSW  15
        { "whatnowproc program", 0 },
-#define NWHATSW  19
+#define NWHATSW  16
        { "nowhatnowproc", 0 },
-#define BITSTUFFSW  20
+#define BITSTUFFSW  17
        { "dashstuffing", 0 },  /* interface to mhl */
-#define NBITSTUFFSW  21
+#define NBITSTUFFSW  18
        { "nodashstuffing", 0 },
-#define VERSIONSW  22
+#define VERSIONSW  19
        { "version", 0 },
-#define HELPSW  23
+#define HELPSW  20
        { "help", 0 },
-#define FILESW  24
+#define FILESW  21
        { "file file", 4 },  /* interface from msh */
 
 #ifdef MHE
-#define BILDSW  25
+#define BILDSW  22
        { "build", 5 },  /* interface from mhe */
 #endif /* MHE */
 
        { NULL, 0 }
 };
 
-static struct swit aqrnl[] = {
-#define NOSW  0
-       { "quit", 0 },
-#define YESW  1
-       { "replace", 0 },
-#define LISTDSW  2
-       { "list", 0 },
-#define REFILSW  3
-       { "refile +folder", 0 },
-#define NEWSW  4
-       { "new", 0 },
-       { NULL, 0 }
-};
-
-static struct swit aqrl[] = {
-       { "quit", 0 },
-       { "replace", 0 },
-       { "list", 0 },
-       { "refile +folder", 0 },
-       { NULL, 0 }
-};
-
 static char drft[BUFSIZ];
 
 static char delim3[] =
@@ -122,14 +94,13 @@ main (int argc, char **argv)
 {
        int msgp = 0, anot = 0, inplace = 1, mime = 0;
        int issue = 0, volume = 0, dashstuff = 0;
-       int nedit = 0, nwhat = 0, i, in;
-       int out, isdf = 0, msgnum;
-       char *cp, *cwd, *maildir, *dfolder = NULL;
-       char *dmsg = NULL, *digest = NULL, *ed = NULL;
+       int nedit = 0, nwhat = 0, in;
+       int out, msgnum;
+       char *cp, *cwd, *maildir;
+       char *digest = NULL, *ed = NULL;
        char *file = NULL, *filter = NULL, *folder = NULL;
        char *form = NULL, buf[BUFSIZ], value[10];
        char **argp, **arguments, *msgs[MAXARGS];
-       struct stat st;
 
 #ifdef MHE
        int buildsw = 0;
@@ -251,25 +222,6 @@ main (int argc, char **argv)
                                                adios (NULL, "bad argument %s %s", argp[-2], cp);
                                        continue;
 
-                               case DFOLDSW:
-                                       if (dfolder)
-                                               adios (NULL, "only one draft folder at a time!");
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
-                                                                       *cp != '@' ? TFOLDER : TSUBCWF);
-                                       continue;
-                               case DMSGSW:
-                                       if (dmsg)
-                                               adios (NULL, "only one draft message at a time!");
-                                       if (!(dmsg = *argp++) || *dmsg == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       continue;
-                               case NDFLDSW:
-                                       dfolder = NULL;
-                                       isdf = NOTOK;
-                                       continue;
-
                                case BITSTUFFSW:
                                        dashstuff = 1;  /* trinary logic */
                                        continue;
@@ -295,45 +247,12 @@ main (int argc, char **argv)
        if (file && (msgp || folder))
                adios (NULL, "can't mix files and folders/msgs");
 
-try_it_again:
-
 #ifdef MHE
        strncpy (drft, buildsw ? m_maildir ("draft")
-               : m_draft (dfolder, NULL, NOUSE, &isdf), sizeof(drft));
-
-       /* Check if a draft already exists */
-       if (!buildsw && stat (drft, &st) != NOTOK) {
+               : m_draft("new"), sizeof(drft));
 #else
-       strncpy (drft, m_draft (dfolder, dmsg, NOUSE, &isdf), sizeof(drft));
-
-       /* Check if a draft already exists */
-       if (stat (drft, &st) != NOTOK) {
+       strncpy (drft, m_draft("new"), sizeof(drft));
 #endif /* MHE */
-               printf ("Draft \"%s\" exists (%ld bytes).", drft, (long) st.st_size);
-               for (i = LISTDSW; i != YESW;) {
-                       if (!(argp = getans ("\nDisposition? ", isdf ? aqrnl : aqrl)))
-                               done (1);
-                       switch (i = smatch (*argp, isdf ? aqrnl : aqrl)) {
-                               case NOSW:
-                                       done (0);
-                               case NEWSW:
-                                       dmsg = NULL;
-                                       goto try_it_again;
-                               case YESW:
-                                       break;
-                               case LISTDSW:
-                                       showfile (++argp, drft);
-                                       break;
-                               case REFILSW:
-                                       if (refile (++argp, drft) == 0)
-                                               i = YESW;
-                                       break;
-                               default:
-                                       advise (NULL, "say what?");
-                                       break;
-                       }
-               }
-       }
 
        if (file) {
                /*