Commit 594a6a48 authored by Antonio Radici's avatar Antonio Radici

Imported Upstream version 1.5.21

parent 899a5db7
This diff is collapsed.
......@@ -202,7 +202,7 @@ A_NORMAL or KEY_MIN, then you probably don't have a SysV compliant curses
library. You should install either ncurses or S-Lang (see above), and then
run the ``configure'' script again.
Please note that "VPATH" builds currently do _not_ work.
Please note that "VPATH" builds currently only work with GNU make (gmake).
......
......@@ -13,7 +13,11 @@ SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR)
bin_SCRIPTS = muttbug flea @SMIMEAUX_TARGET@
BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h hcversion.h
if BUILD_HCACHE
HCVERSION = hcversion.h
endif
BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h $(HCVERSION)
bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
mutt_SOURCES = \
......@@ -29,7 +33,7 @@ mutt_SOURCES = \
score.c send.c sendlib.c signal.c sort.c \
status.c system.c thread.c charset.c history.c lib.c \
muttlib.c editmsg.c mbyte.c \
url.c ascii.c crypt-mod.c crypt-mod.h
url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
nodist_mutt_SOURCES = $(BUILT_SOURCES)
......@@ -66,7 +70,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
rfc2231.h rfc822.h rfc3676.h sha1.h sort.h mime.types VERSION prepare \
_regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \
mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h \
README.SSL smime.h \
README.SSL smime.h group.h \
muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
ChangeLog mkchangelog.sh mutt_idna.h \
snprintf.c regex.c crypt-gpgme.h hcachever.sh.in
......
# Makefile.in generated by automake 1.11 from Makefile.am.
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
......@@ -85,9 +85,10 @@ am_mutt_OBJECTS = addrbook.$(OBJEXT) alias.$(OBJEXT) attach.$(OBJEXT) \
system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
ascii.$(OBJEXT) crypt-mod.$(OBJEXT)
am__objects_1 = patchlist.$(OBJEXT)
nodist_mutt_OBJECTS = $(am__objects_1)
ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT)
am__objects_1 =
am__objects_2 = patchlist.$(OBJEXT) $(am__objects_1)
nodist_mutt_OBJECTS = $(am__objects_2)
mutt_OBJECTS = $(am_mutt_OBJECTS) $(nodist_mutt_OBJECTS)
am__DEPENDENCIES_1 =
am_mutt_dotlock_OBJECTS = mutt_dotlock.$(OBJEXT)
......@@ -270,6 +271,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PGPAUX_TARGET = @PGPAUX_TARGET@
......@@ -342,7 +344,8 @@ AUTOMAKE_OPTIONS = 1.6 foreign
@BUILD_IMAP_TRUE@IMAP_INCLUDES = -I$(top_srcdir)/imap
SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR)
bin_SCRIPTS = muttbug flea @SMIMEAUX_TARGET@
BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h hcversion.h
@BUILD_HCACHE_TRUE@HCVERSION = hcversion.h
BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h $(HCVERSION)
mutt_SOURCES = \
addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
crypt.c cryptglue.c \
......@@ -356,7 +359,7 @@ mutt_SOURCES = \
score.c send.c sendlib.c signal.c sort.c \
status.c system.c thread.c charset.c history.c lib.c \
muttlib.c editmsg.c mbyte.c \
url.c ascii.c crypt-mod.c crypt-mod.h
url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
nodist_mutt_SOURCES = $(BUILT_SOURCES)
mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
......@@ -385,7 +388,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
rfc2231.h rfc822.h rfc3676.h sha1.h sort.h mime.types VERSION prepare \
_regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \
mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h \
README.SSL smime.h \
README.SSL smime.h group.h \
muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
ChangeLog mkchangelog.sh mutt_idna.h \
snprintf.c regex.c crypt-gpgme.h hcachever.sh.in
......@@ -663,6 +666,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc2231.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc3676.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rfc822.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe_asprintf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/score.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/send.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendlib.Po@am__quote@
......@@ -713,7 +717,7 @@ mutt_md5-md5.obj: md5.c
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
......@@ -738,7 +742,7 @@ $(RECURSIVE_TARGETS):
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
......@@ -902,7 +906,8 @@ distdir: $(DISTFILES)
fi; \
done
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
......@@ -946,17 +951,17 @@ dist dist-all: distdir
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
......
......@@ -102,6 +102,7 @@ OP_MAIN_CHANGE_FOLDER_READONLY "open a different folder in read only mode"
OP_MAIN_CLEAR_FLAG "clear a status flag from a message"
OP_MAIN_DELETE_PATTERN "delete messages matching a pattern"
OP_MAIN_IMAP_FETCH "force retrieval of mail from IMAP server"
OP_MAIN_IMAP_LOGOUT_ALL "logout from all IMAP servers"
OP_MAIN_FETCH_MAIL "retrieve mail from POP server"
OP_MAIN_FIRST_MESSAGE "move to the first message"
OP_MAIN_LAST_MESSAGE "move to the last message"
......
Problems are listed in approximate order of priority.
- character set support: We should have a global cache of
character to file name mappings.
- When displaying MIME headers, rfc 2047 decoding is applied (which
should not happen), and rfc 2231 decoding is not applied (which
should happen).
- Help formatting could be revamped a bit.
- re-add support for .mh_sequences files
- In the "attachment" menu, assume this:
1 [text/plain, 7bit, 1.1K] <no description>
......@@ -62,5 +57,3 @@ Problems are listed in approximate order of priority.
menu will require re-allocating and possibly updating the v2r
array. How do we handle "in-the-middle additions" properly? Do
they happen at all?
$Id$
......@@ -5,11 +5,22 @@ The keys used are:
!: modified feature, -: deleted feature, +: new feature
hg tip:
! $thorough_search defaults to yes
+ imap-logout-all closes all open IMAP connections
! header/body cache paths are always UTF-8
+ $wrap_headers to control outgoing message's header length
+ all text/* parts can be displayed inline without mailcap
+ send-hooks now run in batch mode; previously only send2-hooks ran.
1.5.20 (2009-06-14):
! mbox/mmdf new mail flag is kept when leaving folders with new mail
! $fcc_attach is a quadoption now
+ $honor_disposition to honor Content-Disposition headers
+ $search_context specifies number of context lines for search results
in pager/page-based menus
+ ssl_use_sslv2 defaults to no
! ssl_use_sslv2 defaults to no
+ uncolor works for header + body objects, too
+ the "flagged" and "replied" flags are enabled/supported for
POP when built with header caching
......@@ -20,11 +31,12 @@ hg tip:
search as regex patterns do (except IMAP)
+ $ssl_verify_dates controls whether mutt checks the validity period of
SSL certificates
+ $ssl_verify_hostname controls whether mutt will accept certificates whose
+ $ssl_verify_host controls whether mutt will accept certificates whose
host names do not match the host name in the folder URL.
1.5.19 (2009-01-05):
! command-line arguments: -a now mandates -- at end of file list
+ support for SSL certificate chains
+ <what-key> function works in pager, too
+ support for tokyocabinet (qdbm successor)
......
......@@ -155,6 +155,8 @@ int mutt_account_getuser (ACCOUNT* account)
else if ((account->type == M_ACCT_TYPE_POP) && PopUser)
strfcpy (account->user, PopUser, sizeof (account->user));
#endif
else if (option (OPTNOCURSES))
return -1;
/* prompt (defaults to unix username), copy into account->user */
else
{
......@@ -215,6 +217,8 @@ int mutt_account_getpass (ACCOUNT* account)
else if ((account->type == M_ACCT_TYPE_SMTP) && SmtpPass)
strfcpy (account->pass, SmtpPass, sizeof (account->pass));
#endif
else if (option (OPTNOCURSES))
return -1;
else
{
snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "),
......
# generated automatically by aclocal 1.11 -*- Autoconf -*-
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
......@@ -13,36 +13,121 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],,
[m4_warning([this file was generated for autoconf 2.63.
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
[m4_warning([this file was generated for autoconf 2.65.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
# isc-posix.m4 serial 2 (gettext-0.11.2)
dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
# longlong.m4 serial 13
dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
# This test replaces the one in autoconf.
# Currently this macro should have the same name as the autoconf macro
# because gettext's gettext.m4 (distributed in the automake package)
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
# give these diagnostics:
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
dnl From Paul Eggert.
# Define HAVE_LONG_LONG_INT if 'long long int' works.
# This fixes a bug in Autoconf 2.61, but can be removed once we
# assume 2.62 everywhere.
# Note: If the type 'long long int' exists but is only 32 bits large
# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
# defined. In this case you can treat 'long long int' like 'long int'.
AC_DEFUN([AC_TYPE_LONG_LONG_INT],
[
AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
[AC_LINK_IFELSE(
[_AC_TYPE_LONG_LONG_SNIPPET],
[dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
dnl If cross compiling, assume the bug isn't important, since
dnl nobody cross compiles for this platform as far as we know.
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[@%:@include <limits.h>
@%:@ifndef LLONG_MAX
@%:@ define HALF \
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
@%:@ define LLONG_MAX (HALF - 1 + HALF)
@%:@endif]],
[[long long int n = 1;
int i;
for (i = 0; ; i++)
{
long long int m = n << i;
if (m >> i != n)
return 1;
if (LLONG_MAX / 2 < m)
break;
}
return 0;]])],
[ac_cv_type_long_long_int=yes],
[ac_cv_type_long_long_int=no],
[ac_cv_type_long_long_int=yes])],
[ac_cv_type_long_long_int=no])])
if test $ac_cv_type_long_long_int = yes; then
AC_DEFINE([HAVE_LONG_LONG_INT], 1,
[Define to 1 if the system has the type `long long int'.])
fi
])
undefine([AC_ISC_POSIX])
# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
# This fixes a bug in Autoconf 2.61, but can be removed once we
# assume 2.62 everywhere.
# Note: If the type 'unsigned long long int' exists but is only 32 bits
# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
# will not be defined. In this case you can treat 'unsigned long long int'
# like 'unsigned long int'.
AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
[
AC_CACHE_CHECK([for unsigned long long int],
[ac_cv_type_unsigned_long_long_int],
[AC_LINK_IFELSE(
[_AC_TYPE_LONG_LONG_SNIPPET],
[ac_cv_type_unsigned_long_long_int=yes],
[ac_cv_type_unsigned_long_long_int=no])])
if test $ac_cv_type_unsigned_long_long_int = yes; then
AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
[Define to 1 if the system has the type `unsigned long long int'.])
fi
])
AC_DEFUN([AC_ISC_POSIX],
[
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
]
)
# Expands to a C program that can be used to test for simultaneous support
# of 'long long' and 'unsigned long long'. We don't want to say that
# 'long long' is available if 'unsigned long long' is not, or vice versa,
# because too many programs rely on the symmetry between signed and unsigned
# integer types (excluding 'bool').
AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
[
AC_LANG_PROGRAM(
[[/* Test preprocessor. */
#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
error in preprocessor;
#endif
#if ! (18446744073709551615ULL <= -1ull)
error in preprocessor;
#endif
/* Test literals. */
long long int ll = 9223372036854775807ll;
long long int nll = -9223372036854775807LL;
unsigned long long int ull = 18446744073709551615ULL;
/* Test constant expressions. */
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
? 1 : -1)];
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
? 1 : -1)];
int i = 63;]],
[[/* Test availability of runtime routines for shift and division. */
long long int llmax = 9223372036854775807ll;
unsigned long long int ullmax = 18446744073709551615ull;
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
| (llmax / ll) | (llmax % ll)
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
| (ullmax / ull) | (ullmax % ull));]])
])
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
......@@ -59,7 +144,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.11], [],
m4_if([$1], [1.11.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
......@@ -75,7 +160,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.11])dnl
[AM_AUTOMAKE_VERSION([1.11.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
......
......@@ -169,7 +169,7 @@ int mutt_compose_attachment (BODY *a)
/* Remove headers by copying out data to another file, then
* copying the file back */
fseeko (fp, b->offset, 0);
mutt_mktemp (tempfile);
mutt_mktemp (tempfile, sizeof (tempfile));
if ((tfp = safe_fopen (tempfile, "w")) == NULL)
{
mutt_perror _("Failure to open file to strip headers.");
......@@ -508,7 +508,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr,
mutt_adv_mktemp (pagerfile, sizeof(pagerfile));
}
else
mutt_mktemp (pagerfile);
mutt_mktemp (pagerfile, sizeof (pagerfile));
}
if (use_mailcap)
......@@ -938,7 +938,7 @@ int mutt_decode_save_attachment (FILE *fp, BODY *m, char *path,
/* Ok, the difference between send and receive:
* recv: BODY->filename is a suggested name, and Context|HEADER points
* to the attachment in mailbox which is encooded
* to the attachment in mailbox which is encoded
* send: BODY->filename points to the un-encoded file which contains the
* attachment
*/
......@@ -1043,7 +1043,7 @@ int mutt_print_attachment (FILE *fp, BODY *a)
ifp = NULL;
fpout = NULL;
mutt_mktemp (newfile);
mutt_mktemp (newfile, sizeof (newfile));
if (mutt_decode_save_attachment (fp, a, newfile, M_PRINTING, 0) == 0)
{
......
/*
* Copyright (C) 2006-7 Brendan Cully <brendan@kublai.com>
* Copyright (C) 2006 Rocco Rutte <pdmef@gmx.net>
* Copyright (C) 2006, 2009 Rocco Rutte <pdmef@gmx.net>
*
* 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
......@@ -42,6 +42,7 @@ static int bcache_path(ACCOUNT *account, const char *mailbox,
char *dst, size_t dstlen)
{
char host[STRING];
char path[_POSIX_PATH_MAX];
ciss_url_t url;
int len;
......@@ -62,12 +63,14 @@ static int bcache_path(ACCOUNT *account, const char *mailbox,
return -1;
}
dprint (3, (debugfile, "bcache_path: URL: '%s'\n", host));
mutt_encode_path (path, sizeof (path), NONULL (mailbox));
len = snprintf (dst, dstlen-1, "%s/%s%s%s", MessageCachedir,
host, NONULL(mailbox),
(mailbox && *mailbox &&
mailbox[mutt_strlen(mailbox) - 1] == '/') ? "" : "/");
host, path,
(*path && path[mutt_strlen (path) - 1] == '/') ? "" : "/");
dprint (3, (debugfile, "bcache_path: rc: %d, path: '%s'\n", len, dst));
if (len < 0 || len >= dstlen-1)
return -1;
......
......@@ -40,6 +40,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
#include <locale.h>
static struct mapping_t FolderHelp[] = {
{ N_("Exit"), OP_EXIT },
......@@ -161,11 +162,27 @@ folder_format_str (char *dest, size_t destlen, size_t col, char op, const char *
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
......@@ -1068,7 +1085,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
if ((err = REGCOMP (rx, s, REG_NOSUB)) != 0)
{
regerror (err, rx, buf, sizeof (buf));
regfree (rx);
FREE (&rx);
mutt_error ("%s", buf);
}
......
......@@ -45,6 +45,8 @@ time_t BuffyDoneTime = 0; /* last time we knew for sure how much mail there was.
static short BuffyCount = 0; /* how many boxes with new mail */
static short BuffyNotify = 0; /* # of unnotified new boxes */
static BUFFY* buffy_get (const char *path);
/* Find the last message in the file.
* upon success return 0. If no message found - return -1 */
......@@ -191,6 +193,23 @@ void mutt_update_mailbox (BUFFY * b)
return;
}
static BUFFY *buffy_new (const char *path)
{
BUFFY* buffy;
buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
strfcpy (buffy->path, path, sizeof (buffy->path));
buffy->next = NULL;
buffy->magic = 0;
return buffy;
}
static void buffy_free (BUFFY **mailbox)
{
FREE (mailbox); /* __FREE_CHECKED__ */
}
int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *err)
{
BUFFY **tmp,*tmp1;
......@@ -209,7 +228,7 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
for (tmp = &Incoming; *tmp;)
{
tmp1=(*tmp)->next;
FREE (tmp); /* __FREE_CHECKED__ */
buffy_free (tmp);
*tmp=tmp1;
}
return 0;
......@@ -236,23 +255,15 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
{
if(*tmp)
{
FREE (&((*tmp)->path));
tmp1=(*tmp)->next;
FREE (tmp); /* __FREE_CHECKED__ */
buffy_free (tmp);
*tmp=tmp1;
}
continue;
}
if (!*tmp)
{
*tmp = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
strfcpy ((*tmp)->path, buf, sizeof ((*tmp)->path));
(*tmp)->next = NULL;
/* it is tempting to set magic right here */
(*tmp)->magic = 0;
}
*tmp = buffy_new (buf);
(*tmp)->new = 0;
(*tmp)->notified = 1;
......@@ -274,20 +285,96 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
return 0;
}
/* people use check_mbox_size on systems where modified time attributes are
* BADLY broken. Ignore them.
*/
#define STAT_CHECK_SIZE (sb.st_size > tmp->size)
#define STAT_CHECK_TIME (sb.st_mtime > sb.st_atime || (tmp->newly_created && sb.st_ctime == sb.st_mtime && sb.st_ctime == sb.st_atime))
#define STAT_CHECK (option(OPTCHECKMBOXSIZE) ? STAT_CHECK_SIZE : STAT_CHECK_TIME)
/* returns 1 if maildir has new mail */
static int buffy_maildir_hasnew (BUFFY* mailbox)
{
char path[_POSIX_PATH_MAX];
DIR *dirp;
struct dirent *de;
char *p;
int rc = 0;
struct stat sb;
snprintf (path, sizeof (path), "%s/new", mailbox->path);
/* when $mail_check_recent is set, if the new/ directory hasn't been modified since
* the user last exited the mailbox, then we know there is no recent mail.
*/
if (option(OPTMAILCHECKRECENT))
{
if (stat(path, &sb) == 0 && sb.st_mtime < mailbox->last_visited)
return 0;
}
if ((dirp = opendir (path)) == NULL)
{
mailbox->magic = 0;
return 0;
}
while ((de = readdir (dirp)) != NULL)
{
if (*de->d_name == '.')
continue;
if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T'))
{
if (option(OPTMAILCHECKRECENT))
{
char msgpath[_POSIX_PATH_MAX];
snprintf(msgpath, sizeof(msgpath), "%s/%s", path, de->d_name);
/* ensure this message was received since leaving this mailbox */
if (stat(msgpath, &sb) == 0 && (sb.st_ctime <= mailbox->last_visited))
continue;
}
/* one new and undeleted message is enough */
mailbox->new = 1;
rc = 1;
break;
}
}
closedir (dirp);
return rc;
}
/* returns 1 if mailbox has new mail */
static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
{
int rc = 0;
int statcheck;
if (option (OPTCHECKMBOXSIZE))
statcheck = sb->st_size > mailbox->size;
else
statcheck = sb->st_mtime > sb->st_atime
|| (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
if (statcheck)
{
if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
{
rc = 1;
mailbox->new = 1;
}
}
else if (option(OPTCHECKMBOXSIZE))
{
/* some other program has deleted mail from the folder */
mailbox->size = (off_t) sb->st_size;
}
if (mailbox->newly_created &&
(sb->st_ctime != sb->st_mtime || sb->st_ctime != sb->st_atime))
mailbox->newly_created = 0;
return rc;
}
int mutt_buffy_check (int force)
{
BUFFY *tmp;
struct stat sb;
struct dirent *de;
DIR *dirp;
char path[_POSIX_PATH_MAX];
struct stat contex_sb;
time_t t;
......@@ -314,14 +401,11 @@ int mutt_buffy_check (int force)
#ifdef USE_IMAP
BuffyCount += imap_buffy_check (force);
if (!Context || Context->magic != M_IMAP)