Some IMAP servers don't like it if the currently selected mailbox is
deleted. In those cases, send a CLOSE command before issuing any
other commands.
{
if (!imap_delete_mailbox (Context, mx))
{
+ /* Some IMAP servers react badly to the currently selected mailbox
+ * being deleted, so close in that case */
+ if (Context &&
+ !mutt_strcmp (state.entry[nentry].name, Context->realpath))
+ {
+ Context->deleted = 0;
+ mx_fastclose_mailbox (Context);
+ FREE (&Context);
+ }
/* free the mailbox from the browser */
FREE (&((state.entry)[nentry].name));
FREE (&((state.entry)[nentry].desc));