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));
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;
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);