http://www.spinnaker.de/mutt/compressed/
* Patch last synced with upstream:
- - Date: 2005-09-29
- - File: http://www.spinnaker.de/mutt/compressed/patch-1.5.11.rr.compressed.1.gz
+ - Date: 2008-05-20
+ - File: http://www.spinnaker.de/mutt/compressed/patch-1.5.18.rr.compressed.1.gz
* Changes made:
- - filterdiff -p1 \
- $(for f in Makefile.in config.h.in configure 'Muttrc*' doc/manual.txt \
- doc/manual.sgml 'doc/manual*.html' doc/muttrc.man; do echo "-x $f"; done)
- - adjust the init.h hunk to the presence of group & ungroup
- - 2006-07-15: adjust Makefile.am and doc/manual.xml.head to mutt-1.5.12
- - 2006-08-16: adjust Makefile.am mutt-1.5.13
+ - 2008-05-20 myon: refreshed to remove hunks in auto* files
+ - 2009-09-15 myon: refreshed for mutt-1.5.19
+ status.c:103: add sizeof (tmp) to mutt_pretty_mailbox
+ - 2009-09-15 scotton: removed doc/Muttrc for mutt-1.5.19 (only patch doc/Muttrc.head)
+ - 2009-09-11 antonio: removed DefaultMagic, see 541360
+ - 2010-05-31 myon: remove commented paragraph "Use folders..." in
+ doc/Muttrc.head, see #578096
== END PATCH
-Index: compress.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ compress.c 2007-03-01 22:30:00.101678680 +0100
-@@ -0,0 +1,487 @@
+--- /dev/null
++++ b/compress.c
+@@ -0,0 +1,496 @@
+/*
+ * Copyright (C) 1997 Alain Penders <Alain@Finale-Dev.com>
+ *
+ int magic;
+
+ if (is_new (path))
-+ return (find_compress_hook (M_CLOSEHOOK, path) ? 1 : 0);
++ {
++ char *dir_path = safe_strdup(path);
++ char *aux = strrchr(dir_path, '/');
++ int dir_valid = 1;
++ if (aux)
++ {
++ *aux='\0';
++ if (access(dir_path, W_OK|X_OK))
++ dir_valid = 0;
++ }
++ safe_free((void**)&dir_path);
++ return dir_valid && (find_compress_hook (M_CLOSEHOOK, path) ? 1 : 0);
++ }
+
+ magic = mx_get_magic (path);
+
+ ctx->realpath = ctx->path;
+
+ /* Uncompress to /tmp */
-+ mutt_mktemp (tmppath);
++ mutt_mktemp (tmppath, sizeof(tmppath));
+ ctx->path = safe_malloc (strlen (tmppath) + 1);
+ strcpy (ctx->path, tmppath);
+}
+}
+
+static const char *
-+compresshook_format_str (char *dest, size_t destlen, char op, const char *src,
-+ const char *fmt, const char *ifstring,
-+ const char *elsestring, unsigned long data,
-+ format_flag flags)
++compresshook_format_str (char *dest, size_t destlen, size_t col, char op,
++ const char *src, const char *fmt,
++ const char *ifstring, const char *elsestring,
++ unsigned long data, format_flag flags)
+{
+ char tmp[SHORT_STRING];
+
+static char *get_compression_cmd (const char* cmd, const CONTEXT* ctx)
+{
+ char expanded[_POSIX_PATH_MAX];
-+ mutt_FormatString (expanded, sizeof (expanded), cmd, compresshook_format_str,
-+ (unsigned long) ctx, 0);
++ mutt_FormatString (expanded, sizeof (expanded), 0, cmd,
++ compresshook_format_str, (unsigned long) ctx, 0);
+ return safe_strdup (expanded);
+}
+
+ COMPRESS_INFO *ci = set_compress_info (ctx);
+ if (!ci->open) {
+ ctx->magic = 0;
-+ FREE (ctx->compressinfo);
++ FREE (&ctx->compressinfo);
+ return (-1);
+ }
+ if (!ci->close || access (ctx->path, W_OK) != 0)
+ {
+ mutt_any_key_to_continue (NULL);
+ ctx->magic = 0;
-+ FREE (ctx->compressinfo);
++ FREE (&ctx->compressinfo);
+ mutt_error (_("Error executing: %s : unable to open the mailbox!\n"), cmd);
+ }
+ FREE (&cmd);
+
+ set_path (ctx);
+
-+ ctx->magic = DefaultMagic;
-+
+ if (!is_new (ctx->realpath))
-+ if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
+ if ((fh = fopen (ctx->path, "w")))
+ fclose (fh);
+ /* No error checking - the parent function will catch it */
+ fclose (ctx->fp);
+ ctx->fp = NULL;
+ /* if the folder was removed, remove the gzipped folder too */
-+ if ((ctx->magic > 0)
-+ && (access (ctx->path, F_OK) != 0)
++ if ((ctx->magic > 0)
++ && (access (ctx->path, F_OK) != 0)
+ && ! option (OPTSAVEEMPTY))
+ remove (ctx->realpath);
+ else
+ if (! (ctx->append
+ && ((append = get_append_command (ctx->realpath, ctx))
+ || (append = ci->close))))
-+ {
++ {
+ /* if we can not or should not append, we only have to remove the */
+ /* compressed info, because sync was already called */
+ mutt_fast_close_compressed (ctx);
+}
+
+#endif /* USE_COMPRESSED */
-Index: compress.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ compress.h 2007-03-01 22:30:00.101678680 +0100
+--- /dev/null
++++ b/compress.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 1997 Alain Penders <Alain@Finale-Dev.com>
+int mutt_test_compress_command (const char *);
+int mutt_check_mailbox_compressed (CONTEXT *);
+void mutt_fast_close_compressed (CONTEXT *);
-Index: configure.in
-===================================================================
---- configure.in.orig 2007-03-01 22:20:42.248485256 +0100
-+++ configure.in 2007-03-01 22:30:00.102678528 +0100
-@@ -808,6 +808,11 @@ AC_ARG_ENABLE(locales-fix, AC_HELP_STRIN
+--- a/configure.ac
++++ b/configure.ac
+@@ -812,6 +812,11 @@
AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ])
fi])
AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]),
[if test $withval != yes; then
AC_DEFINE_UNQUOTED(EXECSHELL, "$withval",
-Index: curs_main.c
-===================================================================
---- curs_main.c.orig 2007-03-01 22:08:47.806097008 +0100
-+++ curs_main.c 2007-03-01 22:30:00.102678528 +0100
-@@ -1090,6 +1090,11 @@ int mutt_index_menu (void)
+--- a/curs_main.c
++++ b/curs_main.c
+@@ -1153,6 +1153,11 @@
{
int check;
mutt_str_replace (&LastFolder, Context->path);
oldcount = Context ? Context->msgcount : 0;
-Index: doc/manual.xml.head
-===================================================================
---- doc/manual.xml.head.orig 2007-03-01 22:08:47.852090016 +0100
-+++ doc/manual.xml.head 2007-03-01 22:30:00.106677920 +0100
-@@ -4749,6 +4749,205 @@ becomes an issue as mutt will silently f
+--- a/doc/manual.xml.head
++++ b/doc/manual.xml.head
+@@ -6116,6 +6116,205 @@
- </sect1>
+ </chapter>
+<sect1 id="compressedfolders">
+<title>Compressed folders Support (OPTIONAL)</title>
+For example:
+
+<screen>
-+open-hook \\.gz$ "gzip -cd %f > %t"
++open-hook \\.gz$ "gzip -cd %f > %t"
+close-hook \\.gz$ "gzip -c %t > %f"
-+append-hook \\.gz$ "gzip -c %t >> %f"
++append-hook \\.gz$ "gzip -c %t >> %f"
+</screen>
+
+You do not have to specify all of the commands. If you omit <link
+Example:
+
+<screen>
-+open-hook \\.gz$ "gzip -cd %f > %t"
++open-hook \\.gz$ "gzip -cd %f > %t"
+</screen>
+
+If the <emphasis>command</emphasis> is empty, this operation is
+Example:
+
+<screen>
-+append-hook \\.gz$ "gzip -c %t >> %f"
++append-hook \\.gz$ "gzip -c %t >> %f"
+</screen>
+
+When <link linkend="append-hook">append-hook</link> is used, the folder
+</sect2>
+</sect1>
+
- </chapter>
-
<chapter id="mimesupport">
-Index: doc/muttrc.man.head
-===================================================================
---- doc/muttrc.man.head.orig 2007-03-01 22:08:47.900082720 +0100
-+++ doc/muttrc.man.head 2007-03-01 22:30:00.106677920 +0100
-@@ -316,6 +316,24 @@ specify the ID of the public key to be u
+ <title>Mutt's MIME Support</title>
+
+--- a/doc/muttrc.man.head
++++ b/doc/muttrc.man.head
+@@ -346,6 +346,24 @@
to a certain recipient. The meaning of "key ID" is to be taken
broadly: This can be a different e-mail address, a numerical key ID,
or even just an arbitrary search string.
+"\fI\\\\.gz$\fP"). The commands tell Mutt how to uncompress a folder
+(\fBopen-hook\fP), compress a folder (\fBclose-hook\fP) or append a
+compressed mail to a compressed folder (\fBappend-hook\fP). The
-+\fIcommand\fP string is the
++\fIcommand\fP string is the
+.BR printf (3)
+like format string, and it should accept two parameters: \fB%f\fP,
+which is replaced with the (compressed) folder name, and \fB%t\fP
.TP
\fBpush\fP \fIstring\fP
This command adds the named \fIstring\fP to the keyboard buffer.
-Index: hook.c
-===================================================================
---- hook.c.orig 2007-03-01 22:08:47.947075576 +0100
-+++ hook.c 2007-03-01 22:30:00.107677768 +0100
+--- a/hook.c
++++ b/hook.c
@@ -24,6 +24,10 @@
#include "mailbox.h"
#include "mutt_crypt.h"
#include <limits.h>
#include <string.h>
#include <stdlib.h>
-@@ -92,6 +96,16 @@ int mutt_parse_hook (BUFFER *buf, BUFFER
+@@ -92,6 +96,16 @@
memset (&pattern, 0, sizeof (pattern));
pattern.data = safe_strdup (path);
}
+ {
+ if (mutt_test_compress_command (command.data))
+ {
-+ strfcpy (err->data, _("bad formatted command string"), err->dsize);
++ strfcpy (err->data, _("badly formatted command string"), err->dsize);
+ return (-1);
+ }
+ }
+#endif
- else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ACCOUNTHOOK))
+ else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ICONVHOOK | M_ACCOUNTHOOK))
&& (!WithCrypto || !(data & M_CRYPTHOOK))
)
-Index: init.h
-===================================================================
---- init.h.orig 2007-03-01 22:20:35.279544696 +0100
-+++ init.h 2007-03-01 22:30:00.108677616 +0100
-@@ -3155,6 +3155,11 @@ struct command_t Commands[] = {
+--- a/init.h
++++ b/init.h
+@@ -3530,6 +3530,11 @@
+ { "fcc-hook", mutt_parse_hook, M_FCCHOOK },
+ { "fcc-save-hook", mutt_parse_hook, M_FCCHOOK | M_SAVEHOOK },
{ "folder-hook", mutt_parse_hook, M_FOLDERHOOK },
- { "group", parse_group, 0 },
- { "ungroup", parse_ungroup, 0 },
+#ifdef USE_COMPRESSED
+ { "open-hook", mutt_parse_hook, M_OPENHOOK },
+ { "close-hook", mutt_parse_hook, M_CLOSEHOOK },
+ { "append-hook", mutt_parse_hook, M_APPENDHOOK },
+#endif
+ { "group", parse_group, M_GROUP },
+ { "ungroup", parse_group, M_UNGROUP },
{ "hdr_order", parse_list, UL &HeaderOrderList },
- #ifdef HAVE_ICONV
- { "iconv-hook", mutt_parse_hook, M_ICONVHOOK },
-Index: main.c
-===================================================================
---- main.c.orig 2007-03-01 22:20:46.386856128 +0100
-+++ main.c 2007-03-01 22:30:00.108677616 +0100
-@@ -404,6 +404,12 @@ static void show_version (void)
+--- a/main.c
++++ b/main.c
+@@ -401,6 +401,12 @@
#else
"-LOCALES_HACK "
#endif
#ifdef HAVE_WC_FUNCS
"+HAVE_WC_FUNCS "
-Index: Makefile.am
-===================================================================
---- Makefile.am.orig 2007-03-01 22:20:46.454845792 +0100
-+++ Makefile.am 2007-03-01 22:30:00.108677616 +0100
-@@ -18,7 +18,7 @@ BUILT_SOURCES = keymap_defs.h patchlist.
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -22,7 +22,7 @@
bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
- mutt_SOURCES = $(BUILT_SOURCES) \
+ mutt_SOURCES = \
addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
- crypt.c cryptglue.c \
+ crypt.c cryptglue.c compress.c \
commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \
edit.c enter.c flags.c init.c filter.c from.c \
getdomain.c group.c \
-@@ -67,7 +67,7 @@ EXTRA_mutt_SOURCES = account.c md5c.c mu
- utf8.c wcwidth.c
+@@ -61,7 +61,7 @@
+ bcache.h browser.h hcache.h mbyte.h mutt_idna.h remailer.h url.h
EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
- configure account.h \
attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \
globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
-Index: mbox.c
-===================================================================
---- mbox.c.orig 2007-03-01 22:08:48.131047608 +0100
-+++ mbox.c 2007-03-01 22:30:00.109677464 +0100
+--- a/mbox.c
++++ b/mbox.c
@@ -29,6 +29,10 @@
#include "copy.h"
#include "mutt_curses.h"
#include <sys/stat.h>
#include <dirent.h>
#include <string.h>
-@@ -1026,6 +1030,12 @@ bail: /* Come here in case of disaster
+@@ -1070,6 +1074,12 @@
int mbox_close_mailbox (CONTEXT *ctx)
{
mx_unlock_file (ctx->path, fileno (ctx->fp), 1);
mutt_unblock_signals ();
mx_fastclose_mailbox (ctx);
return 0;
-Index: mutt.h
-===================================================================
---- mutt.h.orig 2007-03-01 22:20:43.625275952 +0100
-+++ mutt.h 2007-03-01 22:30:00.109677464 +0100
-@@ -159,6 +159,11 @@ typedef enum
+--- a/mutt.h
++++ b/mutt.h
+@@ -146,6 +146,11 @@
#define M_ACCOUNTHOOK (1<<9)
#define M_REPLYHOOK (1<<10)
#define M_SEND2HOOK (1<<11)
/* tree characters for linearize_tree and print_enriched_string */
#define M_TREE_LLCORNER 1
-@@ -882,6 +887,11 @@ typedef struct
- void *data; /* driver specific data */
- #endif /* USE_IMAP */
+@@ -887,6 +892,11 @@
+ int flagged; /* how many flagged messages */
+ int msgnotreadyet; /* which msg "new" in pager, -1 if none */
+#ifdef USE_COMPRESSED
+ void *compressinfo; /* compressed mbox module private data */
short magic; /* mailbox type */
unsigned char rights[(RIGHTSMAX + 7)/8]; /* ACL bits */
-Index: mx.c
-===================================================================
---- mx.c.orig 2007-03-01 22:08:48.223033624 +0100
-+++ mx.c 2007-03-01 22:30:00.110677312 +0100
+--- a/mx.c
++++ b/mx.c
@@ -30,6 +30,10 @@
#include "keymap.h"
#include "url.h"
#ifdef USE_IMAP
#include "imap.h"
#endif
-@@ -454,6 +458,10 @@ int mx_get_magic (const char *path)
+@@ -414,6 +418,10 @@
return (-1);
}
return (magic);
}
-@@ -493,6 +501,13 @@ static int mx_open_mailbox_append (CONTE
+@@ -453,6 +461,13 @@
{
struct stat sb;
ctx->append = 1;
#ifdef USE_IMAP
-@@ -656,7 +671,12 @@ CONTEXT *mx_open_mailbox (const char *pa
+@@ -616,7 +631,12 @@
}
ctx->magic = mx_get_magic (path);
if(ctx->magic == 0)
mutt_error (_("%s is not a mailbox."), path);
-@@ -762,6 +782,10 @@ void mx_fastclose_mailbox (CONTEXT *ctx)
+@@ -721,6 +741,10 @@
mutt_free_header (&ctx->hdrs[i]);
FREE (&ctx->hdrs);
FREE (&ctx->v2r);
FREE (&ctx->path);
FREE (&ctx->pattern);
if (ctx->limit_pattern)
-@@ -819,6 +843,12 @@ static int sync_mailbox (CONTEXT *ctx, i
+@@ -773,6 +797,12 @@
+
if (tmp && tmp->new == 0)
mutt_update_mailbox (tmp);
- #endif
+
+#ifdef USE_COMPRESSED
+ if (rc == 0 && ctx->compressinfo)
return rc;
}
-@@ -1020,6 +1050,11 @@ int mx_close_mailbox (CONTEXT *ctx, int
+@@ -1043,6 +1073,11 @@
!mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
mx_unlink_empty (ctx->path);
mx_fastclose_mailbox (ctx);
return 0;
-@@ -1329,6 +1364,11 @@ int mx_check_mailbox (CONTEXT *ctx, int
+@@ -1361,6 +1396,11 @@
{
int rc;
if (ctx)
{
if (ctx->locked) lock = 0;
-Index: mx.h
-===================================================================
---- mx.h.orig 2007-03-01 22:08:48.272026176 +0100
-+++ mx.h 2007-03-01 22:30:00.110677312 +0100
-@@ -40,6 +40,9 @@ enum
- #ifdef USE_POP
- , M_POP
- #endif
+--- a/mx.h
++++ b/mx.h
+@@ -36,6 +36,9 @@
+ M_MAILDIR,
+ M_IMAP,
+ M_POP
+#ifdef USE_COMPRESSED
+ , M_COMPRESSED
+#endif
};
WHERE short DefaultMagic INITVAL (M_MBOX);
-Index: PATCHES
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ PATCHES 2007-03-01 22:30:00.110677312 +0100
-@@ -0,0 +1 @@
-+patch-1.5.11.rr.compressed.1
-Index: po/de.po
-===================================================================
---- po/de.po.orig 2007-03-01 22:21:09.228383688 +0100
-+++ po/de.po 2007-03-01 22:30:00.112677008 +0100
-@@ -1266,6 +1266,48 @@ msgstr "Prüfung des Absenders fehlgeschl
- msgid "Failed to figure out sender"
- msgstr "Kann Absender nicht ermitteln"
+--- a/po/POTFILES.in
++++ b/po/POTFILES.in
+@@ -8,6 +8,7 @@
+ color.c
+ commands.c
+ compose.c
++compress.c
+ crypt-gpgme.c
+ crypt.c
+ cryptglue.c
+--- a/status.c
++++ b/status.c
+@@ -96,6 +96,14 @@
+
+ case 'f':
+ snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
++#ifdef USE_COMPRESSED
++ if (Context && Context->compressinfo && Context->realpath)
++ {
++ strfcpy (tmp, Context->realpath, sizeof (tmp));
++ mutt_pretty_mailbox (tmp, sizeof (tmp));
++ }
++ else
++#endif
+ if (Context && Context->path)
+ {
+ strfcpy (tmp, Context->path, sizeof (tmp));
+--- a/po/de.po
++++ b/po/de.po
+@@ -5159,6 +5159,36 @@
+ msgid "show S/MIME options"
+ msgstr "Zeige S/MIME Optionen"
-+#: compress.c:203 mbox.c:661
-+msgid "Mailbox was corrupted!"
-+msgstr "Mailbox wurde zerstört!"
+
+#: compress.c:228 compress.c:253
+#, c-format
+msgid "Decompressing %s...\n"
+msgstr "Entpacke %s...\n"
+
-+#: compress.c:246 compress.c:367 compress.c:443 mbox.c:706
-+msgid "Unable to lock mailbox!"
-+msgstr "Kann Mailbox nicht für exklusiven Zugriff sperren!"
-+
-+#: compress.c:264
-+#, c-format
-+msgid "Error executing: %s : unable to open the mailbox!\n"
-+msgstr "Fehler beim Ausführen von %s : Kann die Mailbox nicht öffnen!\n"
-+
+#: compress.c:350 compress.c:377 compress.c:423 compress.c:454
+#, c-format
+msgid "Compressing %s...\n"
+msgid " %s: Error compressing mailbox! Uncompressed one kept!\n"
+msgstr " %s: Fehler beim packen der Mailbox! Entpackte Mailbox gespeichert!\n"
+
- #: crypt.c:69
- #, c-format
- msgid " (current time: %c)"
-@@ -1926,6 +1968,10 @@ msgstr ""
- msgid "Help for %s"
- msgstr "Hilfe für %s"
-
-+#: hook.c:96
-+msgid "bad formatted command string"
-+msgstr "Hook enthält nicht die Muster %f und %t"
-+
- #: hook.c:246
- #, c-format
- msgid "unhook: Can't do unhook * from within a hook."
-@@ -3428,18 +3474,10 @@ msgstr "Lese %s..."
- msgid "Mailbox is corrupt!"
- msgstr "Mailbox fehlerhaft!"
+ #~ msgid "Clear"
+ #~ msgstr "Klartext"
--#: mbox.c:670
--msgid "Mailbox was corrupted!"
--msgstr "Mailbox wurde zerstört!"
--
- #: mbox.c:711 mbox.c:964
- msgid "Fatal error! Could not reopen mailbox!"
- msgstr "Fataler Fehler, konnte Mailbox nicht erneut öffnen!"
-
--#: mbox.c:720
--msgid "Unable to lock mailbox!"
--msgstr "Kann Mailbox nicht für exklusiven Zugriff sperren!"
--
- #. this means ctx->changed or ctx->deleted was set, but no
- #. * messages were found to be changed or deleted. This should
- #. * never happen, is we presume it is a bug in mutt.
-Index: po/POTFILES.in
-===================================================================
---- po/POTFILES.in.orig 2007-03-01 22:20:56.152371544 +0100
-+++ po/POTFILES.in 2007-03-01 22:30:00.112677008 +0100
-@@ -8,6 +8,7 @@ charset.c
- color.c
- commands.c
- compose.c
-+compress.c
- crypt-gpgme.c
- crypt.c
- cryptglue.c
-Index: status.c
-===================================================================
---- status.c.orig 2007-03-01 22:08:48.458997752 +0100
-+++ status.c 2007-03-01 22:30:00.113676856 +0100
-@@ -97,6 +97,14 @@ status_format_str (char *buf, size_t buf
-
- case 'f':
- snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
-+#ifdef USE_COMPRESSED
-+ if (Context && Context->compressinfo && Context->realpath)
-+ {
-+ strfcpy (tmp, Context->realpath, sizeof (tmp));
-+ mutt_pretty_mailbox (tmp);
-+ }
-+ else
-+#endif
- if (Context && Context->path)
- {
- strfcpy (tmp, Context->path, sizeof (tmp));