* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
return 0;
}
-int select_file_search (MUTTMENU *menu, regex_t *re, int n)
+static int select_file_search (MUTTMENU *menu, regex_t *re, int n)
{
#ifdef USE_NNTP
if (option (OPTNEWS))
return (regexec (re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 0));
}
-void folder_entry (char *s, size_t slen, MUTTMENU *menu, int num)
+static void folder_entry (char *s, size_t slen, MUTTMENU *menu, int num)
{
FOLDER folder;
menu->redraw = REDRAW_FULL;
}
-int file_tag (MUTTMENU *menu, int n, int m)
+static int file_tag (MUTTMENU *menu, int n, int m)
{
struct folder_file *ff = &(((struct folder_file *)menu->data)[n]);
int ot;
else
{
getcwd (LastDir, sizeof (LastDir));
- strcat (LastDir, "/"); /* __STRCAT_CHECKED__ */
- strncat (LastDir, f, i);
+ safe_strcat (LastDir, sizeof (LastDir), "/");
+ safe_strncat (LastDir, sizeof (LastDir), f, i);
}
}
else
}
break;
- case OP_DELETE_MAILBOX:
+ case OP_RENAME_MAILBOX:
+ if (!state.entry[menu->current].imap)
+ mutt_error (_("Rename is only supported for IMAP mailboxes"));
+ else
+ {
+ int nentry = menu->current;
+
+ if (imap_mailbox_rename (state.entry[nentry].name) >= 0) {
+ destroy_state (&state);
+ init_state (&state, NULL);
+ state.imap_browse = 1;
+ imap_browse (LastDir, &state);
+ menu->data = state.entry;
+ menu->current = 0;
+ menu->top = 0;
+ init_menu (&state, menu, title, sizeof (title), buffy);
+ MAYBE_REDRAW (menu->redraw);
+ }
+ }
+ break;
+
+ case OP_DELETE_MAILBOX:
if (!state.entry[menu->current].imap)
mutt_error (_("Delete is only supported for IMAP mailboxes"));
else
{
if (S_ISDIR (st.st_mode))
{
- strfcpy (LastDir, buf, sizeof (LastDir));
destroy_state (&state);
- if (examine_directory (menu, &state, LastDir, prefix) == 0)
- {
- menu->current = 0;
- menu->top = 0;
- init_menu (&state, menu, title, sizeof (title), buffy);
- }
+ if (examine_directory (menu, &state, buf, prefix) == 0)
+ strfcpy (LastDir, buf, sizeof (LastDir));
else
{
mutt_error _("Error scanning directory.");
- destroy_state (&state);
- mutt_menuDestroy (&menu);
- goto bail;
+ if (examine_directory (menu, &state, LastDir, prefix) == -1)
+ {
+ mutt_menuDestroy (&menu);
+ goto bail;
+ }
}
+ menu->current = 0;
+ menu->top = 0;
+ init_menu (&state, menu, title, sizeof (title), buffy);
}
else
mutt_error (_("%s is not a directory."), buf);