]> granicus.if.org Git - neomutt/commitdiff
imap: remove ImapMbox from browse_add_list_result()
authorMehdi Abaakouk <sileht@sileht.net>
Wed, 14 Nov 2018 08:36:44 +0000 (09:36 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 15 Nov 2018 00:26:28 +0000 (00:26 +0000)
imap/browse.c

index f1bd0d0bf43d6785a590e50845c08dc58e55c8ac..2d780ca97489da976dfd67d14970c78097254dbb 100644 (file)
@@ -35,6 +35,7 @@
 #include <string.h>
 #include "imap/imap_private.h"
 #include "mutt/mutt.h"
+#include "email/url.h"
 #include "conn/conn.h"
 #include "mutt.h"
 #include "account.h"
@@ -143,14 +144,11 @@ static int browse_add_list_result(struct ImapAccountData *adata, const char *cmd
                                   struct BrowserState *state, bool isparent)
 {
   struct ImapList list;
-  struct ImapMbox mx;
   int rc;
-
-  if (imap_parse_path(state->folder, &mx))
-  {
-    mutt_debug(2, "current folder %s makes no sense\n", state->folder);
-    return -1;
-  }
+  struct Url url;
+  char tmp[PATH_MAX];
+  mutt_str_strfcpy(tmp, state->folder, sizeof(tmp));
+  url_parse(&url, tmp);
 
   imap_cmd_start(adata, cmd);
   adata->cmdtype = IMAP_CT_LIST;
@@ -166,13 +164,12 @@ static int browse_add_list_result(struct ImapAccountData *adata, const char *cmd
       if (isparent)
         list.noselect = true;
       /* prune current folder from output */
-      if (isparent || !mutt_str_startswith(mx.mbox, list.name, CASE_MATCH))
+      if (isparent || !mutt_str_startswith(list.name, url.path, CASE_MATCH))
         add_folder(list.delim, list.name, list.noselect, list.noinferiors, state, isparent);
     }
   } while (rc == IMAP_CMD_CONTINUE);
   adata->cmddata = NULL;
 
-  FREE(&mx.mbox);
   return (rc == IMAP_CMD_OK) ? 0 : -1;
 }