Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Feb 2005 08:33:13 +0100 (CET)
From:      Udo Schweigert <udo.schweigert@siemens.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/77161: maintainer-update of mail/mutt-devel
Message-ID:  <200502060733.j167XDJM014143@alaska.cert.siemens.com>
Resent-Message-ID: <200502060740.j167eDNG036413@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         77161
>Category:       ports
>Synopsis:       maintainer-update of mail/mutt-devel
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 06 07:40:13 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Udo Schweigert
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
>Environment:

>Description:

Maintainer update of mail/mutt-devel:

	- Update to mutt-1.5.7.

Committer: 
	cvs rm files/extra-patch-nntp.c files/patch-Makefile.in 
	   files/patch-smime-recvattach files/patch-threadsubject files/patch-z 

	cvs add files/extra-patch-sidebar files/patch-hcache-db
	   files/patch-pgp.c

>How-To-Repeat:
>Fix:

diff -ru  /usr/ports/mail/mutt-devel/Makefile ./Makefile
--- /usr/ports/mail/mutt-devel/Makefile	Thu Jan 13 06:06:55 2005
+++ ./Makefile	Sun Feb  6 07:54:21 2005
@@ -47,7 +47,10 @@
 #  WITH_MUTT_QUOTE_PATCH
 #  This is a default knob and can be disabled by WITHOUT_MUTT_QUOTE_PATCH
 #
-# If you want to have the Maildir/IMAP header cache define:
+# If you want to have the IMAP header cache define:
+#  WITH_MUTT_IMAP_HEADER_CACHE
+#
+# If you want to have the Maildir and the IMAP header cache define:
 #  WITH_MUTT_MAILDIR_HEADER_CACHE
 #
 # If you want to make SMIME outlook compatible define:
@@ -55,10 +58,6 @@
 #  This is a default knob and can be disabled by
 #    WITHOUT_MUTT_SMIME_OUTLOOK_COMPAT
 #
-# If you want to use enhanced pgp features define:
-#  WITH_MUTT_PGP_PATCH
-#  This is a default knob and can be disabled by WITHOUT_MUTT_PGP_PATCH
-#
 # If you want to read and post news with mutt define:
 #  WITH_MUTT_NNTP
 #
@@ -93,8 +92,8 @@
 #
 
 PORTNAME=	mutt-devel
-PORTVERSION=	1.5.6
-PORTREVISION=	11
+PORTVERSION=	1.5.7
+PORTREVISION=	0
 CATEGORIES+=	mail ipv6
 .if defined(WITH_MUTT_NNTP)
 CATEGORIES+=	news
@@ -102,8 +101,12 @@
 MASTER_SITES=	ftp://ftp.mutt.org/mutt/devel/ \
 		ftp://ftp.fu-berlin.de/pub/unix/mail/mutt/devel/ \
 		ftp://ftp.demon.co.uk/pub/mirrors/mutt/devel/ \
-		ftp://ftp.parodius.com/pub/mutt/devel/
-DISTNAME=	mutt-${PORTVERSION}i
+		ftp://ftp.parodius.com/pub/mutt/devel/ \
+		http://www.mutt.org.ua/download/mutt-${VVV_PATCH_VERSION}/:vvv \
+		http://www2.mutt.org.ua/download/mutt-${VVV_PATCH_VERSION}/:vvv \
+		http://www3.mutt.org.ua/download/mutt-${VVV_PATCH_VERSION}/:vvv \
+		ftp://ftp.mutt.org.ua/pub/mutt/mutt-${VVV_PATCH_VERSION}/:vvv \
+		ftp://ftp3.mutt.org.ua/pub/mutt/mutt-${VVV_PATCH_VERSION}/:vvv \
 
 PATCH_SITES+=	http://www.mutt.org.ua/download/mutt-${VVV_PATCH_VERSION}/:vvv \
 		http://www2.mutt.org.ua/download/mutt-${VVV_PATCH_VERSION}/:vvv \
@@ -112,6 +115,7 @@
 		ftp://ftp3.mutt.org.ua/pub/mutt/mutt-${VVV_PATCH_VERSION}/:vvv \
 		http://cedricduval.free.fr/mutt/patches/download/:cd \
 		http://home.woolridge.ca/mutt/patches/:dw \
+		http://www.spinnaker.de/mutt/compressed/:rr \
 		http://thomer.com/mutt/:thomer
 
 MAINTAINER?=	udo.schweigert@siemens.com
@@ -145,14 +149,21 @@
 
 .include <bsd.port.pre.mk>
 
+DISTNAME=	mutt-${PORTVERSION}i
+EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
+
 CD_PATCH_VERSION=	1.5.5.1
 CD_IFDEF_PATCH_VERSION=	1.5.4
+DW_PATCH_VERSION=	1.5.6
 .if !defined(VVV_PATCH_VERSION)
 VVV_PATCH_VERSION=	${PORTVERSION}
 .endif
 .if !defined(CD_PATCH_VERSION)
 CD_PATCH_VERSION=	${PORTVERSION}
 .endif
+.if !defined(RR_PATCH_VERSION)
+RR_PATCH_VERSION=	${PORTVERSION}
+.endif
 .if !defined(CD_IFDEF_PATCH_VERSION)
 CD_IFDEF_PATCH_VERSION=	${CD_PATCH_VERSION}
 .endif
@@ -162,16 +173,16 @@
 .if !defined(DW_MBOX_PATCH_VERSION)
 DW_MBOX_PATCH_VERSION=	${DW_PATCH_VERSION}
 .endif
-.if defined(WITH_MUTT_IMAP_HEADER_CACHE)
-WITH_MUTT_MAILDIR_HEADER_CACHE=	yes
+.if defined(WITH_MUTT_MAILDIR_HEADER_CACHE)
+WITH_MUTT_IMAP_HEADER_CACHE=	yes
+.endif
+.if defined(WITH_MUTT_SIGNATURE_MENU)
+.error The WITH_MUTT_SIGNATURE_MENU does not work at the moment
 .endif
 .if defined(WITH_MUTT_SIDEBAR_PATCH)
 .if defined(WITH_MUTT_NNTP)
 .error The WITH_MUTT_SIDEBAR_PATCH and WITH_MUTT_NNTP are not compatible
 .endif
-.if defined(WITH_MUTT_MAILDIR_MTIME_PATCH)
-.error The WITH_MUTT_SIDEBAR_PATCH and WITH_MUTT_MAILDIR_MTIME_PATCH are not compatible
-.endif
 .if defined(WITH_MUTT_SIGNATURE_MENU)
 .error The WITH_MUTT_SIDEBAR_PATCH and WITH_MUTT_SIGNATURE_MENU are not compatible
 .endif
@@ -243,7 +254,7 @@
 .if defined(WITH_MUTT_CYRUS_SASL2)
 LIB_DEPENDS+=	sasl2.2:${PORTSDIR}/security/cyrus-sasl2
 .endif
-.if defined(WITH_MUTT_MAILDIR_HEADER_CACHE)
+.if defined(WITH_MUTT_IMAP_HEADER_CACHE)
 LIB_DEPENDS+=	db-4.2.2:${PORTSDIR}/databases/db42
 CFLAGS+=	-I${LOCALBASE}/include/db42
 .endif
@@ -269,20 +280,15 @@
 	@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-maildir-mtime
 .endif
 .endif
-.if defined(WITH_MUTT_NNTP)
-pre-configure::
-	@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-nntp.c
-.endif
 
-.if ! defined(WITHOUT_MUTT_PGP_PATCH)
-SGML_NEEDED=	yes
+.if defined(WITH_MUTT_EDIT_THREADS)
 pre-configure::
-	@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-pgp-dw
+	@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-edit-threads
 .endif
 
-.if defined(WITH_MUTT_EDIT_THREADS)
+.if defined(WITH_MUTT_SIDEBAR_PATCH)
 pre-configure::
