workaround a stupid issue in how decoding is performed in mutt *sigh*
[apps/madmutt.git] / imap / browse.c
index 4f4bee0..85a64b1 100644 (file)
@@ -12,8 +12,6 @@
 
 #include <lib-lib/lib-lib.h>
 
-#include <lib-ui/enter.h>
-
 #include "mutt.h"
 #include "imap_private.h"
 
@@ -63,7 +61,7 @@ int imap_browse (char *path, struct browser_state *state)
   save_lsub = option (OPTIMAPCHECKSUBSCRIBED);
   unset_option (OPTIMAPCHECKSUBSCRIBED);
   m_strcpy(list_cmd, sizeof(list_cmd),
-           option(OPTIMAPLSUB) ? "LSUB" : "string_list_t");
+           option(OPTIMAPLSUB) ? "LSUB" : "LIST");
 
   if (!(idata = imap_conn_find (&(mx.account), 0)))
     goto fail;
@@ -71,7 +69,6 @@ int imap_browse (char *path, struct browser_state *state)
   if (!mx.mbox) {
     home_namespace = 1;
     mbox[0] = '\0';             /* Do not replace "" with "INBOX" here */
-    mx.mbox = m_strdup(ImapHomeNamespace);
     if (mutt_bit_isset (idata->capabilities, NAMESPACE)) {
       mutt_message _("Getting namespaces...");
 
@@ -112,7 +109,7 @@ int imap_browse (char *path, struct browser_state *state)
             mbox[n] = '\0';
           }
         }
-      } while (m_strncmp(idata->cmd.buf, idata->cmd.seq, SEQLEN));
+      } while (m_strncmp(idata->cmd.buf.data, idata->cmd.seq, SEQLEN));
     }
 
     /* if we're descending a folder, mark it as current in browser_state */
@@ -178,7 +175,7 @@ int imap_browse (char *path, struct browser_state *state)
     /* Listing the home namespace, so INBOX should be included. Home 
      * namespace is not "", so we have to list it explicitly. We ask the 
      * server to see if it has descendants. */
-    if (browse_add_list_result (idata, "string_list_t \"\" \"INBOX\"", state, 0))
+    if (browse_add_list_result (idata, "LIST \"\" \"INBOX\"", state, 0))
       goto fail;
   }
 
@@ -298,7 +295,8 @@ int imap_mailbox_rename (const char *mailbox)
   }
 
   if (imap_rename_mailbox (idata, &mx, newname) < 0) {
-    mutt_error (_("Rename failed: %s"), imap_get_qualifier (idata->cmd.buf));
+    mutt_error (_("Rename failed: %s"),
+                imap_get_qualifier(idata->cmd.buf.data));
     mutt_sleep (1);
     goto fail;
   }
@@ -345,7 +343,7 @@ static int browse_add_list_result (IMAP_DATA * idata, const char *cmd,
         imap_add_folder (idata->delim, name, noselect, noinferiors, state,
                          isparent);
     }
-  } while ((m_strncmp(idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
+  } while ((m_strncmp(idata->cmd.buf.data, idata->cmd.seq, SEQLEN) != 0));
 
   p_delete(&mx.mbox);
   return 0;
@@ -384,7 +382,7 @@ static void imap_add_folder (char delim, char *folder, int noselect,
   /* apply filemask filter. This should really be done at menu setup rather
    * than at scan, since it's so expensive to scan. But that's big changes
    * to browser.c */
-  if (!((regexec (Mask.rx, relpath, 0, NULL, 0) == 0) ^ Mask.not)) {
+  if (!((regexec (Mask.rx, relpath, 0, NULL, 0) == 0) ^ Mask.neg)) {
     p_delete(&mx.mbox);
     return;
   }
@@ -438,7 +436,7 @@ static int browse_get_namespace (IMAP_DATA * idata, char *nsbuf, int nsblen,
     if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE)
       break;
 
-    s = imap_next_word (idata->cmd.buf);
+    s = imap_next_word (idata->cmd.buf.data);
     if (ascii_strncasecmp ("NAMESPACE", s, 9) == 0) {
       /* There are three sections to the response, User, Other, Shared,
        * and maybe more by extension */
@@ -526,11 +524,11 @@ static int browse_verify_namespace (IMAP_DATA * idata,
      * than invisible namespaces */
     if (nsi->delim)
       snprintf (buf, sizeof (buf), "%s \"\" \"%s%c%%\"",
-                option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", nsi->prefix,
+                option (OPTIMAPLSUB) ? "LSUB" : "LIST", nsi->prefix,
                 nsi->delim);
     else
       snprintf (buf, sizeof (buf), "%s \"\" \"%s%%\"",
-                option (OPTIMAPLSUB) ? "LSUB" : "string_list_t", nsi->prefix);
+                option (OPTIMAPLSUB) ? "LSUB" : "LIST", nsi->prefix);
 
     imap_cmd_start (idata, buf);
 
@@ -541,7 +539,7 @@ static int browse_verify_namespace (IMAP_DATA * idata,
                                     &nsi->noinferiors, &delim) != 0)
         return -1;
       nsi->listable |= (name != NULL);
-    } while ((m_strncmp(idata->cmd.buf, idata->cmd.seq, SEQLEN) != 0));
+    } while ((m_strncmp(idata->cmd.buf.data, idata->cmd.seq, SEQLEN) != 0));
   }
 
   return 0;