]> git.pld-linux.org Git - packages/mutt.git/blob - mutt-rr.compressed.patch
- updated for mutt 1.5.12
[packages/mutt.git] / mutt-rr.compressed.patch
1 diff -urN mutt-1.5.12/compress.c mutt-1.5.12-ro/compress.c
2 --- mutt-1.5.12/compress.c      1970-01-01 01:00:00.000000000 +0100
3 +++ mutt-1.5.12-ro/compress.c   2006-07-15 20:13:19.000000000 +0200
4 @@ -0,0 +1,487 @@
5 +/*
6 + * Copyright (C) 1997 Alain Penders <Alain@Finale-Dev.com>
7 + *
8 + *     This program is free software; you can redistribute it and/or modify
9 + *     it under the terms of the GNU General Public License as published by
10 + *     the Free Software Foundation; either version 2 of the License, or
11 + *     (at your option) any later version.
12 + *
13 + *     This program is distributed in the hope that it will be useful,
14 + *     but WITHOUT ANY WARRANTY; without even the implied warranty of
15 + *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 + *     GNU General Public License for more details.
17 + *
18 + *     You should have received a copy of the GNU General Public License
19 + *     along with this program; if not, write to the Free Software
20 + *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 + */
22 +
23 +#if HAVE_CONFIG_H
24 +# include "config.h"
25 +#endif
26 +
27 +#include "mutt.h"
28 +
29 +#ifdef USE_COMPRESSED
30 +
31 +#include "mx.h"
32 +#include "mailbox.h"
33 +#include "mutt_curses.h"
34 +
35 +#include <errno.h>
36 +#include <string.h>
37 +#include <unistd.h>
38 +#include <sys/stat.h>
39 +
40 +typedef struct
41 +{
42 +  const char *close;   /* close-hook  command */
43 +  const char *open;    /* open-hook   command */
44 +  const char *append;  /* append-hook command */
45 +  off_t size;          /* size of real folder */
46 +} COMPRESS_INFO;
47 +
48 +
49 +/*
50 + * ctx - context to lock
51 + * excl - exclusive lock?
52 + * retry - should retry if unable to lock?
53 + */
54 +int mbox_lock_compressed (CONTEXT *ctx, FILE *fp, int excl, int retry)
55 +{
56 +  int r;
57 +
58 +  if ((r = mx_lock_file (ctx->realpath, fileno (fp), excl, 1, retry)) == 0)
59 +    ctx->locked = 1;
60 +  else if (retry && !excl)
61 +  {
62 +    ctx->readonly = 1;
63 +    return 0;
64 +  }
65 +
66 +  return (r);
67 +}
68 +
69 +void mbox_unlock_compressed (CONTEXT *ctx, FILE *fp)
70 +{
71 +  if (ctx->locked)
72 +  {
73 +    fflush (fp);
74 +
75 +    mx_unlock_file (ctx->realpath, fileno (fp), 1);
76 +    ctx->locked = 0;
77 +  }
78 +}
79 +
80 +static int is_new (const char *path)
81 +{
82 +  return (access (path, W_OK) != 0 && errno == ENOENT) ? 1 : 0;
83 +}
84 +
85 +static const char* find_compress_hook (int type, const char *path)
86 +{
87 +  const char* c = mutt_find_hook (type, path);
88 +  return (!c || !*c) ? NULL : c;
89 +}
90 +
91 +int mutt_can_read_compressed (const char *path)
92 +{
93 +  return find_compress_hook (M_OPENHOOK, path) ? 1 : 0;
94 +}
95 +
96 +/*
97 + * if the file is new, we really do not append, but create, and so use
98 + * close-hook, and not append-hook
99 + */
100 +static const char* get_append_command (const char *path, const CONTEXT* ctx)
101 +{
102 +  COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
103 +  return (is_new (path)) ? ci->close : ci->append;
104 +}
105 +
106 +int mutt_can_append_compressed (const char *path)
107 +{
108 +  int magic;
109 +
110 +  if (is_new (path))
111 +    return (find_compress_hook (M_CLOSEHOOK, path) ? 1 : 0);
112 +
113 +  magic = mx_get_magic (path);
114 +
115 +  if (magic != 0 && magic != M_COMPRESSED)
116 +    return 0;
117 +
118 +  return (find_compress_hook (M_APPENDHOOK, path)
119 +         || (find_compress_hook (M_OPENHOOK, path)
120 +             && find_compress_hook (M_CLOSEHOOK, path))) ? 1 : 0;
121 +}
122 +
123 +/* open a compressed mailbox */
124 +static COMPRESS_INFO *set_compress_info (CONTEXT *ctx)
125 +{
126 +  COMPRESS_INFO *ci;
127 +
128 +  /* Now lets uncompress this thing */
129 +  ci = safe_malloc (sizeof (COMPRESS_INFO));
130 +  ctx->compressinfo = (void*) ci;
131 +  ci->append = find_compress_hook (M_APPENDHOOK, ctx->path);
132 +  ci->open = find_compress_hook (M_OPENHOOK, ctx->path);
133 +  ci->close = find_compress_hook (M_CLOSEHOOK, ctx->path);
134 +  return ci;
135 +}
136 +
137 +static void set_path (CONTEXT* ctx)
138 +{
139 +  char tmppath[_POSIX_PATH_MAX];
140 +
141 +  /* Setup the right paths */
142 +  ctx->realpath = ctx->path;
143 +
144 +  /* Uncompress to /tmp */
145 +  mutt_mktemp (tmppath);
146 +  ctx->path = safe_malloc (strlen (tmppath) + 1);
147 +  strcpy (ctx->path, tmppath);
148 +}
149 +
150 +static int get_size (const char* path)
151 +{
152 +  struct stat sb;
153 +  if (stat (path, &sb) != 0)
154 +    return 0;
155 +  return (sb.st_size);
156 +}
157 +
158 +static void store_size (CONTEXT* ctx)
159 +{
160 +  COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
161 +  ci->size = get_size (ctx->realpath);
162 +}
163 +
164 +static const char *
165 +compresshook_format_str (char *dest, size_t destlen, char op, const char *src,
166 +                        const char *fmt, const char *ifstring,
167 +                        const char *elsestring, unsigned long data,
168 +                        format_flag flags)
169 +{
170 +  char tmp[SHORT_STRING];
171 +
172 +  CONTEXT *ctx = (CONTEXT *) data;
173 +  switch (op)
174 +  {
175 +  case 'f':
176 +    snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
177 +    snprintf (dest, destlen, tmp, ctx->realpath);
178 +    break;
179 +  case 't':
180 +    snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
181 +    snprintf (dest, destlen, tmp, ctx->path);
182 +    break;
183 +  }
184 +  return (src);
185 +}
186 +
187 +/*
188 + * check that the command has both %f and %t
189 + * 0 means OK, -1 means error
190 + */
191 +int mutt_test_compress_command (const char* cmd)
192 +{
193 +  return (strstr (cmd, "%f") && strstr (cmd, "%t")) ? 0 : -1;
194 +}
195 +
196 +static char *get_compression_cmd (const char* cmd, const CONTEXT* ctx)
197 +{
198 +  char expanded[_POSIX_PATH_MAX];
199 +  mutt_FormatString (expanded, sizeof (expanded), cmd, compresshook_format_str,
200 +                    (unsigned long) ctx, 0);
201 +  return safe_strdup (expanded);
202 +}
203 +
204 +int mutt_check_mailbox_compressed (CONTEXT* ctx)
205 +{
206 +  COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
207 +  if (ci->size != get_size (ctx->realpath))
208 +  {
209 +    FREE (&ctx->compressinfo);
210 +    FREE (&ctx->realpath);
211 +    mutt_error _("Mailbox was corrupted!");
212 +    return (-1);
213 +  }
214 +  return (0);
215 +}
216 +
217 +int mutt_open_read_compressed (CONTEXT *ctx)
218 +{
219 +  char *cmd;
220 +  FILE *fp;
221 +  int rc;
222 +
223 +  COMPRESS_INFO *ci = set_compress_info (ctx);
224 +  if (!ci->open) {
225 +    ctx->magic = 0;
226 +    FREE (ctx->compressinfo);
227 +    return (-1);
228 +  }
229 +  if (!ci->close || access (ctx->path, W_OK) != 0)
230 +    ctx->readonly = 1;
231 +
232 +  set_path (ctx);
233 +  store_size (ctx);
234 +
235 +  if (!ctx->quiet)
236 +    mutt_message (_("Decompressing %s..."), ctx->realpath);
237 +
238 +  cmd = get_compression_cmd (ci->open, ctx);
239 +  if (cmd == NULL)
240 +    return (-1);
241 +  dprint (2, (debugfile, "DecompressCmd: '%s'\n", cmd));
242 +
243 +  if ((fp = fopen (ctx->realpath, "r")) == NULL)
244 +  {
245 +    mutt_perror (ctx->realpath);
246 +    FREE (&cmd);
247 +    return (-1);
248 +  }
249 +  mutt_block_signals ();
250 +  if (mbox_lock_compressed (ctx, fp, 0, 1) == -1)
251 +  {
252 +    fclose (fp);
253 +    mutt_unblock_signals ();
254 +    mutt_error _("Unable to lock mailbox!");
255 +    FREE (&cmd);
256 +    return (-1);
257 +  }
258 +
259 +  endwin ();
260 +  fflush (stdout);
261 +  fprintf (stderr, _("Decompressing %s...\n"),ctx->realpath);
262 +  rc = mutt_system (cmd);
263 +  mbox_unlock_compressed (ctx, fp);
264 +  mutt_unblock_signals ();
265 +  fclose (fp);
266 +
267 +  if (rc)
268 +  {
269 +    mutt_any_key_to_continue (NULL);
270 +    ctx->magic = 0;
271 +    FREE (ctx->compressinfo);
272 +    mutt_error (_("Error executing: %s : unable to open the mailbox!\n"), cmd);
273 +  }
274 +  FREE (&cmd);
275 +  if (rc)
276 +    return (-1);
277 +
278 +  if (mutt_check_mailbox_compressed (ctx))
279 +    return (-1);
280 +
281 +  ctx->magic = mx_get_magic (ctx->path);
282 +
283 +  return (0);
284 +}
285 +
286 +void restore_path (CONTEXT* ctx)
287 +{
288 +  FREE (&ctx->path);
289 +  ctx->path = ctx->realpath;
290 +}
291 +
292 +/* remove the temporary mailbox */
293 +void remove_file (CONTEXT* ctx)
294 +{
295 +  if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
296 +    remove (ctx->path);
297 +}
298 +
299 +int mutt_open_append_compressed (CONTEXT *ctx)
300 +{
301 +  FILE *fh;
302 +  COMPRESS_INFO *ci = set_compress_info (ctx);
303 +
304 +  if (!get_append_command (ctx->path, ctx))
305 +  {
306 +    if (ci->open && ci->close)
307 +      return (mutt_open_read_compressed (ctx));
308 +
309 +    ctx->magic = 0;
310 +    FREE (&ctx->compressinfo);
311 +    return (-1);
312 +  }
313 +
314 +  set_path (ctx);
315 +
316 +  ctx->magic = DefaultMagic;
317 +
318 +  if (!is_new (ctx->realpath))
319 +    if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
320 +      if ((fh = fopen (ctx->path, "w")))
321 +       fclose (fh);
322 +  /* No error checking - the parent function will catch it */
323 +
324 +  return (0);
325 +}
326 +
327 +/* close a compressed mailbox */
328 +void mutt_fast_close_compressed (CONTEXT *ctx)
329 +{
330 +  dprint (2, (debugfile, "mutt_fast_close_compressed called on '%s'\n",
331 +             ctx->path));
332 +
333 +  if (ctx->compressinfo)
334 +  {
335 +    if (ctx->fp)
336 +      fclose (ctx->fp);
337 +    ctx->fp = NULL;
338 +    /* if the folder was removed, remove the gzipped folder too */
339 +    if ((ctx->magic > 0) 
340 +       && (access (ctx->path, F_OK) != 0) 
341 +       && ! option (OPTSAVEEMPTY))
342 +      remove (ctx->realpath);
343 +    else
344 +      remove_file (ctx);
345 +
346 +    restore_path (ctx);
347 +    FREE (&ctx->compressinfo);
348 +  }
349 +}
350 +
351 +/* return 0 on success, -1 on failure */
352 +int mutt_sync_compressed (CONTEXT* ctx)
353 +{
354 +  char *cmd;
355 +  int rc = 0;
356 +  FILE *fp;
357 +  COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
358 +
359 +  if (!ctx->quiet)
360 +    mutt_message (_("Compressing %s..."), ctx->realpath);
361 +
362 +  cmd = get_compression_cmd (ci->close, ctx);
363 +  if (cmd == NULL)
364 +    return (-1);
365 +
366 +  if ((fp = fopen (ctx->realpath, "a")) == NULL)
367 +  {
368 +    mutt_perror (ctx->realpath);
369 +    FREE (&cmd);
370 +    return (-1);
371 +  }
372 +  mutt_block_signals ();
373 +  if (mbox_lock_compressed (ctx, fp, 1, 1) == -1)
374 +  {
375 +    fclose (fp);
376 +    mutt_unblock_signals ();
377 +    mutt_error _("Unable to lock mailbox!");
378 +    store_size (ctx);
379 +    FREE (&cmd);
380 +    return (-1);
381 +  }
382 +
383 +  dprint (2, (debugfile, "CompressCommand: '%s'\n", cmd));
384 +
385 +  endwin ();
386 +  fflush (stdout);
387 +  fprintf (stderr, _("Compressing %s...\n"), ctx->realpath);
388 +  if (mutt_system (cmd))
389 +  {
390 +    mutt_any_key_to_continue (NULL);
391 +    mutt_error (_("%s: Error compressing mailbox! Original mailbox deleted, uncompressed one kept!\n"), ctx->path);
392 +    rc = -1;
393 +  }
394 +
395 +  mbox_unlock_compressed (ctx, fp);
396 +  mutt_unblock_signals ();
397 +  fclose (fp);
398 +
399 +  FREE (&cmd);
400 +
401 +  store_size (ctx);
402 +
403 +  return (rc);
404 +}
405 +
406 +int mutt_slow_close_compressed (CONTEXT *ctx)
407 +{
408 +  FILE *fp;
409 +  const char *append;
410 +  char *cmd;
411 +  COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
412 +
413 +  dprint (2, (debugfile, "mutt_slow_close_compressed called on '%s'\n",
414 +             ctx->path));
415 +
416 +  if (! (ctx->append
417 +        && ((append = get_append_command (ctx->realpath, ctx))
418 +            || (append = ci->close))))
419 +  { 
420 +    /* if we can not or should not append, we only have to remove the */
421 +    /* compressed info, because sync was already called               */
422 +    mutt_fast_close_compressed (ctx);
423 +    return (0);
424 +  }
425 +
426 +  if (ctx->fp)
427 +    fclose (ctx->fp);
428 +  ctx->fp = NULL;
429 +
430 +  if (!ctx->quiet)
431 +  {
432 +    if (append == ci->close)
433 +      mutt_message (_("Compressing %s..."), ctx->realpath);
434 +    else
435 +      mutt_message (_("Compressed-appending to %s..."), ctx->realpath);
436 +  }
437 +
438 +  cmd = get_compression_cmd (append, ctx);
439 +  if (cmd == NULL)
440 +    return (-1);
441 +
442 +  if ((fp = fopen (ctx->realpath, "a")) == NULL)
443 +  {
444 +    mutt_perror (ctx->realpath);
445 +    FREE (&cmd);
446 +    return (-1);
447 +  }
448 +  mutt_block_signals ();
449 +  if (mbox_lock_compressed (ctx, fp, 1, 1) == -1)
450 +  {
451 +    fclose (fp);
452 +    mutt_unblock_signals ();
453 +    mutt_error _("Unable to lock mailbox!");
454 +    FREE (&cmd);
455 +    return (-1);
456 +  }
457 +
458 +  dprint (2, (debugfile, "CompressCmd: '%s'\n", cmd));
459 +
460 +  endwin ();
461 +  fflush (stdout);
462 +
463 +  if (append == ci->close)
464 +    fprintf (stderr, _("Compressing %s...\n"), ctx->realpath);
465 +  else
466 +    fprintf (stderr, _("Compressed-appending to %s...\n"), ctx->realpath);
467 +
468 +  if (mutt_system (cmd))
469 +  {
470 +    mutt_any_key_to_continue (NULL);
471 +    mutt_error (_(" %s: Error compressing mailbox!  Uncompressed one kept!\n"),
472 +               ctx->path);
473 +    FREE (&cmd);
474 +    mbox_unlock_compressed (ctx, fp);
475 +    mutt_unblock_signals ();
476 +    fclose (fp);
477 +    return (-1);
478 +  }
479 +
480 +  mbox_unlock_compressed (ctx, fp);
481 +  mutt_unblock_signals ();
482 +  fclose (fp);
483 +  remove_file (ctx);
484 +  restore_path (ctx);
485 +  FREE (&cmd);
486 +  FREE (&ctx->compressinfo);
487 +
488 +  return (0);
489 +}
490 +
491 +#endif /* USE_COMPRESSED */
492 diff -urN mutt-1.5.12/compress.h mutt-1.5.12-ro/compress.h
493 --- mutt-1.5.12/compress.h      1970-01-01 01:00:00.000000000 +0100
494 +++ mutt-1.5.12-ro/compress.h   2006-07-15 20:13:19.000000000 +0200
495 @@ -0,0 +1,27 @@
496 +/*
497 + * Copyright (C) 1997 Alain Penders <Alain@Finale-Dev.com>
498 + *
499 + *     This program is free software; you can redistribute it and/or modify
500 + *     it under the terms of the GNU General Public License as published by
501 + *     the Free Software Foundation; either version 2 of the License, or
502 + *     (at your option) any later version.
503 + *
504 + *     This program is distributed in the hope that it will be useful,
505 + *     but WITHOUT ANY WARRANTY; without even the implied warranty of
506 + *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
507 + *     GNU General Public License for more details.
508 + *
509 + *     You should have received a copy of the GNU General Public License
510 + *     along with this program; if not, write to the Free Software
511 + *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
512 + */
513 +
514 +int mutt_can_read_compressed (const char *);
515 +int mutt_can_append_compressed (const char *);
516 +int mutt_open_read_compressed (CONTEXT *);
517 +int mutt_open_append_compressed (CONTEXT *);
518 +int mutt_slow_close_compressed (CONTEXT *);
519 +int mutt_sync_compressed (CONTEXT *);
520 +int mutt_test_compress_command (const char *);
521 +int mutt_check_mailbox_compressed (CONTEXT *);
522 +void mutt_fast_close_compressed (CONTEXT *);
523 diff -urN mutt-1.5.12/config.h.in mutt-1.5.12-ro/config.h.in
524 --- mutt-1.5.12/config.h.in     2006-07-14 20:15:56.000000000 +0200
525 +++ mutt-1.5.12-ro/config.h.in  2006-07-15 20:13:19.000000000 +0200
526 @@ -510,6 +510,9 @@
527  /* Define to enable Sun mailtool attachments support. */
528  #undef SUN_ATTACHMENT
529  
530 +/* Define to enable compressed mailboxes support */
531 +#undef USE_COMPRESSED
532 +
533  /* Define to use dotlocking for mailboxes. */
534  #undef USE_DOTLOCK
535  
536 diff -urN mutt-1.5.12/configure mutt-1.5.12-ro/configure
537 --- mutt-1.5.12/configure       2006-07-14 20:15:42.000000000 +0200
538 +++ mutt-1.5.12-ro/configure    2006-07-15 20:13:19.000000000 +0200
539 @@ -872,6 +872,7 @@
540    --enable-hcache         Enable header caching
541    --disable-iconv         Disable iconv support
542    --disable-nls           Do not use Native Language Support
543 +  --enable-compressed     Enable compressed folders support
544  
545  Optional Packages:
546    --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
547 @@ -14882,6 +14883,18 @@
548  fi;
549  
550  
551 +# Check whether --enable-compressed or --disable-compressed was given.
552 +if test "${enable_compressed+set}" = set; then
553 +  enableval="$enable_compressed"
554 +  if test x$enableval = xyes; then
555 +                cat >> confdefs.h <<\EOF
556 +#define USE_COMPRESSED 1
557 +EOF
558 +
559 +        fi
560 +fi
561 +
562 +
563  # Check whether --with-exec-shell or --without-exec-shell was given.
564  if test "${with_exec_shell+set}" = set; then
565    withval="$with_exec_shell"
566 diff -urN mutt-1.5.12/configure.in mutt-1.5.12-ro/configure.in
567 --- mutt-1.5.12/configure.in    2006-07-14 20:15:32.000000000 +0200
568 +++ mutt-1.5.12-ro/configure.in 2006-07-15 20:13:19.000000000 +0200
569 @@ -745,6 +745,11 @@
570                  AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ])
571          fi])
572  
573 +AC_ARG_ENABLE(compressed, AC_HELP_STRING([--enable-compressed], [Enable compressed folders support]),
574 +       [if test x$enableval = xyes; then
575 +                AC_DEFINE(USE_COMPRESSED,1, [ Define to support compressed folders. ])
576 +        fi])
577 +
578  AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]),
579          [if test $withval != yes; then
580                  AC_DEFINE_UNQUOTED(EXECSHELL, "$withval",
581 diff -urN mutt-1.5.12/curs_main.c mutt-1.5.12-ro/curs_main.c
582 --- mutt-1.5.12/curs_main.c     2006-06-08 13:50:29.000000000 +0200
583 +++ mutt-1.5.12-ro/curs_main.c  2006-07-15 20:13:19.000000000 +0200
584 @@ -1096,6 +1096,11 @@
585          {
586           int check;
587  
588 +#ifdef USE_COMPRESSED
589 +         if (Context->compressinfo && Context->realpath)
590 +           mutt_str_replace (&LastFolder, Context->realpath);
591 +         else
592 +#endif
593           mutt_str_replace (&LastFolder, Context->path);
594           oldcount = Context ? Context->msgcount : 0;
595  
596 diff -urN mutt-1.5.12/doc/manual.xml.head mutt-1.5.12-ro/doc/manual.xml.head
597 --- mutt-1.5.12/doc/manual.xml.head     2006-07-14 20:09:13.000000000 +0200
598 +++ mutt-1.5.12-ro/doc/manual.xml.head  2006-07-15 20:20:18.000000000 +0200
599 @@ -4747,6 +4747,205 @@
600  
601  </chapter>
602  
603 +<sect1 id="compressedfolders">
604 +<title>Compressed folders Support (OPTIONAL)</title>
605 +
606 +<para>
607 +If Mutt was compiled with compressed folders support (by running the
608 +<emphasis>configure</emphasis> script with the
609 +<emphasis>--enable-compressed</emphasis> flag), Mutt can open folders
610 +stored in an arbitrary format, provided that the user has a script to
611 +convert from/to this format to one of the accepted.
612 +
613 +The most common use is to open compressed archived folders e.g. with
614 +gzip.
615 +
616 +In addition, the user can provide a script that gets a folder in an
617 +accepted format and appends its context to the folder in the
618 +user-defined format, which may be faster than converting the entire
619 +folder to the accepted format, appending to it and converting back to
620 +the user-defined format.
621 +
622 +There are three hooks defined (<link
623 +linkend="open-hook">open-hook</link>, <link
624 +linkend="close-hook">close-hook</link> and <link
625 +linkend="append-hook">append-hook</link>) which define commands to
626 +uncompress and compress a folder and to append messages to an existing
627 +compressed folder respectively.
628 +
629 +For example:
630 +
631 +<screen>
632 +open-hook \\.gz$ "gzip -cd %f &gt; %t" 
633 +close-hook \\.gz$ "gzip -c %t &gt; %f"
634 +append-hook \\.gz$ "gzip -c %t &gt;&gt; %f" 
635 +</screen>
636 +
637 +You do not have to specify all of the commands. If you omit <link
638 +linkend="append-hook">append-hook</link>, the folder will be open and
639 +closed again each time you will add to it. If you omit <link
640 +linkend="close-hook">close-hook</link> (or give empty command) , the
641 +folder will be open in the mode. If you specify <link
642 +linkend="append-hook">append-hook</link> though you'll be able to
643 +append to the folder.
644 +
645 +Note that Mutt will only try to use hooks if the file is not in one of
646 +the accepted formats. In particular, if the file is empty, mutt
647 +supposes it is not compressed. This is important because it allows the
648 +use of programs that do not have well defined extensions. Just use
649 +&quot;.&quot; as a regexp. But this may be surprising if your
650 +compressing script produces empty files. In this situation, unset
651 +<link linkend="save-empty">&dollar;save&lowbar;empty</link>, so that
652 +the compressed file will be removed if you delete all of the messages.
653 +</para>
654 +
655 +<sect2 id="open-hook">
656 +<title>Open a compressed mailbox for reading</title>
657 +
658 +<para>
659 +Usage: <literal>open-hook</literal> <emphasis>regexp</emphasis> &quot;<emphasis>command</emphasis>&quot;
660 +
661 +The <emphasis>command</emphasis> is the command that can be used for
662 +opening the folders whose names match <emphasis>regexp</emphasis>.
663 +
664 +The <emphasis>command</emphasis> string is the printf-like format
665 +string, and it should accept two parameters: &percnt;f, which is
666 +replaced with the (compressed) folder name, and &percnt;t which is
667 +replaced with the name of the temporary folder to which to write.
668 +
669 +&percnt;f and &percnt;t can be repeated any number of times in the
670 +command string, and all of the entries are replaced with the
671 +appropriate folder name. In addition, &percnt;&percnt; is replaced by
672 +&percnt;, as in printf, and any other &percnt;anything is left as is.
673 +
674 +The <emphasis>command</emphasis> should <emphasis
675 +role="bold">not</emphasis> remove the original compressed file.  The
676 +<emphasis>command</emphasis> should return non-zero exit status if it
677 +fails, so mutt knows something's wrong.
678 +
679 +Example:
680 +
681 +<screen>
682 +open-hook \\.gz$ "gzip -cd %f &gt; %t" 
683 +</screen>
684 +
685 +If the <emphasis>command</emphasis> is empty, this operation is
686 +disabled for this file type.
687 +</para>
688 +</sect2>
689 +
690 +<sect2 id="close-hook">
691 +<title>Write a compressed mailbox</title>
692 +
693 +<para>
694 +Usage: <literal>close-hook</literal> <emphasis>regexp</emphasis> &quot;<emphasis>command</emphasis>&quot;
695 +
696 +This is used to close the folder that was open with the <link
697 +linkend="open-hook">open-hook</link> command after some changes were
698 +made to it.
699 +
700 +The <emphasis>command</emphasis> string is the command that can be
701 +used for closing the folders whose names match
702 +<emphasis>regexp</emphasis>. It has the same format as in the <link
703 +linkend="open-hook">open-hook</link> command. Temporary folder in this
704 +case is the folder previously produced by the <link
705 +linkend="open-hook">open-hook</link> command.
706 +
707 +The <emphasis>command</emphasis> should <emphasis
708 +role="bold">not</emphasis> remove the decompressed file. The
709 +<emphasis>command</emphasis> should return non-zero exit status if it
710 +fails, so mutt knows something's wrong.
711 +
712 +Example:
713 +
714 +<screen>
715 +close-hook \\.gz$ "gzip -c %t &gt; %f"
716 +</screen>
717 +
718 +If the <emphasis>command</emphasis> is empty, this operation is
719 +disabled for this file type, and the file can only be open in the
720 +read-only mode.
721 +
722 +<link linkend="close-hook">close-hook</link> is not called when you
723 +exit from the folder if the folder was not changed.
724 +</para>
725 +</sect2>
726 +
727 +<sect2 id="append-hook">
728 +<title>Append a message to a compressed mailbox</title>
729 +
730 +<para>
731 +Usage: <literal>append-hook</literal> <emphasis>regexp</emphasis> &quot;<emphasis>command</emphasis>&quot;
732 +
733 +This command is used for saving to an existing compressed folder.  The
734 +<emphasis>command</emphasis> is the command that can be used for
735 +appending to the folders whose names match
736 +<emphasis>regexp</emphasis>. It has the same format as in the <link
737 +linkend="open-hook">open-hook</link> command.  The temporary folder in
738 +this case contains the messages that are being appended.
739 +
740 +The <emphasis>command</emphasis> should <emphasis
741 +role="bold">not</emphasis> remove the decompressed file. The
742 +<emphasis>command</emphasis> should return non-zero exit status if it
743 +fails, so mutt knows something's wrong.
744 +
745 +Example:
746 +
747 +<screen>
748 +append-hook \\.gz$ "gzip -c %t &gt;&gt; %f" 
749 +</screen>
750 +
751 +When <link linkend="append-hook">append-hook</link> is used, the folder
752 +is not opened, which saves time, but this means that we can not find
753 +out what the folder type is. Thus the default (<link
754 +linkend="mbox-type">&dollar;mbox&lowbar;type</link>) type is always
755 +supposed (i.e.  this is the format used for the temporary folder).
756 +
757 +If the file does not exist when you save to it, <link
758 +linkend="close-hook">close-hook</link> is called, and not <link
759 +linkend="append-hook">append-hook</link>. <link
760 +linkend="append-hook">append-hook</link> is only for appending to
761 +existing folders.
762 +
763 +If the <emphasis>command</emphasis> is empty, this operation is
764 +disabled for this file type. In this case, the folder will be open and
765 +closed again (using <link linkend="open-hook">open-hook</link> and
766 +<link linkend="close-hook">close-hook</link>respectively) each time you
767 +will add to it.
768 +</para>
769 +</sect2>
770 +
771 +<sect2>
772 +<title>Encrypted folders</title>
773 +
774 +<para>
775 +The compressed folders support can also be used to handle encrypted
776 +folders. If you want to encrypt a folder with PGP, you may want to use
777 +the following hooks:
778 +
779 +<screen>
780 +open-hook  \\.pgp$ "pgp -f &lt; %f &gt; %t"
781 +close-hook \\.pgp$ "pgp -fe YourPgpUserIdOrKeyId &lt; %t &gt; %f"
782 +</screen>
783 +
784 +Please note, that PGP does not support appending to an encrypted
785 +folder, so there is no append-hook defined.
786 +
787 +If you are using GnuPG instead of PGP, you may use the following hooks
788 +instead:
789 +
790 +<screen>
791 +open-hook  \\.gpg$ "gpg --decrypt &lt; %f &gt; %t"
792 +close-hook \\.gpg$ "gpg --encrypt --recipient YourGpgUserIdOrKeyId &lt; %t &gt; %f"
793 +</screen>
794 +
795 +<emphasis role="bold">Note:</emphasis> the folder is temporary stored
796 +decrypted in the /tmp directory, where it can be read by your system
797 +administrator. So think about the security aspects of this.
798 +</para>
799 +</sect2>
800 +</sect1>
801 +
802  <chapter id="mimesupport">
803  <title>Mutt's MIME Support</title>
804  
805 diff -urN mutt-1.5.12/doc/muttrc.man.head mutt-1.5.12-ro/doc/muttrc.man.head
806 --- mutt-1.5.12/doc/muttrc.man.head     2006-07-11 17:01:04.000000000 +0200
807 +++ mutt-1.5.12-ro/doc/muttrc.man.head  2006-07-15 20:13:19.000000000 +0200
808 @@ -316,6 +316,24 @@
809  to a certain recipient.  The meaning of "key ID" is to be taken
810  broadly: This can be a different e-mail address, a numerical key ID,
811  or even just an arbitrary search string.
812 +.PP
813 +.nf
814 +\fBopen-hook\fP \fIregexp\fP "\fIcommand\fP"
815 +\fBclose-hook\fP \fIregexp\fP "\fIcommand\fP"
816 +\fBappend-hook\fP \fIregexp\fP "\fIcommand\fP"
817 +.fi
818 +.IP
819 +These commands provide a way to handle compressed folders. The given
820 +\fBregexp\fP specifies which folders are taken as compressed (e.g.
821 +"\fI\\\\.gz$\fP"). The commands tell Mutt how to uncompress a folder
822 +(\fBopen-hook\fP), compress a folder (\fBclose-hook\fP) or append a
823 +compressed mail to a compressed folder (\fBappend-hook\fP). The
824 +\fIcommand\fP string is the 
825 +.BR printf (3)
826 +like format string, and it should accept two parameters: \fB%f\fP,
827 +which is replaced with the (compressed) folder name, and \fB%t\fP
828 +which is replaced with the name of the temporary folder to which to
829 +write.
830  .TP
831  \fBpush\fP \fIstring\fP
832  This command adds the named \fIstring\fP to the keyboard buffer.
833 diff -urN mutt-1.5.12/hook.c mutt-1.5.12-ro/hook.c
834 --- mutt-1.5.12/hook.c  2006-03-03 11:11:43.000000000 +0100
835 +++ mutt-1.5.12-ro/hook.c       2006-07-15 20:13:19.000000000 +0200
836 @@ -24,6 +24,10 @@
837  #include "mailbox.h"
838  #include "mutt_crypt.h"
839  
840 +#ifdef USE_COMPRESSED
841 +#include "compress.h"
842 +#endif
843 +
844  #include <limits.h>
845  #include <string.h>
846  #include <stdlib.h>
847 @@ -92,6 +96,16 @@
848      memset (&pattern, 0, sizeof (pattern));
849      pattern.data = safe_strdup (path);
850    }
851 +#ifdef USE_COMPRESSED
852 +  else if (data & (M_APPENDHOOK | M_OPENHOOK | M_CLOSEHOOK))
853 +  {
854 +    if (mutt_test_compress_command (command.data))
855 +    {
856 +      strfcpy (err->data, _("bad formatted command string"), err->dsize);
857 +      return (-1);
858 +    }
859 +  }
860 +#endif
861    else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ACCOUNTHOOK))
862             && (!WithCrypto || !(data & M_CRYPTHOOK))
863        )
864 diff -urN mutt-1.5.12/init.h mutt-1.5.12-ro/init.h
865 --- mutt-1.5.12/init.h  2006-07-05 10:40:05.000000000 +0200
866 +++ mutt-1.5.12-ro/init.h       2006-07-15 20:14:00.000000000 +0200
867 @@ -3052,6 +3052,11 @@
868    { "fcc-hook",                mutt_parse_hook,        M_FCCHOOK },
869    { "fcc-save-hook",   mutt_parse_hook,        M_FCCHOOK | M_SAVEHOOK },
870    { "folder-hook",     mutt_parse_hook,        M_FOLDERHOOK },
871 +#ifdef USE_COMPRESSED
872 +  { "open-hook",       mutt_parse_hook,        M_OPENHOOK },
873 +  { "close-hook",      mutt_parse_hook,        M_CLOSEHOOK },
874 +  { "append-hook",     mutt_parse_hook,        M_APPENDHOOK },
875 +#endif
876    { "group",           parse_group,            0 },
877    { "ungroup",         parse_ungroup,          0 },
878    { "hdr_order",       parse_list,             UL &HeaderOrderList },
879 diff -urN mutt-1.5.12/main.c mutt-1.5.12-ro/main.c
880 --- mutt-1.5.12/main.c  2006-07-12 01:38:47.000000000 +0200
881 +++ mutt-1.5.12-ro/main.c       2006-07-15 20:13:19.000000000 +0200
882 @@ -398,6 +398,12 @@
883  #else
884         "-LOCALES_HACK  "
885  #endif
886 +
887 +#ifdef USE_COMPRESSED
888 +       "+COMPRESSED  "
889 +#else
890 +       "-COMPRESSED  "
891 +#endif
892               
893  #ifdef HAVE_WC_FUNCS
894         "+HAVE_WC_FUNCS  "
895 diff -urN mutt-1.5.12/Makefile.am mutt-1.5.12-ro/Makefile.am
896 --- mutt-1.5.12/Makefile.am     2006-07-05 10:43:47.000000000 +0200
897 +++ mutt-1.5.12-ro/Makefile.am  2006-07-15 20:14:59.000000000 +0200
898 @@ -18,7 +18,7 @@
899  bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
900  mutt_SOURCES = $(BUILT_SOURCES) \
901         addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
902 -        crypt.c cryptglue.c \
903 +        crypt.c cryptglue.c compress.c \
904         commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \
905         edit.c enter.c flags.c init.c filter.c from.c \
906         getdomain.c group.c \
907 @@ -68,7 +68,7 @@
908         crypt-gpgme.c crypt-mod-pgp-gpgme.c crypt-mod-smime-gpgme.c
909  
910  EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
911 -       configure account.h \
912 +       configure account.h compress.h \
913         attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \
914         globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
915         mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
916 diff -urN mutt-1.5.12/Makefile.in mutt-1.5.12-ro/Makefile.in
917 --- mutt-1.5.12/Makefile.in     2006-07-14 20:21:03.000000000 +0200
918 +++ mutt-1.5.12-ro/Makefile.in  2006-07-15 20:15:35.000000000 +0200
919 @@ -78,7 +78,7 @@
920         attach.$(OBJEXT) base64.$(OBJEXT) browser.$(OBJEXT) \
921         buffy.$(OBJEXT) color.$(OBJEXT) crypt.$(OBJEXT) \
922         cryptglue.$(OBJEXT) commands.$(OBJEXT) complete.$(OBJEXT) \
923 -       compose.$(OBJEXT) copy.$(OBJEXT) curs_lib.$(OBJEXT) \
924 +       compose.$(OBJEXT) compress.$(OBJEXT) copy.$(OBJEXT) curs_lib.$(OBJEXT) \
925         curs_main.$(OBJEXT) date.$(OBJEXT) edit.$(OBJEXT) \
926         enter.$(OBJEXT) flags.$(OBJEXT) init.$(OBJEXT) \
927         filter.$(OBJEXT) from.$(OBJEXT) getdomain.$(OBJEXT) \
928 @@ -301,7 +301,7 @@
929  BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h
930  mutt_SOURCES = $(BUILT_SOURCES) \
931         addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
932 -        crypt.c cryptglue.c \
933 +        compress.c crypt.c cryptglue.c \
934         commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \
935         edit.c enter.c flags.c init.c filter.c from.c \
936         getdomain.c group.c \
937 @@ -333,7 +333,7 @@
938         crypt-gpgme.c crypt-mod-pgp-gpgme.c crypt-mod-smime-gpgme.c
939  
940  EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
941 -       configure account.h \
942 +       configure account.h compress.h \
943         attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \
944         globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
945         mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
946 @@ -501,6 +501,7 @@
947  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commands.Po@am__quote@
948  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complete.Po@am__quote@
949  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compose.Po@am__quote@
950 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress.Po@am__quote@
951  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copy.Po@am__quote@
952  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt-gpgme.Po@am__quote@
953  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt-mod-pgp-classic.Po@am__quote@
954 diff -urN mutt-1.5.12/mbox.c mutt-1.5.12-ro/mbox.c
955 --- mutt-1.5.12/mbox.c  2005-10-31 11:02:08.000000000 +0100
956 +++ mutt-1.5.12-ro/mbox.c       2006-07-15 20:13:19.000000000 +0200
957 @@ -28,6 +28,10 @@
958  #include "sort.h"
959  #include "copy.h"
960  
961 +#ifdef USE_COMPRESSED
962 +#include "compress.h"
963 +#endif
964 +
965  #include <sys/stat.h>
966  #include <dirent.h>
967  #include <string.h>
968 @@ -1014,6 +1018,12 @@
969  int mbox_close_mailbox (CONTEXT *ctx)
970  {
971    mx_unlock_file (ctx->path, fileno (ctx->fp), 1);
972 +
973 +#ifdef USE_COMPRESSED
974 +  if (ctx->compressinfo)
975 +    mutt_slow_close_compressed (ctx);
976 +#endif
977 +
978    mutt_unblock_signals ();
979    mx_fastclose_mailbox (ctx);
980    return 0;
981 diff -urN mutt-1.5.12/mutt.h mutt-1.5.12-ro/mutt.h
982 --- mutt-1.5.12/mutt.h  2006-06-08 13:49:07.000000000 +0200
983 +++ mutt-1.5.12-ro/mutt.h       2006-07-15 20:13:19.000000000 +0200
984 @@ -157,6 +157,11 @@
985  #define M_ACCOUNTHOOK  (1<<9)
986  #define M_REPLYHOOK    (1<<10)
987  #define M_SEND2HOOK     (1<<11)
988 +#ifdef USE_COMPRESSED
989 +#define M_OPENHOOK     (1<<12)
990 +#define M_APPENDHOOK   (1<<13)
991 +#define M_CLOSEHOOK    (1<<14)
992 +#endif
993  
994  /* tree characters for linearize_tree and print_enriched_string */
995  #define M_TREE_LLCORNER                1
996 @@ -860,6 +865,11 @@
997    void *data;                  /* driver specific data */
998  #endif /* USE_IMAP */
999  
1000 +#ifdef USE_COMPRESSED
1001 +  void *compressinfo;          /* compressed mbox module private data */
1002 +  char *realpath;              /* path to compressed mailbox */
1003 +#endif /* USE_COMPRESSED */
1004 +
1005    short magic;                 /* mailbox type */
1006  
1007    unsigned int locked : 1;     /* is the mailbox locked? */
1008 diff -urN mutt-1.5.12/Muttrc mutt-1.5.12-ro/Muttrc
1009 --- mutt-1.5.12/Muttrc  2006-07-14 20:15:57.000000000 +0200
1010 +++ mutt-1.5.12-ro/Muttrc       2006-07-15 20:13:19.000000000 +0200
1011 @@ -20,6 +20,11 @@
1012  macro index,pager y "<change-folder>?<toggle-mailboxes>" "show incoming mailboxes list"
1013  bind browser y exit
1014  
1015 +# Use folders which match on \\.gz$ as gzipped folders:
1016 +# open-hook \\.gz$ "gzip -cd %f > %t"
1017 +# close-hook \\.gz$ "gzip -c %t > %f"
1018 +# append-hook \\.gz$ "gzip -c %t >> %f"
1019 +
1020  # If Mutt is unable to determine your site's domain name correctly, you can
1021  # set the default here.
1022  #
1023 diff -urN mutt-1.5.12/Muttrc.head mutt-1.5.12-ro/Muttrc.head
1024 --- mutt-1.5.12/Muttrc.head     2006-07-14 20:15:55.000000000 +0200
1025 +++ mutt-1.5.12-ro/Muttrc.head  2006-07-15 20:13:19.000000000 +0200
1026 @@ -20,6 +20,11 @@
1027  macro index,pager y "<change-folder>?<toggle-mailboxes>" "show incoming mailboxes list"
1028  bind browser y exit
1029  
1030 +# Use folders which match on \\.gz$ as gzipped folders:
1031 +# open-hook \\.gz$ "gzip -cd %f > %t"
1032 +# close-hook \\.gz$ "gzip -c %t > %f"
1033 +# append-hook \\.gz$ "gzip -c %t >> %f"
1034 +
1035  # If Mutt is unable to determine your site's domain name correctly, you can
1036  # set the default here.
1037  #
1038 diff -urN mutt-1.5.12/Muttrc.head.in mutt-1.5.12-ro/Muttrc.head.in
1039 --- mutt-1.5.12/Muttrc.head.in  2005-10-04 17:05:34.000000000 +0200
1040 +++ mutt-1.5.12-ro/Muttrc.head.in       2006-07-15 20:13:19.000000000 +0200
1041 @@ -20,6 +20,11 @@
1042  macro index,pager y "<change-folder>?<toggle-mailboxes>" "show incoming mailboxes list"
1043  bind browser y exit
1044  
1045 +# Use folders which match on \\.gz$ as gzipped folders:
1046 +# open-hook \\.gz$ "gzip -cd %f > %t"
1047 +# close-hook \\.gz$ "gzip -c %t > %f"
1048 +# append-hook \\.gz$ "gzip -c %t >> %f"
1049 +
1050  # If Mutt is unable to determine your site's domain name correctly, you can
1051  # set the default here.
1052  #
1053 diff -urN mutt-1.5.12/mx.c mutt-1.5.12-ro/mx.c
1054 --- mutt-1.5.12/mx.c    2006-05-18 20:44:29.000000000 +0200
1055 +++ mutt-1.5.12-ro/mx.c 2006-07-15 20:13:19.000000000 +0200
1056 @@ -30,6 +30,10 @@
1057  #include "keymap.h"
1058  #include "url.h"
1059  
1060 +#ifdef USE_COMPRESSED
1061 +#include "compress.h"
1062 +#endif
1063 +
1064  #ifdef USE_IMAP
1065  #include "imap.h"
1066  #endif
1067 @@ -454,6 +458,10 @@
1068      return (-1);
1069    }
1070  
1071 +#ifdef USE_COMPRESSED
1072 +  if (magic == 0 && mutt_can_read_compressed (path))
1073 +    return M_COMPRESSED;
1074 +#endif
1075    return (magic);
1076  }
1077  
1078 @@ -493,6 +501,13 @@
1079  {
1080    struct stat sb;
1081  
1082 +#ifdef USE_COMPRESSED
1083 +  /* special case for appending to compressed folders -
1084 +   * even if we can not open them for reading */
1085 +  if (mutt_can_append_compressed (ctx->path))
1086 +    mutt_open_append_compressed (ctx);
1087 +#endif
1088 +
1089    ctx->append = 1;
1090  
1091  #ifdef USE_IMAP
1092 @@ -653,7 +668,12 @@
1093    }
1094  
1095    ctx->magic = mx_get_magic (path);
1096 -  
1097 +
1098 +#ifdef USE_COMPRESSED
1099 +  if (ctx->magic == M_COMPRESSED)
1100 +    mutt_open_read_compressed (ctx);
1101 +#endif
1102 +
1103    if(ctx->magic == 0)
1104      mutt_error (_("%s is not a mailbox."), path);
1105  
1106 @@ -759,6 +779,10 @@
1107      mutt_free_header (&ctx->hdrs[i]);
1108    FREE (&ctx->hdrs);
1109    FREE (&ctx->v2r);
1110 +#ifdef USE_COMPRESSED
1111 +  if (ctx->compressinfo)
1112 +    mutt_fast_close_compressed (ctx);
1113 +#endif
1114    FREE (&ctx->path);
1115    FREE (&ctx->pattern);
1116    if (ctx->limit_pattern) 
1117 @@ -816,6 +840,12 @@
1118    if (tmp && tmp->new == 0)
1119      mutt_update_mailbox (tmp);
1120  #endif
1121 +
1122 +#ifdef USE_COMPRESSED
1123 +  if (rc == 0 && ctx->compressinfo)
1124 +    return mutt_sync_compressed (ctx);
1125 +#endif
1126 +
1127    return rc;
1128  }
1129  
1130 @@ -1017,6 +1047,11 @@
1131        !mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
1132      mx_unlink_empty (ctx->path);
1133  
1134 +#ifdef USE_COMPRESSED
1135 +  if (ctx->compressinfo && mutt_slow_close_compressed (ctx))
1136 +    return (-1);
1137 +#endif
1138 +
1139    mx_fastclose_mailbox (ctx);
1140  
1141    return 0;
1142 @@ -1326,6 +1361,11 @@
1143  {
1144    int rc;
1145  
1146 +#ifdef USE_COMPRESSED
1147 +  if (ctx->compressinfo)
1148 +    return mutt_check_mailbox_compressed (ctx);
1149 +#endif
1150 +
1151    if (ctx)
1152    {
1153      if (ctx->locked) lock = 0;
1154 diff -urN mutt-1.5.12/mx.h mutt-1.5.12-ro/mx.h
1155 --- mutt-1.5.12/mx.h    2005-09-18 10:22:22.000000000 +0200
1156 +++ mutt-1.5.12-ro/mx.h 2006-07-15 20:13:19.000000000 +0200
1157 @@ -40,6 +40,9 @@
1158  #ifdef USE_POP
1159    , M_POP
1160  #endif
1161 +#ifdef USE_COMPRESSED
1162 +  , M_COMPRESSED
1163 +#endif
1164  };
1165  
1166  WHERE short DefaultMagic INITVAL (M_MBOX);
1167 diff -urN mutt-1.5.12/PATCHES mutt-1.5.12-ro/PATCHES
1168 --- mutt-1.5.12/PATCHES 2006-07-14 20:12:47.000000000 +0200
1169 +++ mutt-1.5.12-ro/PATCHES      2006-07-15 20:21:02.000000000 +0200
1170 @@ -0,0 +1 @@
1171 +patch-1.5.12.rr.compressed.1
1172 diff -urN mutt-1.5.12/po/de.po mutt-1.5.12-ro/po/de.po
1173 --- mutt-1.5.12/po/de.po        2006-07-14 20:16:36.000000000 +0200
1174 +++ mutt-1.5.12-ro/po/de.po     2006-07-15 20:13:19.000000000 +0200
1175 @@ -1262,6 +1262,48 @@
1176  msgid "Failed to figure out sender"
1177  msgstr "Kann Absender nicht ermitteln"
1178  
1179 +#: compress.c:203 mbox.c:661
1180 +msgid "Mailbox was corrupted!"
1181 +msgstr "Mailbox wurde zerstört!"
1182 +
1183 +#: compress.c:228 compress.c:253
1184 +#, c-format
1185 +msgid "Decompressing %s...\n"
1186 +msgstr "Entpacke %s...\n"
1187 +
1188 +#: compress.c:246 compress.c:367 compress.c:443 mbox.c:706
1189 +msgid "Unable to lock mailbox!"
1190 +msgstr "Kann Mailbox nicht für exklusiven Zugriff sperren!"
1191 +
1192 +#: compress.c:264
1193 +#, c-format
1194 +msgid "Error executing: %s : unable to open the mailbox!\n"
1195 +msgstr "Fehler beim Ausführen von %s : Kann die Mailbox nicht öffnen!\n"
1196 +
1197 +#: compress.c:350 compress.c:377 compress.c:423 compress.c:454
1198 +#, c-format
1199 +msgid "Compressing %s...\n"
1200 +msgstr "Komprimiere %s...\n"
1201 +
1202 +#: compress.c:381
1203 +#, c-format
1204 +msgid ""
1205 +"%s: Error compressing mailbox! Original mailbox deleted, uncompressed one "
1206 +"kept!\n"
1207 +msgstr ""
1208 +"%s: Fehler beim Komprimieren der Mailbox! Ursprüngliche Mailbox gelöscht, "
1209 +"entpackte gespeichert!\n"
1210 +
1211 +#: compress.c:425 compress.c:456
1212 +#, c-format
1213 +msgid "Compressed-appending to %s...\n"
1214 +msgstr "Hänge komprimiert an %s... an\n"
1215 +
1216 +#: compress.c:461
1217 +#, c-format
1218 +msgid " %s: Error compressing mailbox!  Uncompressed one kept!\n"
1219 +msgstr " %s: Fehler beim packen der Mailbox! Entpackte Mailbox gespeichert!\n"
1220 +
1221  #: crypt.c:69
1222  #, c-format
1223  msgid " (current time: %c)"
1224 @@ -1910,6 +1952,10 @@
1225  msgid "Help for %s"
1226  msgstr "Hilfe für %s"
1227  
1228 +#: hook.c:96
1229 +msgid "bad formatted command string"
1230 +msgstr "Hook enthält nicht die Muster %f und %t"
1231 +
1232  #: hook.c:246
1233  #, c-format
1234  msgid "unhook: Can't do unhook * from within a hook."
1235 @@ -3424,18 +3470,10 @@
1236  msgid "Mailbox is corrupt!"
1237  msgstr "Mailbox fehlerhaft!"
1238  
1239 -#: mbox.c:662
1240 -msgid "Mailbox was corrupted!"
1241 -msgstr "Mailbox wurde zerstört!"
1242 -
1243  #: mbox.c:701 mbox.c:952
1244  msgid "Fatal error!  Could not reopen mailbox!"
1245  msgstr "Fataler Fehler, konnte Mailbox nicht erneut öffnen!"
1246  
1247 -#: mbox.c:710
1248 -msgid "Unable to lock mailbox!"
1249 -msgstr "Kann Mailbox nicht für exklusiven Zugriff sperren!"
1250 -
1251  #. this means ctx->changed or ctx->deleted was set, but no
1252  #. * messages were found to be changed or deleted.  This should
1253  #. * never happen, is we presume it is a bug in mutt.
1254 diff -urN mutt-1.5.12/po/POTFILES.in mutt-1.5.12-ro/po/POTFILES.in
1255 --- mutt-1.5.12/po/POTFILES.in  2005-08-03 11:17:47.000000000 +0200
1256 +++ mutt-1.5.12-ro/po/POTFILES.in       2006-07-15 20:13:19.000000000 +0200
1257 @@ -8,6 +8,7 @@
1258  color.c
1259  commands.c
1260  compose.c
1261 +compress.c
1262  crypt-gpgme.c
1263  crypt.c
1264  cryptglue.c
1265 diff -urN mutt-1.5.12/status.c mutt-1.5.12-ro/status.c
1266 --- mutt-1.5.12/status.c        2005-09-18 10:22:22.000000000 +0200
1267 +++ mutt-1.5.12-ro/status.c     2006-07-15 20:13:19.000000000 +0200
1268 @@ -97,6 +97,14 @@
1269  
1270      case 'f':
1271        snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
1272 +#ifdef USE_COMPRESSED
1273 +      if (Context && Context->compressinfo && Context->realpath)
1274 +      {
1275 +        strfcpy (tmp, Context->realpath, sizeof (tmp));
1276 +        mutt_pretty_mailbox (tmp);
1277 +      }
1278 +      else
1279 +#endif
1280        if (Context && Context->path)
1281        {
1282         strfcpy (tmp, Context->path, sizeof (tmp));
This page took 0.141051 seconds and 3 git commands to generate.