]> granicus.if.org Git - mutt/commitdiff
An unmailboxes command. #1311.
authorNicolas Rachinsky <nicolas@dauerreden.de>
Mon, 9 Sep 2002 19:29:23 +0000 (19:29 +0000)
committerNicolas Rachinsky <nicolas@dauerreden.de>
Mon, 9 Sep 2002 19:29:23 +0000 (19:29 +0000)
buffy.c
buffy.h
doc/manual.sgml.head
doc/muttrc.man.head
init.h

diff --git a/buffy.c b/buffy.c
index 0a15c92aac92b0f7fe082c93d1bb733f61ba0c84..660075d859f6e35287805ed9be91c8d39ad14ccb 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -162,7 +162,7 @@ void mutt_update_mailbox (BUFFY * b)
 
 int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *err)
 {
-  BUFFY **tmp;
+  BUFFY **tmp,*tmp1;
   char buf[_POSIX_PATH_MAX];
 #ifdef BUFFY_SIZE
   struct stat sb;
@@ -172,6 +172,19 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
   {
     mutt_extract_token (path, s, 0);
     strfcpy (buf, path->data, sizeof (buf));
+
+    if(data == M_UNMAILBOXES && mutt_strcmp(buf,"*") == 0)
+    {
+      for (tmp = &Incoming; *tmp;)
+      {
+        safe_free((void **)&((*tmp)->path));
+        tmp1=(*tmp)->next;
+        safe_free((void **)tmp);
+        *tmp=tmp1;
+      }
+      return 0;
+    }
+
     mutt_expand_path (buf, sizeof (buf));
 
     /* Skip empty tokens. */
@@ -184,6 +197,18 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
        break;
     }
 
+    if(data == M_UNMAILBOXES)
+    {
+      if(*tmp)
+      {
+        safe_free((void **)&((*tmp)->path));
+        tmp1=(*tmp)->next;
+        safe_free((void **)tmp);
+        *tmp=tmp1;
+      }
+      continue;
+    }
+
     if (!*tmp)
     {
       *tmp = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
diff --git a/buffy.h b/buffy.h
index f3e819522279c3d68ab8fac90cabcaa8aeb5c02f..adfc2695d9eb207dd229ad7b85d3404e8e286a6f 100644 (file)
--- a/buffy.h
+++ b/buffy.h
  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  */
 
+/*parameter to mutt_parse_mailboxes*/
+#define M_MAILBOXES   1
+#define M_UNMAILBOXES 2 
+
 typedef struct buffy_t
 {
   char *path;
index dfb36a662304cbd10cab06b9702d72fbfa81cfe0..829151b12b9dea3fad7fc9ee6a3417b68ff49397 100644 (file)
@@ -1207,7 +1207,7 @@ mailbox).
 
 <sect1>Defining mailboxes which receive mail<label id="mailboxes">
 <p>
-Usage: <tt/mailboxes/ &lsqb;!&rsqb;<em/filename/ &lsqb; <em/filename/ ... &rsqb;
+Usage: <tt/&lsqb;un&rsqb;mailboxes/ &lsqb;!&rsqb;<em/filename/ &lsqb; <em/filename/ ... &rsqb;
 
 This command specifies folders which can receive mail and
 which will be checked for new messages.  By default, the
@@ -1221,6 +1221,11 @@ Pressing TAB in the directory browser will bring up a menu showing the files
 specified by the <tt/mailboxes/ command, and indicate which contain new
 messages.  Mutt will automatically enter this mode when invoked from the
 command line with the <tt/-y/ option.
+
+The ``unmailboxes'' command is used to remove a token from the list
+of folders which receive mail. Use ``unmailboxes *'' to remove all
+tokens.
+
 <p>
 <bf/Note:/ new mail is detected by comparing the last modification time to
 the last access time.  Utilities like <tt/biff/ or <tt/frm/ or any other
index e0f718e9992e9e6ea169647bac6db5744b8e4a8f..a0e84b539575988c7b1e17aa12e6b48841ff7832 100644 (file)
@@ -18,7 +18,7 @@
 .\"     along with this program; if not, write to the Free Software
 .\"     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 .\"
-.TH muttrc 5 "February 2001" Unix "User Manuals"
+.TH muttrc 5 "September 2002" Unix "User Manuals"
 .SH NAME
 .PP
 muttrc \- Configuration file for the Mutt Mail User Agent
@@ -238,11 +238,18 @@ When mutt changes to a mail folder which matches \fIpattern\fP,
 messages will be moved to that folder when the mail folder is left.
 .IP
 The first matchig \fBmbox-hook\fP applies.
-.TP
+.PP
+.nf
 \fBmailboxes\fP \fIfilename\fP [ \fIfilename\fP ... ]
-This command specifies folders which can receive mail and which will
+\fBunmailboxes\fP [ \fB*\fP | \fIfilename\fP ... ]
+.fi
+.IP
+The \fBmailboxes\fP specifies folders which can receive mail and which will
 be checked for new messages.  When changing folders, pressing space
-will cycle through folders with new mail. 
+will cycle through folders with new mail.  The \fBunmailboxes\fP
+command is used to remove a file name from the list of folders which
+can receive mail.  If "\fB*\fP" is specified as the file name, the
+list is emptied.
 .PP
 .nf
 \fBmy_hdr\fP \fIstring\fP
diff --git a/init.h b/init.h
index 0f84dd8717d526d2e2607a5f22f516523b2f52b6..30970ec1d81da4dc94f58a3dec66dae8904c7206 100644 (file)
--- a/init.h
+++ b/init.h
@@ -2676,7 +2676,8 @@ struct command_t Commands[] = {
   { "ignore",          parse_ignore,           0 },
   { "lists",           parse_list,             UL &MailLists },
   { "macro",           mutt_parse_macro,       0 },
-  { "mailboxes",       mutt_parse_mailboxes,   0 },
+  { "mailboxes",       mutt_parse_mailboxes,   M_MAILBOXES },
+  { "unmailboxes",     mutt_parse_mailboxes,   M_UNMAILBOXES },
   { "message-hook",    mutt_parse_hook,        M_MESSAGEHOOK },
   { "mbox-hook",       mutt_parse_hook,        M_MBOXHOOK },
   { "mime_lookup",     parse_list,     UL &MimeLookupList },