]> granicus.if.org Git - mutt/commitdiff
Report CREATE failures
authorBrendan Cully <brendan@kublai.com>
Mon, 5 Jan 2009 23:59:13 +0000 (15:59 -0800)
committerBrendan Cully <brendan@kublai.com>
Mon, 5 Jan 2009 23:59:13 +0000 (15:59 -0800)
ChangeLog
imap/command.c
imap/imap.c
imap/imap_private.h

index 012bc173b38d4d02ef11ec5c20c1badb4bb83f04..5645ab16dd51f6698a8592a47361734890e19dee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2009-01-05 12:19 -0800  Brendan Cully  <brendan@kublai.com>  (1cdc8d64b55c)
+2009-01-05 15:37 -0800  Brendan Cully  <brendan@kublai.com>  (55a58914feb1)
+
+       * browser.c: Style fixes
+
+       * browser.c: Leave error message on screen if imap_mailbox_create
+       fails
 
        * doc/mutt.man: Add pointer to the full manual to the front of mutt.1
 
@@ -12,7 +17,7 @@
 
 2009-01-04 18:32 -0800  Emanuele Giaquinta  <e.giaquinta@glauco.it>  (e47d05dc2633)
 
-       * ChangeLog, imap/util.c: Indentation fix
+       * imap/util.c: Indentation fix
 
 2009-01-04 18:12 -0800  Brendan Cully  <brendan@kublai.com>  (1947c370fcd9)
 
index 7040596a30348b09dbf8dad2fa07464fd52f62d5..304ae6eb9907c6d6eb57474bdc272eff472b1860 100644 (file)
@@ -190,6 +190,35 @@ int imap_code (const char *s)
   return cmd_status (s) == IMAP_CMD_OK;
 }
 
+/* imap_cmd_trailer: extra information after tagged command response if any */
+const char* imap_cmd_trailer (IMAP_DATA* idata)
+{
+  static const char* notrailer = "";
+  const char* s = idata->buf;
+
+  if (!s)
+  {
+    dprint (2, (debugfile, "imap_cmd_trailer: not a tagged response"));
+    return notrailer;
+  }
+
+  s = imap_next_word ((char *)s);
+  if (!s || (ascii_strncasecmp (s, "OK", 2) &&
+            ascii_strncasecmp (s, "NO", 2) &&
+            ascii_strncasecmp (s, "BAD", 3)))
+  {
+    dprint (2, (debugfile, "imap_cmd_trailer: not a command completion: %s",
+               idata->buf));
+    return notrailer;
+  }
+
+  s = imap_next_word ((char *)s);
+  if (!s)
+    return notrailer;
+
+  return s;
+}
+
 /* imap_exec: execute a command, and wait for the response from the server.
  * Also, handle untagged responses.
  * Flags:
index 11965c46b2848e9de4674ee2f360dea09ecff574..e5cb67544c73816e6e78e75e443169e9b2e3cb74 100644 (file)
@@ -122,7 +122,10 @@ int imap_create_mailbox (IMAP_DATA* idata, char* mailbox)
   snprintf (buf, sizeof (buf), "CREATE %s", mbox);
       
   if (imap_exec (idata, buf, 0) != 0)
+  {
+    mutt_error (_("CREATE failed: %s"), imap_cmd_trailer (idata));
     return -1;
+  }
 
   return 0;
 }
index 0eaffeac5075db5e1164a43e3a53a2f4da0d87df..9a861aad81f349df9793a2cba8701d83d89f7eb3 100644 (file)
@@ -247,6 +247,7 @@ int imap_cmd_start (IMAP_DATA* idata, const char* cmd);
 int imap_cmd_step (IMAP_DATA* idata);
 void imap_cmd_finish (IMAP_DATA* idata);
 int imap_code (const char* s);
+const char* imap_cmd_trailer (IMAP_DATA* idata);
 int imap_exec (IMAP_DATA* idata, const char* cmd, int flags);
 int imap_cmd_idle (IMAP_DATA* idata);