-	@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-edit-threads
+	@${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/extra-patch-sidebar
 .endif
 
 .if defined(WITH_MUTT_ASPELL)
@@ -297,7 +303,6 @@
 CONFIGURE_ARGS+=	--with-curses=${LOCALBASE}
 .elif defined(MUTT_USES_SLANG)
 CONFIGURE_ARGS+=	--with-slang=${LOCALBASE}
-PATCHFILES+=	patch-${VVV_PATCH_VERSION}.vvv.slang.gz:vvv
 .endif
 .if defined(WITH_MUTT_CYRUS_SASL2)
 CONFIGURE_ARGS+=	--with-sasl2=${LOCALBASE}
@@ -319,14 +324,24 @@
 PATCH_DIST_STRIP=	-p1
 
 .if ! defined (WITHOUT_MUTT_COMPRESSED_FOLDERS)
-PATCHFILES+=	patch-${VVV_PATCH_VERSION}.rr.compressed.gz:vvv
+DISTFILES+=	patch-${RR_PATCH_VERSION}.rr.compressed.1.gz:rr
 CONFIGURE_ARGS+=	--enable-compressed
 SGML_NEEDED=	yes
+pre-patch::
+	@${GUNZIP_CMD} -c ${DISTDIR}/${DIST_SUBDIR}/patch-${RR_PATCH_VERSION}.rr.compressed.1.gz > ${WRKDIR}/patch-compressed
+	@${REINPLACE_CMD} -E '/^diff.*\/doc\/manual.txt$$/,/^diff/d' \
+		 ${WRKDIR}/patch-compressed
+	@${PATCH} ${PATCH_ARGS} -p1 < ${WRKDIR}/patch-compressed
 .endif
 .if defined(WITH_MUTT_NNTP)
-PATCHFILES+=	patch-${VVV_PATCH_VERSION}.vvv.nntp.gz:vvv
+DISTFILES+=	patch-${VVV_PATCH_VERSION}.vvv.nntp.gz:vvv
 CONFIGURE_ARGS+=	--enable-nntp
 SGML_NEEDED=	yes
+pre-patch::
+	@${GUNZIP_CMD} -c ${DISTDIR}/${DIST_SUBDIR}/patch-${VVV_PATCH_VERSION}.vvv.nntp.gz > ${WRKDIR}/patch-nntp
+	@${REINPLACE_CMD} -E '/^diff.*\/doc\/manual.txt$$/,/^diff/d' \
+		 ${WRKDIR}/patch-nntp
+	@${PATCH} ${PATCH_ARGS} -p1 < ${WRKDIR}/patch-nntp
 .endif
 .if ! defined(WITHOUT_MUTT_QUOTE_PATCH)
 PATCHFILES+=	patch-${VVV_PATCH_VERSION}.vvv.initials.gz:vvv \
@@ -349,12 +364,12 @@
 PATCHFILES+=	p0-patch-${DW_MBOX_PATCH_VERSION}.dw.mbox-hook.1:dw
 .endif
 .if defined(WITH_MUTT_SIDEBAR_PATCH)
-PATCHFILES+=	patch-1.5.6i.sidebar.20041122.txt:thomer
+PATCHFILES+=	patch-1.5.7i.sidebar.20050203.txt:thomer
 .endif
 
 WRKSRC=		${WRKDIR}/${DISTNAME:S/i$//}
 MAN1=		mutt.1 mutt_dotlock.1
-MAN5=		muttrc.5 mbox.5
+MAN5=		muttrc.5 mbox.5 mmdf.5
 
 post-patch::
 	@${REINPLACE_CMD} -e 's,/usr/bin/gpg,${LOCALBASE}/bin/gpg,g' \
@@ -377,9 +392,12 @@
 .if ! defined(WITHOUT_MUTT_QUOTE_PATCH)
 SCRIPTS_ENV+=	MUTT_QUOTE_PATCH="yes"
 .endif
+.if defined(WITH_MUTT_IMAP_HEADER_CACHE)
+SCRIPTS_ENV+=	MUTT_IMAP_HEADER_CACHE="yes"
+CONFIGURE_ARGS+=	--enable-hcache --without-gdbm --with-bdb
+.endif
 .if defined(WITH_MUTT_MAILDIR_HEADER_CACHE)
 SCRIPTS_ENV+=	MUTT_MAILDIR_HEADER_CACHE="yes"
-CONFIGURE_ARGS+=	--enable-hcache --without-gdbm --with-bdb
 .endif
 .if defined(WITH_MUTT_SIDEBAR_PATCH)
 SCRIPTS_ENV+=	MUTT_SIDEBAR_PATCH="yes"
@@ -392,9 +410,6 @@
 .endif
 .if defined(WITH_MUTT_IFDEF_PATCH)
 SCRIPTS_ENV+=	MUTT_IFDEF_PATCH="yes"
-.endif
-.if ! defined(WITHOUT_MUTT_PGP_PATCH)
-SCRIPTS_ENV+=	MUTT_PGP_PATCH="yes"
 .endif
 .if ! defined(WITHOUT_MUTT_HTML)
 SCRIPTS_ENV+=	MUTT_HTML="yes"
diff -ru  /usr/ports/mail/mutt-devel/distinfo ./distinfo
--- /usr/ports/mail/mutt-devel/distinfo	Thu Jan 13 06:06:55 2005
+++ ./distinfo	Sun Feb  6 07:54:21 2005
@@ -1,20 +1,16 @@
-MD5 (mutt/mutt-1.5.6i.tar.gz) = aa1433635d7c86beba1675a3408b0324
-SIZE (mutt/mutt-1.5.6i.tar.gz) = 2910730
-MD5 (mutt/patch-1.5.6.vvv.slang.gz) = 11dccb4b178d63d0dbf51afcea3b30c8
-SIZE (mutt/patch-1.5.6.vvv.slang.gz) = 347
-MD5 (mutt/patch-1.5.6.rr.compressed.gz) = 0d57a62f17c93eb1d2eff60e070933b3
-SIZE (mutt/patch-1.5.6.rr.compressed.gz) = 10077
-MD5 (mutt/patch-1.5.6.vvv.nntp.gz) = b32ef18006ce8a211ad2d1dabc62bfcb
-SIZE (mutt/patch-1.5.6.vvv.nntp.gz) = 106691
-MD5 (mutt/patch-1.5.6.vvv.initials.gz) = eecaa646227609b52e5267178b3bc462
-SIZE (mutt/patch-1.5.6.vvv.initials.gz) = 667
-MD5 (mutt/patch-1.5.6.vvv.quote.gz) = f262968775cf5c37ba49b29248fcf170
-SIZE (mutt/patch-1.5.6.vvv.quote.gz) = 1558
-MD5 (mutt/patch-1.5.5.1.cd.signatures_menu.2.1) = 22caeffb4a612f5fa6e1f585b40c51a6
-SIZE (mutt/patch-1.5.5.1.cd.signatures_menu.2.1) = 22637
+MD5 (mutt/mutt-1.5.7i.tar.gz) = 395c699f1d00ee193f8f145b82d6afb7
+SIZE (mutt/mutt-1.5.7i.tar.gz) = 2990425
+MD5 (mutt/patch-1.5.7.rr.compressed.1.gz) = d001ab9fe475063a9d640a75f8dbbad5
+SIZE (mutt/patch-1.5.7.rr.compressed.1.gz) = 13770
+MD5 (mutt/patch-1.5.7.vvv.nntp.gz) = e2ad220c76ced7b519cea60ef67cc827
+SIZE (mutt/patch-1.5.7.vvv.nntp.gz) = 91881
+MD5 (mutt/patch-1.5.7.vvv.initials.gz) = 08e1772a0682a507ac5806c6d019c3b9
+SIZE (mutt/patch-1.5.7.vvv.initials.gz) = 699
+MD5 (mutt/patch-1.5.7.vvv.quote.gz) = 011d98d05d4d0866ea3a913935784e0f
+SIZE (mutt/patch-1.5.7.vvv.quote.gz) = 1627
 MD5 (mutt/patch-1.5.4.cd.ifdef.1) = a545036cdb55519154d0b35465f52daa
 SIZE (mutt/patch-1.5.4.cd.ifdef.1) = 3545
 MD5 (mutt/p0-patch-1.5.6.dw.mbox-hook.1) = 9e29a6778ab07a4de3442691e4573fea
 SIZE (mutt/p0-patch-1.5.6.dw.mbox-hook.1) = 6405
-MD5 (mutt/patch-1.5.6i.sidebar.20041122.txt) = 3c5f1be18b9fb2be693c8c717f6b940c
-SIZE (mutt/patch-1.5.6i.sidebar.20041122.txt) = 46178
+MD5 (mutt/patch-1.5.7i.sidebar.20050203.txt) = e36f06d15f63e94f746c572900bfb9fa
+SIZE (mutt/patch-1.5.7i.sidebar.20050203.txt) = 46003
diff -ru  /usr/ports/mail/mutt-devel/files/extra-patch-edit-threads ./files/extra-patch-edit-threads
--- /usr/ports/mail/mutt-devel/files/extra-patch-edit-threads	Tue Feb 10 19:27:50 2004
+++ ./files/extra-patch-edit-threads	Fri Feb  4 09:22:54 2005
@@ -42,15 +42,6 @@
 diff -ru work.old/mutt-1.5.6/configure work/mutt-1.5.6/configure
 --- configure	Sun Feb  1 19:22:06 2004
 +++ configure	Tue Feb 10 14:40:41 2004
-@@ -40,6 +40,8 @@
- ac_help="$ac_help
-     --with-gss[=PFX]         Compile in GSSAPI authentication for IMAP"
- ac_help="$ac_help
-+  --enable-imap-edit-threads Enable editing threads support for IMAP"
-+ac_help="$ac_help
-   --with-ssl[=PFX]           Compile in SSL support for POP/IMAP"
- ac_help="$ac_help
-   --with-nss[=PFX]           Compile in SSL support for POP/IMAP via NSS"
 @@ -5383,6 +5385,23 @@
  else
    USE_GSS_TRUE='#'
diff -ru  /usr/ports/mail/mutt-devel/files/extra-patch-maildir-header-cache ./files/extra-patch-maildir-header-cache
--- /usr/ports/mail/mutt-devel/files/extra-patch-maildir-header-cache	Tue Nov  9 19:57:39 2004
+++ ./files/extra-patch-maildir-header-cache	Fri Feb  4 09:22:54 2005
@@ -2,1325 +2,44 @@
 --- a/PATCHES
 +++ b/PATCHES
 @@ -0,0 +1 @@
-+patch-1.5.6.tg.hcache.11
-diff -Nru a/configure.in b/configure.in
---- a/configure.in	2004-08-18 09:43:09 +02:00
-+++ b/configure.in	2004-10-14 07:21:52 +02:00
-@@ -692,11 +692,6 @@
-    AC_CHECK_FUNCS(idna_to_ascii_lz idna_to_ascii_from_locale)
- fi
- 
--if test "$need_md5" = "yes"
--then
--        MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS md5c.o"
--fi
--
- dnl -- end socket --
- 
- AC_ARG_ENABLE(debug, [  --enable-debug             Enable debugging support],
-@@ -767,6 +762,96 @@
-                    NOTE: this requires significant more memory when defined.])
- 
-         fi])
-+
-+dnl -- start cache --
-+AC_ARG_ENABLE(hcache, [  --enable-hcache            Enable header caching],
-+[if test x$enableval = xyes; then
-+    AC_DEFINE(USE_HCACHE, 1, [Enable header caching])
-+    MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS hcache.o"
-+
-+    OLDCPPFLAGS="$CPPFLAGS"
-+    OLDLIBS="$LIBS"
-+
-+    need_md5="yes"
-+    ac_prefer_gdbm=yes
-+    AC_ARG_WITH(gdbm, [  --without-gdbm             Get rid of gdbm even if it is available ],
-+        ac_prefer_gdbm=$withval)
-+    if test x$ac_prefer_gdbm != xno; then
-+        CPPFLAGS="$OLDCPPFLAGS"
-+        LIBS="$OLDLIBS -lgdbm";
-+        AC_CACHE_CHECK(for gdbm_open, ac_cv_gdbmopen,[
-+            ac_cv_gdbmopen=no
-+            AC_TRY_LINK([#include <gdbm.h>],[gdbm_open(0,0,0,0,0);],[ac_cv_gdbmopen=yes])
-+        ])
-+    fi
-+
-+    ac_bdb_prefix=yes
-+    AC_ARG_WITH(bdb, [  --with-bdb[=DIR]          Use BerkeleyDB4 if gdbm is not available ],
-+        ac_bdb_prefix=$withval)
-+    if test x$ac_bdb_prefix != xno -a x$ac_cv_gdbmopen != xyes; then
-+        test x$ac_bdb_prefix = xyes && ac_bdb_prefix="$mutt_cv_prefix /opt/csw/bdb4 /opt /usr/local /usr"
-+        for d in $ac_bdb_prefix; do
-+            bdbpfx="$bdbpfx $d"
-+            for v in BerkeleyDB.4.3 BerkeleyDB.4.2 BerkeleyDB.4.1; do
-+                bdbpfx="$bdbpfx $d/$v"
-+            done
-+        done
-+        BDB_VERSIONS="db-4.2 db4.2 db42 ''"
-+        AC_MSG_CHECKING([for BerkeleyDB > 4.0])
-+        for d in $bdbpfx; do
-+            BDB_INCLUDE_DIR=""
-+            BDB_LIB_DIR=""
-+            for v in / $BDB_VERSIONS; do
-+                if test -r "$d/include/$v/db.h"; then
-+                    BDB_INCLUDE_DIR="$d/include/$v"
-+                    if test -d "$d/lib/$v"; then
-+                        BDB_LIB_DIR="$d/lib/$v"
-+                        for l in `echo $BDB_VERSIONS`; do
-+                            CPPFLAGS="-I$BDB_INCLUDE_DIR $OLDCPPFLAGS"
-+                            LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$l"
-+                            AC_TRY_LINK([
-+                                #include <stdlib.h>
-+                                #include <db.h>
-+                            ],[
-+                                DB *db = NULL;
-+                                db->open(db,NULL,NULL,NULL,0,0,0);
-+                            ],[
-+                                ac_cv_dbcreate=yes
-+                                BDB_LIB="$l"
-+                                break
-+                            ])
-+                        done
-+                        test x$ac_dbcreate = xyes && break
-+                    fi
-+                fi
-+            done
-+            test x$BDB_LIB != x && break
-+        done
-+        if test x$ac_cv_dbcreate = xyes; then
-+            AC_MSG_RESULT(yes)
-+        else
-+            AC_MSG_RESULT(no)
-+        fi
-+    fi
-+
-+    if test x$ac_cv_gdbmopen = xyes; then
-+        CPPFLAGS="$OLDCPPFLAGS"
-+        LIBS="$OLDLIBS -lgdbm";
-+        AC_DEFINE(HAVE_GDBM, 1, [GDBM Support])
-+    elif test x$ac_cv_dbcreate = xyes; then
-+        CPPFLAGS="-I$BDB_INCLUDE_DIR $OLDCPPFLAGS"
-+        LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$BDB_LIB"
-+        AC_DEFINE(HAVE_DB4, 1, [Sleepycat DB4 Support])
-+    else
-+        AC_MSG_ERROR(You need Sleepycat DB4 or GDBM for --enable-hcache)
-+    fi
-+fi])
-+dnl -- end cache --
-+
-+if test "$need_md5" = "yes"
-+then
-+        MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS md5c.o"
-+fi
- 
- AC_SUBST(MUTTLIBS)
- AC_SUBST(MUTT_LIB_OBJECTS)
-diff -Nru a/globals.h b/globals.h
---- a/globals.h	2004-08-18 09:43:11 +02:00
-+++ b/globals.h	2004-08-26 22:32:53 +02:00
-@@ -63,6 +63,10 @@
- WHERE char *Locale;
- WHERE char *MailcapPath;
- WHERE char *Maildir;
-+#if USE_HCACHE
-+WHERE char *HeaderCache;
-+WHERE char *HeaderCachePageSize;
-+#endif
- WHERE char *MhFlagged;
- WHERE char *MhReplied;
- WHERE char *MhUnseen;
++patch-1.5.7.tg.hcache.1
 diff -Nru a/hcache.c b/hcache.c
---- /dev/null	Wed Dec 31 16:00:00 196900
-+++ b/hcache.c	2004-11-09 00:09:22 +01:00
-@@ -0,0 +1,880 @@
-+/*
-+ * Copyright (C) 2004 Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
-+ * Copyright (C) 2004 Tobias Werth <sitowert@stud.uni-erlangen.de>
-+ * Copyright (C) 2004 Brian Fundakowski Feldman <green@FreeBSD.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
-+ *     the Free Software Foundation; either version 2 of the License, or
-+ *     (at your option) any later version.
-+ *
-+ *     This program is distributed in the hope that it will be useful,
-+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *     GNU General Public License for more details.
-+ *
-+ *     You should have received a copy of the GNU General Public License
-+ *     along with this program; if not, write to the Free Software
-+ *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
-+ */
-+
-+#if HAVE_CONFIG_H
-+#include "config.h"
-+#endif /* HAVE_CONFIG_H */
-+
-+#if HAVE_GDBM
-+#include <gdbm.h>
-+#elif HAVE_DB4
-+#include <db.h>
-+#endif
-+
-+#include <errno.h>
-+#include <fcntl.h>
-+#include "mutt.h"
-+#ifdef USE_IMAP
-+#include "message.h"
-+#endif
-+#include "mime.h"
-+#include "mx.h"
-+#include "lib.h"
-+#include "md5.h"
-+
-+#if HAVE_GDBM
-+static struct
-+header_cache
-+{
-+	GDBM_FILE db;
-+	char *folder;
-+	unsigned int crc;
-+} HEADER_CACHE;
-+#elif HAVE_DB4
-+static struct
-+header_cache
-+{
-+	DB_ENV *env;
-+	DB *db;
-+	unsigned int crc;
-+	int fd;
-+	char lockfile[_POSIX_PATH_MAX];
-+} HEADER_CACHE;
-+#endif
-+
-+typedef union
-+{
-+        struct timeval timeval;
-+        unsigned long long uid_validity;
-+} validate;
-+
-+static void *
-+lazy_malloc(size_t siz)
-+{
-+	if (0 < siz && siz < 4096) {
-+		siz = 4096;
-+	}
-+
-+	return safe_malloc(siz);
-+}
-+
-+static void
-+lazy_realloc(void *ptr, size_t siz)
-+{
-+	void **p = (void **)ptr;
-+
-+	if ( p != NULL
-+	&&   0 < siz
-+	&& siz < 4096) {
-+		return;
-+	}
-+
-+	safe_realloc(ptr, siz);
-+}
-+
-+static unsigned char *
-+dump_int(unsigned int i, unsigned char *d, int *off)
-+{
-+	lazy_realloc(&d, *off + sizeof(int));
-+	memcpy(d + *off, &i, sizeof(int));
-+	(*off) += sizeof(int);
-+
-+	return d;
-+}
-+
-+static void
-+restore_int(unsigned int *i, const unsigned char *d, int *off)
-+{
-+	memcpy(i, d + *off, sizeof(int));
-+	(*off) += sizeof(int);
-+}
-+
-+static unsigned char *
-+dump_char(char *c, unsigned char *d, int *off)
-+{
-+	unsigned int size;
-+
-+	if (c == NULL) {
-+		size = 0;
-+		d = dump_int(size, d, off);
-+		return d;
-+	}
-+
-+	size = mutt_strlen(c) + 1;
-+	d = dump_int(size, d, off);
-+	lazy_realloc(&d, *off + size);
-+	memcpy(d + *off, c, size);
-+	*off += size;
-+
-+	return d;
-+}
-+
-+static unsigned char *
-+dump_char_size(char *c, unsigned char *d, int *off, ssize_t size)
-+{
-+	if (c == NULL) {
-+		size = 0;
-+		d = dump_int(size, d, off);
-+		return d;
-+	}
-+
-+	d = dump_int(size, d, off);
-+	lazy_realloc(&d, *off + size);
-+	memcpy(d + *off, c, size);
-+	*off += size;
-+
-+	return d;
-+}
-+
-+static void
-+restore_char(char **c, const unsigned char *d, int *off)
-+{
-+	unsigned int size;
-+	restore_int(&size, d, off);
-+
-+	if (size == 0) {
-+		*c = NULL;
-+		return;
-+	}
-+
-+	*c = safe_malloc(size);
-+	memcpy(*c, d + *off, size);
-+	*off += size;
-+}
-+
-+static unsigned char *
-+dump_address(ADDRESS *a, unsigned char *d, int *off)
-+{
-+	unsigned int counter = 0;
-+	unsigned int start_off = *off;
-+
-+	d = dump_int(0xdeadbeef, d, off);
-+
-+	while (a) {
-+#ifdef EXACT_ADDRESS
-+		d = dump_char(a->val, d, off);
-+#endif
-+		d = dump_char(a->personal, d, off);
-+		d = dump_char(a->mailbox, d, off);
-+		d = dump_int(a->group, d, off);
-+		a = a->next;
-+		counter++;
-+	}
-+
-+	memcpy(d + start_off, &counter, sizeof(int));
-+
-+	return d;
-+}
-+
-+static void
-+restore_address(ADDRESS **a, const unsigned char *d, int *off)
-+{
-+	unsigned int counter;
-+
-+	restore_int(&counter, d, off);
-+
-+	while (counter) {
-+		*a = safe_malloc(sizeof(ADDRESS));
-+#ifdef EXACT_ADDRESS
-+		restore_char(&(*a)->val, d, off);
-+#endif
-+		restore_char(&(*a)->personal, d, off);
-+		restore_char(&(*a)->mailbox, d, off);
-+		restore_int((unsigned int *)&(*a)->group, d, off);
-+		a = &(*a)->next;
-+		counter--;
-+	}
-+
-+	*a = NULL;
-+}
-+
-+static unsigned char *
-+dump_list(LIST *l, unsigned char *d, int *off)
-+{
-+	unsigned int counter = 0;
-+	unsigned int start_off = *off;
-+
-+	d = dump_int(0xdeadbeef, d, off);
-+
-+	while (l) {
-+		d = dump_char(l->data, d, off);
-+		l = l->next;
-+		counter++;
-+	}
-+
-+	memcpy(d + start_off, &counter, sizeof(int));
-+
-+	return d;
-+}
-+
-+static void
-+restore_list(LIST **l, const unsigned char *d, int *off)
-+{
-+	unsigned int counter;
-+
-+	restore_int(&counter, d, off);
-+
-+	while (counter) {
-+		*l = safe_malloc(sizeof(LIST));
-+		restore_char(&(*l)->data, d, off);
-+		l = &(*l)->next;
-+		counter--;
-+	}
-+
-+	*l = NULL;
-+}
-+
-+static unsigned char *
-+dump_buffer(BUFFER *b, unsigned char *d, int *off)
-+{
-+	if (! b) {
-+		d = dump_int(0, d, off);
-+		return d;
-+	} else {
-+		d = dump_int(1, d, off);
-+	}
-+
-+	d = dump_char_size(b->data, d, off, b->dsize + 1);
-+	d = dump_int(b->dptr - b->data, d, off);
-+	d = dump_int(b->dsize, d, off);
-+	d = dump_int(b->destroy, d, off);
-+
-+	return d;
-+}
-+
-+static void
-+restore_buffer(BUFFER **b, const unsigned char *d, int *off)
-+{
-+	unsigned int used;
-+	unsigned int offset;
-+	restore_int(&used, d, off);
-+	if (! used) {
-+		return;
-+	}
-+
-+	*b = safe_malloc(sizeof(BUFFER));
-+
-+	restore_char(& (*b)->data, d, off);
-+	restore_int(& offset, d, off);
-+	(*b)->dptr = (*b)->data + offset;
-+	restore_int(& (*b)->dsize, d, off);
-+	restore_int((unsigned int *) & (*b)->destroy, d, off);
-+}
-+
-+static unsigned char *
-+dump_parameter(PARAMETER *p, unsigned char *d, int *off)
-+{
-+	unsigned int counter = 0;
-+	unsigned int start_off = *off;
-+
-+	d = dump_int(0xdeadbeef, d, off);
-+
-+	while (p) {
-+		d = dump_char(p->attribute, d, off);
-+		d = dump_char(p->value, d, off);
-+		p = p->next;
-+		counter++;
-+	}
-+
-+	memcpy(d + start_off, &counter, sizeof(int));
-+
-+	return d;
-+}
-+
-+static void
-+restore_parameter(PARAMETER **p, const unsigned char *d, int *off)
-+{
-+	unsigned int counter;
-+
-+	restore_int(&counter, d, off);
-+
-+	while (counter) {
-+		*p = safe_malloc(sizeof(PARAMETER));
-+		restore_char(&(*p)->attribute, d, off);
-+		restore_char(&(*p)->value, d, off);
-+		p = &(*p)->next;
-+		counter--;
-+	}
-+
-+	*p = NULL;
-+}
-+
-+static unsigned char *
-+dump_body(BODY *c, unsigned char *d, int *off)
-+{
-+	lazy_realloc(&d, *off + sizeof(BODY));
-+	memcpy(d + *off, c, sizeof(BODY));
-+	*off += sizeof(BODY);
-+
-+	d = dump_char(c->xtype, d, off);
-+	d = dump_char(c->subtype, d, off);
-+
-+	d = dump_parameter(c->parameter, d, off);
-+
-+	d = dump_char(c->description, d, off);
-+	d = dump_char(c->form_name, d, off);
-+	d = dump_char(c->filename, d, off);
-+	d = dump_char(c->d_filename, d, off);
-+
-+	return d;
-+}
-+
-+static void
-+restore_body(BODY *c, const unsigned char *d, int *off)
-+{
-+	memcpy(c, d + *off, sizeof(BODY));
-+	*off += sizeof(BODY);
-+
-+	restore_char(& c->xtype, d, off);
-+	restore_char(& c->subtype, d, off);
-+
-+	restore_parameter(& c->parameter, d, off);
-+
-+	restore_char(& c->description, d, off);
-+	restore_char(& c->form_name, d, off);
-+	restore_char(& c->filename, d, off);
-+	restore_char(& c->d_filename, d, off);
-+}
-+
-+static unsigned char *
-+dump_envelope(ENVELOPE *e, unsigned char *d, int *off)
-+{
-+	d = dump_address(e->return_path, d, off);
-+	d = dump_address(e->from, d, off);
-+	d = dump_address(e->to, d, off);
-+	d = dump_address(e->cc, d, off);
-+	d = dump_address(e->bcc, d, off);
-+	d = dump_address(e->sender, d, off);
-+	d = dump_address(e->reply_to, d, off);
-+	d = dump_address(e->mail_followup_to, d, off);
-+
-+	d = dump_char(e->subject, d, off);
-+	if (e->real_subj) {
-+		d = dump_int(e->real_subj - e->subject, d, off);
-+	} else {
-+		d = dump_int(-1, d, off);
-+	}
-+	d = dump_char(e->message_id, d, off);
-+	d = dump_char(e->supersedes, d, off);
-+	d = dump_char(e->date, d, off);
-+	d = dump_char(e->x_label, d, off);
-+
-+	d = dump_list(e->references, d, off);
-+	d = dump_list(e->in_reply_to, d, off);
-+	d = dump_list(e->userhdrs, d, off);
-+
-+	return d;
-+}
-+
-+static void
-+restore_envelope(ENVELOPE *e, const unsigned char *d, int *off)
-+{
-+	int real_subj_off;
-+
-+	restore_address(& e->return_path, d, off);
-+	restore_address(& e->from, d, off);
-+	restore_address(& e->to, d, off);
-+	restore_address(& e->cc, d, off);
-+	restore_address(& e->bcc, d, off);
-+	restore_address(& e->sender, d, off);
-+	restore_address(& e->reply_to, d, off);
-+	restore_address(& e->mail_followup_to, d, off);
-+
-+	restore_char(& e->subject, d, off);
-+	restore_int((unsigned int *) (& real_subj_off), d, off);
-+	if (0 <= real_subj_off) {
-+		e->real_subj = e->subject + real_subj_off;
-+	} else {
-+		e->real_subj = NULL;
-+	}
-+	restore_char(& e->message_id, d, off);
-+	restore_char(& e->supersedes, d, off);
-+	restore_char(& e->date, d, off);
-+	restore_char(& e->x_label, d, off);
-+
-+	restore_list(& e->references, d, off);
-+	restore_list(& e->in_reply_to, d, off);
-+	restore_list(& e->userhdrs, d, off);
-+}
-+
-+static
-+unsigned int crc32(unsigned int crc, unsigned char const *p, size_t len)
-+{
-+	int i;
-+	while (len--) {
-+		crc ^= *p++;
-+		for (i = 0; i < 8; i++)
-+			crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0);
-+	}
-+	return crc;
-+}
-+
-+static int
-+generate_crc32()
-+{
-+	int crc = 0;
-+
-+	crc = crc32(crc, (unsigned char const *) "sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613", mutt_strlen("sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613"));
-+
-+#if HAVE_LANGINFO_CODESET
-+	crc = crc32(crc, (unsigned char const *) Charset, mutt_strlen(Charset));
-+	crc = crc32(crc, (unsigned char const *) "HAVE_LANGINFO_CODESET", mutt_strlen("HAVE_LANGINFO_CODESET"));
-+#endif
-+
-+#if EXACT_ADDRESS
-+	crc = crc32(crc, (unsigned char const *) "EXACT_ADDRESS", mutt_strlen("EXACT_ADDRESS"));
-+#endif
-+
-+#ifdef USE_POP
-+	crc = crc32(crc, (unsigned char const *) "USE_POP", mutt_strlen("USE_POP"));
-+#endif
-+
-+#ifdef MIXMASTER
-+	crc = crc32(crc, (unsigned char const *) "MIXMASTER", mutt_strlen("MIXMASTER"));
-+#endif
-+
-+#ifdef USE_IMAP
-+ 	crc = crc32(crc, (unsigned char const *) "USE_IMAP", mutt_strlen("USE_IMAP"));
-+#endif
-+	return crc;
-+}
-+
-+static int
-+crc32_matches(const char *d, unsigned int crc)
-+{
-+	int off = sizeof(validate);
-+	unsigned int mycrc = 0;
-+
-+	if (! d) {
-+		return 0;
-+	}
-+
-+	restore_int(&mycrc, (unsigned char *) d, &off);
-+
-+	return (crc == mycrc);
-+}
-+
-+/* Append md5sumed folder to path if path is a directory. */
-+static const char *
-+mutt_hcache_per_folder(const char *path, const char *folder)
-+{
-+	static char mutt_hcache_per_folder_path[_POSIX_PATH_MAX];
-+	struct stat path_stat;
-+	MD5_CTX md5;
-+	unsigned char md5sum[16];
-+	int ret;
-+
-+	ret = stat(path, &path_stat);
-+	if (ret < 0) {
-+		return path;
-+	}
-+
-+	if (! S_ISDIR(path_stat.st_mode)) {
-+		return path;
-+	}
-+
-+	MD5Init(&md5);
-+	MD5Update(&md5, (unsigned char *) folder, strlen(folder));
-+	MD5Final(md5sum, &md5);
-+
-+	ret = snprintf(mutt_hcache_per_folder_path, _POSIX_PATH_MAX,
-+                        "%s/%02x%02x%02x%02x%02x%02x%02x%02x"
-+                        "%02x%02x%02x%02x%02x%02x%02x%02x",
-+			path, md5sum[0], md5sum[1], md5sum[2], md5sum[3],
-+			md5sum[4], md5sum[5], md5sum[6], md5sum[7], md5sum[8],
-+			md5sum[9], md5sum[10], md5sum[11], md5sum[12],
-+			md5sum[13], md5sum[14], md5sum[15]);
-+
-+	if (ret <= 0) {
-+		return path;
-+	}
-+
-+	return mutt_hcache_per_folder_path;
-+}
-+
-+/* This function transforms a header into a char so that it is useable by
-+ * db_store */
-+static void *
-+mutt_hcache_dump(void *_db, HEADER *h, int *off, unsigned long long uid_validity)
-+{
-+	struct header_cache *db = _db;
-+	unsigned char *d = NULL;
-+	*off             = 0;
-+
-+	d = lazy_malloc(sizeof(validate));
-+
-+	if (uid_validity) {
-+		memcpy(d, &uid_validity, sizeof(long long));
-+	} else {
-+		struct timeval now;
-+		gettimeofday(&now, NULL);
-+		memcpy(d, &now, sizeof(struct timeval));
-+	}
-+	*off += sizeof(validate);
-+
-+	d = dump_int(db->crc, d, off);
-+
-+	lazy_realloc(&d, *off + sizeof(HEADER));
-+	memcpy(d + *off, h, sizeof(HEADER));
-+	*off += sizeof(HEADER);
-+
-+	d = dump_envelope(h->env, d, off);
-+	d = dump_body(h->content, d, off);
-+	d = dump_char(h->maildir_flags, d, off);
-+
-+	return d;
-+}
-+
-+HEADER *
-+mutt_hcache_restore(const unsigned char *d, HEADER **oh)
-+{
-+	int off = 0;
-+	HEADER *h        = mutt_new_header();
-+
-+	/* skip validate */
-+	off += sizeof(validate);
-+
-+	/* skip crc */
-+	off += sizeof(unsigned int);
-+
-+	memcpy(h, d + off, sizeof(HEADER));
-+	off += sizeof(HEADER);
-+
-+	h->env = mutt_new_envelope();
-+	restore_envelope(h->env, d, &off);
-+
-+	h->content = mutt_new_body();
-+	restore_body(h->content, d, &off);
-+
-+	restore_char(&h->maildir_flags, d, &off);
-+
-+	/* this is needed for maildir style mailboxes */
-+	if (oh) {
-+		h->old  = (*oh)->old;
-+		h->path = safe_strdup((*oh)->path);
-+		mutt_free_header (oh);
-+	}
-+
-+	return h;
-+}
-+
-+#if HAVE_GDBM
-+
-+void *
-+mutt_hcache_open(const char *path, const char *folder)
-+{
-+	struct header_cache *h = safe_calloc(1, sizeof(HEADER_CACHE));
-+	int pagesize = atoi(HeaderCachePageSize) ? atoi(HeaderCachePageSize) : 16384;
-+	h->db     = NULL;
-+        h->folder = safe_strdup (folder);
-+	h->crc    = generate_crc32();
-+
-+	if (! path || path[0] == '\0') {
-+		FREE(& h->folder);
-+		FREE(& h);
-+		return NULL;
-+	}
-+
-+	path = mutt_hcache_per_folder(path, folder);
-+
-+	h->db = gdbm_open((char *) path, pagesize, GDBM_WRCREAT, 00600, NULL);
-+	if (h->db) {
-+		return h;
-+	}
-+
-+	/* if rw failed try ro */
-+	h->db = gdbm_open((char *) path, pagesize, GDBM_READER, 00600, NULL);
-+	if(h->db) {
-+		return h;
-+	} else {
-+		FREE(& h->folder);
-+		FREE(& h);
-+
-+		return NULL;
-+	}
-+}
-+
-+void
-+mutt_hcache_close(void *db)
-+{
-+	struct header_cache *h = db;
-+
-+	if (! h) {
-+		return;
-+	}
-+
-+	gdbm_close(h->db);
-+	FREE(& h->folder);
-+	FREE(& h);
-+}
-+
-+void *
-+mutt_hcache_fetch(void *db, const char *filename, size_t (*keylen)(const char *fn))
-+{
-+	struct header_cache *h = db;
-+	datum key;
-+	datum data;
-+	char path[_POSIX_PATH_MAX];
-+
-+	if (! h) {
-+		return NULL;
-+	}
-+
-+	strncpy(path, h->folder, sizeof(path));
-+	strncat(path, filename, sizeof(path) - mutt_strlen(path));
-+
-+	key.dptr  = path;
-+	key.dsize = keylen(path);
-+
-+	data = gdbm_fetch(h->db, key);
-+
-+	if (! crc32_matches(data.dptr, h->crc)) {
-+		free(data.dptr);
-+		return NULL;
-+	}
-+
-+	return data.dptr;
-+}
-+
-+int
-+mutt_hcache_store(void *db, const char *filename, HEADER *header, unsigned long long uid_validity, size_t (*keylen)(const char *fn))
-+{
-+	struct header_cache *h = db;
-+	datum key;
-+	datum data;
-+	char path[_POSIX_PATH_MAX];
-+	int ret;
-+
-+	if (! h) {
-+		return -1;
-+	}
-+
-+	strncpy(path, h->folder, sizeof(path));
-+	strncat(path, filename, sizeof(path) - mutt_strlen(path));
-+
-+	key.dptr  = path;
-+	key.dsize = keylen(path);
-+
-+	data.dptr = mutt_hcache_dump(db, header, &data.dsize, uid_validity);
-+
-+	ret = gdbm_store(h->db, key, data, GDBM_REPLACE);
-+
-+	FREE(& data.dptr);
-+
-+	return ret;
-+}
-+
-+int
-+mutt_hcache_delete(void *db, const char *filename, size_t (*keylen)(const char *fn))
-+{
-+	datum key;
-+	struct header_cache *h = db;
-+	char path[_POSIX_PATH_MAX];
-+
-+	if (! h) {
-+		return -1;
-+	}
-+
-+	strncpy(path, h->folder, sizeof(path));
-+	strncat(path, filename, sizeof(path) - mutt_strlen(path));
-+
-+	key.dptr  = path;
-+	key.dsize = keylen(path);
-+
-+	return gdbm_delete(h->db, key);
-+}
-+#elif HAVE_DB4
-+
-+static void
-+mutt_hcache_dbt_init(DBT *dbt, void *data, size_t len)
-+{
-+	dbt->data = data;
-+	dbt->size = dbt->ulen = len;
-+	dbt->dlen = dbt->doff = 0;
-+	dbt->flags = DB_DBT_USERMEM;
-+}
-+
-+static void
-+mutt_hcache_dbt_empty_init(DBT *dbt)
-+{
-+	dbt->data = NULL;
-+	dbt->size = dbt->ulen = dbt->dlen = dbt->doff = 0;
-+	dbt->flags = 0;
-+}
-+
-+void *
-+mutt_hcache_open(const char *path, const char *folder)
-+{
-+	struct stat sb;
-+	u_int32_t createflags = DB_CREATE;
-+	int ret;
-+	struct header_cache *h = calloc(1, sizeof(HEADER_CACHE));
-+	int pagesize = atoi(HeaderCachePageSize);
-+
-+
-+	h->crc = generate_crc32();
-+
-+	if (! path || path[0] == '\0') {
-+		FREE(& h);
-+		return NULL;
-+	}
-+
-+	path = mutt_hcache_per_folder(path, folder);
-+
-+	snprintf (h->lockfile, _POSIX_PATH_MAX, "%s-lock-hack", path);
-+
-+	h->fd = open(h->lockfile, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
-+	if (h->fd < 0) {
-+		FREE (&h);
-+		return NULL;
-+	}
-+
-+	if (mx_lock_file(h->lockfile, h->fd, 1, 0, 5)) {
-+		close(h->fd);
-+		FREE (&h);
-+		return NULL;
-+	}
-+
-+	ret = db_env_create(&h->env, 0);
-+	if (ret) {
-+		mx_unlock_file(h->lockfile, h->fd, 0);
-+		close(h->fd);
-+		FREE(& h);
-+		return NULL;
-+	}
-+
-+	ret = h->env->open(h->env, NULL, DB_INIT_MPOOL | DB_CREATE | DB_PRIVATE, 0600);
-+	if (! ret) {
-+		ret = db_create(&h->db, h->env, 0);
-+		if (ret) {
-+			h->env->close(h->env, 0);
-+			mx_unlock_file(h->lockfile, h->fd, 0);
-+			close(h->fd);
-+			FREE(& h);
-+			return NULL;
-+		}
-+	}
-+
-+	if (stat(path, &sb) != 0 && errno == ENOENT) {
-+		createflags |= DB_EXCL;
-+		h->db->set_pagesize(h->db, pagesize);
-+	}
-+
-+	ret = h->db->open(h->db, NULL, path, folder, DB_BTREE, createflags, 0600);
-+	if (ret) {
-+		h->db->close(h->db, 0);
-+		h->env->close(h->env, 0);
-+		mx_unlock_file(h->lockfile, h->fd, 0);
-+		close(h->fd);
-+		FREE(& h);
-+		return NULL;
-+	}
-+
-+	return h;
-+}
-+
-+void
-+mutt_hcache_close(void *db)
-+{
-+	struct header_cache *h = db;
-+	int ret;
-+
-+	if (! h) {
-+		return;
-+	}
-+
-+	h->db->close(h->db, 0);
-+	h->env->close(h->env, 0);
-+	mx_unlock_file(h->lockfile, h->fd, 0);
-+	close(h->fd);
-+	FREE(& h);
-+}
-+
-+void *
-+mutt_hcache_fetch(void *db, const char *filename, size_t (*keylen)(const char *fn))
-+{
-+	DBT key;
-+	DBT data;
-+	struct header_cache *h = db;
-+
-+	if (! h) {
-+		return NULL;
-+	}
-+
-+	filename++; /* skip '/' */
-+
-+	mutt_hcache_dbt_init(&key, (void *) filename, keylen(filename));
-+	mutt_hcache_dbt_empty_init(&data);
-+	data.flags = DB_DBT_MALLOC;
-+
-+	h->db->get(h->db, NULL, &key, &data, 0);
-+
-+	if (! crc32_matches(data.data, h->crc)) {
-+		free(data.data);
-+		return NULL;
-+	}
-+
-+	return data.data;
-+}
-+
-+int
-+mutt_hcache_store(void *db, const char *filename, HEADER *header, unsigned long long uid_validity, size_t (*keylen)(const char *fn))
-+{
-+	DBT key;
-+	DBT data;
-+	int ret;
-+	struct header_cache *h = db;
-+
-+	if (! h) {
-+		return -1;
-+	}
-+
-+	filename++; /* skip '/' */
-+
-+	mutt_hcache_dbt_init(&key, (void *) filename, keylen(filename));
-+
-+	mutt_hcache_dbt_empty_init(&data);
-+	data.flags = DB_DBT_USERMEM;
-+	data.data = mutt_hcache_dump(db, header, (signed int *) &data.size, uid_validity);
-+	data.ulen = data.size;
-+
-+	ret = h->db->put(h->db, NULL, &key, &data, 0);
-+
-+	FREE(& data.data);
-+
-+	return ret;
-+}
-+
-+int
-+mutt_hcache_delete(void *db, const char *filename, size_t (*keylen)(const char *fn))
-+{
-+	DBT key;
-+	struct header_cache *h = db;
-+
-+	if (! h) {
-+		return -1;
-+	}
-+
-+	filename++; /* skip '/' */
-+
-+	mutt_hcache_dbt_init(&key, (void *) filename, keylen(filename));
-+	return h->db->del(h->db, NULL, &key, 0);
-+}
-+#endif
-diff -Nru a/imap/imap.c b/imap/imap.c
---- a/imap/imap.c	2004-08-18 09:43:27 +02:00
-+++ b/imap/imap.c	2004-08-17 00:34:10 +02:00
-@@ -602,6 +602,17 @@
-       if ((pc = imap_get_flags (&(idata->flags), pc)) == NULL)
- 	goto fail;
-     }
-+#ifdef USE_HCACHE
-+    /* save UIDVALIDITY for the header cache */
-+    else if (ascii_strncasecmp("OK [UIDVALIDITY", pc, 14) == 0)
-+    {
-+	    dprint(2, (debugfile, "Getting mailbox UIDVALIDITY\n"));
-+	    pc += 3;
-+	    pc = imap_next_word(pc);
-+
-+	    sscanf(pc, "%u", &(idata->uid_validity));
-+    }
-+#endif
-     else
-     {
-       pc = imap_next_word (pc);
-diff -Nru a/imap/imap_private.h b/imap/imap_private.h
---- a/imap/imap_private.h	2004-08-18 09:43:27 +02:00
-+++ b/imap/imap_private.h	2004-07-24 12:39:31 +02:00
-@@ -179,6 +179,9 @@
-   unsigned int newMailCount;
-   IMAP_CACHE cache[IMAP_CACHE_LEN];
-   int noclose : 1;
-+#ifdef USE_HCACHE
-+  unsigned long long uid_validity;
-+#endif
-   
-   /* all folder flags - system flags AND keywords */
-   LIST *flags;
-diff -Nru a/imap/message.c b/imap/message.c
---- a/imap/message.c	2004-08-18 09:43:27 +02:00
-+++ b/imap/message.c	2004-08-06 02:09:41 +02:00
-@@ -39,6 +39,12 @@
- static int msg_parse_fetch (IMAP_HEADER* h, char* s);
- static char* msg_parse_flags (IMAP_HEADER* h, char* s);
- 
-+#if USE_HCACHE
-+static int msg_fetch_header_fetch (CONTEXT* ctx, IMAP_HEADER* h, char* buf,
-+  FILE* fp);
-+static size_t imap_hcache_keylen (const char *fn);
-+#endif /* USE_HCACHE */
-+
- /* imap_read_headers:
-  * Changed to read many headers instead of just one. It will return the
-  * msgno of the last message read. It will return a value other than
-@@ -57,8 +63,18 @@
-   int fetchlast = 0;
-   const char *want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE IN-REPLY-TO REPLY-TO LINES X-LABEL";
- 
-+#if USE_HCACHE
-+  void *hc   = NULL;
-+  unsigned long long *uid_validity = NULL;
-+  char uid_buf[64];
-+#endif /* USE_HCACHE */
-+
-   ctx = idata->ctx;
- 
-+#if USE_HCACHE
-+  hc = mutt_hcache_open (HeaderCache, ctx->path);
-+#endif /* USE_HCACHE */
-+
-   if (mutt_bit_isset (idata->capabilities,IMAP4REV1))
-   {
-     snprintf (hdrreq, sizeof (hdrreq), "BODY.PEEK[HEADER.FIELDS (%s)]", 
-@@ -73,6 +89,9 @@
-   {	/* Unable to fetch headers for lower versions */
-     mutt_error _("Unable to fetch headers from this IMAP server version.");
-     mutt_sleep (2);	/* pause a moment to let the user see the error */
-+#if USE_HCACHE
-+    mutt_hcache_close (hc);
-+#endif /* USE_HCACHE */
-     return -1;
-   }
- 
-@@ -83,6 +102,9 @@
-   {
-     mutt_error (_("Could not create temporary file %s"), tempfile);
-     mutt_sleep (2);
-+#if USE_HCACHE
-+    mutt_hcache_close (hc);
-+#endif /* USE_HCACHE */
-     return -1;
-   }
-   unlink (tempfile);
-@@ -95,14 +117,88 @@
-   idata->reopen &= ~IMAP_NEWMAIL_PENDING;
-   idata->newMailCount = 0;
- 
-+#if USE_HCACHE
-+  snprintf (buf, sizeof (buf),
-+    "FETCH %d:%d (UID FLAGS)", msgbegin + 1, msgend + 1);
-+  fetchlast = msgend + 1;
-+
-+  imap_cmd_start (idata, buf);
-+
-+  for (msgno = msgbegin; msgno <= msgend ; msgno++)
-+  {
-+    if (ReadInc && (!msgno || ((msgno+1) % ReadInc == 0)))
-+      mutt_message (_("Evaluating cache... [%d/%d]"), msgno + 1,
-+        msgend + 1);
-+
-+    rewind (fp);
-+    memset (&h, 0, sizeof (h));
-+    h.data = safe_calloc (1, sizeof (IMAP_HEADER_DATA));
-+    do
-+    {
-+      mfhrc = 0;
-+
-+      rc = imap_cmd_step (idata);
-+      if (rc != IMAP_CMD_CONTINUE)
-+	break;
-+
-+      if ((mfhrc = msg_fetch_header_fetch (idata->ctx, &h, idata->cmd.buf, fp)) == -1)
-+	continue;
-+      else if (mfhrc < 0)
-+	break;
-+
-+      /* make sure we don't get remnants from older larger message headers */
-+      fputs ("\n\n", fp);
-+
-+      sprintf(uid_buf, "/%u", h.data->uid); /* XXX --tg 21:41 04-07-11 */
-+      uid_validity = (unsigned long long *) mutt_hcache_fetch (hc, uid_buf, &imap_hcache_keylen);
-+
-+      if (uid_validity != NULL
-+      && *uid_validity == idata->uid_validity) {
-+	      ctx->hdrs[msgno] = mutt_hcache_restore((unsigned char *) uid_validity, 0);
-+	      ctx->hdrs[msgno]->index = h.sid - 1;
-+	      if (h.sid != ctx->msgcount + 1)
-+		      dprint (1, (debugfile, "imap_read_headers: msgcount and sequence ID are inconsistent!"));
-+	      /* messages which have not been expunged are ACTIVE (borrowed from mh 
-+	       * folders) */
-+	      ctx->hdrs[msgno]->active = 1;
-+	      ctx->hdrs[msgno]->read = h.read;
-+	      ctx->hdrs[msgno]->old = h.old;
-+	      ctx->hdrs[msgno]->deleted = h.deleted;
-+	      ctx->hdrs[msgno]->flagged = h.flagged;
-+	      ctx->hdrs[msgno]->replied = h.replied;
-+	      ctx->hdrs[msgno]->changed = h.changed;
-+	      /*  ctx->hdrs[msgno]->received is restored from mutt_hcache_restore */
-+	      ctx->hdrs[msgno]->data = (void *) (h.data);
-+
-+	      ctx->msgcount++;
-+      }
-+      rewind (fp);
-+
-+      FREE(&uid_validity);
-+
-+    }
-+    while ((rc != IMAP_CMD_OK) && ((mfhrc == -1) ||
-+      ((msgno + 1) >= fetchlast)));
-+  }
-+
-+  fetchlast = msgbegin;
-+#endif /* USE_HCACHE */
-+
-   for (msgno = msgbegin; msgno <= msgend ; msgno++)
-   {
-     if (ReadInc && (!msgno || ((msgno+1) % ReadInc == 0)))
-       mutt_message (_("Fetching message headers... [%d/%d]"), msgno + 1,
-         msgend + 1);
+--- a/hcache.c	2005-02-03 21:24:02 +01:00
++++ b/hcache.c	2005-02-03 21:49:22 +01:00
+@@ -662,7 +662,7 @@
+         safe_strcat (path, sizeof (path), filename);
  
-+    if (ctx->hdrs[msgno])
-+      continue;
-+
-     if (msgno + 1 > fetchlast)
-     {
-+      fetchlast = msgno + 1;
-+      while((fetchlast <= msgend) && (! ctx->hdrs[fetchlast]))
-+        fetchlast++;
-+
-       /*
-        * Make one request for everything. This makes fetching headers an
-        * order of magnitude faster if you have a large mailbox.
-@@ -112,11 +208,9 @@
-        */
-       snprintf (buf, sizeof (buf),
-         "FETCH %d:%d (UID FLAGS INTERNALDATE RFC822.SIZE %s)", msgno + 1,
--        msgend + 1, hdrreq);
-+        fetchlast, hdrreq);
+ 	key.dptr  = path;
+-	key.dsize = keylen(path);
++	key.dsize = strlen(h->folder) + keylen(path + strlen(h->folder));
  
-       imap_cmd_start (idata, buf);
--
--      fetchlast = msgend + 1;
-     }
+ 	data = gdbm_fetch(h->db, key);
  
-     /* freshen fp, h */
-@@ -170,6 +264,11 @@
-       /* content built as a side-effect of mutt_read_rfc822_header */
-       ctx->hdrs[msgno]->content->length = h.content_length;
+@@ -691,7 +691,7 @@
+         safe_strcat (path, sizeof (path), filename);
  
-+#if USE_HCACHE
-+      sprintf(uid_buf, "/%u", h.data->uid);
-+      mutt_hcache_store(hc, uid_buf, ctx->hdrs[msgno], idata->uid_validity, &imap_hcache_keylen);
-+#endif /* USE_HCACHE */
-+
-       ctx->msgcount++;
-     }
-     while ((rc != IMAP_CMD_OK) && ((mfhrc == -1) ||
-@@ -179,7 +278,9 @@
-     {
-       imap_free_header_data ((void**) &h.data);
-       fclose (fp);
--
-+#if USE_HCACHE
-+  mutt_hcache_close (hc);
-+#endif /* USE_HCACHE */
-       return -1;
-     }
- 	
-@@ -194,6 +295,10 @@
-     }
-   }
+ 	key.dptr  = path;
+-	key.dsize = keylen(path);
++        key.dsize = strlen(h->folder) + keylen(path + strlen(h->folder));
  
-+#if USE_HCACHE
-+  mutt_hcache_close (hc);
-+#endif /* USE_HCACHE */
-+
-   fclose(fp);
+ 	data.dptr = mutt_hcache_dump(db, header, &data.dsize, uid_validity);
  
-   if (ctx->msgcount > oldmsgcount)
-@@ -724,6 +829,7 @@
-   return s;
- }
+@@ -717,7 +717,7 @@
+         safe_strcat (path, sizeof (path), filename);
  
-+
- /* msg_fetch_header: import IMAP FETCH response into an IMAP_HEADER.
-  *   Expects string beginning with * n FETCH.
-  *   Returns:
-@@ -782,6 +888,56 @@
+ 	key.dptr  = path;
+-	key.dsize = keylen(path);
++        key.dsize = strlen(h->folder) + keylen(path + strlen(h->folder));
  
-   return rc;
+ 	return gdbm_delete(h->db, key);
  }
-+
-+#if USE_HCACHE
-+static size_t imap_hcache_keylen (const char *fn)
-+{
-+  return mutt_strlen(fn);
-+}
-+
-+/* msg_fetch_header: import IMAP FETCH response into an IMAP_HEADER.
-+ *   Expects string beginning with * n FETCH.
-+ *   Returns:
-+ *      0 on success
-+ *     -1 if the string is not a fetch response
-+ *     -2 if the string is a corrupt fetch response */
-+static int msg_fetch_header_fetch (CONTEXT* ctx, IMAP_HEADER* h, char* buf, FILE* fp)
-+{
-+  IMAP_DATA* idata;
-+  long bytes;
-+  int rc = -1; /* default now is that string isn't FETCH response*/
-+
-+  idata = (IMAP_DATA*) ctx->data;
-+
-+  if (buf[0] != '*')
-+    return rc;
-+
-+  /* skip to message number */
-+  buf = imap_next_word (buf);
-+  h->sid = atoi (buf);
-+
-+  /* find FETCH tag */
-+  buf = imap_next_word (buf);
-+  if (ascii_strncasecmp ("FETCH", buf, 5))
-+    return rc;
-+
-+  rc = -2; /* we've got a FETCH response, for better or worse */
-+  if (!(buf = strchr (buf, '(')))
-+    return rc;
-+  buf++;
-+
-+  if (msg_parse_fetch (h, buf) < 0) {
-+         return -2;
-+  }
-+
-+  if (!(buf = strchr (buf, ')')))
-+    return rc;
-+  buf++;
-+
-+  return 0;
-+}
-+#endif /* USE_HCACHE */
-+
- 
- /* msg_has_flag: do a caseless comparison of the flag against a flag list,
-  *   return 1 if found or flag list has '\*', 0 otherwise */
 diff -Nru a/init.h b/init.h
---- a/init.h	2004-08-18 09:43:12 +02:00
-+++ b/init.h	2004-09-20 22:58:42 +02:00
-@@ -981,6 +981,34 @@
-   ** \fBDON'T CHANGE THIS SETTING UNLESS YOU ARE REALLY SURE WHAT YOU ARE
-   ** DOING!\fP
+--- a/init.h	2005-01-27 19:54:12 +01:00
++++ b/init.h	2005-02-03 21:33:16 +01:00
+@@ -1032,6 +1032,13 @@
+   ** global header cache for all folders is used. Per default it is unset and so
+   ** no header caching will be used.
    */
-+#if USE_HCACHE
-+
-+  { "header_cache", DT_PATH, R_NONE, UL &HeaderCache, 0 },
-+  /*
-+  ** .pp
-+  ** The header_cache variable points to the header cache database. If
-+  ** header_cache points to a directory there will be created one header cache
-+  ** database per folder within this directory. If it doesn't point to a directory a
-+  ** global header cache for all folders is used. Per default it is unset and so
-+  ** no header caching will be used.
-+  */
 +  { "maildir_header_cache_verify", DT_BOOL, R_NONE, OPTHCACHEVERIFY, 1 },
 +  /*
 +  ** .pp
@@ -1328,51 +47,28 @@
 +  ** files when the header cache is in use.  This incurs one stat(2) per
 +  ** message every time the folder is opened.
 +  */
-+  { "header_cache_pagesize", DT_STR, R_NONE, UL &HeaderCachePageSize, UL "16384" },
-+  /*
-+  ** .pp
-+  ** Change the maildir header cache database page size.  Too large
-+  ** or too small of a page size for the common header can waste
-+  ** space, memory effectiveness, or CPU time. The default should be more or
-+  ** less the best you can get. For details google after mutt maildir header
-+  ** cache (first hit).
-+  */
-+#endif /* USE_HCACHE */
-   { "maildir_trash", DT_BOOL, R_NONE, OPTMAILDIRTRASH, 0 },
+   { "header_cache_pagesize", DT_STR, R_NONE, UL &HeaderCachePageSize, UL "16384" },
    /*
    ** .pp
-diff -Nru a/main.c b/main.c
---- a/main.c	2004-08-18 09:43:12 +02:00
-+++ b/main.c	2004-07-24 12:39:30 +02:00
-@@ -411,6 +411,12 @@
- 	"-HAVE_GETADDRINFO  "
- #endif
- 
-+#if USE_HCACHE
-+	"+USE_HCACHE  "
-+#else
-+	"-USE_HCACHE  "
-+#endif
-+
- 	);
- 
- #ifdef ISPELL
 diff -Nru a/mh.c b/mh.c
---- a/mh.c	2004-08-18 09:43:13 +02:00
-+++ b/mh.c	2004-09-03 14:33:12 +02:00
-@@ -779,30 +779,79 @@
+--- a/mh.c	2005-01-27 19:48:04 +01:00
++++ b/mh.c	2005-02-03 21:35:59 +01:00
+@@ -787,6 +787,14 @@
    return r;
  }
  
 +#if USE_HCACHE
 +static size_t maildir_hcache_keylen (const char *fn)
 +{
-+  const char * p = strchr (fn, ':');
++  const char * p = strrchr (fn, ':');
 +  return p ? (size_t) (p - fn) : mutt_strlen(fn);
 +}
 +#endif
- 
- /* 
++
+ #ifdef USE_INODESORT
+ /*
+  * Merge two maildir lists according to the inode numbers.
+@@ -882,27 +890,67 @@
   * This function does the second parsing pass for a maildir-style
   * folder.
   */
@@ -1381,21 +77,11 @@
  {
    struct maildir *p;
    char fn[_POSIX_PATH_MAX];
-+  int count;
+   int count;
  
--  for (p = md; p; p = p->next)
--    if (p && p->h && !p->header_parsed)
--    {
--      snprintf (fn, sizeof (fn), "%s/%s", ctx->path, p->h->path);
--      if (maildir_parse_message (ctx->magic, fn, p->h->old, p->h))
--	p->header_parsed = 1;
--      else
--	mutt_free_header (&p->h);
--    }
 +#if USE_HCACHE
 +  void *hc = NULL;
 +  void *data;
-+  unsigned int size;
 +  struct timeval *when = NULL;
 +  struct stat lastchanged;
 +  int ret;
@@ -1403,26 +89,40 @@
 +  hc = mutt_hcache_open (HeaderCache, ctx->path);
 +#endif
 +
-+  for (p = md, count = 0; p; p = p->next, count++)
+   for (p = md, count = 0; p; p = p->next, count++)
+-    if (p && p->h && !p->header_parsed)
+-    {
+-      if (!ctx->quiet && ReadInc && ((count % ReadInc) == 0 || count == 1))
+-	mutt_message (_("Reading %s... %d"), ctx->path, count);
+-      snprintf (fn, sizeof (fn), "%s/%s", ctx->path, p->h->path);
+-      if (maildir_parse_message (ctx->magic, fn, p->h->old, p->h))
+-	p->header_parsed = 1;
+-      else
+-	mutt_free_header (&p->h);
+-    }
+-}
 +  {
 +    if (! (p && p->h && !p->header_parsed))
-+    	continue;
-+
++      continue;
+ 
++    if (!ctx->quiet && ReadInc && ((count % ReadInc) == 0 || count == 1))
++      mutt_message (_("Reading %s... %d"), ctx->path, count);
+ 
 +#if USE_HCACHE
-+    data      = mutt_hcache_fetch (hc, p->h->path + 3, &maildir_hcache_keylen);
-+    when      = (struct timeval *) data;
++    data = mutt_hcache_fetch (hc, p->h->path + 3, &maildir_hcache_keylen);
++    when = (struct timeval *) data;
 +#endif
 +
 +    snprintf (fn, sizeof (fn), "%s/%s", ctx->path, p->h->path);
 +
 +#if USE_HCACHE
-+    if (option(OPTHCACHEVERIFY)) {
++    if (option(OPTHCACHEVERIFY))
 +      ret = stat(fn, &lastchanged);
-+    } else {
++    else {
 +      lastchanged.st_mtime = 0;
 +      ret = 0;
 +    }
-+
++    
 +    if (data != NULL && !ret && lastchanged.st_mtime <= when->tv_sec)
 +    {
 +      p->h = mutt_hcache_restore ((unsigned char *)data, &p->h);
@@ -1432,7 +132,6 @@
 +    if (maildir_parse_message (ctx->magic, fn, p->h->old, p->h))
 +    {
 +      p->header_parsed = 1;
-+      maildir_parse_flags (p->h, fn);
 +#if USE_HCACHE
 +      mutt_hcache_store (hc, p->h->path + 3, p->h, 0, &maildir_hcache_keylen);
 +#endif
@@ -1445,14 +144,11 @@
 +#if USE_HCACHE
 +  mutt_hcache_close (hc);
 +#endif
- }
++}
  
--
--
  /* Read a MH/maildir style mailbox.
   *
-  * args:
-@@ -1293,6 +1342,9 @@
+@@ -1399,6 +1447,9 @@
  {
    char path[_POSIX_PATH_MAX], tmp[_POSIX_PATH_MAX];
    int i, j;
@@ -1462,7 +158,7 @@
  
    if (ctx->magic == M_MH)
      i = mh_check_mailbox (ctx, index_hint);
-@@ -1302,6 +1354,11 @@
+@@ -1408,6 +1459,11 @@
    if (i != 0)
      return i;
  
@@ -1474,7 +170,7 @@
    for (i = 0; i < ctx->msgcount; i++)
    {
      if (ctx->hdrs[i]->deleted
-@@ -1310,7 +1367,13 @@
+@@ -1416,7 +1472,13 @@
        snprintf (path, sizeof (path), "%s/%s", ctx->path, ctx->hdrs[i]->path);
        if (ctx->magic == M_MAILDIR
  	  || (option (OPTMHPURGE) && ctx->magic == M_MH))
@@ -1488,7 +184,7 @@
        else if (ctx->magic == M_MH)
        {
  	/* MH just moves files out of the way when you delete them */
-@@ -1332,16 +1395,21 @@
+@@ -1438,16 +1500,21 @@
        if (ctx->magic == M_MAILDIR)
        {
  	if (maildir_sync_message (ctx, i) == -1)
@@ -1512,7 +208,7 @@
    if (ctx->magic == M_MH)
      mh_update_sequences (ctx);
  
-@@ -1362,6 +1430,13 @@
+@@ -1468,6 +1535,13 @@
    }
  
    return 0;
@@ -1527,9 +223,9 @@
  
  static char *maildir_canon_filename (char *dest, const char *src, size_t l)
 diff -Nru a/mutt.h b/mutt.h
---- a/mutt.h	2004-08-18 09:43:13 +02:00
-+++ b/mutt.h	2004-07-24 12:39:30 +02:00
-@@ -345,6 +345,9 @@
+--- a/mutt.h	2005-01-27 19:53:51 +01:00
++++ b/mutt.h	2005-02-03 21:32:14 +01:00
+@@ -353,6 +353,9 @@
    OPTFORCENAME,
    OPTFORWDECODE,
    OPTFORWQUOTE,
@@ -1539,23 +235,3 @@
    OPTHDRS,
    OPTHEADER,
    OPTHELP,
-diff -Nru a/protos.h b/protos.h
---- a/protos.h	2004-08-18 09:43:16 +02:00
-+++ b/protos.h	2004-08-09 08:05:48 +02:00
-@@ -99,6 +99,16 @@
- ENVELOPE *mutt_read_rfc822_header (FILE *, HEADER *, short, short);
- HEADER *mutt_dup_header (HEADER *);
- 
-+#if USE_HCACHE
-+void *mutt_hcache_open(const char *path, const char *folder);
-+void mutt_hcache_close(void *db);
-+HEADER *mutt_hcache_restore(const unsigned char *d, HEADER **oh);
-+void *mutt_hcache_fetch(void *db, const char *filename, size_t (*keylen)(const char *fn));
-+int mutt_hcache_store(void *db, const char *filename, HEADER *h, unsigned long long uid_validity, size_t (*keylen)(const char *fn));
-+int mutt_hcache_delete(void *db, const char *filename, size_t (*keylen)(const char *fn));
-+#endif /* USE_HCACHE */
-+
-+
- ATTACHPTR **mutt_gen_attach_list (BODY *, int, ATTACHPTR **, short *, short *, int, int);
- 
- time_t mutt_decrease_mtime (const char *, struct stat *);
diff -ru  /usr/ports/mail/mutt-devel/files/extra-patch-maildir-mtime ./files/extra-patch-maildir-mtime
--- /usr/ports/mail/mutt-devel/files/extra-patch-maildir-mtime	Tue Aug  3 06:51:13 2004
+++ ./files/extra-patch-maildir-mtime	Sat Feb  5 14:00:13 2005
@@ -1,7 +1,7 @@
 --- PATCHES Dec 2002 17:44:54 -0000	3.6
 +++ PATCHES Feb 2004 13:19:42 -0000
 @@ -0,0 +1 @@
-+patch-1.5.6.dw.maildir-mtime.1
++patch-1.5.7.ust.maildir-mtime.1
 --- browser.c Sep 2003 13:03:25 -0000	3.9
 +++ browser.c Feb 2004 13:19:42 -0000
 @@ -29,2 +29,3 @@
@@ -42,21 +42,49 @@
 -    add_folder (menu, state, buffer, &s, tmp->new);
 +    add_folder (menu, state, buffer, &s, tmp);
    }
---- buffy.c Feb 2004 17:50:43 -0000	3.9
-+++ buffy.c Feb 2004 13:19:42 -0000
-@@ -229,2 +229,3 @@ int mutt_parse_mailboxes (BUFFER *path, 
+--- buffy.c.orig	Sat Oct 30 23:40:07 2004
++++ buffy.c	Sat Feb  5 13:57:07 2005
+@@ -227,6 +227,7 @@
+     (*tmp)->new = 0;
+     (*tmp)->notified = 1;
      (*tmp)->newly_created = 0;
 +    (*tmp)->mtime = 0;
  
-@@ -260,2 +261,3 @@ int mutt_buffy_check (int force)
+ #ifdef BUFFY_SIZE
+     /* for buffy_size, it is important that if the folder is new (tested by
+@@ -258,6 +259,7 @@
+ {
+   BUFFY *tmp;
    struct stat sb;
 +  struct stat smd;
    struct dirent *de;
-@@ -299,2 +301,3 @@ int mutt_buffy_check (int force)
+   DIR *dirp;
+   char path[_POSIX_PATH_MAX];
+@@ -297,6 +299,7 @@
+   for (tmp = Incoming; tmp; tmp = tmp->next)
+   {
      tmp->new = 0;
 +    tmp->mtime = 0;
  
-@@ -383,6 +386,13 @@ int mutt_buffy_check (int force)
+ #ifdef USE_IMAP
+     if (mx_is_imap (tmp->path))
+@@ -370,21 +373,31 @@
+       case M_MAILDIR:
+ 
+ 	snprintf (path, sizeof (path), "%s/new", tmp->path);
++        stat (path, &smd);
++	tmp->mtime = smd.st_mtime;
+ 	if ((dirp = opendir (path)) == NULL)
+ 	{
+ 	  tmp->magic = 0;
+ 	  break;
+ 	}
++
+ 	while ((de = readdir (dirp)) != NULL)
+ 	{
+ 	  char *p;
+ 	  if (*de->d_name != '.' && 
+ 	      (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')))
  	  {
 -	    /* one new and undeleted message is enough */
 -	    BuffyCount++;
@@ -74,6 +102,21 @@
 +	      tmp->mtime = smd.st_mtime;
 +	    }
  	  }
+ 	}
+ 	closedir (dirp);
+@@ -414,6 +427,12 @@
+ #ifdef BUFFY_SIZE
+     else if (Context && Context->path)
+       tmp->size = (long) sb.st_size;	/* update the size */
++#else
++    else if(tmp->magic == M_MAILDIR) {
++	snprintf (path, sizeof (path), "%s/new", tmp->path);
++        stat (path, &smd);
++	tmp->mtime = smd.st_mtime;
++    }
+ #endif
+ 
+     if (!tmp->new)
 --- buffy.h Dec 2002 11:19:39 -0000	3.2
 +++ buffy.h Feb 2004 13:19:42 -0000
 @@ -29,2 +29,3 @@ typedef struct buffy_t
diff -ru  /usr/ports/mail/mutt-devel/files/extra-patch-maildir-mtime-nntp ./files/extra-patch-maildir-mtime-nntp
--- /usr/ports/mail/mutt-devel/files/extra-patch-maildir-mtime-nntp	Tue Aug  3 06:51:13 2004
+++ ./files/extra-patch-maildir-mtime-nntp	Sat Feb  5 23:49:29 2005
@@ -1,9 +1,9 @@
 --- PATCHES Dec 2002 17:44:54 -0000	3.6
 +++ PATCHES Feb 2004 13:19:42 -0000
 @@ -0,0 +1 @@
-+patch-1.5.6.dw.maildir-mtime.1
---- browser.c.orig	Mon Aug  2 18:54:46 2004
-+++ browser.c	Mon Aug  2 19:00:01 2004
++patch-1.5.7.ust.maildir-mtime.1
+--- browser.c.orig	Sat Feb  5 23:45:00 2005
++++ browser.c	Sat Feb  5 23:47:50 2005
 @@ -30,6 +30,7 @@
  #ifdef USE_NNTP
  #include "nntp.h"
@@ -58,44 +58,44 @@
      {
        if ((data = (NNTP_DATA *) tmp->data) != NULL && (data->new ||
  	  (data->subscribed && (!option (OPTSHOWONLYUNREAD) || data->unread))))
--      add_folder (menu, state, data->group, NULL, data, data->new);
-+      add_folder (menu, state, data->group, NULL, data, tmp);
+-        add_folder (menu, state, data->group, NULL, data, data->new);
++        add_folder (menu, state, data->group, NULL, data, tmp);
      }
    }
    else
 @@ -608,21 +614,21 @@
  #ifdef USE_IMAP
