From f00d14dff502dac793deb8ee780e8e76de3cc936 Mon Sep 17 00:00:00 2001 From: misi3k Date: Sat, 14 Feb 2004 10:22:55 +0000 Subject: [PATCH] - updated to 1.4.2.1 Changed files: mutt-folder_columns.patch -> 1.2 mutt-rr.compressed.patch -> 1.5 --- mutt-folder_columns.patch | 193 +--- mutt-rr.compressed.patch | 1776 +------------------------------------ 2 files changed, 36 insertions(+), 1933 deletions(-) diff --git a/mutt-folder_columns.patch b/mutt-folder_columns.patch index 59ffc40..6957ce6 100644 --- a/mutt-folder_columns.patch +++ b/mutt-folder_columns.patch @@ -1,155 +1,15 @@ ---- mutt-1.3.23-orig/mutt_menu.h Sun Oct 28 19:35:26 2001 -+++ mutt-1.3.23/mutt_menu.h Tue Oct 30 16:45:06 2001 -@@ -45,6 +45,7 @@ - int menu; /* menu definition for keymap entries. */ - int offset; /* which screen row to start the index */ - int pagelen; /* number of entries per screen */ -+ int columns; /* number of columns in menu */ - int tagprefix; - - /* Setting dialog != NULL overrides normal menu behaviour. ---- mutt-1.3.23-orig/init.h Sun Oct 28 19:35:26 2001 -+++ mutt-1.3.23/init.h Tue Oct 30 22:49:46 2001 -@@ -499,6 +499,12 @@ - ** you use `+' or `=' for any other variables since expansion takes place - ** during the `set' command. - */ -+ { "folder_columns", DT_NUM, R_NONE, UL &FolderColumns, UL 1 }, -+ /* -+ ** .pp -+ ** Specifies the number of folder columns in folder browser. -+ ** -+ */ - { "folder_format", DT_STR, R_INDEX, UL &FolderFormat, UL "%2C %t %N %F %2l %-8.8u %-8.8g %8s %d %f" }, - /* - ** .pp ---- mutt-1.3.23-orig/globals.h Sun Oct 28 19:35:26 2001 -+++ mutt-1.3.23/globals.h Tue Oct 30 22:44:42 2001 -@@ -138,6 +138,7 @@ - WHERE unsigned short Counter INITVAL (0); - - WHERE short ConnectTimeout; -+WHERE short FolderColumns; - WHERE short HistSize; - WHERE short PagerContext; - WHERE short PagerIndexLines; ---- mutt-1.3.23-orig/browser.c Sun Oct 28 19:35:26 2001 -+++ mutt-1.3.23/browser.c Tue Oct 30 22:44:18 2001 -@@ -476,12 +476,13 @@ - } - - static void init_menu (struct browser_state *state, MUTTMENU *menu, char *title, -- size_t titlelen, int buffy) -+ size_t titlelen, int buffy, int columns) - { - char path[_POSIX_PATH_MAX]; - - menu->max = state->entrylen; -- -+ menu->columns = columns; -+ - if(menu->current >= menu->max) - menu->current = menu->max - 1; - if (menu->current < 0) -@@ -634,7 +635,7 @@ - menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER, - FolderHelp); - -- init_menu (&state, menu, title, sizeof (title), buffy); -+ init_menu (&state, menu, title, sizeof (title), buffy, FolderColumns); - - FOREVER - { -@@ -765,7 +766,7 @@ - } - menu->current = 0; - menu->top = 0; -- init_menu (&state, menu, title, sizeof (title), buffy); -+ init_menu (&state, menu, title, sizeof (title), buffy, 1); - break; - } - } -@@ -863,7 +864,7 @@ - menu->data = state.entry; - menu->current = 0; - menu->top = 0; -- init_menu (&state, menu, title, sizeof (title), buffy); -+ init_menu (&state, menu, title, sizeof (title), buffy, 1); - MAYBE_REDRAW (menu->redraw); - } - break; -@@ -893,7 +894,7 @@ - sizeof (struct folder_file) * (state.entrylen - (nentry+1))); - state.entrylen--; - mutt_message _("Mailbox deleted."); -- init_menu (&state, menu, title, sizeof (title), buffy); -+ init_menu (&state, menu, title, sizeof (title), buffy, 1); - MAYBE_REDRAW (menu->redraw); - } - } -@@ -933,7 +934,7 @@ - menu->data = state.entry; - menu->current = 0; - menu->top = 0; -- init_menu (&state, menu, title, sizeof (title), buffy); -+ init_menu (&state, menu, title, sizeof (title), buffy, 1); - } - else - #endif -@@ -947,7 +948,7 @@ - { - menu->current = 0; - menu->top = 0; -- init_menu (&state, menu, title, sizeof (title), buffy); -+ init_menu (&state, menu, title, sizeof (title), buffy, 1); - } - else - { -@@ -1010,12 +1011,12 @@ - state.imap_browse = 1; - imap_browse (LastDir, &state); - menu->data = state.entry; -- init_menu (&state, menu, title, sizeof (title), buffy); -+ init_menu (&state, menu, title, sizeof (title), buffy, 1); - } - else - #endif - if (examine_directory (menu, &state, LastDir, NULL) == 0) -- init_menu (&state, menu, title, sizeof (title), buffy); -+ init_menu (&state, menu, title, sizeof (title), buffy, 1); - else - { - mutt_error _("Error scanning directory."); -@@ -1099,7 +1100,7 @@ - #endif - else if (examine_directory (menu, &state, LastDir, prefix) == -1) - goto bail; -- init_menu (&state, menu, title, sizeof (title), buffy); -+ init_menu (&state, menu, title, sizeof (title), buffy, 1); - break; - - case OP_BROWSER_NEW_FILE: ---- mutt-1.3.23-orig/menu.c Sun Oct 28 19:35:26 2001 -+++ mutt-1.3.23/menu.c Wed Oct 31 09:30:28 2001 -@@ -126,14 +126,14 @@ +--- mutt-1.4.2.1/menu.c.orig 2004-02-14 11:15:52.874537592 +0100 ++++ mutt-1.4.2.1/menu.c 2004-02-14 11:17:58.135495032 +0100 +@@ -148,7 +148,7 @@ menu->make_entry (s, l, menu, i); } --void menu_pad_string (char *s, size_t l) +-void menu_pad_string (char *s, size_t n) +void menu_pad_string (MUTTMENU *menu, char *s, size_t l) { - size_t n = mutt_strlen (s); int shift = option (OPTARROWCURSOR) ? 3 : 0; - - l--; /* save room for the terminal \0 */ -- if (l > COLS - shift) -- l = COLS - shift; -+ if (l > (COLS / menu->columns) - shift) -+ l = (COLS / menu->columns) - shift; - - /* Let's just pad the string anyway ... */ - mutt_format_string (s, INT_MAX, l, l, 0, ' ', s, n, 1); -@@ -191,69 +191,89 @@ + int cols = COLS - shift; +@@ -196,69 +196,89 @@ menu->redraw &= ~REDRAW_STATUS; } @@ -186,12 +46,24 @@ - addstr ("->"); - attrset (menu->color (i)); - addch (' '); +- } +- else +- move (i - menu->top + menu->offset, 3); + menu_item_pos(menu, i, &row, &col); + if (i < menu->max) + { + menu_make_entry (buf, sizeof (buf), menu, i); + menu_pad_string (menu, buf, sizeof (buf)); -+ + +- print_enriched_string (menu->color(i), (unsigned char *) buf, 1); +- SETCOLOR (MT_COLOR_NORMAL); +- } +- else +- { +- if (i == menu->current) +- { +- SETCOLOR (MT_COLOR_INDICATOR); +- BKGDSET (MT_COLOR_INDICATOR); + if (option (OPTARROWCURSOR)) + { + attrset (menu->color (i)); @@ -239,19 +111,6 @@ + } + } } -- else -- move (i - menu->top + menu->offset, 3); -- -- print_enriched_string (menu->color(i), (unsigned char *) buf, 1); -- SETCOLOR (MT_COLOR_NORMAL); -- } -- else -- { -- if (i == menu->current) -- { -- SETCOLOR (MT_COLOR_INDICATOR); -- BKGDSET (MT_COLOR_INDICATOR); -- } - else - attrset (menu->color (i)); - @@ -288,7 +147,7 @@ SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); -@@ -265,16 +285,18 @@ +@@ -270,16 +290,18 @@ if (menu->redraw & REDRAW_MOTION_RESYNCH) { @@ -311,7 +170,7 @@ SETCOLOR (MT_COLOR_INDICATOR); addstr ("->"); SETCOLOR (MT_COLOR_NORMAL); -@@ -283,17 +305,19 @@ +@@ -288,17 +310,19 @@ { /* erase the current indicator */ attrset (menu->color (menu->oldcurrent)); @@ -335,7 +194,7 @@ print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); -@@ -304,21 +328,22 @@ +@@ -309,21 +333,22 @@ void menu_redraw_current (MUTTMENU *menu) { char buf[STRING]; @@ -362,7 +221,7 @@ print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 1); SETCOLOR (MT_COLOR_NORMAL); } -@@ -326,7 +351,7 @@ +@@ -331,7 +356,7 @@ { SETCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); @@ -371,7 +230,7 @@ print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); -@@ -355,18 +380,18 @@ +@@ -360,18 +385,18 @@ void menu_check_recenter (MUTTMENU *menu) { @@ -394,7 +253,7 @@ menu->redraw |= REDRAW_INDEX; } else if (menu->current < menu->top) -@@ -375,7 +400,7 @@ +@@ -380,7 +405,7 @@ menu->top = menu->current; else { @@ -403,7 +262,7 @@ if (menu->top < 0) menu->top = 0; } -@@ -666,6 +691,7 @@ +@@ -671,6 +696,7 @@ p->pagelen = PAGELEN; p->color = default_color; p->search = menu_search_generic; diff --git a/mutt-rr.compressed.patch b/mutt-rr.compressed.patch index b4fedac..d9b7206 100644 --- a/mutt-rr.compressed.patch +++ b/mutt-rr.compressed.patch @@ -1,30 +1,5 @@ -diff -Nur mutt-1.3.27.orig/Makefile.am mutt-1.3.27/Makefile.am ---- mutt-1.3.27.orig/Makefile.am Fri Nov 9 01:18:28 2001 -+++ mutt-1.3.27/Makefile.am Fri Feb 1 22:51:32 2002 -@@ -18,7 +18,8 @@ - bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@ - mutt_SOURCES = $(BUILT_SOURCES) \ - addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \ -- commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \ -+ commands.c complete.c compose.c compress.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 \ - handler.c hash.c hdrline.c headers.c help.c hook.c keymap.c \ - main.c mbox.c menu.c mh.c mx.c pager.c parse.c pattern.c \ -@@ -70,8 +71,8 @@ - browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c pgppacket.c - - EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h \ -- attach.h buffy.h charset.h copy.h dotlock.h functions.h gen_defs \ -- globals.h hash.h history.h init.h keymap.h \ -+ attach.h buffy.h charset.h compress.h copy.h dotlock.h functions.h \ -+ gen_defs globals.h hash.h history.h init.h keymap.h \ - mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \ - mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \ - mx.h pager.h pgp.h pop.h protos.h reldate.h rfc1524.h rfc2047.h \ -diff -Nur mutt-1.3.27.orig/Makefile.in mutt-1.3.27/Makefile.in ---- mutt-1.3.27.orig/Makefile.in Tue Jan 1 21:18:15 2002 -+++ mutt-1.3.27/Makefile.in Fri Feb 1 22:51:32 2002 +--- mutt-1.4.2.1/Makefile.in.orig 2004-02-12 09:52:26.000000000 +0100 ++++ mutt-1.4.2.1/Makefile.in 2004-02-14 11:14:52.096777216 +0100 @@ -117,7 +117,7 @@ BUILT_SOURCES = keymap_defs.h patchlist.c @@ -34,16 +9,19 @@ diff -Nur mutt-1.3.27.orig/Makefile.in mutt-1.3.27/Makefile.in mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) $(INTLLIBS) $(LIBICONV) -@@ -152,7 +152,7 @@ - EXTRA_mutt_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_tunnel.c pop.c pop_auth.c pop_lib.c pgp.c pgpinvoke.c pgpkey.c pgplib.c sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c pgppacket.c +@@ -151,9 +151,8 @@ + EXTRA_mutt_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_tunnel.c pop.c pop_auth.c pop_lib.c pgp.c pgpinvoke.c pgpkey.c pgplib.c sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c pgppacket.c --EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h attach.h buffy.h charset.h copy.h dotlock.h functions.h gen_defs globals.h hash.h history.h init.h keymap.h mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h mx.h pager.h pgp.h pop.h protos.h reldate.h rfc1524.h rfc2047.h rfc2231.h rfc822.h sha1.h sort.h mime.types VERSION prepare _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h mbyte.h lib.h extlib.c pgpewrap.c pgplib.h Muttrc.head Muttrc makedoc.c stamp-doc-rc README.SSL muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh +- +-EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h attach.h buffy.h charset.h copy.h dotlock.h functions.h gen_defs globals.h hash.h history.h init.h keymap.h mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h mx.h pager.h pgp.h pop.h protos.h reldate.h rfc1524.h rfc2047.h rfc2231.h rfc822.h sha1.h sort.h mime.types VERSION prepare _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h mbyte.h lib.h extlib.c pgpewrap.c pgplib.h Muttrc.head Muttrc makedoc.c stamp-doc-rc README.SSL muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh snprintf.c regex.c +- +EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h attach.h buffy.h charset.h compress.h copy.h dotlock.h functions.h gen_defs globals.h hash.h history.h init.h keymap.h mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h mx.h pager.h pgp.h pop.h protos.h reldate.h rfc1524.h rfc2047.h rfc2231.h rfc822.h sha1.h sort.h mime.types VERSION prepare _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h mbyte.h lib.h extlib.c pgpewrap.c pgplib.h Muttrc.head Muttrc makedoc.c stamp-doc-rc README.SSL muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh - ++ mutt_dotlock_SOURCES = mutt_dotlock.c -@@ -187,7 +187,7 @@ + mutt_dotlock_LDADD = @LIBOBJS@ +@@ -187,7 +186,7 @@ makedoc_OBJECTS = makedoc.o makedoc_LDFLAGS = mutt_OBJECTS = patchlist.o addrbook.o alias.o attach.o base64.o \ @@ -52,1737 +30,3 @@ diff -Nur mutt-1.3.27.orig/Makefile.in mutt-1.3.27/Makefile.in curs_lib.o curs_main.o date.o edit.o enter.o flags.o init.o filter.o \ from.o getdomain.o handler.o hash.o hdrline.o headers.o help.o hook.o \ keymap.o main.o mbox.o menu.o mh.o mx.o pager.o parse.o pattern.o \ -diff -Nur mutt-1.3.27.orig/Muttrc mutt-1.3.27/Muttrc ---- mutt-1.3.27.orig/Muttrc Tue Jan 1 21:18:05 2002 -+++ mutt-1.3.27/Muttrc Fri Feb 1 22:51:32 2002 -@@ -19,6 +19,15 @@ - macro index "!less /usr/local/doc/mutt/manual.txt\n" "Show Mutt documentation" - macro pager "!less /usr/local/doc/mutt/manual.txt\n" "Show Mutt documentation" - -+# Use folders which match on \\.gz$ as gzipped folders: -+# open-hook \\.gz$ "gzip -cd %f > %t" -+# close-hook \\.gz$ "gzip -c %t > %f" -+# append-hook \\.gz$ "gzip -c %t >> %f" -+ -+# open-hook \\.bz2$ "bzip2 -cd %f > %t" -+# close-hook \\.bz2$ "bzip2 -c %t > %f" -+# append-hook \\.bz2$ "bzip2 -c %t >> %f" -+ - # If Mutt is unable to determine your site's domain name correctly, you can - # set the default here. - # -diff -Nur mutt-1.3.27.orig/Muttrc.head mutt-1.3.27/Muttrc.head ---- mutt-1.3.27.orig/Muttrc.head Tue Jan 1 21:18:02 2002 -+++ mutt-1.3.27/Muttrc.head Fri Feb 1 22:51:32 2002 -@@ -19,6 +19,15 @@ - macro index "!less /usr/local/doc/mutt/manual.txt\n" "Show Mutt documentation" - macro pager "!less /usr/local/doc/mutt/manual.txt\n" "Show Mutt documentation" - -+# Use folders which match on \\.gz$ as gzipped folders: -+# open-hook \\.gz$ "gzip -cd %f > %t" -+# close-hook \\.gz$ "gzip -c %t > %f" -+# append-hook \\.gz$ "gzip -c %t >> %f" -+ -+# open-hook \\.bz2$ "bzip2 -cd %f > %t" -+# close-hook \\.bz2$ "bzip2 -c %t > %f" -+# append-hook \\.bz2$ "bzip2 -c %t >> %f" -+ - # If Mutt is unable to determine your site's domain name correctly, you can - # set the default here. - # -diff -Nur mutt-1.3.27.orig/Muttrc.head.in mutt-1.3.27/Muttrc.head.in ---- mutt-1.3.27.orig/Muttrc.head.in Mon Mar 20 11:25:49 2000 -+++ mutt-1.3.27/Muttrc.head.in Fri Feb 1 22:51:32 2002 -@@ -19,6 +19,15 @@ - macro index "!less @docdir@/manual.txt\n" "Show Mutt documentation" - macro pager "!less @docdir@/manual.txt\n" "Show Mutt documentation" - -+# Use folders which match on \\.gz$ as gzipped folders: -+# open-hook \\.gz$ "gzip -cd %f > %t" -+# close-hook \\.gz$ "gzip -c %t > %f" -+# append-hook \\.gz$ "gzip -c %t >> %f" -+ -+# open-hook \\.bz2$ "bzip2 -cd %f > %t" -+# close-hook \\.bz2$ "bzip2 -c %t > %f" -+# append-hook \\.bz2$ "bzip2 -c %t >> %f" -+ - # If Mutt is unable to determine your site's domain name correctly, you can - # set the default here. - # -diff -Nur mutt-1.3.27.orig/PATCHES mutt-1.3.27/PATCHES ---- mutt-1.3.27.orig/PATCHES Mon Nov 26 20:16:22 2001 -+++ mutt-1.3.27/PATCHES Fri Feb 1 22:51:32 2002 -@@ -0,0 +1 @@ -+patch-1.3.27.rr.compressed.1 -diff -Nur mutt-1.3.27.orig/compress.c mutt-1.3.27/compress.c ---- mutt-1.3.27.orig/compress.c Thu Jan 1 01:00:00 1970 -+++ mutt-1.3.27/compress.c Fri Feb 1 22:51:32 2002 -@@ -0,0 +1,483 @@ -+/* -+ * Copyright (C) 1997 Alain Penders -+ * -+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include "mutt.h" -+ -+#ifdef USE_COMPRESSED -+ -+#include "mx.h" -+#include "mailbox.h" -+#include "mutt_curses.h" -+ -+#include -+#include -+#include -+#include -+ -+typedef struct -+{ -+ const char *close; /* close-hook command */ -+ const char *open; /* open-hook command */ -+ const char *append; /* append-hook command */ -+ off_t size; /* size of real folder */ -+} COMPRESS_INFO; -+ -+ -+/* -+ * ctx - context to lock -+ * excl - exclusive lock? -+ * retry - should retry if unable to lock? -+ */ -+int mbox_lock_compressed (CONTEXT *ctx, FILE *fp, int excl, int retry) -+{ -+ int r; -+ -+ if ((r = mx_lock_file (ctx->realpath, fileno (fp), excl, 1, retry)) == 0) -+ ctx->locked = 1; -+ else if (retry && !excl) -+ { -+ ctx->readonly = 1; -+ return 0; -+ } -+ -+ return (r); -+} -+ -+void mbox_unlock_compressed (CONTEXT *ctx, FILE *fp) -+{ -+ if (ctx->locked) -+ { -+ fflush (fp); -+ -+ mx_unlock_file (ctx->realpath, fileno (fp), 1); -+ ctx->locked = 0; -+ } -+} -+ -+static int is_new (const char *path) -+{ -+ return (access (path, W_OK) != 0 && errno == ENOENT) ? 1 : 0; -+} -+ -+static const char* find_compress_hook (int type, const char *path) -+{ -+ const char* c = mutt_find_hook (type, path); -+ return (!c || !*c) ? NULL : c; -+} -+ -+int mutt_can_read_compressed (const char *path) -+{ -+ return find_compress_hook (M_OPENHOOK, path) ? 1 : 0; -+} -+ -+/* -+ * if the file is new, we really do not append, but create, and so use -+ * close-hook, and not append-hook -+ */ -+static const char* get_append_command (const char *path, const CONTEXT* ctx) -+{ -+ COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; -+ return (is_new (path)) ? ci->close : ci->append; -+} -+ -+int mutt_can_append_compressed (const char *path) -+{ -+ int magic; -+ -+ if (is_new (path)) -+ return (find_compress_hook (M_CLOSEHOOK, path) ? 1 : 0); -+ -+ magic = mx_get_magic (path); -+ -+ if (magic != 0 && magic != M_COMPRESSED) -+ return 0; -+ -+ return (find_compress_hook (M_APPENDHOOK, path) -+ || (find_compress_hook (M_OPENHOOK, path) -+ && find_compress_hook (M_CLOSEHOOK, path))) ? 1 : 0; -+} -+ -+/* open a compressed mailbox */ -+static COMPRESS_INFO *set_compress_info (CONTEXT *ctx) -+{ -+ COMPRESS_INFO *ci; -+ -+ /* Now lets uncompress this thing */ -+ ci = safe_malloc (sizeof (COMPRESS_INFO)); -+ ctx->compressinfo = (void*) ci; -+ ci->append = find_compress_hook (M_APPENDHOOK, ctx->path); -+ ci->open = find_compress_hook (M_OPENHOOK, ctx->path); -+ ci->close = find_compress_hook (M_CLOSEHOOK, ctx->path); -+ return ci; -+} -+ -+static void set_path (CONTEXT* ctx) -+{ -+ char tmppath[_POSIX_PATH_MAX]; -+ -+ /* Setup the right paths */ -+ ctx->realpath = ctx->path; -+ -+ /* Uncompress to /tmp */ -+ mutt_mktemp (tmppath); -+ ctx->path = safe_malloc (strlen (tmppath) + 1); -+ strcpy (ctx->path, tmppath); -+} -+ -+static int get_size (const char* path) -+{ -+ struct stat sb; -+ if (stat (path, &sb) != 0) -+ return 0; -+ return (sb.st_size); -+} -+ -+static void store_size (CONTEXT* ctx) -+{ -+ COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; -+ ci->size = get_size (ctx->realpath); -+} -+ -+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) -+{ -+ char tmp[SHORT_STRING]; -+ -+ CONTEXT *ctx = (CONTEXT *) data; -+ switch (op) -+ { -+ case 'f': -+ snprintf (tmp, sizeof (tmp), "%%%ss", fmt); -+ snprintf (dest, destlen, tmp, ctx->realpath); -+ break; -+ case 't': -+ snprintf (tmp, sizeof (tmp), "%%%ss", fmt); -+ snprintf (dest, destlen, tmp, ctx->path); -+ break; -+ } -+ return (src); -+} -+ -+/* -+ * check that the command has both %f and %t -+ * 0 means OK, -1 means error -+ */ -+int mutt_test_compress_command (const char* cmd) -+{ -+ return (strstr (cmd, "%f") && strstr (cmd, "%t")) ? 0 : -1; -+} -+ -+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); -+ return safe_strdup (expanded); -+} -+ -+int mutt_check_mailbox_compressed (CONTEXT* ctx) -+{ -+ COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; -+ if (ci->size != get_size (ctx->realpath)) -+ { -+ safe_free ((void**)&ctx->compressinfo); -+ safe_free ((void**)&ctx->realpath); -+ mutt_error _("Mailbox was corrupted!"); -+ return (-1); -+ } -+ return (0); -+} -+ -+int mutt_open_read_compressed (CONTEXT *ctx) -+{ -+ char *cmd; -+ FILE *fp; -+ int rc; -+ -+ COMPRESS_INFO *ci = set_compress_info (ctx); -+ if (!ci->open) { -+ ctx->magic = 0; -+ safe_free ((void**)ctx->compressinfo); -+ return (-1); -+ } -+ if (!ci->close || access (ctx->path, W_OK) != 0) -+ ctx->readonly = 1; -+ -+ set_path (ctx); -+ store_size (ctx); -+ -+ if (!ctx->quiet) -+ mutt_message (_("Decompressing %s..."), ctx->realpath); -+ -+ cmd = get_compression_cmd (ci->open, ctx); -+ if (cmd == NULL) -+ return (-1); -+ dprint (2, (debugfile, "DecompressCmd: '%s'\n", cmd)); -+ -+ if ((fp = fopen (ctx->realpath, "r")) == NULL) -+ { -+ mutt_perror (ctx->realpath); -+ safe_free ((void **)&cmd); -+ return (-1); -+ } -+ mutt_block_signals (); -+ if (mbox_lock_compressed (ctx, fp, 0, 1) == -1) -+ { -+ fclose (fp); -+ mutt_unblock_signals (); -+ mutt_error _("Unable to lock mailbox!"); -+ safe_free ((void **)&cmd); -+ return (-1); -+ } -+ -+ endwin (); -+ fflush (stdout); -+ fprintf (stderr, _("Decompressing %s...\n"),ctx->realpath); -+ rc = mutt_system (cmd); -+ mbox_unlock_compressed (ctx, fp); -+ mutt_unblock_signals (); -+ fclose (fp); -+ -+ if (rc) -+ { -+ mutt_any_key_to_continue (NULL); -+ ctx->magic = 0; -+ safe_free ((void**)ctx->compressinfo); -+ mutt_error (_("Error executing: %s : unable to open the mailbox!\n"), cmd); -+ } -+ safe_free ((void **)&cmd); -+ if (rc) -+ return (-1); -+ -+ if (mutt_check_mailbox_compressed (ctx)) -+ return (-1); -+ -+ ctx->magic = mx_get_magic (ctx->path); -+ -+ return (0); -+} -+ -+void restore_path (CONTEXT* ctx) -+{ -+ safe_free ((void **)&ctx->path); -+ ctx->path = ctx->realpath; -+} -+ -+/* remove the temporary mailbox */ -+void remove_file (CONTEXT* ctx) -+{ -+ if (ctx->magic == M_MBOX || ctx->magic == M_MMDF) -+ remove (ctx->path); -+} -+ -+int mutt_open_append_compressed (CONTEXT *ctx) -+{ -+ FILE *fh; -+ COMPRESS_INFO *ci = set_compress_info (ctx); -+ -+ if (!get_append_command (ctx->path, ctx)) -+ { -+ if (ci->open && ci->close) -+ return (mutt_open_read_compressed (ctx)); -+ -+ ctx->magic = 0; -+ safe_free ((void**)&ctx->compressinfo); -+ return (-1); -+ } -+ -+ 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 */ -+ -+ return (0); -+} -+ -+/* close a compressed mailbox */ -+void mutt_fast_close_compressed (CONTEXT *ctx) -+{ -+ dprint (2, (debugfile, "mutt_fast_close_compressed called on '%s'\n", -+ ctx->path)); -+ -+ if (ctx->compressinfo) -+ { -+ if (ctx->fp) -+ 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) -+ && ! option (OPTSAVEEMPTY)) -+ remove (ctx->realpath); -+ else -+ remove_file (ctx); -+ -+ restore_path (ctx); -+ safe_free ((void**)&ctx->compressinfo); -+ } -+} -+ -+/* return 0 on success, -1 on failure */ -+int mutt_sync_compressed (CONTEXT* ctx) -+{ -+ char *cmd; -+ int rc = 0; -+ FILE *fp; -+ COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; -+ -+ if (!ctx->quiet) -+ mutt_message (_("Compressing %s..."), ctx->realpath); -+ -+ cmd = get_compression_cmd (ci->close, ctx); -+ if (cmd == NULL) -+ return (-1); -+ -+ if ((fp = fopen (ctx->realpath, "a")) == NULL) -+ { -+ mutt_perror (ctx->realpath); -+ safe_free ((void **)&cmd); -+ return (-1); -+ } -+ mutt_block_signals (); -+ if (mbox_lock_compressed (ctx, fp, 1, 1) == -1) -+ { -+ fclose (fp); -+ mutt_unblock_signals (); -+ mutt_error _("Unable to lock mailbox!"); -+ store_size (ctx); -+ safe_free ((void **)&cmd); -+ return (-1); -+ } -+ -+ dprint (2, (debugfile, "CompressCommand: '%s'\n", cmd)); -+ -+ endwin (); -+ fflush (stdout); -+ fprintf (stderr, _("Compressing %s...\n"), ctx->realpath); -+ if (mutt_system (cmd)) -+ { -+ mutt_any_key_to_continue (NULL); -+ mutt_error (_("%s: Error compressing mailbox! Original mailbox deleted, uncompressed one kept!\n"), ctx->path); -+ rc = -1; -+ } -+ -+ mbox_unlock_compressed (ctx, fp); -+ mutt_unblock_signals (); -+ fclose (fp); -+ -+ safe_free ((void **)&cmd); -+ -+ store_size (ctx); -+ -+ return (rc); -+} -+ -+int mutt_slow_close_compressed (CONTEXT *ctx) -+{ -+ FILE *fp; -+ const char *append; -+ char *cmd; -+ COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; -+ -+ dprint (2, (debugfile, "mutt_slow_close_compressed called on '%s'\n", -+ ctx->path)); -+ -+ 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); -+ return (0); -+ } -+ -+ if (ctx->fp) -+ fclose (ctx->fp); -+ ctx->fp = NULL; -+ -+ if (!ctx->quiet) -+ { -+ if (append == ci->close) -+ mutt_message (_("Compressing %s..."), ctx->realpath); -+ else -+ mutt_message (_("Compressed-appending to %s..."), ctx->realpath); -+ } -+ -+ cmd = get_compression_cmd (append, ctx); -+ if (cmd == NULL) -+ return (-1); -+ -+ if ((fp = fopen (ctx->realpath, "a")) == NULL) -+ { -+ mutt_perror (ctx->realpath); -+ safe_free ((void **)&cmd); -+ return (-1); -+ } -+ mutt_block_signals (); -+ if (mbox_lock_compressed (ctx, fp, 1, 1) == -1) -+ { -+ fclose (fp); -+ mutt_unblock_signals (); -+ mutt_error _("Unable to lock mailbox!"); -+ safe_free ((void **)&cmd); -+ return (-1); -+ } -+ -+ dprint (2, (debugfile, "CompressCmd: '%s'\n", cmd)); -+ -+ endwin (); -+ fflush (stdout); -+ -+ if (append == ci->close) -+ fprintf (stderr, _("Compressing %s...\n"), ctx->realpath); -+ else -+ fprintf (stderr, _("Compressed-appending to %s...\n"), ctx->realpath); -+ -+ if (mutt_system (cmd)) -+ { -+ mutt_any_key_to_continue (NULL); -+ mutt_error (_(" %s: Error compressing mailbox! Uncompressed one kept!\n"), -+ ctx->path); -+ safe_free ((void **)&cmd); -+ mbox_unlock_compressed (ctx, fp); -+ mutt_unblock_signals (); -+ fclose (fp); -+ return (-1); -+ } -+ -+ mbox_unlock_compressed (ctx, fp); -+ mutt_unblock_signals (); -+ fclose (fp); -+ remove_file (ctx); -+ restore_path (ctx); -+ safe_free ((void **)&cmd); -+ safe_free ((void **)&ctx->compressinfo); -+ -+ return (0); -+} -+ -+#endif /* USE_COMPRESSED */ -diff -Nur mutt-1.3.27.orig/compress.h mutt-1.3.27/compress.h ---- mutt-1.3.27.orig/compress.h Thu Jan 1 01:00:00 1970 -+++ mutt-1.3.27/compress.h Fri Feb 1 22:51:32 2002 -@@ -0,0 +1,27 @@ -+/* -+ * Copyright (C) 1997 Alain Penders -+ * -+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+int mutt_can_read_compressed (const char *); -+int mutt_can_append_compressed (const char *); -+int mutt_open_read_compressed (CONTEXT *); -+int mutt_open_append_compressed (CONTEXT *); -+int mutt_slow_close_compressed (CONTEXT *); -+int mutt_sync_compressed (CONTEXT *); -+int mutt_test_compress_command (const char *); -+int mutt_check_mailbox_compressed (CONTEXT *); -+void mutt_fast_close_compressed (CONTEXT *); -diff -Nur mutt-1.3.27.orig/config.h.in mutt-1.3.27/config.h.in ---- mutt-1.3.27.orig/config.h.in Fri Aug 3 18:52:17 2001 -+++ mutt-1.3.27/config.h.in Fri Feb 1 22:52:59 2002 -@@ -151,6 +151,9 @@ - /* Define to enable Sun mailtool attachments support. */ - #undef SUN_ATTACHMENT - -+/* Define to enable compressed mailboxes support */ -+#undef USE_COMPRESSED -+ - /* Define if the result of isprint() is unreliable. */ - #undef LOCALES_HACK - -diff -Nur mutt-1.3.27.orig/configure mutt-1.3.27/configure ---- mutt-1.3.27.orig/configure Tue Jan 1 21:17:56 2002 -+++ mutt-1.3.27/configure Fri Feb 1 22:51:32 2002 -@@ -60,6 +60,8 @@ - ac_help="$ac_help - --enable-locales-fix The result of isprint() is unreliable " - ac_help="$ac_help -+ --enable-compressed Enable compressed folders support " -+ac_help="$ac_help - --with-exec-shell=SHELL Specify alternate shell (ONLY if /bin/sh is broken)" - ac_help="$ac_help - --enable-exact-address Enable regeneration of email addresses" -@@ -5793,6 +5795,18 @@ - EOF - - fi -+fi -+ -+ -+# Check whether --enable-compressed or --disable-compressed was given. -+if test "${enable_compressed+set}" = set; then -+ enableval="$enable_compressed" -+ if test x$enableval = xyes; then -+ cat >> confdefs.h <<\EOF -+#define USE_COMPRESSED 1 -+EOF -+ -+ fi - fi - - -diff -Nur mutt-1.3.27.orig/configure.in mutt-1.3.27/configure.in ---- mutt-1.3.27.orig/configure.in Fri Feb 1 22:51:17 2002 -+++ mutt-1.3.27/configure.in Fri Feb 1 22:51:32 2002 -@@ -644,6 +644,11 @@ - AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ]) - fi]) - -+AC_ARG_ENABLE(compressed, [ --enable-compressed Enable compressed folders support ], -+ [if test x$enableval = xyes; then -+ AC_DEFINE(USE_COMPRESSED,1, [ Define to support compressed folders. ]) -+ fi]) -+ - AC_ARG_WITH(exec-shell, [ --with-exec-shell=SHELL Specify alternate shell (ONLY if /bin/sh is broken)], - [if test $withval != yes; then - AC_DEFINE_UNQUOTED(EXECSHELL, "$withval") -diff -Nur mutt-1.3.27.orig/curs_main.c mutt-1.3.27/curs_main.c ---- mutt-1.3.27.orig/curs_main.c Wed Jan 23 00:42:01 2002 -+++ mutt-1.3.27/curs_main.c Fri Feb 1 22:51:32 2002 -@@ -1010,6 +1010,11 @@ - { - int check; - -+#ifdef USE_COMPRESSED -+ if (Context->compressinfo && Context->realpath) -+ mutt_str_replace (&LastFolder, Context->realpath); -+ else -+#endif - mutt_str_replace (&LastFolder, Context->path); - oldcount = Context ? Context->msgcount : 0; - -diff -Nur mutt-1.3.27.orig/doc/manual-6.html mutt-1.3.27/doc/manual-6.html ---- mutt-1.3.27.orig/doc/manual-6.html Tue Jan 1 21:18:13 2002 -+++ mutt-1.3.27/doc/manual-6.html Fri Feb 1 22:51:32 2002 -@@ -70,12 +70,16 @@ -
  • - alternative_order mimetype [ mimetype ... ]
  • -
  • -+append-hook regexp "command"
  • -+
  • - auto_view mimetype [ mimetype ... ]
  • -
  • - bind map key function
  • -
  • - charset-hook alias charset
  • -
  • -+close-hook regexp "command"
  • -+
  • - color object foreground background [ regexp ]
  • -
  • - uncolor index pattern [ pattern ... ]
  • -@@ -118,6 +122,8 @@ -
  • - unmy_hdr field [ field ... ]
  • -
  • -+open-hook regexp "command"
  • -+
  • - pgp-hook pattern key-id
  • -
  • - push string
  • -diff -Nur mutt-1.3.27.orig/doc/manual.sgml mutt-1.3.27/doc/manual.sgml ---- mutt-1.3.27.orig/doc/manual.sgml Tue Jan 1 21:18:05 2002 -+++ mutt-1.3.27/doc/manual.sgml Fri Feb 1 22:51:32 2002 -@@ -2318,6 +2318,176 @@ - macro pager \cb |urlview\n - - -+Compressed folders Support (OPTIONAL) -+

    -+ -+If Mutt was compiled with compressed folders support (by running the -+, -+ and ) which define commands to uncompress and compress -+a folder and to append messages to an existing compressed folder -+respectively. -+ -+For example: -+ -+ -+open-hook \\.gz$ "gzip -cd %f > %t" -+close-hook \\.gz$ "gzip -c %t > %f" -+append-hook \\.gz$ "gzip -c %t >> %f" -+ -+ -+You do not have to specify all of the commands. If you omit , the folder will be open and -+closed again each time you will add to it. If you omit (or give empty command) , the -+folder will be open in the mode. If you specify though you'll be able to append -+to the folder. -+ -+Note that Mutt will only try to use hooks if the file is not in one of -+the accepted formats. In particular, if the file is empty, mutt -+supposes it is not compressed. This is important because it allows the -+use of programs that do not have well defined extensions. Just use -+&dquot;.&dquot; as a regexp. But this may be surprising if your -+compressing script produces empty files. In this situation, unset , so that the compressed file -+will be removed if you delete all of the messages. -+ -+Open a compressed mailbox for reading

    -+Usage: -+open-hook \\.gz$ "gzip -cd %f > %t" -+ -+ -+If the Write a compressed mailbox

    -+Usage: command after some changes were made to it. -+ -+The command. Temporary folder -+in this case is the folder previously produced by the command. -+ -+The -+close-hook \\.gz$ "gzip -c %t > %f" -+ -+ -+If the is not called when you exit -+from the folder if the folder was not changed. -+ -+Append a message to a compressed mailbox

    -+Usage: command. -+The temporary folder in this case contains the messages that are being -+appended. -+ -+The -+append-hook \\.gz$ "gzip -c %t >> %f" -+ -+ -+When is used, the folder is -+not opened, which saves time, but this means that we can not find out -+what the folder type is. Thus the default () type is always supposed (i.e. -+this is the format used for the temporary folder). -+ -+If the file does not exist when you save to it, is called, and not . is only -+for appending to existing folders. -+ -+If the and respectively) each time you will add to it. -+ -+Encrypted folders -+

    -+The compressed folders support can also be used to handle encrypted -+folders. If you want to encrypt a folder with PGP, you may want to use -+the following hooks: -+ -+ -+open-hook \\.pgp$ "pgp -f < %f > %t" -+close-hook \\.pgp$ "pgp -fe YourPgpUserIdOrKeyId < %t > %f" -+ -+ -+Please note, that PGP does not support appending to an encrypted -+folder, so there is no append-hook defined. -+ -+If you are using GnuPG instead of PGP, you may use the following hooks -+instead: -+ -+ -+open-hook \\.gpg$ "gpg --decrypt < %f > %t" -+close-hook \\.gpg$ "gpg --encrypt --recipient YourGpgUserIdOrKeyId < %t > %f" -+ -+ -+Mutt's MIME Support -

    - Quite a bit of effort has been made to make Mutt the premier text-mode -@@ -2868,12 +3038,16 @@ - - -+ - - - -+ - - - -+ - - - -+Compressed folders Support (OPTIONAL) -+

    -+ -+If Mutt was compiled with compressed folders support (by running the -+, -+ and ) which define commands to uncompress and compress -+a folder and to append messages to an existing compressed folder -+respectively. -+ -+For example: -+ -+ -+open-hook \\.gz$ "gzip -cd %f > %t" -+close-hook \\.gz$ "gzip -c %t > %f" -+append-hook \\.gz$ "gzip -c %t >> %f" -+ -+ -+You do not have to specify all of the commands. If you omit , the folder will be open and -+closed again each time you will add to it. If you omit (or give empty command) , the -+folder will be open in the mode. If you specify though you'll be able to append -+to the folder. -+ -+Note that Mutt will only try to use hooks if the file is not in one of -+the accepted formats. In particular, if the file is empty, mutt -+supposes it is not compressed. This is important because it allows the -+use of programs that do not have well defined extensions. Just use -+&dquot;.&dquot; as a regexp. But this may be surprising if your -+compressing script produces empty files. In this situation, unset , so that the compressed file -+will be removed if you delete all of the messages. -+ -+Open a compressed mailbox for reading

    -+Usage: -+open-hook \\.gz$ "gzip -cd %f > %t" -+ -+ -+If the Write a compressed mailbox

    -+Usage: command after some changes were made to it. -+ -+The command. Temporary folder -+in this case is the folder previously produced by the command. -+ -+The -+close-hook \\.gz$ "gzip -c %t > %f" -+ -+ -+If the is not called when you exit -+from the folder if the folder was not changed. -+ -+Append a message to a compressed mailbox

    -+Usage: command. -+The temporary folder in this case contains the messages that are being -+appended. -+ -+The -+append-hook \\.gz$ "gzip -c %t >> %f" -+ -+ -+When is used, the folder is -+not opened, which saves time, but this means that we can not find out -+what the folder type is. Thus the default () type is always supposed (i.e. -+this is the format used for the temporary folder). -+ -+If the file does not exist when you save to it, is called, and not . is only -+for appending to existing folders. -+ -+If the and respectively) each time you will add to it. -+ -+Encrypted folders -+

    -+The compressed folders support can also be used to handle encrypted -+folders. If you want to encrypt a folder with PGP, you may want to use -+the following hooks: -+ -+ -+open-hook \\.pgp$ "pgp -f < %f > %t" -+close-hook \\.pgp$ "pgp -fe YourPgpUserIdOrKeyId < %t > %f" -+ -+ -+Please note, that PGP does not support appending to an encrypted -+folder, so there is no append-hook defined. -+ -+If you are using GnuPG instead of PGP, you may use the following hooks -+instead: -+ -+ -+open-hook \\.gpg$ "gpg --decrypt < %f > %t" -+close-hook \\.gpg$ "gpg --encrypt --recipient YourGpgUserIdOrKeyId < %t > %f" -+ -+ -+Mutt's MIME Support -

    - Quite a bit of effort has been made to make Mutt the premier text-mode -@@ -2869,12 +3039,16 @@ - - -+ - - - -+ - - - -+ - - %t" -+ close-hook \\.gz$ "gzip -c %t > %f" -+ append-hook \\.gz$ "gzip -c %t >> %f" -+ -+ You do not have to specify all of the commands. If you omit ``append- -+ hook'', the folder will be open and closed again each time you will -+ add to it. If you omit ``close-hook'' (or give empty command) , the -+ folder will be open in the mode. If you specify ``append-hook'' -+ though you'll be able to append to the folder. -+ -+ Note that Mutt will only try to use hooks if the file is not in one of -+ the accepted formats. In particular, if the file is empty, mutt -+ supposes it is not compressed. This is important because it allows the -+ use of programs that do not have well defined extensions. Just use "." -+ as a regexp. But this may be surprising if your compressing script -+ produces empty files. In this situation, unset ``$save_empty'', so -+ that the compressed file will be removed if you delete all of the -+ messages. -+ -+ 44..1144..11.. OOppeenn aa ccoommpprreesssseedd mmaaiillbbooxx ffoorr rreeaaddiinngg -+ -+ Usage: open-hook _r_e_g_e_x_p "_c_o_m_m_a_n_d" -+ -+ The _c_o_m_m_a_n_d is the command that can be used for opening the folders -+ whose names match _r_e_g_e_x_p. -+ -+ The _c_o_m_m_a_n_d string is the printf-like format string, and it should -+ accept two parameters: %f, which is replaced with the (compressed) -+ folder name, and %t which is replaced with the name of the temporary -+ folder to which to write. -+ -+ %f and %t can be repeated any number of times in the command string, -+ and all of the entries are replaced with the appropriate folder name. -+ In addition, %% is replaced by %, as in printf, and any other -+ %anything is left as is. -+ -+ The _c_o_m_m_a_n_d should nnoott remove the original compressed file. The -+ _c_o_m_m_a_n_d should return non-zero exit status if it fails, so mutt knows -+ something's wrong. -+ -+ Example: -+ -+ open-hook \\.gz$ "gzip -cd %f > %t" -+ -+ If the _c_o_m_m_a_n_d is empty, this operation is disabled for this file -+ type. -+ -+ 44..1144..22.. WWrriittee aa ccoommpprreesssseedd mmaaiillbbooxx -+ -+ Usage: close-hook _r_e_g_e_x_p "_c_o_m_m_a_n_d" -+ -+ This is used to close the folder that was open with the ``open-hook'' -+ command after some changes were made to it. -+ -+ The _c_o_m_m_a_n_d string is the command that can be used for closing the -+ folders whose names match _r_e_g_e_x_p. It has the same format as in the -+ ``open-hook'' command. Temporary folder in this case is the folder -+ previously produced by the ``open-hook'' command. -+ -+ The _c_o_m_m_a_n_d should nnoott remove the decompressed file. The _c_o_m_m_a_n_d -+ should return non-zero exit status if it fails, so mutt knows -+ something's wrong. -+ -+ Example: -+ -+ close-hook \\.gz$ "gzip -c %t > %f" -+ -+ If the _c_o_m_m_a_n_d is empty, this operation is disabled for this file -+ type, and the file can only be open in the read-only mode. -+ -+ ``close-hook'' is not called when you exit from the folder if the -+ folder was not changed. -+ -+ 44..1144..33.. AAppppeenndd aa mmeessssaaggee ttoo aa ccoommpprreesssseedd mmaaiillbbooxx -+ -+ Usage: append-hook _r_e_g_e_x_p "_c_o_m_m_a_n_d" -+ -+ This command is used for saving to an existing compressed folder. The -+ _c_o_m_m_a_n_d is the command that can be used for appending to the folders -+ whose names match _r_e_g_e_x_p. It has the same format as in the ``open- -+ hook'' command. The temporary folder in this case contains the -+ messages that are being appended. -+ -+ The _c_o_m_m_a_n_d should nnoott remove the decompressed file. The _c_o_m_m_a_n_d -+ should return non-zero exit status if it fails, so mutt knows -+ something's wrong. -+ -+ Example: -+ -+ append-hook \\.gz$ "gzip -c %t >> %f" -+ -+ When ``append-hook'' is used, the folder is not opened, which saves -+ time, but this means that we can not find out what the folder type is. -+ Thus the default (``$mbox_type'') type is always supposed (i.e. this -+ is the format used for the temporary folder). -+ -+ If the file does not exist when you save to it, ``close-hook'' is -+ called, and not ``append-hook''. ``append-hook'' is only for appending -+ to existing folders. -+ -+ If the _c_o_m_m_a_n_d is empty, this operation is disabled for this file -+ type. In this case, the folder will be open and closed again (using -+ ``open-hook'' and ``close-hook''respectively) each time you will add -+ to it. -+ -+ 44..1144..44.. EEnnccrryypptteedd ffoollddeerrss -+ -+ The compressed folders support can also be used to handle encrypted -+ folders. If you want to encrypt a folder with PGP, you may want to use -+ the following hooks: -+ -+ open-hook \\.pgp$ "pgp -f < %f > %t" -+ close-hook \\.pgp$ "pgp -fe YourPgpUserIdOrKeyId < %t > %f" -+ -+ Please note, that PGP does not support appending to an encrypted -+ folder, so there is no append-hook defined. -+ -+ If you are using GnuPG instead of PGP, you may use the following hooks -+ instead: -+ -+ open-hook \\.gpg$ "gpg --decrypt < %f > %t" -+ close-hook \\.gpg$ "gpg --encrypt --recipient YourGpgUserIdOrKeyId < %t > %f" -+ -+ NNoottee:: the folder is temporary stored decrypted in the /tmp directory, -+ where it can be read by your system administrator. So think about the -+ security aspects of this. -+ - 55.. MMuutttt''ss MMIIMMEE SSuuppppoorrtt - - Quite a bit of effort has been made to make Mutt the premier text-mode -@@ -3148,6 +3303,8 @@ - - · ``unmy_hdr'' _f_i_e_l_d [ _f_i_e_l_d ... ] - -+ · ``open-hook'' _r_e_g_e_x_p "_c_o_m_m_a_n_d" -+ - · ``pgp-hook'' _p_a_t_t_e_r_n _k_e_y_-_i_d - - · ``push'' _s_t_r_i_n_g -diff -Nur mutt-1.3.27.orig/doc/muttrc.man mutt-1.3.27/doc/muttrc.man ---- mutt-1.3.27.orig/doc/muttrc.man Fri Dec 28 18:14:28 2001 -+++ mutt-1.3.27/doc/muttrc.man Fri Feb 1 22:51:32 2002 -@@ -258,6 +258,24 @@ - The pgp-hook command provides a method by which you can - specify the ID of the public key to be used when encrypting messages - to a certain recipient. -+.PP -+.nf -+\fBopen-hook\fP \fIregexp\fP "\fIcommand\fP" -+\fBclose-hook\fP \fIregexp\fP "\fIcommand\fP" -+\fBappend-hook\fP \fIregexp\fP "\fIcommand\fP" -+.fi -+.IP -+These commands provide a way to handle compressed folders. The given -+\fBregexp\fP specifies which folders are taken as compressed (e.g. -+"\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 -+.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 -+which is replaced with the name of the temporary folder to which to -+write. - .TP - \fBpush\fP \fIstring\fP - This command adds the named \fIstring\fP to the keyboard buffer. -diff -Nur mutt-1.3.27.orig/doc/muttrc.man.head mutt-1.3.27/doc/muttrc.man.head ---- mutt-1.3.27.orig/doc/muttrc.man.head Wed Jan 23 00:42:01 2002 -+++ mutt-1.3.27/doc/muttrc.man.head Fri Feb 1 22:51:32 2002 -@@ -258,6 +258,24 @@ - The pgp-hook command provides a method by which you can - specify the ID of the public key to be used when encrypting messages - to a certain recipient. -+.PP -+.nf -+\fBopen-hook\fP \fIregexp\fP "\fIcommand\fP" -+\fBclose-hook\fP \fIregexp\fP "\fIcommand\fP" -+\fBappend-hook\fP \fIregexp\fP "\fIcommand\fP" -+.fi -+.IP -+These commands provide a way to handle compressed folders. The given -+\fBregexp\fP specifies which folders are taken as compressed (e.g. -+"\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 -+.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 -+which is replaced with the name of the temporary folder to which to -+write. - .TP - \fBpush\fP \fIstring\fP - This command adds the named \fIstring\fP to the keyboard buffer. -diff -Nur mutt-1.3.27.orig/hook.c mutt-1.3.27/hook.c ---- mutt-1.3.27.orig/hook.c Fri Jun 29 12:05:50 2001 -+++ mutt-1.3.27/hook.c Fri Feb 1 22:51:32 2002 -@@ -19,6 +19,10 @@ - #include "mutt.h" - #include "mailbox.h" - -+#ifdef USE_COMPRESSED -+#include "compress.h" -+#endif -+ - #include - #include - #include -@@ -87,6 +91,16 @@ - memset (&pattern, 0, sizeof (pattern)); - pattern.data = safe_strdup (path); - } -+#ifdef USE_COMPRESSED -+ else if (data & (M_APPENDHOOK | M_OPENHOOK | M_CLOSEHOOK)) -+ { -+ if (mutt_test_compress_command (command.data)) -+ { -+ strfcpy (err->data, _("bad formatted command string"), err->dsize); -+ return (-1); -+ } -+ } -+#endif - else if (DefaultHook && (data & (M_FOLDERHOOK | M_MBOXHOOK | M_SENDHOOK | - M_FCCHOOK | M_SAVEHOOK | M_MESSAGEHOOK))) - { -diff -Nur mutt-1.3.27.orig/init.h mutt-1.3.27/init.h ---- mutt-1.3.27.orig/init.h Mon Dec 10 11:09:03 2001 -+++ mutt-1.3.27/init.h Fri Feb 1 22:51:32 2002 -@@ -2447,6 +2447,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 }, -+#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 - { "hdr_order", parse_list, UL &HeaderOrderList }, - { "iconv-hook", mutt_parse_hook, M_ICONVHOOK }, - { "ignore", parse_ignore, 0 }, -diff -Nur mutt-1.3.27.orig/main.c mutt-1.3.27/main.c ---- mutt-1.3.27.orig/main.c Wed Nov 7 11:40:26 2001 -+++ mutt-1.3.27/main.c Fri Feb 1 22:51:32 2002 -@@ -328,6 +328,12 @@ - #else - "-LOCALES_HACK " - #endif -+ -+#ifdef USE_COMPRESSED -+ "+COMPRESSED " -+#else -+ "-COMPRESSED " -+#endif - - #ifdef HAVE_WC_FUNCS - "+HAVE_WC_FUNCS " -diff -Nur mutt-1.3.27.orig/mbox.c mutt-1.3.27/mbox.c ---- mutt-1.3.27.orig/mbox.c Wed Oct 31 10:40:05 2001 -+++ mutt-1.3.27/mbox.c Fri Feb 1 22:51:32 2002 -@@ -28,6 +28,10 @@ - #include "sort.h" - #include "copy.h" - -+#ifdef USE_COMPRESSED -+#include "compress.h" -+#endif -+ - #include - #include - #include -@@ -1045,6 +1049,12 @@ - int mbox_close_mailbox (CONTEXT *ctx) - { - mx_unlock_file (ctx->path, fileno (ctx->fp), 1); -+ -+#ifdef USE_COMPRESSED -+ if (ctx->compressinfo) -+ mutt_slow_close_compressed (ctx); -+#endif -+ - mutt_unblock_signals (); - mx_fastclose_mailbox (ctx); - return 0; -diff -Nur mutt-1.3.27.orig/mutt.h mutt-1.3.27/mutt.h ---- mutt-1.3.27.orig/mutt.h Wed Jan 23 00:42:01 2002 -+++ mutt-1.3.27/mutt.h Fri Feb 1 22:51:32 2002 -@@ -143,6 +143,11 @@ - #define M_PGPHOOK (1<<8) - #endif - #define M_ACCOUNTHOOK (1<<9) -+#ifdef USE_COMPRESSED -+#define M_OPENHOOK (1<<10) -+#define M_APPENDHOOK (1<<11) -+#define M_CLOSEHOOK (1<<12) -+#endif - - /* tree characters for linearize_tree and print_enriched_string */ - #define M_TREE_LLCORNER 1 -@@ -745,6 +750,11 @@ - void *data; /* driver specific data */ - #endif /* USE_IMAP */ - -+#ifdef USE_COMPRESSED -+ void *compressinfo; /* compressed mbox module private data */ -+ char *realpath; /* path to compressed mailbox */ -+#endif /* USE_COMPRESSED */ -+ - short magic; /* mailbox type */ - - unsigned int locked : 1; /* is the mailbox locked? */ -diff -Nur mutt-1.3.27.orig/mx.c mutt-1.3.27/mx.c ---- mutt-1.3.27.orig/mx.c Wed Jan 23 00:42:01 2002 -+++ mutt-1.3.27/mx.c Fri Feb 1 22:51:32 2002 -@@ -26,6 +26,10 @@ - #include "keymap.h" - #include "url.h" - -+#ifdef USE_COMPRESSED -+#include "compress.h" -+#endif -+ - #ifdef HAVE_PGP - #include "pgp.h" - #endif -@@ -448,6 +452,10 @@ - return (-1); - } - -+#ifdef USE_COMPRESSED -+ if (magic == 0 && mutt_can_read_compressed (path)) -+ return M_COMPRESSED; -+#endif - return (magic); - } - -@@ -489,6 +497,13 @@ - { - struct stat sb; - -+#ifdef USE_COMPRESSED -+ /* special case for appending to compressed folders - -+ * even if we can not open them for reading */ -+ if (mutt_can_append_compressed (ctx->path)) -+ mutt_open_append_compressed (ctx); -+#endif -+ - ctx->append = 1; - - #ifdef USE_IMAP -@@ -649,7 +664,12 @@ - } - - ctx->magic = mx_get_magic (path); -- -+ -+#ifdef USE_COMPRESSED -+ if (ctx->magic == M_COMPRESSED) -+ mutt_open_read_compressed (ctx); -+#endif -+ - if(ctx->magic == 0) - mutt_error (_("%s is not a mailbox."), path); - -@@ -755,6 +775,10 @@ - mutt_free_header (&ctx->hdrs[i]); - safe_free ((void **) &ctx->hdrs); - safe_free ((void **) &ctx->v2r); -+#ifdef USE_COMPRESSED -+ if (ctx->compressinfo) -+ mutt_fast_close_compressed (ctx); -+#endif - safe_free ((void **) &ctx->path); - safe_free ((void **) &ctx->pattern); - if (ctx->limit_pattern) -@@ -812,6 +836,12 @@ - if (tmp && tmp->new == 0) - mutt_update_mailbox (tmp); - #endif -+ -+#ifdef USE_COMPRESSED -+ if (rc == 0 && ctx->compressinfo) -+ return mutt_sync_compressed (ctx); -+#endif -+ - return rc; - } - -@@ -1018,6 +1048,11 @@ - !mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY)) - mx_unlink_empty (ctx->path); - -+#ifdef USE_COMPRESSED -+ if (ctx->compressinfo && mutt_slow_close_compressed (ctx)) -+ return (-1); -+#endif -+ - mx_fastclose_mailbox (ctx); - - return 0; -@@ -1325,6 +1360,11 @@ - { - int rc; - -+#ifdef USE_COMPRESSED -+ if (ctx->compressinfo) -+ return mutt_check_mailbox_compressed (ctx); -+#endif -+ - if (ctx) - { - if (ctx->locked) lock = 0; -diff -Nur mutt-1.3.27.orig/mx.h mutt-1.3.27/mx.h ---- mutt-1.3.27.orig/mx.h Wed Oct 31 10:40:05 2001 -+++ mutt-1.3.27/mx.h Fri Feb 1 22:51:32 2002 -@@ -41,6 +41,9 @@ - #ifdef USE_POP - , M_POP - #endif -+#ifdef USE_COMPRESSED -+ , M_COMPRESSED -+#endif - }; - - WHERE short DefaultMagic INITVAL (M_MBOX); -diff -Nur mutt-1.3.27.orig/po/POTFILES.in mutt-1.3.27/po/POTFILES.in ---- mutt-1.3.27.orig/po/POTFILES.in Tue Oct 10 21:18:37 2000 -+++ mutt-1.3.27/po/POTFILES.in Fri Feb 1 22:51:32 2002 -@@ -8,6 +8,7 @@ - color.c - commands.c - compose.c -+compress.c - curs_lib.c - curs_main.c - edit.c -diff -Nur mutt-1.3.27.orig/po/de.po mutt-1.3.27/po/de.po ---- mutt-1.3.27.orig/po/de.po Wed Jan 23 00:43:05 2002 -+++ mutt-1.3.27/po/de.po Fri Feb 1 22:51:32 2002 -@@ -654,6 +654,48 @@ - msgid "Message written." - msgstr "Nachricht geschrieben." - -+#: 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" -+msgstr "Komprimiere %s...\n" -+ -+#: compress.c:381 -+#, c-format -+msgid "" -+"%s: Error compressing mailbox! Original mailbox deleted, uncompressed one " -+"kept!\n" -+msgstr "" -+"%s: Fehler beim Komprimieren der Mailbox! Ursprüngliche Mailbox gelöscht, " -+"entpackte gespeichert!\n" -+ -+#: compress.c:425 compress.c:456 -+#, c-format -+msgid "Compressed-appending to %s...\n" -+msgstr "Hänge komprimiert an %s... an\n" -+ -+#: compress.c:461 -+#, c-format -+msgid " %s: Error compressing mailbox! Uncompressed one kept!\n" -+msgstr " %s: Fehler beim packen der Mailbox! Entpackte Mailbox gespeichert!\n" -+ - #: curs_lib.c:153 - msgid "yes" - msgstr "ja" -@@ -1137,6 +1179,10 @@ - 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:240 - msgid "unhook: Can't do unhook * from within a hook." - msgstr "unhook: Innerhalb eines hook kann kein unhook * aufgerufen werden." -@@ -2459,18 +2505,10 @@ - msgid "Mailbox is corrupt!" - msgstr "Mailbox fehlerhaft!" - --#: mbox.c:665 --msgid "Mailbox was corrupted!" --msgstr "Mailbox wurde zerstört!" -- - #: mbox.c:702 mbox.c:978 - msgid "Fatal error! Could not reopen mailbox!" - msgstr "Fataler Fehler, konnte Mailbox nicht erneut öffnen!" - --#: mbox.c:711 --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. -diff -Nur mutt-1.3.27.orig/status.c mutt-1.3.27/status.c ---- mutt-1.3.27.orig/status.c Fri Mar 3 11:10:14 2000 -+++ mutt-1.3.27/status.c Fri Feb 1 22:51:32 2002 -@@ -93,6 +93,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); -+ } -+ else -+#endif - if (Context && Context->path) - { - strfcpy (tmp, Context->path, sizeof (tmp)); ---- mutt-1.3.99/doc/manual-4.html~ Tue May 21 22:14:04 2002 -+++ mutt-1.3.99/doc/manual-4.html Tue May 21 22:15:56 2002 -@@ -815,7 +815,57 @@ - -

    - --
    -+

    4.14 Compressed folders Support (OPTIONAL) -+

    -+ -+ -+

    If Mutt was compiled with compressed folders support (by running the -+configure script with the --enable-compressed flag), Mutt -+can open folders stored in an arbitrary format, provided that the user -+has a script to convert from/to this format to one of the accepted.

    -+

    The most common use is to open compressed archived folders e.g. with -+gzip.

    -+

    In addition, the user can provide a script that gets a folder in an -+accepted format and appends its context to the folder in the -+user-defined format, which may be faster than converting the entire -+folder to the accepted format, appending to it and converting back to -+the user-defined format.

    -+

    There are three hooks defined ( -+open-hook, -+close-hook and -+append-hook) which define commands to uncompress and compress -+a folder and to append messages to an existing compressed folder -+respectively.

    -+

    For example:

    -+

    -+

    -+
    -+open-hook \\.gz$ "gzip -cd %f > %t" 
    -+close-hook \\.gz$ "gzip -c %t > %f"
    -+append-hook \\.gz$ "gzip -c %t >> %f" 
    -+
    -+
    -+

    -+

    You do not have to specify all of the commands. If you omit -+append-hook, the folder will be open and -+closed again each time you will add to it. If you omit -+close-hook (or give empty command) , the -+folder will be open in the mode. If you specify -+append-hook though you'll be able to append -+to the folder.

    -+

    Note that Mutt will only try to use hooks if the file is not in one of -+the accepted formats. In particular, if the file is empty, mutt -+supposes it is not compressed. This is important because it allows the -+use of programs that do not have well defined extensions. Just use -+"." as a regexp. But this may be surprising if your -+compressing script produces empty files. In this situation, unset -+$save_empty, so that the compressed file -+will be removed if you delete all of the messages.

    -+ -+

    Open a compressed mailbox for reading

    -+ -+

    Usage: open-hook regexp "command"


    -+ - Next - Previous - Contents -- 2.43.0