]> granicus.if.org Git - mutt/commitdiff
Brendan Cully's latest changes:
authorThomas Roessler <roessler@does-not-exist.org>
Tue, 25 Jan 2000 21:21:10 +0000 (21:21 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Tue, 25 Jan 2000 21:21:10 +0000 (21:21 +0000)
   Here is a patch to add some support for read-only IMAP folders.
   This is most useful if you have multiple copies of mutt open, but
   it also allows you to open a folder read-only and not have to
   worry about flags getting changed. Toggling read-only still
   doesn't work correctly - you may lose your 'N' flags if you open
   a folder normally and switch to read-only.

  I've also decided to try using UID FETCH, although I'm not sure if
  older IMAP servers support it, but then again I'm not sure if
  anyone's using any really old IMAP servers. The main advantage is
  in the case of multiple clients, where one client is deleting
  messages and the other isn't getting notification. I'm
  experiencing that on my UW-IMAP 4.6 server. On the other hand,
  this server seems to have all sorts of terrible problems with this
  scenario, so I'm not sure how well the code functions. It's a
  two-line change so far, it's experimental, and it's the only IMAP
  code in an #if 0 block...

imap/BUGS
imap/README
imap/TODO
imap/command.c
imap/imap.c
imap/message.c

index c74b50f93681e7258ad4a1cd54ff310cafcb2e4d..e510781b020e5c7e0d10983319d729c009ac0e98 100644 (file)
--- a/imap/BUGS
+++ b/imap/BUGS
@@ -1,9 +1,12 @@
 In no particular order:
 
-* Mutt doesn't detect when a mailbox has only been opened read-only
-  (because, say, another process has it open), so it lets you store
-  changes that it can't commit.
-  --> just pick up the [READ-ONLY] in the tagged response, set mutt's flag
+* Mutt doesn't display untagged [ALERT] responses to the user. Pointed out
+  by Larry P Schrof <schrof@cig.mot.com>
+  19991220
+
+* Mutt displays 'mailbox externally modified' messages constantly if the
+  server provides spurious untagged EXISTS responses. Mutt should handle
+  those gracefully, I guess.
 
 * ~h searches download the entire folder, setting everything to \Seen in
   the process.
@@ -21,10 +24,14 @@ In no particular order:
   may see occasional segfaults. Solving this cleanly requires some major
   architectural updates. Until that happens, I recommend you keep
   backup copies of messages you're composing from within your editor.
+  Tommi Komulainen's keepalive patch for edit sessions may work for you,
+  though. Committed to CVS late November 1999, I think.
 
 * Sometimes hdr->env seems to be NULL, according to other users' core
   files. I haven't been able to reproduce this, and am not sure how
-  to track it down. But it's very naughty indeed.
+  to track it down. But it's very naughty indeed. It appears to be the
+  result of spurious mx_close_mailbox calls handling the untagged
+  BYE response.
 
 * Mutt marks your connection for logout as soon as you say quit, even if
   you bail out with ^G later.
@@ -51,4 +58,4 @@ In no particular order:
 * The mutt_pretty routines don't work well when the delimiter isn't '/'.
 
 Brendan Cully <brendan@kublai.com>
-Updated 19991110
+Updated 20000125
index d12712bcd5b7e78e1bcb450563a15fb3ec78c4f1..13d56d853496433f7460830cb095d42d973abe87 100644 (file)
@@ -20,10 +20,11 @@ New features vs. the stable distribution:
 * Server-side copy
 * Fast sync
 * Secure login (GSSAPI and CRAM-MD5)
-* More and better segfaults
 * Attach messages from IMAP folders
-* Use an IMAP path as your Maildir (set folder='')
+* Use an IMAP path as your Maildir (set folder={...})
 * Preserve message keywords
 * Preserve deleted messages if you don't choose to expunge them
 * Delete mailboxes (from the browser)
 * Multiple IMAP usernames
+* Read-only folder support (toggling read-only is buggy, though)
+* More and better segfaults
index 3d2f3e2f158b471c88be34fb327c4f16d9336c49..328cd0b0723d5986232e89616f9f6c18aa340873 100644 (file)
--- a/imap/TODO
+++ b/imap/TODO
@@ -63,6 +63,7 @@ IMAP enhancements, by priority:
 
 * Commands for creating/deleting folders on the server, since users may not
   otherwise be able to do this on IMAP servers.
+  Delete done, still must implement create.
 
   PRIORITY: [** ]
 
@@ -71,5 +72,12 @@ IMAP enhancements, by priority:
 
   PRIORITY: [** ]
 
+* Create a logout command, so users can reconnect with different account
+  information without quitting mutt. Note: Tommi Komulainen's
+  multiple-account code makes this unnecessary - just use an account of
+  the form {username@host}
+
+  PRIORITY: [*  ]
+
 Brendan Cully <brendan@kublai.com>
-Updated: 19991119
+Updated: 19991227
index 12ecf49235bbabaf1ed47235091eaa3bf6f18f99..9bb7b4cf9bb762860d1207fe2cbde92be33effe3 100644 (file)
@@ -235,6 +235,12 @@ int imap_handle_untagged (IMAP_DATA *idata, char *s)
       mx_fastclose_mailbox (idata->selected_ctx);
     return (-1);
   }