-       if (mx_is_imap (tmp->path))
-       {
--	add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
-+	add_folder (menu, state, tmp->path, NULL, NULL, tmp);
- 	continue;
-       }
+     if (mx_is_imap (tmp->path))
+     {
+-      add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
++      add_folder (menu, state, tmp->path, NULL, NULL, tmp);
+       continue;
+     }
  #endif
  #ifdef USE_POP
-       if (mx_is_pop (tmp->path))
-       {
--	add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
-+	add_folder (menu, state, tmp->path, NULL, NULL, tmp);
- 	continue;
-       }
+     if (mx_is_pop (tmp->path))
+     {
+-      add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
++      add_folder (menu, state, tmp->path, NULL, NULL, tmp);
+       continue;
+     }
  #endif
  #ifdef USE_NNTP
-       if (mx_is_nntp (tmp->path))
-       {
--	add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
-+	add_folder (menu, state, tmp->path, NULL, NULL, tmp);
- 	continue;
-       }
+     if (mx_is_nntp (tmp->path))
+     {
+-      add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
++      add_folder (menu, state, tmp->path, NULL, NULL, tmp);
+       continue;
+     }
  #endif
 @@ -636,7 +642,7 @@
-       strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
-       mutt_pretty_mailbox (buffer);
+     strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
+     mutt_pretty_mailbox (buffer);
  
