/*
- * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
+ * Copyright (C) 1996-2000,2007 Michael R. Elkins <me@mutt.org>
*
* 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
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
+#include <locale.h>
static struct mapping_t FolderHelp[] = {
{ N_("Exit"), OP_EXIT },
{ N_("Chdir"), OP_CHANGE_DIRECTORY },
{ N_("Mask"), OP_ENTER_MASK },
{ N_("Help"), OP_HELP },
- { NULL }
+ { NULL, 0 }
};
typedef struct folder_t
break;
case 'd':
+ case 'D':
if (folder->ff->st != NULL)
{
- tnow = time (NULL);
- t_fmt = tnow - folder->ff->st->st_mtime < 31536000 ? "%b %d %H:%M" : "%b %d %Y";
+ int do_locales = TRUE;
+
+ if (op == 'D') {
+ t_fmt = NONULL(DateFmt);
+ if (*t_fmt == '!') {
+ ++t_fmt;
+ do_locales = FALSE;
+ }
+ } else {
+ tnow = time (NULL);
+ t_fmt = tnow - folder->ff->st->st_mtime < 31536000 ? "%b %d %H:%M" : "%b %d %Y";
+ }
+ if (do_locales)
+ setlocale(LC_TIME, NONULL (Locale)); /* use environment if $locale is not set */
+ else
+ setlocale(LC_TIME, "C");
strftime (date, sizeof (date), t_fmt, localtime (&folder->ff->st->st_mtime));
+
mutt_format_s (dest, destlen, fmt, date);
}
else
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);
}
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"),
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;
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);
init_menu (&state, menu, title, sizeof (title), buffy);
MAYBE_REDRAW (menu->redraw);
}
+ /* else leave error on screen */
break;
case OP_RENAME_MAILBOX:
{
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;
if ((err = REGCOMP (rx, s, REG_NOSUB)) != 0)
{
regerror (err, rx, buf, sizeof (buf));
- regfree (rx);
FREE (&rx);
mutt_error ("%s", buf);
}