+  else if (mutt_strncasecmp ("NO", s, 2) == 0)
+  {
+    /* Display the warning message from the server */
+    mutt_error (s+3);
+    sleep (1);
+  }
   else
   {
     dprint (1, (debugfile, "imap_handle_untagged(): unhandled request: %s\n",
index ead41b153450999457f916e497b60c0d1880c5aa..828af0b018aebfd4151a0ff4f99b979207628401 100644 (file)
@@ -65,10 +65,7 @@ int imap_delete_mailbox (CONTEXT* ctx, char* mailbox)
   snprintf (buf, sizeof (buf), "DELETE %s", mbox);
 
   if (imap_exec (buf, sizeof (buf), CTX_DATA, buf, 0) != 0)
-  {
-    imap_error ("imap_delete_mailbox", buf);
     return -1;
-  }
 
   return 0;
 }
@@ -216,7 +213,8 @@ int imap_reopen_mailbox (CONTEXT *ctx, int *index_hint)
   mutt_message (_("Reopening mailbox... %s"), CTX_DATA->selected_mailbox);
   imap_quote_string (buf, sizeof (buf), CTX_DATA->selected_mailbox);
   imap_make_sequence (seq, sizeof (seq));
-  snprintf (bufout, sizeof (bufout), "%s SELECT %s\r\n", seq, buf);
+  snprintf (bufout, sizeof (bufout), "%s %s %s\r\n", seq,
+    ctx->readonly ? "EXAMINE" : "SELECT", buf);
   mutt_socket_write (CTX_DATA->conn, bufout);
 
   do
@@ -245,6 +243,12 @@ int imap_reopen_mailbox (CONTEXT *ctx, int *index_hint)
     }
   }
   while (mutt_strncmp (seq, buf, mutt_strlen (seq)) != 0);
+  /* check for READ-ONLY notification */
+  if (!strncmp (imap_get_qualifier (buf), "[READ-ONLY]", 11))
+  {
+    dprint (2, (debugfile, "Mailbox is read-only.\n"));
+    ctx->readonly = 1;
+  }
 
   if (!imap_code (buf))
   {
@@ -428,9 +432,7 @@ int imap_open_connection (IMAP_DATA *idata, CONNECTION *conn)
   char buf[LONG_STRING];
 
   if (mutt_socket_open_connection (conn) < 0)
-  {
-    return (-1);
-  }
+    return -1;
 
   idata->state = IMAP_CONNECTED;
 
@@ -438,7 +440,7 @@ int imap_open_connection (IMAP_DATA *idata, CONNECTION *conn)
   {
     mutt_socket_close_connection (conn);
     idata->state = IMAP_DISCONNECTED;
-    return (-1);
+    return -1;
   }
 
   if (mutt_strncmp ("* OK", buf, 4) == 0)
@@ -448,7 +450,7 @@ int imap_open_connection (IMAP_DATA *idata, CONNECTION *conn)
     {
       mutt_socket_close_connection (conn);
       idata->state = IMAP_DISCONNECTED;
-      return (-1);
+      return -1;
     }
   }
   else if (mutt_strncmp ("* PREAUTH", buf, 9) == 0)
@@ -457,7 +459,7 @@ int imap_open_connection (IMAP_DATA *idata, CONNECTION *conn)
     {
       mutt_socket_close_connection (conn);
       idata->state = IMAP_DISCONNECTED;
-      return (-1);
+      return -1;
     }
   } 
   else
@@ -465,7 +467,7 @@ int imap_open_connection (IMAP_DATA *idata, CONNECTION *conn)
     imap_error ("imap_open_connection()", buf);
     mutt_socket_close_connection (conn);
     idata->state = IMAP_DISCONNECTED;
-    return (-1);
+    return -1;
   }
 
   idata->state = IMAP_AUTHENTICATED;
@@ -587,7 +589,8 @@ int imap_open_mailbox (CONTEXT *ctx)
   mutt_message (_("Selecting %s..."), idata->selected_mailbox);
   imap_quote_string (buf, sizeof(buf), idata->selected_mailbox);
   imap_make_sequence (seq, sizeof (seq));
-  snprintf (bufout, sizeof (bufout), "%s SELECT %s\r\n", seq, buf);
+  snprintf (bufout, sizeof (bufout), "%s %s %s\r\n", seq,
+    ctx->readonly ? "EXAMINE" : "SELECT", buf);
   mutt_socket_write (conn, bufout);
 
   idata->state = IMAP_SELECTED;
@@ -644,6 +647,12 @@ int imap_open_mailbox (CONTEXT *ctx)
     }
   }
   while (mutt_strncmp (seq, buf, mutt_strlen (seq)) != 0);
+  /* check for READ-ONLY notification */
+  if (!strncmp (imap_get_qualifier (buf), "[READ-ONLY]", 11))
+  {
+    dprint (2, (debugfile, "Mailbox is read-only.\n"));
+    ctx->readonly = 1;
+  }
 
   /* dump the mailbox flags we've found */
   if (debuglevel > 2)
index d5c894c1f9c5875e1bbe1bad61dc44d3e4e0e98b..ea6cc23e2f6a70999e77547b5cc9c24a70d3410c 100644 (file)
@@ -269,8 +269,13 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno)
   }
 
   imap_make_sequence (seq, sizeof (seq));
+#if 0
   snprintf (buf, sizeof (buf), "%s FETCH %d RFC822\r\n", seq,
            ctx->hdrs[msgno]->index + 1);
+#else
+  snprintf (buf, sizeof (buf), "%s UID FETCH %d RFC822\r\n", seq,
+           HEADER_DATA(ctx->hdrs[msgno])->uid);
+#endif
   mutt_socket_write (CTX_DATA->conn, buf);
   do
   {