--      add_folder (menu, state, buffer, &s, NULL, tmp->new);
-+      add_folder (menu, state, buffer, &s, NULL, tmp);
-     }
-     while ((tmp = tmp->next));
+-    add_folder (menu, state, buffer, &s, NULL, tmp->new);
++    add_folder (menu, state, buffer, &s, NULL, tmp);
+   }
+   while ((tmp = tmp->next));
    }
 @@ -1555,7 +1561,7 @@
  		if (regexec (rx, nd->group, 0, NULL, 0) == 0)
@@ -106,21 +106,49 @@
  		}
  	      }
  	    }
---- buffy.c Feb 2004 17:50:43 -0000	3.9
-+++ buffy.c Feb 2004 13:19:42 -0000
-@@ -229,2 +229,3 @@ int mutt_parse_mailboxes (BUFFER *path, 
+--- buffy.c.orig	Sat Oct 30 23:40:07 2004
++++ buffy.c	Sat Feb  5 13:57:07 2005
+@@ -227,6 +227,7 @@
+     (*tmp)->new = 0;
+     (*tmp)->notified = 1;
      (*tmp)->newly_created = 0;
 +    (*tmp)->mtime = 0;
  
-@@ -260,2 +261,3 @@ int mutt_buffy_check (int force)
+ #ifdef BUFFY_SIZE
+     /* for buffy_size, it is important that if the folder is new (tested by
+@@ -258,6 +259,7 @@
+ {
+   BUFFY *tmp;
    struct stat sb;
 +  struct stat smd;
    struct dirent *de;
-@@ -299,2 +301,3 @@ int mutt_buffy_check (int force)
+   DIR *dirp;
+   char path[_POSIX_PATH_MAX];
+@@ -297,6 +299,7 @@
+   for (tmp = Incoming; tmp; tmp = tmp->next)
+   {
      tmp->new = 0;
 +    tmp->mtime = 0;
  
-@@ -383,6 +386,13 @@ int mutt_buffy_check (int force)
+ #ifdef USE_IMAP
+     if (mx_is_imap (tmp->path))
+@@ -370,21 +373,31 @@
+       case M_MAILDIR:
+ 
+ 	snprintf (path, sizeof (path), "%s/new", tmp->path);
++        stat (path, &smd);
++	tmp->mtime = smd.st_mtime;
+ 	if ((dirp = opendir (path)) == NULL)
+ 	{
+ 	  tmp->magic = 0;
+ 	  break;
+ 	}
++
+ 	while ((de = readdir (dirp)) != NULL)
+ 	{
+ 	  char *p;
+ 	  if (*de->d_name != '.' && 
+ 	      (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')))
  	  {
 -	    /* one new and undeleted message is enough */
 -	    BuffyCount++;
@@ -138,6 +166,21 @@
 +	      tmp->mtime = smd.st_mtime;
 +	    }
  	  }
