| | 800 | |
| | 801 | case OP_NEW_MAILBOX: |
| | 802 | mutt_error (_("Creating mailboxes is not yet supported.")); |
| | 803 | break; |
| | 804 | |
| | 805 | case OP_DELETE_MAILBOX: |
| | 806 | if (!mx_is_imap (state.entry[menu->current].name)) |
| | 807 | mutt_error (_("Delete is only supported for IMAP mailboxes")); |
| | 808 | else |
| | 809 | { |
| | 810 | char msg[LONG_STRING]; |
| | 811 | char* mbox; |
| | 812 | int nentry = menu->current; |
| | 813 | |
| | 814 | imap_parse_path (state.entry[nentry].name, NULL, 0, NULL, |
| | 815 | NULL, &mbox); |
| | 816 | snprintf (msg, sizeof (msg), _("Really delete mailbox \"%s\"?"), |
| | 817 | mbox); |
| | 818 | if (mutt_yesorno (msg, M_NO) == M_YES) |
| | 819 | { |
| | 820 | if (!imap_delete_mailbox (Context, mbox)) |
| | 821 | { |
| | 822 | /* free the mailbox from the browser */ |
| | 823 | safe_free ((void **) &((state.entry)[nentry].name)); |
| | 824 | safe_free ((void **) &((state.entry)[nentry].desc)); |
| | 825 | /* and move all other entries up */ |
| | 826 | if (nentry+1 < state.entrylen) |
| | 827 | memmove (state.entry + nentry, state.entry + nentry + 1, |
| | 828 | sizeof (struct folder_file) * (state.entrylen - (nentry+1))); |
| | 829 | state.entrylen--; |
| | 830 | mutt_message _("Mailbox deleted."); |
| | 831 | init_menu (&state, menu, title, sizeof (title), buffy); |
| | 832 | MAYBE_REDRAW (menu->redraw); |
| | 833 | } |
| | 834 | } |
| | 835 | else |
| | 836 | mutt_message _("Mailbox not deleted."); |
| | 837 | } |
| | 838 | break; |