X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/14c29200cb58d3c4a0830265f2433849781858d0..60b8fdd035ce4663b2dc0df721ab2ad78ec3c6f4:/browser.c?ds=sidebyside diff --git a/browser.c b/browser.c index 0d01221..c05af05 100644 --- a/browser.c +++ b/browser.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1996-2000 Michael R. Elkins + * Copyright (C) 1996-2000,2007 Michael R. Elkins * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ static struct mapping_t FolderHelp[] = { { N_("Chdir"), OP_CHANGE_DIRECTORY }, { N_("Mask"), OP_ENTER_MASK }, { N_("Help"), OP_HELP }, - { NULL } + { NULL, 0 } }; typedef struct folder_t @@ -460,9 +460,24 @@ static int examine_mailboxes (MUTTMENU *menu, struct browser_state *state) if ((! S_ISREG (s.st_mode)) && (! S_ISDIR (s.st_mode)) && (! S_ISLNK (s.st_mode))) continue; + + if (mx_is_maildir (tmp->path)) + { + struct stat st2; + char md[_POSIX_PATH_MAX]; + + snprintf (md, sizeof (md), "%s/new", tmp->path); + if (stat (md, &s) < 0) + s.st_mtime = 0; + snprintf (md, sizeof (md), "%s/cur", tmp->path); + if (stat (md, &st2) < 0) + st2.st_mtime = 0; + if (st2.st_mtime > s.st_mtime) + s.st_mtime = st2.st_mtime; + } strfcpy (buffer, NONULL(tmp->path), sizeof (buffer)); - mutt_pretty_mailbox (buffer); + mutt_pretty_mailbox (buffer, sizeof (buffer)); add_folder (menu, state, buffer, &s, tmp->new); } @@ -508,7 +523,7 @@ static void init_menu (struct browser_state *state, MUTTMENU *menu, char *title, else { strfcpy (path, LastDir, sizeof (path)); - mutt_pretty_mailbox (path); + mutt_pretty_mailbox (path, sizeof (path)); #ifdef USE_IMAP if (state->imap_browse && option (OPTIMAPLSUB)) snprintf (title, titlelen, _("Subscribed [%s], File mask: %s"), @@ -645,8 +660,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num if (examine_directory (NULL, &state, LastDir, prefix) == -1) goto bail; - menu = mutt_new_menu (); - menu->menu = MENU_FOLDER; + menu = mutt_new_menu (MENU_FOLDER); menu->make_entry = folder_entry; menu->search = select_file_search; menu->title = title; @@ -861,22 +875,22 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num case OP_BROWSER_TOGGLE_LSUB: if (option (OPTIMAPLSUB)) - { unset_option (OPTIMAPLSUB); - } else - { set_option (OPTIMAPLSUB); - } + mutt_ungetch (0, OP_CHECK_NEW); break; case OP_CREATE_MAILBOX: if (!state.imap_browse) + { mutt_error (_("Create is only supported for IMAP mailboxes")); - else + break; + } + + if (!imap_mailbox_create (LastDir)) { - imap_mailbox_create (LastDir); /* TODO: find a way to detect if the new folder would appear in * this window, and insert it without starting over. */ destroy_state (&state); @@ -890,6 +904,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num init_menu (&state, menu, title, sizeof (title), buffy); MAYBE_REDRAW (menu->redraw); } + /* else leave error on screen */ break; case OP_RENAME_MAILBOX: @@ -899,7 +914,8 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num { int nentry = menu->current; - if (imap_mailbox_rename (state.entry[nentry].name) >= 0) { + if (imap_mailbox_rename (state.entry[nentry].name) >= 0) + { destroy_state (&state); init_state (&state, NULL); state.imap_browse = 1;