+ 	}
+ 	closedir (dirp);
+@@ -414,6 +427,12 @@
+ #ifdef BUFFY_SIZE
+     else if (Context && Context->path)
+       tmp->size = (long) sb.st_size;	/* update the size */
++#else
++    else if(tmp->magic == M_MAILDIR) {
++	snprintf (path, sizeof (path), "%s/new", tmp->path);
++        stat (path, &smd);
++	tmp->mtime = smd.st_mtime;
++    }
+ #endif
+ 
+     if (!tmp->new)
 --- buffy.h Dec 2002 11:19:39 -0000	3.2
 +++ buffy.h Feb 2004 13:19:42 -0000
 @@ -29,2 +29,3 @@ typedef struct buffy_t
diff -ru  /usr/ports/mail/mutt-devel/files/extra-patch-nntp.c ./files/extra-patch-nntp.c
--- /usr/ports/mail/mutt-devel/files/extra-patch-nntp.c	Tue Aug  3 06:51:13 2004
+++ ./files/extra-patch-nntp.c	Thu Jan  1 01:00:00 1970
@@ -1,31 +0,0 @@
---- nntp.c.orig	Mon Aug  2 15:11:21 2004
-+++ nntp.c	Mon Aug  2 15:12:31 2004
-@@ -1064,13 +1064,12 @@
- {
-   char buf[LONG_STRING];
-   CONNECTION* conn;
--  CONNECTION* tmp;
- 
-   conn = mutt_socket_head ();
- 
-   while (conn)
-   {
--    tmp = conn;
-+    CONNECTION *next = conn->next;
- 
-     if (conn->account.type == M_ACCT_TYPE_NNTP)
-     {
-@@ -1079,11 +1078,10 @@
-       mutt_socket_readln (buf, sizeof (buf), conn);
-       mutt_clear_error ();
-       mutt_socket_close (conn);
--
--      mutt_socket_free (tmp);
-+      mutt_socket_free (conn);
-     }
- 
--    conn = conn->next;
-+    conn = next;
-   }
- }
- 
diff -ru  /usr/ports/mail/mutt-devel/files/extra-patch-nodoc-contrib ./files/extra-patch-nodoc-contrib
--- /usr/ports/mail/mutt-devel/files/extra-patch-nodoc-contrib	Sat Oct  5 21:03:32 2002
+++ ./files/extra-patch-nodoc-contrib	Fri Feb  4 13:52:12 2005
@@ -9,12 +9,12 @@
  
  if NEEDS_PGPEWRAP
  bin_SCRIPTS = pgpewrap muttbug flea
