]> granicus.if.org Git - mutt/commitdiff
Fix from #918. From <ntyni+mutt@mappi.helsinki.fi>.
authorThomas Roessler <roessler@does-not-exist.org>
Tue, 18 Dec 2001 15:13:17 +0000 (15:13 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Tue, 18 Dec 2001 15:13:17 +0000 (15:13 +0000)
browser.c
imap/imap.c
imap/imap.h

index 611e438bfaa21b76a28ed3d4ef755f9bb9c2a4e9..ece5d6159d5fad65c0b949382191f721a375dba6 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -884,7 +884,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
             mx.mbox);
          if (mutt_yesorno (msg, M_NO) == M_YES)
           {
-           if (!imap_delete_mailbox (Context, mx.mbox))
+           if (!imap_delete_mailbox (Context, mx))
             {
              /* free the mailbox from the browser */
              safe_free ((void **) &((state.entry)[nentry].name));
index e80ccdfb190b90210b982fc4ee881977d727c4e7..9cd2e4d0e97c19b94ed5f01780b2a5b4b36c95b4 100644 (file)
@@ -104,14 +104,26 @@ int imap_create_mailbox (IMAP_DATA* idata, char* mailbox)
   return 0;
 }
 
-int imap_delete_mailbox (CONTEXT* ctx, char* mailbox)
+int imap_delete_mailbox (CONTEXT* ctx, IMAP_MBOX mx)
 {
   char buf[LONG_STRING], mbox[LONG_STRING];
-  
-  imap_munge_mbox_name (mbox, sizeof (mbox), mailbox);
+  IMAP_DATA *idata;
+
+  if (!ctx || !ctx->data) {
+       if (!(idata = imap_conn_find (&mx.account,
+               option (OPTIMAPPASSIVE) ? M_IMAP_CONN_NONEW : 0)))
+       {
+               FREE (&mx.mbox);
+               return -1;
+       }
+  } else {
+         idata = ctx->data;
+  }
+
+  imap_munge_mbox_name (mbox, sizeof (mbox), mx.mbox);
   snprintf (buf, sizeof (buf), "DELETE %s", mbox);
 
-  if (imap_exec ((IMAP_DATA*) ctx->data, buf, 0) != 0)
+  if (imap_exec ((IMAP_DATA*) idata, buf, 0) != 0)
     return -1;
 
   return 0;
index ae4ae61d3922e65482d32d721ce1358ff6f6de40..bd34e23d3a8a843cc06772ebc4682f145b1457ee 100644 (file)
@@ -35,7 +35,7 @@ typedef struct
 int imap_access (const char*, int);
 int imap_check_mailbox (CONTEXT *ctx, int *index_hint);
 int imap_close_connection (CONTEXT *ctx);
-int imap_delete_mailbox (CONTEXT* idata, char* mailbox);
+int imap_delete_mailbox (CONTEXT* idata, IMAP_MBOX mx);
 int imap_open_mailbox (CONTEXT *ctx);
 int imap_open_mailbox_append (CONTEXT *ctx);
 int imap_sync_mailbox (CONTEXT *ctx, int expunge, int *index_hint);