2 This is the compressed folders patch by Roland Rosenfeld
5 The home page for this patch is:
7 http://www.spinnaker.de/mutt/compressed/
9 * Patch last synced with upstream:
11 - File: http://www.spinnaker.de/mutt/compressed/patch-1.5.11.rr.compressed.1.gz
15 $(for f in Makefile.in config.h.in configure 'Muttrc*' doc/manual.txt \
16 doc/manual.sgml 'doc/manual*.html' doc/muttrc.man; do echo "-x $f"; done)
17 - adjust the init.h hunk to the presence of group & ungroup
18 - 2006-07-15: adjust Makefile.am and doc/manual.xml.head to mutt-1.5.12
19 - 2006-08-16: adjust Makefile.am mutt-1.5.13
26 + * Copyright (C) 1997 Alain Penders <Alain@Finale-Dev.com>
28 + * This program is free software; you can redistribute it and/or modify
29 + * it under the terms of the GNU General Public License as published by
30 + * the Free Software Foundation; either version 2 of the License, or
31 + * (at your option) any later version.
33 + * This program is distributed in the hope that it will be useful,
34 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 + * GNU General Public License for more details.
38 + * You should have received a copy of the GNU General Public License
39 + * along with this program; if not, write to the Free Software
40 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
49 +#ifdef USE_COMPRESSED
53 +#include "mutt_curses.h"
58 +#include <sys/stat.h>
62 + const char *close; /* close-hook command */
63 + const char *open; /* open-hook command */
64 + const char *append; /* append-hook command */
65 + off_t size; /* size of real folder */
70 + * ctx - context to lock
71 + * excl - exclusive lock?
72 + * retry - should retry if unable to lock?
74 +int mbox_lock_compressed (CONTEXT *ctx, FILE *fp, int excl, int retry)
78 + if ((r = mx_lock_file (ctx->realpath, fileno (fp), excl, 1, retry)) == 0)
80 + else if (retry && !excl)
89 +void mbox_unlock_compressed (CONTEXT *ctx, FILE *fp)
95 + mx_unlock_file (ctx->realpath, fileno (fp), 1);
100 +static int is_new (const char *path)
102 + return (access (path, W_OK) != 0 && errno == ENOENT) ? 1 : 0;
105 +static const char* find_compress_hook (int type, const char *path)
107 + const char* c = mutt_find_hook (type, path);
108 + return (!c || !*c) ? NULL : c;
111 +int mutt_can_read_compressed (const char *path)
113 + return find_compress_hook (M_OPENHOOK, path) ? 1 : 0;
117 + * if the file is new, we really do not append, but create, and so use
118 + * close-hook, and not append-hook
120 +static const char* get_append_command (const char *path, const CONTEXT* ctx)
122 + COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
123 + return (is_new (path)) ? ci->close : ci->append;
126 +int mutt_can_append_compressed (const char *path)
131 + return (find_compress_hook (M_CLOSEHOOK, path) ? 1 : 0);
133 + magic = mx_get_magic (path);
135 + if (magic != 0 && magic != M_COMPRESSED)
138 + return (find_compress_hook (M_APPENDHOOK, path)
139 + || (find_compress_hook (M_OPENHOOK, path)
140 + && find_compress_hook (M_CLOSEHOOK, path))) ? 1 : 0;
143 +/* open a compressed mailbox */
144 +static COMPRESS_INFO *set_compress_info (CONTEXT *ctx)
148 + /* Now lets uncompress this thing */
149 + ci = safe_malloc (sizeof (COMPRESS_INFO));
150 + ctx->compressinfo = (void*) ci;
151 + ci->append = find_compress_hook (M_APPENDHOOK, ctx->path);
152 + ci->open = find_compress_hook (M_OPENHOOK, ctx->path);
153 + ci->close = find_compress_hook (M_CLOSEHOOK, ctx->path);
157 +static void set_path (CONTEXT* ctx)
159 + char tmppath[_POSIX_PATH_MAX];
161 + /* Setup the right paths */
162 + ctx->realpath = ctx->path;
164 + /* Uncompress to /tmp */
165 + mutt_mktemp (tmppath);
166 + ctx->path = safe_malloc (strlen (tmppath) + 1);
167 + strcpy (ctx->path, tmppath);
170 +static int get_size (const char* path)
173 + if (stat (path, &sb) != 0)
175 + return (sb.st_size);
178 +static void store_size (CONTEXT* ctx)
180 + COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
181 + ci->size = get_size (ctx->realpath);
185 +compresshook_format_str (char *dest, size_t destlen, char op, const char *src,
186 + const char *fmt, const char *ifstring,
187 + const char *elsestring, unsigned long data,
190 + char tmp[SHORT_STRING];
192 + CONTEXT *ctx = (CONTEXT *) data;
196 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
197 + snprintf (dest, destlen, tmp, ctx->realpath);
200 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
201 + snprintf (dest, destlen, tmp, ctx->path);
208 + * check that the command has both %f and %t
209 + * 0 means OK, -1 means error
211 +int mutt_test_compress_command (const char* cmd)
213 + return (strstr (cmd, "%f") && strstr (cmd, "%t")) ? 0 : -1;
216 +static char *get_compression_cmd (const char* cmd, const CONTEXT* ctx)
218 + char expanded[_POSIX_PATH_MAX];
219 + mutt_FormatString (expanded, sizeof (expanded), cmd, compresshook_format_str,
220 + (unsigned long) ctx, 0);
221 + return safe_strdup (expanded);
224 +int mutt_check_mailbox_compressed (CONTEXT* ctx)
226 + COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
227 + if (ci->size != get_size (ctx->realpath))
229 + FREE (&ctx->compressinfo);
230 + FREE (&ctx->realpath);
231 + mutt_error _("Mailbox was corrupted!");
237 +int mutt_open_read_compressed (CONTEXT *ctx)
243 + COMPRESS_INFO *ci = set_compress_info (ctx);
246 + FREE (ctx->compressinfo);
249 + if (!ci->close || access (ctx->path, W_OK) != 0)
256 + mutt_message (_("Decompressing %s..."), ctx->realpath);
258 + cmd = get_compression_cmd (ci->open, ctx);
261 + dprint (2, (debugfile, "DecompressCmd: '%s'\n", cmd));
263 + if ((fp = fopen (ctx->realpath, "r")) == NULL)
265 + mutt_perror (ctx->realpath);
269 + mutt_block_signals ();
270 + if (mbox_lock_compressed (ctx, fp, 0, 1) == -1)
273 + mutt_unblock_signals ();
274 + mutt_error _("Unable to lock mailbox!");
281 + fprintf (stderr, _("Decompressing %s...\n"),ctx->realpath);
282 + rc = mutt_system (cmd);
283 + mbox_unlock_compressed (ctx, fp);
284 + mutt_unblock_signals ();
289 + mutt_any_key_to_continue (NULL);
291 + FREE (ctx->compressinfo);
292 + mutt_error (_("Error executing: %s : unable to open the mailbox!\n"), cmd);
298 + if (mutt_check_mailbox_compressed (ctx))
301 + ctx->magic = mx_get_magic (ctx->path);
306 +void restore_path (CONTEXT* ctx)
309 + ctx->path = ctx->realpath;
312 +/* remove the temporary mailbox */
313 +void remove_file (CONTEXT* ctx)
315 + if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
316 + remove (ctx->path);
319 +int mutt_open_append_compressed (CONTEXT *ctx)
322 + COMPRESS_INFO *ci = set_compress_info (ctx);
324 + if (!get_append_command (ctx->path, ctx))
326 + if (ci->open && ci->close)
327 + return (mutt_open_read_compressed (ctx));
330 + FREE (&ctx->compressinfo);
336 + ctx->magic = DefaultMagic;
338 + if (!is_new (ctx->realpath))
339 + if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
340 + if ((fh = fopen (ctx->path, "w")))
342 + /* No error checking - the parent function will catch it */
347 +/* close a compressed mailbox */
348 +void mutt_fast_close_compressed (CONTEXT *ctx)
350 + dprint (2, (debugfile, "mutt_fast_close_compressed called on '%s'\n",
353 + if (ctx->compressinfo)
358 + /* if the folder was removed, remove the gzipped folder too */
359 + if ((ctx->magic > 0)
360 + && (access (ctx->path, F_OK) != 0)
361 + && ! option (OPTSAVEEMPTY))
362 + remove (ctx->realpath);
366 + restore_path (ctx);
367 + FREE (&ctx->compressinfo);
371 +/* return 0 on success, -1 on failure */
372 +int mutt_sync_compressed (CONTEXT* ctx)
377 + COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
380 + mutt_message (_("Compressing %s..."), ctx->realpath);
382 + cmd = get_compression_cmd (ci->close, ctx);
386 + if ((fp = fopen (ctx->realpath, "a")) == NULL)
388 + mutt_perror (ctx->realpath);
392 + mutt_block_signals ();
393 + if (mbox_lock_compressed (ctx, fp, 1, 1) == -1)
396 + mutt_unblock_signals ();
397 + mutt_error _("Unable to lock mailbox!");
403 + dprint (2, (debugfile, "CompressCommand: '%s'\n", cmd));
407 + fprintf (stderr, _("Compressing %s...\n"), ctx->realpath);
408 + if (mutt_system (cmd))
410 + mutt_any_key_to_continue (NULL);
411 + mutt_error (_("%s: Error compressing mailbox! Original mailbox deleted, uncompressed one kept!\n"), ctx->path);
415 + mbox_unlock_compressed (ctx, fp);
416 + mutt_unblock_signals ();
426 +int mutt_slow_close_compressed (CONTEXT *ctx)
429 + const char *append;
431 + COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
433 + dprint (2, (debugfile, "mutt_slow_close_compressed called on '%s'\n",
437 + && ((append = get_append_command (ctx->realpath, ctx))
438 + || (append = ci->close))))
440 + /* if we can not or should not append, we only have to remove the */
441 + /* compressed info, because sync was already called */
442 + mutt_fast_close_compressed (ctx);
452 + if (append == ci->close)
453 + mutt_message (_("Compressing %s..."), ctx->realpath);
455 + mutt_message (_("Compressed-appending to %s..."), ctx->realpath);
458 + cmd = get_compression_cmd (append, ctx);
462 + if ((fp = fopen (ctx->realpath, "a")) == NULL)
464 + mutt_perror (ctx->realpath);
468 + mutt_block_signals ();
469 + if (mbox_lock_compressed (ctx, fp, 1, 1) == -1)
472 + mutt_unblock_signals ();
473 + mutt_error _("Unable to lock mailbox!");
478 + dprint (2, (debugfile, "CompressCmd: '%s'\n", cmd));
483 + if (append == ci->close)
484 + fprintf (stderr, _("Compressing %s...\n"), ctx->realpath);
486 + fprintf (stderr, _("Compressed-appending to %s...\n"), ctx->realpath);
488 + if (mutt_system (cmd))
490 + mutt_any_key_to_continue (NULL);
491 + mutt_error (_(" %s: Error compressing mailbox! Uncompressed one kept!\n"),
494 + mbox_unlock_compressed (ctx, fp);
495 + mutt_unblock_signals ();
500 + mbox_unlock_compressed (ctx, fp);
501 + mutt_unblock_signals ();
504 + restore_path (ctx);
506 + FREE (&ctx->compressinfo);
511 +#endif /* USE_COMPRESSED */
516 + * Copyright (C) 1997 Alain Penders <Alain@Finale-Dev.com>
518 + * This program is free software; you can redistribute it and/or modify
519 + * it under the terms of the GNU General Public License as published by
520 + * the Free Software Foundation; either version 2 of the License, or
521 + * (at your option) any later version.
523 + * This program is distributed in the hope that it will be useful,
524 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
525 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
526 + * GNU General Public License for more details.
528 + * You should have received a copy of the GNU General Public License
529 + * along with this program; if not, write to the Free Software
530 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
533 +int mutt_can_read_compressed (const char *);
534 +int mutt_can_append_compressed (const char *);
535 +int mutt_open_read_compressed (CONTEXT *);
536 +int mutt_open_append_compressed (CONTEXT *);
537 +int mutt_slow_close_compressed (CONTEXT *);
538 +int mutt_sync_compressed (CONTEXT *);
539 +int mutt_test_compress_command (const char *);
540 +int mutt_check_mailbox_compressed (CONTEXT *);
541 +void mutt_fast_close_compressed (CONTEXT *);
542 --- configure.in.orig
545 AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ])
548 +AC_ARG_ENABLE(compressed, AC_HELP_STRING([--enable-compressed], [Enable compressed folders support]),
549 + [if test x$enableval = xyes; then
550 + AC_DEFINE(USE_COMPRESSED,1, [ Define to support compressed folders. ])
553 AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]),
554 [if test $withval != yes; then
555 AC_DEFINE_UNQUOTED(EXECSHELL, "$withval",
558 @@ -1096,6 +1096,11 @@
562 +#ifdef USE_COMPRESSED
563 + if (Context->compressinfo && Context->realpath)
564 + mutt_str_replace (&LastFolder, Context->realpath);
567 mutt_str_replace (&LastFolder, Context->path);
568 oldcount = Context ? Context->msgcount : 0;
570 --- doc/manual.xml.head.orig
571 +++ doc/manual.xml.head
572 @@ -4749,6 +4749,205 @@
576 +<sect1 id="compressedfolders">
577 +<title>Compressed folders Support (OPTIONAL)</title>
580 +If Mutt was compiled with compressed folders support (by running the
581 +<emphasis>configure</emphasis> script with the
582 +<emphasis>--enable-compressed</emphasis> flag), Mutt can open folders
583 +stored in an arbitrary format, provided that the user has a script to
584 +convert from/to this format to one of the accepted.
586 +The most common use is to open compressed archived folders e.g. with
589 +In addition, the user can provide a script that gets a folder in an
590 +accepted format and appends its context to the folder in the
591 +user-defined format, which may be faster than converting the entire
592 +folder to the accepted format, appending to it and converting back to
593 +the user-defined format.
595 +There are three hooks defined (<link
596 +linkend="open-hook">open-hook</link>, <link
597 +linkend="close-hook">close-hook</link> and <link
598 +linkend="append-hook">append-hook</link>) which define commands to
599 +uncompress and compress a folder and to append messages to an existing
600 +compressed folder respectively.
605 +open-hook \\.gz$ "gzip -cd %f > %t"
606 +close-hook \\.gz$ "gzip -c %t > %f"
607 +append-hook \\.gz$ "gzip -c %t >> %f"
610 +You do not have to specify all of the commands. If you omit <link
611 +linkend="append-hook">append-hook</link>, the folder will be open and
612 +closed again each time you will add to it. If you omit <link
613 +linkend="close-hook">close-hook</link> (or give empty command) , the
614 +folder will be open in the mode. If you specify <link
615 +linkend="append-hook">append-hook</link> though you'll be able to
616 +append to the folder.
618 +Note that Mutt will only try to use hooks if the file is not in one of
619 +the accepted formats. In particular, if the file is empty, mutt
620 +supposes it is not compressed. This is important because it allows the
621 +use of programs that do not have well defined extensions. Just use
622 +"." as a regexp. But this may be surprising if your
623 +compressing script produces empty files. In this situation, unset
624 +<link linkend="save-empty">$save_empty</link>, so that
625 +the compressed file will be removed if you delete all of the messages.
628 +<sect2 id="open-hook">
629 +<title>Open a compressed mailbox for reading</title>
632 +Usage: <literal>open-hook</literal> <emphasis>regexp</emphasis> "<emphasis>command</emphasis>"
634 +The <emphasis>command</emphasis> is the command that can be used for
635 +opening the folders whose names match <emphasis>regexp</emphasis>.
637 +The <emphasis>command</emphasis> string is the printf-like format
638 +string, and it should accept two parameters: %f, which is
639 +replaced with the (compressed) folder name, and %t which is
640 +replaced with the name of the temporary folder to which to write.
642 +%f and %t can be repeated any number of times in the
643 +command string, and all of the entries are replaced with the
644 +appropriate folder name. In addition, %% is replaced by
645 +%, as in printf, and any other %anything is left as is.
647 +The <emphasis>command</emphasis> should <emphasis
648 +role="bold">not</emphasis> remove the original compressed file. The
649 +<emphasis>command</emphasis> should return non-zero exit status if it
650 +fails, so mutt knows something's wrong.
655 +open-hook \\.gz$ "gzip -cd %f > %t"
658 +If the <emphasis>command</emphasis> is empty, this operation is
659 +disabled for this file type.
663 +<sect2 id="close-hook">
664 +<title>Write a compressed mailbox</title>
667 +Usage: <literal>close-hook</literal> <emphasis>regexp</emphasis> "<emphasis>command</emphasis>"
669 +This is used to close the folder that was open with the <link
670 +linkend="open-hook">open-hook</link> command after some changes were
673 +The <emphasis>command</emphasis> string is the command that can be
674 +used for closing the folders whose names match
675 +<emphasis>regexp</emphasis>. It has the same format as in the <link
676 +linkend="open-hook">open-hook</link> command. Temporary folder in this
677 +case is the folder previously produced by the <link
678 +linkend="open-hook">open-hook</link> command.
680 +The <emphasis>command</emphasis> should <emphasis
681 +role="bold">not</emphasis> remove the decompressed file. The
682 +<emphasis>command</emphasis> should return non-zero exit status if it
683 +fails, so mutt knows something's wrong.
688 +close-hook \\.gz$ "gzip -c %t > %f"
691 +If the <emphasis>command</emphasis> is empty, this operation is
692 +disabled for this file type, and the file can only be open in the
695 +<link linkend="close-hook">close-hook</link> is not called when you
696 +exit from the folder if the folder was not changed.
700 +<sect2 id="append-hook">
701 +<title>Append a message to a compressed mailbox</title>
704 +Usage: <literal>append-hook</literal> <emphasis>regexp</emphasis> "<emphasis>command</emphasis>"
706 +This command is used for saving to an existing compressed folder. The
707 +<emphasis>command</emphasis> is the command that can be used for
708 +appending to the folders whose names match
709 +<emphasis>regexp</emphasis>. It has the same format as in the <link
710 +linkend="open-hook">open-hook</link> command. The temporary folder in
711 +this case contains the messages that are being appended.
713 +The <emphasis>command</emphasis> should <emphasis
714 +role="bold">not</emphasis> remove the decompressed file. The
715 +<emphasis>command</emphasis> should return non-zero exit status if it
716 +fails, so mutt knows something's wrong.
721 +append-hook \\.gz$ "gzip -c %t >> %f"
724 +When <link linkend="append-hook">append-hook</link> is used, the folder
725 +is not opened, which saves time, but this means that we can not find
726 +out what the folder type is. Thus the default (<link
727 +linkend="mbox-type">$mbox_type</link>) type is always
728 +supposed (i.e. this is the format used for the temporary folder).
730 +If the file does not exist when you save to it, <link
731 +linkend="close-hook">close-hook</link> is called, and not <link
732 +linkend="append-hook">append-hook</link>. <link
733 +linkend="append-hook">append-hook</link> is only for appending to
736 +If the <emphasis>command</emphasis> is empty, this operation is
737 +disabled for this file type. In this case, the folder will be open and
738 +closed again (using <link linkend="open-hook">open-hook</link> and
739 +<link linkend="close-hook">close-hook</link>respectively) each time you
745 +<title>Encrypted folders</title>
748 +The compressed folders support can also be used to handle encrypted
749 +folders. If you want to encrypt a folder with PGP, you may want to use
750 +the following hooks:
753 +open-hook \\.pgp$ "pgp -f < %f > %t"
754 +close-hook \\.pgp$ "pgp -fe YourPgpUserIdOrKeyId < %t > %f"
757 +Please note, that PGP does not support appending to an encrypted
758 +folder, so there is no append-hook defined.
760 +If you are using GnuPG instead of PGP, you may use the following hooks
764 +open-hook \\.gpg$ "gpg --decrypt < %f > %t"
765 +close-hook \\.gpg$ "gpg --encrypt --recipient YourGpgUserIdOrKeyId < %t > %f"
768 +<emphasis role="bold">Note:</emphasis> the folder is temporary stored
769 +decrypted in the /tmp directory, where it can be read by your system
770 +administrator. So think about the security aspects of this.
777 <chapter id="mimesupport">
778 --- doc/muttrc.man.head.orig
779 +++ doc/muttrc.man.head
781 to a certain recipient. The meaning of "key ID" is to be taken
782 broadly: This can be a different e-mail address, a numerical key ID,
783 or even just an arbitrary search string.
786 +\fBopen-hook\fP \fIregexp\fP "\fIcommand\fP"
787 +\fBclose-hook\fP \fIregexp\fP "\fIcommand\fP"
788 +\fBappend-hook\fP \fIregexp\fP "\fIcommand\fP"
791 +These commands provide a way to handle compressed folders. The given
792 +\fBregexp\fP specifies which folders are taken as compressed (e.g.
793 +"\fI\\\\.gz$\fP"). The commands tell Mutt how to uncompress a folder
794 +(\fBopen-hook\fP), compress a folder (\fBclose-hook\fP) or append a
795 +compressed mail to a compressed folder (\fBappend-hook\fP). The
796 +\fIcommand\fP string is the
798 +like format string, and it should accept two parameters: \fB%f\fP,
799 +which is replaced with the (compressed) folder name, and \fB%t\fP
800 +which is replaced with the name of the temporary folder to which to
803 \fBpush\fP \fIstring\fP
804 This command adds the named \fIstring\fP to the keyboard buffer.
809 #include "mutt_crypt.h"
811 +#ifdef USE_COMPRESSED
812 +#include "compress.h"
819 memset (&pattern, 0, sizeof (pattern));
820 pattern.data = safe_strdup (path);
822 +#ifdef USE_COMPRESSED
823 + else if (data & (M_APPENDHOOK | M_OPENHOOK | M_CLOSEHOOK))
825 + if (mutt_test_compress_command (command.data))
827 + strfcpy (err->data, _("bad formatted command string"), err->dsize);
832 else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ACCOUNTHOOK))
833 && (!WithCrypto || !(data & M_CRYPTHOOK))
837 @@ -3119,6 +3119,11 @@
838 { "folder-hook", mutt_parse_hook, M_FOLDERHOOK },
839 { "group", parse_group, 0 },
840 { "ungroup", parse_ungroup, 0 },
841 +#ifdef USE_COMPRESSED
842 + { "open-hook", mutt_parse_hook, M_OPENHOOK },
843 + { "close-hook", mutt_parse_hook, M_CLOSEHOOK },
844 + { "append-hook", mutt_parse_hook, M_APPENDHOOK },
846 { "hdr_order", parse_list, UL &HeaderOrderList },
848 { "iconv-hook", mutt_parse_hook, M_ICONVHOOK },
856 +#ifdef USE_COMPRESSED
867 bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
868 mutt_SOURCES = $(BUILT_SOURCES) \
869 addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
870 - crypt.c cryptglue.c \
871 + crypt.c cryptglue.c compress.c \
872 commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \
873 edit.c enter.c flags.c init.c filter.c from.c \
874 getdomain.c group.c \
876 crypt-gpgme.c crypt-mod-pgp-gpgme.c crypt-mod-smime-gpgme.c
878 EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
879 - configure account.h \
880 + configure account.h compress.h \
881 attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \
882 globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
883 mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
890 +#ifdef USE_COMPRESSED
891 +#include "compress.h"
894 #include <sys/stat.h>
897 @@ -1014,6 +1018,12 @@
898 int mbox_close_mailbox (CONTEXT *ctx)
900 mx_unlock_file (ctx->path, fileno (ctx->fp), 1);
902 +#ifdef USE_COMPRESSED
903 + if (ctx->compressinfo)
904 + mutt_slow_close_compressed (ctx);
907 mutt_unblock_signals ();
908 mx_fastclose_mailbox (ctx);
913 #define M_ACCOUNTHOOK (1<<9)
914 #define M_REPLYHOOK (1<<10)
915 #define M_SEND2HOOK (1<<11)
916 +#ifdef USE_COMPRESSED
917 +#define M_OPENHOOK (1<<12)
918 +#define M_APPENDHOOK (1<<13)
919 +#define M_CLOSEHOOK (1<<14)
922 /* tree characters for linearize_tree and print_enriched_string */
923 #define M_TREE_LLCORNER 1
925 void *data; /* driver specific data */
926 #endif /* USE_IMAP */
928 +#ifdef USE_COMPRESSED
929 + void *compressinfo; /* compressed mbox module private data */
930 + char *realpath; /* path to compressed mailbox */
931 +#endif /* USE_COMPRESSED */
933 short magic; /* mailbox type */
935 unsigned int locked : 1; /* is the mailbox locked? */
942 +#ifdef USE_COMPRESSED
943 +#include "compress.h"
953 +#ifdef USE_COMPRESSED
954 + if (magic == 0 && mutt_can_read_compressed (path))
955 + return M_COMPRESSED;
964 +#ifdef USE_COMPRESSED
965 + /* special case for appending to compressed folders -
966 + * even if we can not open them for reading */
967 + if (mutt_can_append_compressed (ctx->path))
968 + mutt_open_append_compressed (ctx);
977 ctx->magic = mx_get_magic (path);
980 +#ifdef USE_COMPRESSED
981 + if (ctx->magic == M_COMPRESSED)
982 + mutt_open_read_compressed (ctx);
986 mutt_error (_("%s is not a mailbox."), path);
989 mutt_free_header (&ctx->hdrs[i]);
992 +#ifdef USE_COMPRESSED
993 + if (ctx->compressinfo)
994 + mutt_fast_close_compressed (ctx);
997 FREE (&ctx->pattern);
998 if (ctx->limit_pattern)
1000 if (tmp && tmp->new == 0)
1001 mutt_update_mailbox (tmp);
1004 +#ifdef USE_COMPRESSED
1005 + if (rc == 0 && ctx->compressinfo)
1006 + return mutt_sync_compressed (ctx);
1012 @@ -1017,6 +1047,11 @@
1013 !mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
1014 mx_unlink_empty (ctx->path);
1016 +#ifdef USE_COMPRESSED
1017 + if (ctx->compressinfo && mutt_slow_close_compressed (ctx))
1021 mx_fastclose_mailbox (ctx);
1024 @@ -1326,6 +1361,11 @@
1028 +#ifdef USE_COMPRESSED
1029 + if (ctx->compressinfo)
1030 + return mutt_check_mailbox_compressed (ctx);
1035 if (ctx->locked) lock = 0;
1042 +#ifdef USE_COMPRESSED
1047 WHERE short DefaultMagic INITVAL (M_MBOX);
1051 +patch-1.5.11.rr.compressed.1
1052 patch-1.5.6.tt.assumed_charset.1
1053 patch-1.5.6.dw.maildir-mtime.1
1056 @@ -1267,6 +1267,48 @@
1057 msgid "Failed to figure out sender"
1058 msgstr "Kann Absender nicht ermitteln"
1060 +#: compress.c:203 mbox.c:661
1061 +msgid "Mailbox was corrupted!"
1062 +msgstr "Mailbox wurde zerstört!"
1064 +#: compress.c:228 compress.c:253
1066 +msgid "Decompressing %s...\n"
1067 +msgstr "Entpacke %s...\n"
1069 +#: compress.c:246 compress.c:367 compress.c:443 mbox.c:706
1070 +msgid "Unable to lock mailbox!"
1071 +msgstr "Kann Mailbox nicht für exklusiven Zugriff sperren!"
1075 +msgid "Error executing: %s : unable to open the mailbox!\n"
1076 +msgstr "Fehler beim Ausführen von %s : Kann die Mailbox nicht öffnen!\n"
1078 +#: compress.c:350 compress.c:377 compress.c:423 compress.c:454
1080 +msgid "Compressing %s...\n"
1081 +msgstr "Komprimiere %s...\n"
1086 +"%s: Error compressing mailbox! Original mailbox deleted, uncompressed one "
1089 +"%s: Fehler beim Komprimieren der Mailbox! Ursprüngliche Mailbox gelöscht, "
1090 +"entpackte gespeichert!\n"
1092 +#: compress.c:425 compress.c:456
1094 +msgid "Compressed-appending to %s...\n"
1095 +msgstr "Hänge komprimiert an %s... an\n"
1099 +msgid " %s: Error compressing mailbox! Uncompressed one kept!\n"
1100 +msgstr " %s: Fehler beim packen der Mailbox! Entpackte Mailbox gespeichert!\n"
1104 msgid " (current time: %c)"
1105 @@ -1915,6 +1957,10 @@
1107 msgstr "Hilfe für %s"
1110 +msgid "bad formatted command string"
1111 +msgstr "Hook enthält nicht die Muster %f und %t"
1115 msgid "unhook: Can't do unhook * from within a hook."
1116 @@ -3422,18 +3468,10 @@
1117 msgid "Mailbox is corrupt!"
1118 msgstr "Mailbox fehlerhaft!"
1121 -msgid "Mailbox was corrupted!"
1122 -msgstr "Mailbox wurde zerstört!"
1124 #: mbox.c:701 mbox.c:952
1125 msgid "Fatal error! Could not reopen mailbox!"
1126 msgstr "Fataler Fehler, konnte Mailbox nicht erneut öffnen!"
1129 -msgid "Unable to lock mailbox!"
1130 -msgstr "Kann Mailbox nicht für exklusiven Zugriff sperren!"
1132 #. this means ctx->changed or ctx->deleted was set, but no
1133 #. * messages were found to be changed or deleted. This should
1134 #. * never happen, is we presume it is a bug in mutt.
1135 --- po/POTFILES.in.orig
1150 snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
1151 +#ifdef USE_COMPRESSED
1152 + if (Context && Context->compressinfo && Context->realpath)
1154 + strfcpy (tmp, Context->realpath, sizeof (tmp));
1155 + mutt_pretty_mailbox (tmp);
1159 if (Context && Context->path)
1161 strfcpy (tmp, Context->path, sizeof (tmp));