---- doc/Makefile.in.orig2	Wed Oct  2 17:38:36 2002
-+++ doc/Makefile.in	Wed Oct  2 17:40:59 2002
-@@ -89,14 +89,6 @@
- 		$(DESTDIR)$(mandir)/man1/mutt_dotlock.1
+--- doc/Makefile.in.orig	Fri Feb  4 13:46:04 2005
++++ doc/Makefile.in	Fri Feb  4 13:47:49 2005
+@@ -92,14 +92,6 @@
  	./instdoc muttrc.man $(DESTDIR)$(mandir)/man5/muttrc.5
  	./instdoc $(srcdir)/mbox.man $(DESTDIR)$(mandir)/man5/mbox.5
+ 	./instdoc $(srcdir)/mmdf.man $(DESTDIR)$(mandir)/man5/mmdf.5
 -	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(docdir)
 -	for f in $(srcdir_DOCFILES) ; do \
 -		$(INSTALL) -m 644 $(srcdir)/$$f $(DESTDIR)$(docdir) ; \
diff -ru  /usr/ports/mail/mutt-devel/files/extra-patch-sidebar ./files/extra-patch-sidebar
--- /usr/ports/mail/mutt-devel/files/extra-patch-sidebar	Thu Jan  1 01:00:00 1970
+++ ./files/extra-patch-sidebar	Fri Feb  4 18:22:16 2005
@@ -0,0 +1,10 @@
+--- Makefile.am.orig	Fri Feb  4 18:12:14 2005
++++ Makefile.am	Fri Feb  4 18:17:17 2005
+@@ -195,6 +195,7 @@
+ 		$(srcdir)/init.h | ./makedoc -c | cat Muttrc.head - > Muttrc
+ 	touch stamp-doc-rc
+ 
++mutt_SOURCES += sidebar.c
+ 
+ .PHONY: commit pclean check-security commit-real commit-changelog
+ .PHONY: changelog ChangeLog
diff -ru  /usr/ports/mail/mutt-devel/files/patch-05 ./files/patch-05
--- /usr/ports/mail/mutt-devel/files/patch-05	Wed Jan  1 18:27:03 2003
+++ ./files/patch-05	Fri Feb  4 09:22:54 2005
@@ -41,65 +41,3 @@
        p = strchr (letters, ch.ch);
        if (p)
        {
---- browser.c.orig	Fri Sep 24 01:08:08 1999
-+++ browser.c	Sun Sep 26 23:46:25 1999
-@@ -750,7 +750,7 @@
- 	  switch (mutt_multi_choice ((reverse) ?
- 	      _("Reverse sort by (d)ate, (a)lpha, si(z)e or do(n)'t sort? ") :
- 	      _("Sort by (d)ate, (a)lpha, si(z)e or do(n)'t sort? "),
--	      _("dazn")))
-+	      N_("dazn")))
- 	  {
- 	    case -1: /* abort */
- 	      resort = 0;
---- commands.c.orig	Wed Jul  7 02:56:24 1999
-+++ commands.c	Sun Sep 26 23:46:25 1999
-@@ -337,7 +337,7 @@
-   switch (mutt_multi_choice (reverse ?
- 			     _("Rev-Sort (d)ate/(f)rm/(r)ecv/(s)ubj/t(o)/(t)hread/(u)nsort/si(z)e/s(c)ore?: ") :
- 			     _("Sort (d)ate/(f)rm/(r)ecv/(s)ubj/t(o)/(t)hread/(u)nsort/si(z)e/s(c)ore?: "),
--			     _("dfrsotuzc")))
-+			     N_("dfrsotuzc")))
-   {
-   case -1: /* abort - don't resort */
-     return -1;
---- compose.c.orig	Wed Dec 11 12:20:04 2002
-+++ compose.c	Tue Dec 17 19:57:50 2002
-@@ -173,7 +173,7 @@
-   char input_signas[SHORT_STRING];
- 
-   switch (mutt_multi_choice (_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, or (f)orget it? "),
--			     _("esabf")))
-+			     N_("esabf")))
-   {
-   case 1: /* (e)ncrypt */
-     msg->security |= PGPENCRYPT;
-@@ -229,7 +229,7 @@
-     char *p;
- 
-   switch (mutt_multi_choice (_("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, or (f)orget it? "),
--			     _("eswabf")))
-+			     N_("eswabf")))
-   {
-   case 1: /* (e)ncrypt */
-     msg->security |= SMIMEENCRYPT;
-@@ -239,7 +239,7 @@
-     msg->security |= SMIMEENCRYPT;
-     switch (mutt_multi_choice (_("1: DES, 2: Triple-DES, 3: RC2-40,"
- 				 " 4: RC2-64, 5: RC2-128, or (f)orget it? "),
--			       _("12345f"))) {
-+			       N_("12345f"))) {
-     case 1:
- 	mutt_str_replace (&SmimeCryptAlg, "des");
- 	break;
---- muttlib.c.orig	Sun Apr  9 14:39:02 2000
-+++ muttlib.c	Fri May 12 11:26:58 2000
-@@ -671,7 +671,7 @@
-   if (*append == 0 && access (fname, F_OK) == 0)
-   {
-     switch (mutt_multi_choice
--	    (_("File exists, (o)verwrite, (a)ppend, or (c)ancel?"), _("oac")))
-+	    (_("File exists, (o)verwrite, (a)ppend, or (c)ancel?"), N_("oac")))
-     {
-       case -1: /* abort */
-       case 3:  /* cancel */
diff -ru  /usr/ports/mail/mutt-devel/files/patch-Makefile.in ./files/patch-Makefile.in
--- /usr/ports/mail/mutt-devel/files/patch-Makefile.in	Sat May 13 17:36:47 2000
+++ ./files/patch-Makefile.in	Thu Jan  1 01:00:00 1970
@@ -1,11 +0,0 @@
---- Makefile.in.orig	Tue May  9 17:15:37 2000
-+++ Makefile.in	Fri May 12 13:53:08 2000
-@@ -210,7 +210,7 @@
- SOURCES = $(mutt_dotlock_SOURCES) $(pgpring_SOURCES) $(makedoc_SOURCES) $(mutt_SOURCES) $(EXTRA_mutt_SOURCES)
- OBJECTS = $(mutt_dotlock_OBJECTS) $(pgpring_OBJECTS) $(makedoc_OBJECTS) $(mutt_OBJECTS)
- 
--all: all-redirect
-+all: $(BUILT_SOURCES) all-redirect
- .SUFFIXES:
- .SUFFIXES: .S .c .o .s
- $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
diff -ru  /usr/ports/mail/mutt-devel/files/patch-doc-manual.sgml.head ./files/patch-doc-manual.sgml.head
--- /usr/ports/mail/mutt-devel/files/patch-doc-manual.sgml.head	Sun Aug 29 16:06:34 2004
+++ ./files/patch-doc-manual.sgml.head	Fri Feb  4 09:22:54 2005
@@ -1,5 +1,5 @@
---- doc/manual.sgml.head.orig	Sun Feb  1 18:49:53 2004
-+++ doc/manual.sgml.head	Wed Aug 25 14:02:33 2004
+--- doc/manual.sgml.head.orig	Sat Jan 15 10:42:44 2005
++++ doc/manual.sgml.head	Fri Feb  4 08:05:59 2005
 @@ -125,24 +125,24 @@
  <tscreen><verb>
  ^A or <Home>    bol             move to the start of the line
@@ -60,16 +60,16 @@
  i       ispell                  check spelling (if available on your system)
  ^F      forget-passphrase       wipe passphrase(s) from memory
  </verb></tscreen>
-@@ -1760,7 +1760,7 @@
- ~g              cryptographically signed messages
+@@ -1876,7 +1876,7 @@
  ~G              cryptographically encrypted messages
+ ~H EXPR         messages with a spam attribute matching EXPR
  ~h EXPR         messages which contain EXPR in the message header
 -~k		message contains PGP key material
 +~k              message contains PGP key material
  ~i ID           message which match ID in the ``Message-ID'' field
  ~L EXPR         message is either originated or received by EXPR
  ~l              message is addressed to a known mailing list
-@@ -1778,12 +1778,12 @@
+@@ -1894,13 +1894,13 @@
  ~T              tagged messages
  ~t USER         messages addressed to USER
  ~U              unread messages
@@ -81,11 +81,13 @@
  ~y EXPR         messages which contain EXPR in the `X-Label' field
  ~z [MIN]-[MAX]  messages with a size in the range MIN to MAX *)
 -~=		duplicated messages (see $duplicate_threads)
+-~$		unreferenced messages (requires threaded view)
 +~=              duplicated messages (see $duplicate_threads)
++~$              unreferenced messages (requires threaded view)
  </verb></tscreen>
  
  Where EXPR, USER, ID, and SUBJECT are 
-@@ -1885,10 +1885,10 @@
+@@ -2003,10 +2003,10 @@
  An error margin is a sign (+ or -), followed by a digit, followed by
  one of the following units:
  <verb>
@@ -100,7 +102,7 @@
  </verb>
  As a special case, you can replace the sign by a ``*'' character,
  which is equivalent to giving identical plus and minus error margins.
-@@ -2919,7 +2919,7 @@
+@@ -3044,7 +3044,7 @@
  to send messages from the command line as well.
  
  <tscreen><verb>
diff -ru  /usr/ports/mail/mutt-devel/files/patch-hcache-db ./files/patch-hcache-db
--- /usr/ports/mail/mutt-devel/files/patch-hcache-db	Thu Jan  1 01:00:00 1970
+++ ./files/patch-hcache-db	Fri Feb  4 09:22:54 2005
@@ -0,0 +1,11 @@
+--- configure.old	Fri Jan 28 11:01:06 2005
++++ configure	Fri Feb  4 09:18:42 2005
+@@ -12642,7 +12642,7 @@
+                 bdbpfx="$bdbpfx $d/$v"
+             done
+         done
+-        BDB_VERSIONS="db-4 db4 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db ''"
++        BDB_VERSIONS="db-4.2 db4.2 db42 ''"
+         echo "$as_me:$LINENO: checking for BerkeleyDB > 4.0" >&5
+ echo $ECHO_N "checking for BerkeleyDB > 4.0... $ECHO_C" >&6
+         for d in $bdbpfx; do
diff -ru  /usr/ports/mail/mutt-devel/files/patch-init.c ./files/patch-init.c
--- /usr/ports/mail/mutt-devel/files/patch-init.c	Sun Jul  4 13:11:53 2004
+++ ./files/patch-init.c	Fri Feb  4 09:22:54 2005
@@ -37,24 +37,3 @@
  
  #ifndef DOMAIN
  #define DOMAIN buffer
---- init.c.orig
-+++ init.c
-@@ -1371,17 +1371,6 @@
-   pid_t pid;
-   struct stat s;
- 
--  if (stat (rcfile, &s) < 0)
--  {
--    snprintf (err->data, err->dsize, _("%s: stat: %s"), rcfile, strerror (errno));
--    return (-1);
--  }
--  if (!S_ISREG (s.st_mode))
--  {
--    snprintf (err->data, err->dsize, _("%s: not a regular file"), rcfile);
--    return (-1);
--  }
--
-   if ((f = mutt_open_read (rcfile, &pid)) == NULL)
-   {
-     snprintf (err->data, err->dsize, "%s: %s", rcfile, strerror (errno));
-
diff -ru  /usr/ports/mail/mutt-devel/files/patch-mktemp ./files/patch-mktemp
--- /usr/ports/mail/mutt-devel/files/patch-mktemp	Tue May 11 09:36:58 2004
+++ ./files/patch-mktemp	Fri Feb  4 09:22:54 2005
@@ -1,10 +1,10 @@
---- muttlib.c.orig	Thu Apr 22 14:43:58 2004
-+++ muttlib.c	Thu Apr 22 14:51:01 2004
-@@ -657,7 +657,11 @@
+--- muttlib.c.orig	Fri Feb  4 08:09:25 2005
++++ muttlib.c	Fri Feb  4 08:13:37 2005
+@@ -664,7 +664,11 @@
  
  void _mutt_mktemp (char *s, const char *src, int line)
  {
--  snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d", NONULL (Tempdir), NONULL(Hostname), (int) getpid (), Counter++);
+-  snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d-%d", NONULL (Tempdir), NONULL(Hostname), (int) getuid(), (int) getpid (), Counter++);
 +  char t[7];
 +  snprintf (t, 7, "-%05d", Counter++);
 +  snprintf (s, _POSIX_PATH_MAX-6, "%s/mutt-%s-XXXXXXXX", NONULL(Tempdir), NONULL(Hostname));
diff -ru  /usr/ports/mail/mutt-devel/files/patch-pgp.c ./files/patch-pgp.c
--- /usr/ports/mail/mutt-devel/files/patch-pgp.c	Thu Jan  1 01:00:00 1970
+++ ./files/patch-pgp.c	Fri Feb  4 13:41:44 2005
@@ -0,0 +1,11 @@
+--- pgp.c.orig	Thu Jan 27 21:30:04 2005
++++ pgp.c	Fri Feb  4 13:14:04 2005
+@@ -209,7 +209,7 @@
+     if (armor_header)
+     {
+       char *p = mutt_skip_whitespace (buf);
+-      if (*p == '\n') 
++      if (*p == '\0') 
+ 	armor_header = 0;
+       continue;
+     }
diff -ru  /usr/ports/mail/mutt-devel/files/patch-smime-recvattach ./files/patch-smime-recvattach
--- /usr/ports/mail/mutt-devel/files/patch-smime-recvattach	Tue Aug 31 10:11:05 2004
+++ ./files/patch-smime-recvattach	Thu Jan  1 01:00:00 1970
@@ -1,39 +0,0 @@
-diff -u -r3.13 recvattach.c
---- recvattach.c	12 Apr 2004 20:33:33 -0000	3.13
-+++ recvattach.c	30 Aug 2004 20:26:30 -0000
-@@ -913,18 +913,33 @@
-       mx_close_message (&msg);
-       return;
-     }
--    if ((WithCrypto & APPLICATION_SMIME) && hdr->security & APPLICATION_SMIME)
-+    if ((WithCrypto & APPLICATION_SMIME) && (hdr->security & APPLICATION_SMIME))
-     {
-       if (hdr->env)
- 	  crypt_smime_getkeys (hdr->env);
- 
-       if (mutt_is_application_smime(hdr->content))
-+      {
- 	secured = ! crypt_smime_decrypt_mime (msg->fp, &fp,
-                                               hdr->content, &cur);
-+	
-+	/* S/MIME nesting */
-+	if ((mutt_is_application_smime (cur) & SMIMEOPAQUE))
-+	{
-+	  BODY *_cur = cur;
-+	  FILE *_fp = fp;
-+	  
-+	  fp = NULL; cur = NULL;
-+	  secured = !crypt_smime_decrypt_mime (_fp, &fp, _cur, &cur);
-+	  
-+	  mutt_free_body (&_cur);
-+	  safe_fclose (&_fp);
-+	}
-+      }
-       else
- 	need_secured = 0;
-     }
--    if ((WithCrypto & APPLICATION_PGP) && hdr->security & APPLICATION_PGP)
-+    if ((WithCrypto & APPLICATION_PGP) && (hdr->security & APPLICATION_PGP))
-     {
-       if (mutt_is_multipart_encrypted(hdr->content))
- 	secured = !crypt_pgp_decrypt_mime (msg->fp, &fp, hdr->content, &cur);
diff -ru  /usr/ports/mail/mutt-devel/files/patch-threadcomplete ./files/patch-threadcomplete
--- /usr/ports/mail/mutt-devel/files/patch-threadcomplete	Tue Oct 12 18:42:03 2004
+++ ./files/patch-threadcomplete	Fri Feb  4 09:22:54 2005
@@ -4,12 +4,12 @@
 @@ -0,0 +1 @@
 +patch-1.5.6+20040904.tg.mutt-thread.3
 diff -Nru a/doc/manual.sgml.head b/doc/manual.sgml.head
---- doc/manual.sgml.head	2004-07-24 12:27:29 +02:00
-+++ doc/manual.sgml.head	2004-09-04 12:40:02 +02:00
-@@ -1809,6 +1809,8 @@
- ~y EXPR         messages which contain EXPR in the `X-Label' field
+--- doc/manual.sgml.head.orig	Fri Feb  4 08:15:50 2005
++++ doc/manual.sgml.head	Fri Feb  4 08:19:51 2005
+@@ -1903,6 +1903,8 @@
  ~z [MIN]-[MAX]  messages with a size in the range MIN to MAX *)
  ~=              duplicated messages (see $duplicate_threads)
+ ~$              unreferenced messages (requires threaded view)
 +~(PATTERN)      messages in threads containing messages matching a certain
 +                pattern, e.g. all threads containing messages from you: ~(~P)
  </verb></tscreen>
diff -ru  /usr/ports/mail/mutt-devel/files/patch-threadsubject ./files/patch-threadsubject
--- /usr/ports/mail/mutt-devel/files/patch-threadsubject	Sat Jun 26 17:40:28 2004
+++ ./files/patch-threadsubject	Thu Jan  1 01:00:00 1970
@@ -1,51 +0,0 @@
-From:
-
-http://www.elho.net/dev/mutt/patch-1.5.6.eh.thread_subject.1
-
-diff -ru mutt-1.5.6.orig/init.h mutt-1.5.6/init.h
---- init.h	2004-02-01 18:15:17.000000000 +0100
-+++ init.h	2004-06-21 22:58:49.000000000 +0200
-@@ -704,6 +704,13 @@
-   ** When set, mutt will not show the presence of missing messages in the
-   ** thread tree.
-   */
-+  { "hide_thread_subject", DT_BOOL, R_TREE|R_INDEX, OPTHIDETHREADSUBJECT, 1 },
-+  /*
-+  ** .pp
-+  ** When set, mutt will not show the subject of messages in the thread
-+  ** tree that have the same subject as their parent or closest previously
-+  ** displayed sibling.
-+  */
-   { "hide_top_limited",	DT_BOOL, R_TREE|R_INDEX, OPTHIDETOPLIMITED, 0 },
-   /*
-   ** .pp
-diff -ru mutt-1.5.6.orig/mutt.h mutt-1.5.6/mutt.h
---- mutt.h	2004-02-01 18:15:17.000000000 +0100
-+++ mutt.h	2004-06-21 22:48:35.000000000 +0200
-@@ -351,6 +351,7 @@
-   OPTHIDDENHOST,
-   OPTHIDELIMITED,
-   OPTHIDEMISSING,
-+  OPTHIDETHREADSUBJECT,
-   OPTHIDETOPLIMITED,
-   OPTHIDETOPMISSING,
-   OPTIGNORELISTREPLYTO,
-diff -ru mutt-1.5.6.orig/PATCHES mutt-1.5.6/PATCHES
---- PATCHES	2004-02-01 18:42:47.000000000 +0100
-+++ PATCHES	2004-06-21 21:54:50.000000000 +0200
-@@ -0,0 +1 @@
-+patch-1.5.6.eh.thread_subject.1
-diff -ru mutt-1.5.6.orig/thread.c mutt-1.5.6/thread.c
---- thread.c	2004-02-01 18:10:58.000000000 +0100
-+++ thread.c	2004-06-21 22:51:35.000000000 +0200
-@@ -41,6 +41,10 @@
- {
-   THREAD *tmp, *tree = hdr->thread;
- 
-+  /* if the user disabled subject hiding, display it */
-+  if (!option (OPTHIDETHREADSUBJECT))
-+    return (1);
-+
-   /* if our subject is different from our parent's, display it */
-   if (hdr->subject_changed)
-     return (1);
diff -ru  /usr/ports/mail/mutt-devel/files/patch-z ./files/patch-z
--- /usr/ports/mail/mutt-devel/files/patch-z	Sat Jan  8 19:38:59 2005
+++ ./files/patch-z	Thu Jan  1 01:00:00 1970
@@ -1,22 +0,0 @@
---- Makefile.am.orig2	Thu Jan  6 15:58:57 2005
-+++ Makefile.am	Thu Jan  6 15:59:33 2005
-@@ -12,7 +12,7 @@
- 
- SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR)
- 
--bin_SCRIPTS = muttbug flea @SMIMEAUX_TARGET@
-+bin_SCRIPTS = @SMIMEAUX_TARGET@
- 
- BUILT_SOURCES = keymap_defs.h patchlist.c Muttrc
- 
---- doc/Makefile.in.orig2	Thu Jan  6 15:45:57 2005
-+++ doc/Makefile.in	Thu Jan  6 15:53:52 2005
-@@ -78,8 +78,6 @@
- 	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man1
- 	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man5
- 	./instdoc $(srcdir)/mutt.man $(DESTDIR)$(mandir)/man1/mutt.1
--	./instdoc $(srcdir)/muttbug.man $(DESTDIR)$(mandir)/man1/flea.1
--	echo ".so $(mandir)/man1/flea.1" > $(DESTDIR)$(mandir)/man1/muttbug.1
- 	./instdoc $(srcdir)/dotlock.man \
- 		$(DESTDIR)$(mandir)/man1/mutt_dotlock.1
- 	./instdoc muttrc.man $(DESTDIR)$(mandir)/man5/muttrc.5
diff -ru  /usr/ports/mail/mutt-devel/scripts/generate-plist ./scripts/generate-plist
--- /usr/ports/mail/mutt-devel/scripts/generate-plist	Thu Jan 13 06:06:55 2005
+++ ./scripts/generate-plist	Fri Feb  4 18:23:28 2005
@@ -21,7 +21,9 @@
 PATH=/bin:/usr/bin
 
 cat > $tmp_first <<EOF
