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