+bin/flea
 bin/mutt
+bin/muttbug
 bin/mutt_dotlock
 bin/pgpewrap
 bin/pgpring
@@ -131,7 +133,7 @@
   fi
 
   if [ "$MUTT_HTML" = "yes" ]; then
-    html=372
+    html=380
     if [ "$MUTT_COMPRESSED_FOLDERS" = "yes" ]; then
       html=$(($html + 5))
     fi
@@ -144,8 +146,11 @@
     if [ "$MUTT_EDIT_THREADS" = "yes" ]; then
       html=$(($html + 3))
     fi
+    if [ "$MUTT_IMAP_HEADER_CACHE" = "yes" ]; then
+      html=$(($html + 2))
+    fi
     if [ "$MUTT_MAILDIR_HEADER_CACHE" = "yes" ]; then
-      html=$(($html + 3))
+      html=$(($html + 1))
     fi
     if [ "$MUTT_SIDEBAR_PATCH" = "yes" ]; then
       html=$(($html + 2))
@@ -155,9 +160,6 @@
     fi
     if [ "$MUTT_IFDEF_PATCH" = "yes" ]; then
       html=$(($html + 1))
-    fi
-    if [ "$MUTT_PGP_PATCH" = "yes" ]; then
-      html=$(($html + 3))
     fi
     if [ "$MUTT_SLAVE_HTML_PAGES" != "" ]; then
       html=$(($html + $MUTT_SLAVE_HTML_PAGES))
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502060733.j167XDJM014143>