Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 198242 | Differences between
and this patch

Collapse All | Expand All

(-)mutt-1.5.17/compress.c (+499 lines)
Line 0 Link Here
1
/*
2
 * Copyright (C) 1997 Alain Penders <Alain@Finale-Dev.com>
3
 *
4
 *     This program is free software; you can redistribute it and/or modify
5
 *     it under the terms of the GNU General Public License as published by
6
 *     the Free Software Foundation; either version 2 of the License, or
7
 *     (at your option) any later version.
8
 *
9
 *     This program is distributed in the hope that it will be useful,
10
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 *     GNU General Public License for more details.
13
 *
14
 *     You should have received a copy of the GNU General Public License
15
 *     along with this program; if not, write to the Free Software
16
 *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
 */
18
19
#if HAVE_CONFIG_H
20
# include "config.h"
21
#endif
22
23
#include "mutt.h"
24
25
#ifdef USE_COMPRESSED
26
27
#include "mx.h"
28
#include "mailbox.h"
29
#include "mutt_curses.h"
30
31
#include <errno.h>
32
#include <string.h>
33
#include <unistd.h>
34
#include <sys/stat.h>
35
36
typedef struct
37
{
38
  const char *close;	/* close-hook  command */
39
  const char *open;	/* open-hook   command */
40
  const char *append;	/* append-hook command */
41
  off_t size;		/* size of real folder */
42
} COMPRESS_INFO;
43
44
45
/*
46
 * ctx - context to lock
47
 * excl - exclusive lock?
48
 * retry - should retry if unable to lock?
49
 */
50
int mbox_lock_compressed (CONTEXT *ctx, FILE *fp, int excl, int retry)
51
{
52
  int r;
53
54
  if ((r = mx_lock_file (ctx->realpath, fileno (fp), excl, 1, retry)) == 0)
55
    ctx->locked = 1;
56
  else if (retry && !excl)
57
  {
58
    ctx->readonly = 1;
59
    return 0;
60
  }
61
62
  return (r);
63
}
64
65
void mbox_unlock_compressed (CONTEXT *ctx, FILE *fp)
66
{
67
  if (ctx->locked)
68
  {
69
    fflush (fp);
70
71
    mx_unlock_file (ctx->realpath, fileno (fp), 1);
72
    ctx->locked = 0;
73
  }
74
}
75
76
static int is_new (const char *path)
77
{
78
  return (access (path, W_OK) != 0 && errno == ENOENT) ? 1 : 0;
79
}
80
81
static const char* find_compress_hook (int type, const char *path)
82
{
83
  const char* c = mutt_find_hook (type, path);
84
  return (!c || !*c) ? NULL : c;
85
}
86
87
int mutt_can_read_compressed (const char *path)
88
{
89
  return find_compress_hook (M_OPENHOOK, path) ? 1 : 0;
90
}
91
92
/*
93
 * if the file is new, we really do not append, but create, and so use
94
 * close-hook, and not append-hook
95
 */
96
static const char* get_append_command (const char *path, const CONTEXT* ctx)
97
{
98
  COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
99
  return (is_new (path)) ? ci->close : ci->append;
100
}
101
102
int mutt_can_append_compressed (const char *path)
103
{
104
  int magic;
105
106
  if (is_new (path))
107
  {
108
    char *dir_path = safe_strdup(path);
109
    char *aux = strrchr(dir_path, '/');
110
    int dir_valid = 1;
111
    if (aux)
112
    {
113
      *aux='\0';
114
      if (access(dir_path, W_OK|X_OK))
115
        dir_valid = 0;
116
    }
117
    safe_free((void**)&dir_path);
118
    return dir_valid && (find_compress_hook (M_CLOSEHOOK, path) ? 1 : 0);
119
  }
120
121
  magic = mx_get_magic (path);
122
123
  if (magic != 0 && magic != M_COMPRESSED)
124
    return 0;
125
126
  return (find_compress_hook (M_APPENDHOOK, path)
127
	  || (find_compress_hook (M_OPENHOOK, path)
128
	      && find_compress_hook (M_CLOSEHOOK, path))) ? 1 : 0;
129
}
130
131
/* open a compressed mailbox */
132
static COMPRESS_INFO *set_compress_info (CONTEXT *ctx)
133
{
134
  COMPRESS_INFO *ci;
135
136
  /* Now lets uncompress this thing */
137
  ci = safe_malloc (sizeof (COMPRESS_INFO));
138
  ctx->compressinfo = (void*) ci;
139
  ci->append = find_compress_hook (M_APPENDHOOK, ctx->path);
140
  ci->open = find_compress_hook (M_OPENHOOK, ctx->path);
141
  ci->close = find_compress_hook (M_CLOSEHOOK, ctx->path);
142
  return ci;
143
}
144
145
static void set_path (CONTEXT* ctx)
146
{
147
  char tmppath[_POSIX_PATH_MAX];
148
149
  /* Setup the right paths */
150
  ctx->realpath = ctx->path;
151
152
  /* Uncompress to /tmp */
153
  mutt_mktemp (tmppath);
154
  ctx->path = safe_malloc (strlen (tmppath) + 1);
155
  strcpy (ctx->path, tmppath);
156
}
157
158
static int get_size (const char* path)
159
{
160
  struct stat sb;
161
  if (stat (path, &sb) != 0)
162
    return 0;
163
  return (sb.st_size);
164
}
165
166
static void store_size (CONTEXT* ctx)
167
{
168
  COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
169
  ci->size = get_size (ctx->realpath);
170
}
171
172
static const char *
173
compresshook_format_str (char *dest, size_t destlen, size_t col, char op,
174
			 const char *src, const char *fmt,
175
			 const char *ifstring, const char *elsestring,
176
			 unsigned long data, format_flag flags)
177
{
178
  char tmp[SHORT_STRING];
179
180
  CONTEXT *ctx = (CONTEXT *) data;
181
  switch (op)
182
  {
183
  case 'f':
184
    snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
185
    snprintf (dest, destlen, tmp, ctx->realpath);
186
    break;
187
  case 't':
188
    snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
189
    snprintf (dest, destlen, tmp, ctx->path);
190
    break;
191
  }
192
  return (src);
193
}
194
195
/*
196
 * check that the command has both %f and %t
197
 * 0 means OK, -1 means error
198
 */
199
int mutt_test_compress_command (const char* cmd)
200
{
201
  return (strstr (cmd, "%f") && strstr (cmd, "%t")) ? 0 : -1;
202
}
203
204
static char *get_compression_cmd (const char* cmd, const CONTEXT* ctx)
205
{
206
  char expanded[_POSIX_PATH_MAX];
207
  mutt_FormatString (expanded, sizeof (expanded), 0, cmd, 
208
		     compresshook_format_str, (unsigned long) ctx, 0);
209
  return safe_strdup (expanded);
210
}
211
212
int mutt_check_mailbox_compressed (CONTEXT* ctx)
213
{
214
  COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
215
  if (ci->size != get_size (ctx->realpath))
216
  {
217
    FREE (&ctx->compressinfo);
218
    FREE (&ctx->realpath);
219
    mutt_error _("Mailbox was corrupted!");
220
    return (-1);
221
  }
222
  return (0);
223
}
224
225
int mutt_open_read_compressed (CONTEXT *ctx)
226
{
227
  char *cmd;
228
  FILE *fp;
229
  int rc;
230
231
  COMPRESS_INFO *ci = set_compress_info (ctx);
232
  if (!ci->open) {
233
    ctx->magic = 0;
234
    FREE (&ctx->compressinfo);
235
    return (-1);
236
  }
237
  if (!ci->close || access (ctx->path, W_OK) != 0)
238
    ctx->readonly = 1;
239
240
  set_path (ctx);
241
  store_size (ctx);
242
243
  if (!ctx->quiet)
244
    mutt_message (_("Decompressing %s..."), ctx->realpath);
245
246
  cmd = get_compression_cmd (ci->open, ctx);
247
  if (cmd == NULL)
248
    return (-1);
249
  dprint (2, (debugfile, "DecompressCmd: '%s'\n", cmd));
250
251
  if ((fp = fopen (ctx->realpath, "r")) == NULL)
252
  {
253
    mutt_perror (ctx->realpath);
254
    FREE (&cmd);
255
    return (-1);
256
  }
257
  mutt_block_signals ();
258
  if (mbox_lock_compressed (ctx, fp, 0, 1) == -1)
259
  {
260
    fclose (fp);
261
    mutt_unblock_signals ();
262
    mutt_error _("Unable to lock mailbox!");
263
    FREE (&cmd);
264
    return (-1);
265
  }
266
267
  endwin ();
268
  fflush (stdout);
269
  fprintf (stderr, _("Decompressing %s...\n"),ctx->realpath);
270
  rc = mutt_system (cmd);
271
  mbox_unlock_compressed (ctx, fp);
272
  mutt_unblock_signals ();
273
  fclose (fp);
274
275
  if (rc)
276
  {
277
    mutt_any_key_to_continue (NULL);
278
    ctx->magic = 0;
279
    FREE (&ctx->compressinfo);
280
    mutt_error (_("Error executing: %s : unable to open the mailbox!\n"), cmd);
281
  }
282
  FREE (&cmd);
283
  if (rc)
284
    return (-1);
285
286
  if (mutt_check_mailbox_compressed (ctx))
287
    return (-1);
288
289
  ctx->magic = mx_get_magic (ctx->path);
290
291
  return (0);
292
}
293
294
void restore_path (CONTEXT* ctx)
295
{
296
  FREE (&ctx->path);
297
  ctx->path = ctx->realpath;
298
}
299
300
/* remove the temporary mailbox */
301
void remove_file (CONTEXT* ctx)
302
{
303
  if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
304
    remove (ctx->path);
305
}
306
307
int mutt_open_append_compressed (CONTEXT *ctx)
308
{
309
  FILE *fh;
310
  COMPRESS_INFO *ci = set_compress_info (ctx);
311
312
  if (!get_append_command (ctx->path, ctx))
313
  {
314
    if (ci->open && ci->close)
315
      return (mutt_open_read_compressed (ctx));
316
317
    ctx->magic = 0;
318
    FREE (&ctx->compressinfo);
319
    return (-1);
320
  }
321
322
  set_path (ctx);
323
324
  ctx->magic = DefaultMagic;
325
326
  if (!is_new (ctx->realpath))
327
    if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
328
      if ((fh = fopen (ctx->path, "w")))
329
	fclose (fh);
330
  /* No error checking - the parent function will catch it */
331
332
  return (0);
333
}
334
335
/* close a compressed mailbox */
336
void mutt_fast_close_compressed (CONTEXT *ctx)
337
{
338
  dprint (2, (debugfile, "mutt_fast_close_compressed called on '%s'\n",
339
	      ctx->path));
340
341
  if (ctx->compressinfo)
342
  {
343
    if (ctx->fp)
344
      fclose (ctx->fp);
345
    ctx->fp = NULL;
346
    /* if the folder was removed, remove the gzipped folder too */
347
    if ((ctx->magic > 0) 
348
	&& (access (ctx->path, F_OK) != 0) 
349
	&& ! option (OPTSAVEEMPTY))
350
      remove (ctx->realpath);
351
    else
352
      remove_file (ctx);
353
354
    restore_path (ctx);
355
    FREE (&ctx->compressinfo);
356
  }
357
}
358
359
/* return 0 on success, -1 on failure */
360
int mutt_sync_compressed (CONTEXT* ctx)
361
{
362
  char *cmd;
363
  int rc = 0;
364
  FILE *fp;
365
  COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
366
367
  if (!ctx->quiet)
368
    mutt_message (_("Compressing %s..."), ctx->realpath);
369
370
  cmd = get_compression_cmd (ci->close, ctx);
371
  if (cmd == NULL)
372
    return (-1);
373
374
  if ((fp = fopen (ctx->realpath, "a")) == NULL)
375
  {
376
    mutt_perror (ctx->realpath);
377
    FREE (&cmd);
378
    return (-1);
379
  }
380
  mutt_block_signals ();
381
  if (mbox_lock_compressed (ctx, fp, 1, 1) == -1)
382
  {
383
    fclose (fp);
384
    mutt_unblock_signals ();
385
    mutt_error _("Unable to lock mailbox!");
386
    store_size (ctx);
387
    FREE (&cmd);
388
    return (-1);
389
  }
390
391
  dprint (2, (debugfile, "CompressCommand: '%s'\n", cmd));
392
393
  endwin ();
394
  fflush (stdout);
395
  fprintf (stderr, _("Compressing %s...\n"), ctx->realpath);
396
  if (mutt_system (cmd))
397
  {
398
    mutt_any_key_to_continue (NULL);
399
    mutt_error (_("%s: Error compressing mailbox! Original mailbox deleted, uncompressed one kept!\n"), ctx->path);
400
    rc = -1;
401
  }
402
403
  mbox_unlock_compressed (ctx, fp);
404
  mutt_unblock_signals ();
405
  fclose (fp);
406
407
  FREE (&cmd);
408
409
  store_size (ctx);
410
411
  return (rc);
412
}
413
414
int mutt_slow_close_compressed (CONTEXT *ctx)
415
{
416
  FILE *fp;
417
  const char *append;
418
  char *cmd;
419
  COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
420
421
  dprint (2, (debugfile, "mutt_slow_close_compressed called on '%s'\n",
422
	      ctx->path));
423
424
  if (! (ctx->append
425
	 && ((append = get_append_command (ctx->realpath, ctx))
426
	     || (append = ci->close))))
427
  { 
428
    /* if we can not or should not append, we only have to remove the */
429
    /* compressed info, because sync was already called               */
430
    mutt_fast_close_compressed (ctx);
431
    return (0);
432
  }
433
434
  if (ctx->fp)
435
    fclose (ctx->fp);
436
  ctx->fp = NULL;
437
438
  if (!ctx->quiet)
439
  {
440
    if (append == ci->close)
441
      mutt_message (_("Compressing %s..."), ctx->realpath);
442
    else
443
      mutt_message (_("Compressed-appending to %s..."), ctx->realpath);
444
  }
445
446
  cmd = get_compression_cmd (append, ctx);
447
  if (cmd == NULL)
448
    return (-1);
449
450
  if ((fp = fopen (ctx->realpath, "a")) == NULL)
451
  {
452
    mutt_perror (ctx->realpath);
453
    FREE (&cmd);
454
    return (-1);
455
  }
456
  mutt_block_signals ();
457
  if (mbox_lock_compressed (ctx, fp, 1, 1) == -1)
458
  {
459
    fclose (fp);
460
    mutt_unblock_signals ();
461
    mutt_error _("Unable to lock mailbox!");
462
    FREE (&cmd);
463
    return (-1);
464
  }
465
466
  dprint (2, (debugfile, "CompressCmd: '%s'\n", cmd));
467
468
  endwin ();
469
  fflush (stdout);
470
471
  if (append == ci->close)
472
    fprintf (stderr, _("Compressing %s...\n"), ctx->realpath);
473
  else
474
    fprintf (stderr, _("Compressed-appending to %s...\n"), ctx->realpath);
475
476
  if (mutt_system (cmd))
477
  {
478
    mutt_any_key_to_continue (NULL);
479
    mutt_error (_(" %s: Error compressing mailbox!  Uncompressed one kept!\n"),
480
		ctx->path);
481
    FREE (&cmd);
482
    mbox_unlock_compressed (ctx, fp);
483
    mutt_unblock_signals ();
484
    fclose (fp);
485
    return (-1);
486
  }
487
488
  mbox_unlock_compressed (ctx, fp);
489
  mutt_unblock_signals ();
490
  fclose (fp);
491
  remove_file (ctx);
492
  restore_path (ctx);
493
  FREE (&cmd);
494
  FREE (&ctx->compressinfo);
495
496
  return (0);
497
}
498
499
#endif /* USE_COMPRESSED */
(-)mutt-1.5.17/compress.h (+27 lines)
Line 0 Link Here
1
/*
2
 * Copyright (C) 1997 Alain Penders <Alain@Finale-Dev.com>
3
 *
4
 *     This program is free software; you can redistribute it and/or modify
5
 *     it under the terms of the GNU General Public License as published by
6
 *     the Free Software Foundation; either version 2 of the License, or
7
 *     (at your option) any later version.
8
 *
9
 *     This program is distributed in the hope that it will be useful,
10
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 *     GNU General Public License for more details.
13
 *
14
 *     You should have received a copy of the GNU General Public License
15
 *     along with this program; if not, write to the Free Software
16
 *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
 */
18
19
int mutt_can_read_compressed (const char *);
20
int mutt_can_append_compressed (const char *);
21
int mutt_open_read_compressed (CONTEXT *);
22
int mutt_open_append_compressed (CONTEXT *);
23
int mutt_slow_close_compressed (CONTEXT *);
24
int mutt_sync_compressed (CONTEXT *);
25
int mutt_test_compress_command (const char *);
26
int mutt_check_mailbox_compressed (CONTEXT *);
27
void mutt_fast_close_compressed (CONTEXT *);
(-)mutt-1.5.17/config.h.in (+3 lines)
Lines 510-515 Link Here
510
/* Define to enable Sun mailtool attachments support. */
510
/* Define to enable Sun mailtool attachments support. */
511
#undef SUN_ATTACHMENT
511
#undef SUN_ATTACHMENT
512
512
513
/* Define to enable compressed mailboxes support */
514
#undef USE_COMPRESSED
515
513
/* Define to use dotlocking for mailboxes. */
516
/* Define to use dotlocking for mailboxes. */
514
#undef USE_DOTLOCK
517
#undef USE_DOTLOCK
515
518
(-)mutt-1.5.17/configure (+12 lines)
Lines 1371-1376 Link Here
1371
  --enable-hcache         Enable header caching
1371
  --enable-hcache         Enable header caching
1372
  --disable-iconv         Disable iconv support
1372
  --disable-iconv         Disable iconv support
1373
  --disable-nls           Do not use Native Language Support
1373
  --disable-nls           Do not use Native Language Support
1374
  --enable-compressed     Enable compressed folders support
1374
1375
1375
Optional Packages:
1376
Optional Packages:
1376
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
1377
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
Lines 15398-15403 Link Here
15398
fi
15399
fi
15399
15400
15400
15401
15402
# Check whether --enable-compressed or --disable-compressed was given.
15403
if test "${enable_compressed+set}" = set; then
15404
  enableval="$enable_compressed"; if test x$enableval = xyes; then
15405
15406
cat >>confdefs.h <<\_ACEOF
15407
#define USE_COMPRESSED 1
15408
_ACEOF
15409
15410
        fi
15411
fi
15412
15401
15413
15402
# Check whether --with-exec-shell was given.
15414
# Check whether --with-exec-shell was given.
15403
if test "${with_exec_shell+set}" = set; then
15415
if test "${with_exec_shell+set}" = set; then
(-)mutt-1.5.17/configure.ac (+5 lines)
Lines 791-796 Link Here
791
                AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ])
791
                AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ])
792
        fi])
792
        fi])
793
793
794
AC_ARG_ENABLE(compressed, AC_HELP_STRING([--enable-compressed], [Enable compressed folders support]),
795
	[if test x$enableval = xyes; then
796
                AC_DEFINE(USE_COMPRESSED,1, [ Define to support compressed folders. ])
797
        fi])
798
794
AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]),
799
AC_ARG_WITH(exec-shell, AC_HELP_STRING([--with-exec-shell=SHELL], [Specify alternate shell (ONLY if /bin/sh is broken)]),
795
        [if test $withval != yes; then
800
        [if test $withval != yes; then
796
                AC_DEFINE_UNQUOTED(EXECSHELL, "$withval",
801
                AC_DEFINE_UNQUOTED(EXECSHELL, "$withval",
(-)mutt-1.5.17/curs_main.c (+5 lines)
Lines 1111-1116 Link Here
1111
        {
1111
        {
1112
	  int check;
1112
	  int check;
1113
1113
1114
#ifdef USE_COMPRESSED
1115
	  if (Context->compressinfo && Context->realpath)
1116
	    mutt_str_replace (&LastFolder, Context->realpath);
1117
	  else
1118
#endif
1114
	  mutt_str_replace (&LastFolder, Context->path);
1119
	  mutt_str_replace (&LastFolder, Context->path);
1115
	  oldcount = Context ? Context->msgcount : 0;
1120
	  oldcount = Context ? Context->msgcount : 0;
1116
1121
(-)mutt-1.5.17/doc/manual.xml.head (+199 lines)
Lines 4654-4659 Link Here
4654
4654
4655
</chapter>
4655
</chapter>
4656
4656
4657
<sect1 id="compressedfolders">
4658
<title>Compressed folders Support (OPTIONAL)</title>
4659
4660
<para>
4661
If Mutt was compiled with compressed folders support (by running the
4662
<emphasis>configure</emphasis> script with the
4663
<emphasis>--enable-compressed</emphasis> flag), Mutt can open folders
4664
stored in an arbitrary format, provided that the user has a script to
4665
convert from/to this format to one of the accepted.
4666
4667
The most common use is to open compressed archived folders e.g. with
4668
gzip.
4669
4670
In addition, the user can provide a script that gets a folder in an
4671
accepted format and appends its context to the folder in the
4672
user-defined format, which may be faster than converting the entire
4673
folder to the accepted format, appending to it and converting back to
4674
the user-defined format.
4675
4676
There are three hooks defined (<link
4677
linkend="open-hook">open-hook</link>, <link
4678
linkend="close-hook">close-hook</link> and <link
4679
linkend="append-hook">append-hook</link>) which define commands to
4680
uncompress and compress a folder and to append messages to an existing
4681
compressed folder respectively.
4682
4683
For example:
4684
4685
<screen>
4686
open-hook \\.gz$ "gzip -cd %f &gt; %t" 
4687
close-hook \\.gz$ "gzip -c %t &gt; %f"
4688
append-hook \\.gz$ "gzip -c %t &gt;&gt; %f" 
4689
</screen>
4690
4691
You do not have to specify all of the commands. If you omit <link
4692
linkend="append-hook">append-hook</link>, the folder will be open and
4693
closed again each time you will add to it. If you omit <link
4694
linkend="close-hook">close-hook</link> (or give empty command) , the
4695
folder will be open in the mode. If you specify <link
4696
linkend="append-hook">append-hook</link> though you'll be able to
4697
append to the folder.
4698
4699
Note that Mutt will only try to use hooks if the file is not in one of
4700
the accepted formats. In particular, if the file is empty, mutt
4701
supposes it is not compressed. This is important because it allows the
4702
use of programs that do not have well defined extensions. Just use
4703
&quot;.&quot; as a regexp. But this may be surprising if your
4704
compressing script produces empty files. In this situation, unset
4705
<link linkend="save-empty">&dollar;save&lowbar;empty</link>, so that
4706
the compressed file will be removed if you delete all of the messages.
4707
</para>
4708
4709
<sect2 id="open-hook">
4710
<title>Open a compressed mailbox for reading</title>
4711
4712
<para>
4713
Usage: <literal>open-hook</literal> <emphasis>regexp</emphasis> &quot;<emphasis>command</emphasis>&quot;
4714
4715
The <emphasis>command</emphasis> is the command that can be used for
4716
opening the folders whose names match <emphasis>regexp</emphasis>.
4717
4718
The <emphasis>command</emphasis> string is the printf-like format
4719
string, and it should accept two parameters: &percnt;f, which is
4720
replaced with the (compressed) folder name, and &percnt;t which is
4721
replaced with the name of the temporary folder to which to write.
4722
4723
&percnt;f and &percnt;t can be repeated any number of times in the
4724
command string, and all of the entries are replaced with the
4725
appropriate folder name. In addition, &percnt;&percnt; is replaced by
4726
&percnt;, as in printf, and any other &percnt;anything is left as is.
4727
4728
The <emphasis>command</emphasis> should <emphasis
4729
role="bold">not</emphasis> remove the original compressed file.  The
4730
<emphasis>command</emphasis> should return non-zero exit status if it
4731
fails, so mutt knows something's wrong.
4732
4733
Example:
4734
4735
<screen>
4736
open-hook \\.gz$ "gzip -cd %f &gt; %t" 
4737
</screen>
4738
4739
If the <emphasis>command</emphasis> is empty, this operation is
4740
disabled for this file type.
4741
</para>
4742
</sect2>
4743
4744
<sect2 id="close-hook">
4745
<title>Write a compressed mailbox</title>
4746
4747
<para>
4748
Usage: <literal>close-hook</literal> <emphasis>regexp</emphasis> &quot;<emphasis>command</emphasis>&quot;
4749
4750
This is used to close the folder that was open with the <link
4751
linkend="open-hook">open-hook</link> command after some changes were
4752
made to it.
4753
4754
The <emphasis>command</emphasis> string is the command that can be
4755
used for closing the folders whose names match
4756
<emphasis>regexp</emphasis>. It has the same format as in the <link
4757
linkend="open-hook">open-hook</link> command. Temporary folder in this
4758
case is the folder previously produced by the <link
4759
linkend="open-hook">open-hook</link> command.
4760
4761
The <emphasis>command</emphasis> should <emphasis
4762
role="bold">not</emphasis> remove the decompressed file. The
4763
<emphasis>command</emphasis> should return non-zero exit status if it
4764
fails, so mutt knows something's wrong.
4765
4766
Example:
4767
4768
<screen>
4769
close-hook \\.gz$ "gzip -c %t &gt; %f"
4770
</screen>
4771
4772
If the <emphasis>command</emphasis> is empty, this operation is
4773
disabled for this file type, and the file can only be open in the
4774
read-only mode.
4775
4776
<link linkend="close-hook">close-hook</link> is not called when you
4777
exit from the folder if the folder was not changed.
4778
</para>
4779
</sect2>
4780
4781
<sect2 id="append-hook">
4782
<title>Append a message to a compressed mailbox</title>
4783
4784
<para>
4785
Usage: <literal>append-hook</literal> <emphasis>regexp</emphasis> &quot;<emphasis>command</emphasis>&quot;
4786
4787
This command is used for saving to an existing compressed folder.  The
4788
<emphasis>command</emphasis> is the command that can be used for
4789
appending to the folders whose names match
4790
<emphasis>regexp</emphasis>. It has the same format as in the <link
4791
linkend="open-hook">open-hook</link> command.  The temporary folder in
4792
this case contains the messages that are being appended.
4793
4794
The <emphasis>command</emphasis> should <emphasis
4795
role="bold">not</emphasis> remove the decompressed file. The
4796
<emphasis>command</emphasis> should return non-zero exit status if it
4797
fails, so mutt knows something's wrong.
4798
4799
Example:
4800
4801
<screen>
4802
append-hook \\.gz$ "gzip -c %t &gt;&gt; %f" 
4803
</screen>
4804
4805
When <link linkend="append-hook">append-hook</link> is used, the folder
4806
is not opened, which saves time, but this means that we can not find
4807
out what the folder type is. Thus the default (<link
4808
linkend="mbox-type">&dollar;mbox&lowbar;type</link>) type is always
4809
supposed (i.e.  this is the format used for the temporary folder).
4810
4811
If the file does not exist when you save to it, <link
4812
linkend="close-hook">close-hook</link> is called, and not <link
4813
linkend="append-hook">append-hook</link>. <link
4814
linkend="append-hook">append-hook</link> is only for appending to
4815
existing folders.
4816
4817
If the <emphasis>command</emphasis> is empty, this operation is
4818
disabled for this file type. In this case, the folder will be open and
4819
closed again (using <link linkend="open-hook">open-hook</link> and
4820
<link linkend="close-hook">close-hook</link>respectively) each time you
4821
will add to it.
4822
</para>
4823
</sect2>
4824
4825
<sect2>
4826
<title>Encrypted folders</title>
4827
4828
<para>
4829
The compressed folders support can also be used to handle encrypted
4830
folders. If you want to encrypt a folder with PGP, you may want to use
4831
the following hooks:
4832
4833
<screen>
4834
open-hook  \\.pgp$ "pgp -f &lt; %f &gt; %t"
4835
close-hook \\.pgp$ "pgp -fe YourPgpUserIdOrKeyId &lt; %t &gt; %f"
4836
</screen>
4837
4838
Please note, that PGP does not support appending to an encrypted
4839
folder, so there is no append-hook defined.
4840
4841
If you are using GnuPG instead of PGP, you may use the following hooks
4842
instead:
4843
4844
<screen>
4845
open-hook  \\.gpg$ "gpg --decrypt &lt; %f &gt; %t"
4846
close-hook \\.gpg$ "gpg --encrypt --recipient YourGpgUserIdOrKeyId &lt; %t &gt; %f"
4847
</screen>
4848
4849
<emphasis role="bold">Note:</emphasis> the folder is temporary stored
4850
decrypted in the /tmp directory, where it can be read by your system
4851
administrator. So think about the security aspects of this.
4852
</para>
4853
</sect2>
4854
</sect1>
4855
4657
<chapter id="mimesupport">
4856
<chapter id="mimesupport">
4658
<title>Mutt's MIME Support</title>
4857
<title>Mutt's MIME Support</title>
4659
4858
(-)mutt-1.5.17/doc/muttrc.man.head (+18 lines)
Lines 345-350 Link Here
345
to a certain recipient.  The meaning of "key ID" is to be taken
345
to a certain recipient.  The meaning of "key ID" is to be taken
346
broadly: This can be a different e-mail address, a numerical key ID,
346
broadly: This can be a different e-mail address, a numerical key ID,
347
or even just an arbitrary search string.
347
or even just an arbitrary search string.
348
.PP
349
.nf
350
\fBopen-hook\fP \fIregexp\fP "\fIcommand\fP"
351
\fBclose-hook\fP \fIregexp\fP "\fIcommand\fP"
352
\fBappend-hook\fP \fIregexp\fP "\fIcommand\fP"
353
.fi
354
.IP
355
These commands provide a way to handle compressed folders. The given
356
\fBregexp\fP specifies which folders are taken as compressed (e.g.
357
"\fI\\\\.gz$\fP"). The commands tell Mutt how to uncompress a folder
358
(\fBopen-hook\fP), compress a folder (\fBclose-hook\fP) or append a
359
compressed mail to a compressed folder (\fBappend-hook\fP). The
360
\fIcommand\fP string is the 
361
.BR printf (3)
362
like format string, and it should accept two parameters: \fB%f\fP,
363
which is replaced with the (compressed) folder name, and \fB%t\fP
364
which is replaced with the name of the temporary folder to which to
365
write.
348
.TP
366
.TP
349
\fBpush\fP \fIstring\fP
367
\fBpush\fP \fIstring\fP
350
This command adds the named \fIstring\fP to the keyboard buffer.
368
This command adds the named \fIstring\fP to the keyboard buffer.
(-)mutt-1.5.17/hook.c (+14 lines)
Lines 24-29 Link Here
24
#include "mailbox.h"
24
#include "mailbox.h"
25
#include "mutt_crypt.h"
25
#include "mutt_crypt.h"
26
26
27
#ifdef USE_COMPRESSED
28
#include "compress.h"
29
#endif
30
27
#include <limits.h>
31
#include <limits.h>
28
#include <string.h>
32
#include <string.h>
29
#include <stdlib.h>
33
#include <stdlib.h>
Lines 92-97 Link Here
92
    memset (&pattern, 0, sizeof (pattern));
96
    memset (&pattern, 0, sizeof (pattern));
93
    pattern.data = safe_strdup (path);
97
    pattern.data = safe_strdup (path);
94
  }
98
  }
99
#ifdef USE_COMPRESSED
100
  else if (data & (M_APPENDHOOK | M_OPENHOOK | M_CLOSEHOOK))
101
  {
102
    if (mutt_test_compress_command (command.data))
103
    {
104
      strfcpy (err->data, _("badly formatted command string"), err->dsize);
105
      return (-1);
106
    }
107
  }
108
#endif
95
  else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ICONVHOOK | M_ACCOUNTHOOK))
109
  else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ICONVHOOK | M_ACCOUNTHOOK))
96
           && (!WithCrypto || !(data & M_CRYPTHOOK))
110
           && (!WithCrypto || !(data & M_CRYPTHOOK))
97
      )
111
      )
(-)mutt-1.5.17/init.h (+5 lines)
Lines 3156-3161 Link Here
3156
  { "fcc-hook",		mutt_parse_hook,	M_FCCHOOK },
3156
  { "fcc-hook",		mutt_parse_hook,	M_FCCHOOK },
3157
  { "fcc-save-hook",	mutt_parse_hook,	M_FCCHOOK | M_SAVEHOOK },
3157
  { "fcc-save-hook",	mutt_parse_hook,	M_FCCHOOK | M_SAVEHOOK },
3158
  { "folder-hook",	mutt_parse_hook,	M_FOLDERHOOK },
3158
  { "folder-hook",	mutt_parse_hook,	M_FOLDERHOOK },
3159
#ifdef USE_COMPRESSED
3160
  { "open-hook",	mutt_parse_hook,	M_OPENHOOK },
3161
  { "close-hook",	mutt_parse_hook,	M_CLOSEHOOK },
3162
  { "append-hook",	mutt_parse_hook,	M_APPENDHOOK },
3163
#endif
3159
  { "group",		parse_group,		0 },
3164
  { "group",		parse_group,		0 },
3160
  { "ungroup",		parse_ungroup,		0 },
3165
  { "ungroup",		parse_ungroup,		0 },
3161
  { "hdr_order",	parse_list,		UL &HeaderOrderList },
3166
  { "hdr_order",	parse_list,		UL &HeaderOrderList },
(-)mutt-1.5.17/main.c (+6 lines)
Lines 409-414 Link Here
409
#else
409
#else
410
	"-LOCALES_HACK  "
410
	"-LOCALES_HACK  "
411
#endif
411
#endif
412
413
#ifdef USE_COMPRESSED
414
	"+COMPRESSED  "
415
#else
416
	"-COMPRESSED  "
417
#endif
412
	      
418
	      
413
#ifdef HAVE_WC_FUNCS
419
#ifdef HAVE_WC_FUNCS
414
	"+HAVE_WC_FUNCS  "
420
	"+HAVE_WC_FUNCS  "
(-)mutt-1.5.17/Makefile.am (-2 / +2 lines)
Lines 18-24 Link Here
18
bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
18
bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
19
mutt_SOURCES = $(BUILT_SOURCES) \
19
mutt_SOURCES = $(BUILT_SOURCES) \
20
	addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
20
	addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
21
	crypt.c cryptglue.c \
21
	crypt.c cryptglue.c compress.c \
22
	commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \
22
	commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \
23
	edit.c enter.c flags.c init.c filter.c from.c \
23
	edit.c enter.c flags.c init.c filter.c from.c \
24
	getdomain.c group.c \
24
	getdomain.c group.c \
Lines 66-72 Link Here
66
	utf8.c wcwidth.c 
66
	utf8.c wcwidth.c 
67
67
68
EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
68
EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
69
	configure account.h \
69
	configure account.h compress.h \
70
	attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \
70
	attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \
71
	globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
71
	globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
72
	mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
72
	mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
(-)mutt-1.5.17/Makefile.in (-3 / +4 lines)
Lines 74-80 Link Here
74
	attach.$(OBJEXT) base64.$(OBJEXT) browser.$(OBJEXT) \
74
	attach.$(OBJEXT) base64.$(OBJEXT) browser.$(OBJEXT) \
75
	buffy.$(OBJEXT) color.$(OBJEXT) crypt.$(OBJEXT) \
75
	buffy.$(OBJEXT) color.$(OBJEXT) crypt.$(OBJEXT) \
76
	cryptglue.$(OBJEXT) commands.$(OBJEXT) complete.$(OBJEXT) \
76
	cryptglue.$(OBJEXT) commands.$(OBJEXT) complete.$(OBJEXT) \
77
	compose.$(OBJEXT) copy.$(OBJEXT) curs_lib.$(OBJEXT) \
77
	compose.$(OBJEXT) compress.$(OBJEXT) copy.$(OBJEXT) curs_lib.$(OBJEXT) \
78
	curs_main.$(OBJEXT) date.$(OBJEXT) edit.$(OBJEXT) \
78
	curs_main.$(OBJEXT) date.$(OBJEXT) edit.$(OBJEXT) \
79
	enter.$(OBJEXT) flags.$(OBJEXT) init.$(OBJEXT) \
79
	enter.$(OBJEXT) flags.$(OBJEXT) init.$(OBJEXT) \
80
	filter.$(OBJEXT) from.$(OBJEXT) getdomain.$(OBJEXT) \
80
	filter.$(OBJEXT) from.$(OBJEXT) getdomain.$(OBJEXT) \
Lines 302-308 Link Here
302
BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h hcversion.h
302
BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h hcversion.h
303
mutt_SOURCES = $(BUILT_SOURCES) \
303
mutt_SOURCES = $(BUILT_SOURCES) \
304
	addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
304
	addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
305
	crypt.c cryptglue.c \
305
	crypt.c cryptglue.c compress.c \
306
	commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \
306
	commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \
307
	edit.c enter.c flags.c init.c filter.c from.c \
307
	edit.c enter.c flags.c init.c filter.c from.c \
308
	getdomain.c group.c \
308
	getdomain.c group.c \
Lines 335-341 Link Here
335
	utf8.c wcwidth.c 
335
	utf8.c wcwidth.c 
336
336
337
EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
337
EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
338
	configure account.h \
338
	configure account.h compress.h \
339
	attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \
339
	attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \
340
	globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
340
	globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
341
	mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
341
	mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
Lines 507-512 Link Here
507
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commands.Po@am__quote@
507
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commands.Po@am__quote@
508
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complete.Po@am__quote@
508
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/complete.Po@am__quote@
509
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compose.Po@am__quote@
509
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compose.Po@am__quote@
510
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress.Po@am__quote@
510
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copy.Po@am__quote@
511
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copy.Po@am__quote@
511
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt-gpgme.Po@am__quote@
512
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt-gpgme.Po@am__quote@
512
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt-mod-pgp-classic.Po@am__quote@
513
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt-mod-pgp-classic.Po@am__quote@
(-)mutt-1.5.17/mbox.c (+10 lines)
Lines 29-34 Link Here
29
#include "copy.h"
29
#include "copy.h"
30
#include "mutt_curses.h"
30
#include "mutt_curses.h"
31
31
32
#ifdef USE_COMPRESSED
33
#include "compress.h"
34
#endif
35
32
#include <sys/stat.h>
36
#include <sys/stat.h>
33
#include <dirent.h>
37
#include <dirent.h>
34
#include <string.h>
38
#include <string.h>
Lines 1026-1031 Link Here
1026
int mbox_close_mailbox (CONTEXT *ctx)
1030
int mbox_close_mailbox (CONTEXT *ctx)
1027
{
1031
{
1028
  mx_unlock_file (ctx->path, fileno (ctx->fp), 1);
1032
  mx_unlock_file (ctx->path, fileno (ctx->fp), 1);
1033
1034
#ifdef USE_COMPRESSED
1035
  if (ctx->compressinfo)
1036
    mutt_slow_close_compressed (ctx);
1037
#endif
1038
1029
  mutt_unblock_signals ();
1039
  mutt_unblock_signals ();
1030
  mx_fastclose_mailbox (ctx);
1040
  mx_fastclose_mailbox (ctx);
1031
  return 0;
1041
  return 0;
(-)mutt-1.5.17/mutt.h (+10 lines)
Lines 160-165 Link Here
160
#define M_ACCOUNTHOOK	(1<<9)
160
#define M_ACCOUNTHOOK	(1<<9)
161
#define M_REPLYHOOK	(1<<10)
161
#define M_REPLYHOOK	(1<<10)
162
#define M_SEND2HOOK     (1<<11)
162
#define M_SEND2HOOK     (1<<11)
163
#ifdef USE_COMPRESSED
164
#define M_OPENHOOK	(1<<12)
165
#define M_APPENDHOOK	(1<<13)
166
#define M_CLOSEHOOK	(1<<14)
167
#endif
163
168
164
/* tree characters for linearize_tree and print_enriched_string */
169
/* tree characters for linearize_tree and print_enriched_string */
165
#define M_TREE_LLCORNER		1
170
#define M_TREE_LLCORNER		1
Lines 885-890 Link Here
885
  int flagged;			/* how many flagged messages */
890
  int flagged;			/* how many flagged messages */
886
  int msgnotreadyet;		/* which msg "new" in pager, -1 if none */
891
  int msgnotreadyet;		/* which msg "new" in pager, -1 if none */
887
892
893
#ifdef USE_COMPRESSED
894
  void *compressinfo;		/* compressed mbox module private data */
895
  char *realpath;		/* path to compressed mailbox */
896
#endif /* USE_COMPRESSED */
897
888
  short magic;			/* mailbox type */
898
  short magic;			/* mailbox type */
889
899
890
  unsigned char rights[(RIGHTSMAX + 7)/8];	/* ACL bits */
900
  unsigned char rights[(RIGHTSMAX + 7)/8];	/* ACL bits */
(-)mutt-1.5.17/Muttrc (+5 lines)
Lines 24-29 Link Here
24
macro index,pager y "<change-folder>?<toggle-mailboxes>" "show incoming mailboxes list"
24
macro index,pager y "<change-folder>?<toggle-mailboxes>" "show incoming mailboxes list"
25
bind browser y exit
25
bind browser y exit
26
26
27
# Use folders which match on \\.gz$ as gzipped folders:
28
# open-hook \\.gz$ "gzip -cd %f > %t"
29
# close-hook \\.gz$ "gzip -c %t > %f"
30
# append-hook \\.gz$ "gzip -c %t >> %f"
31
27
# If Mutt is unable to determine your site's domain name correctly, you can
32
# If Mutt is unable to determine your site's domain name correctly, you can
28
# set the default here.
33
# set the default here.
29
#
34
#
(-)mutt-1.5.17/Muttrc.head (+5 lines)
Lines 24-29 Link Here
24
macro index,pager y "<change-folder>?<toggle-mailboxes>" "show incoming mailboxes list"
24
macro index,pager y "<change-folder>?<toggle-mailboxes>" "show incoming mailboxes list"
25
bind browser y exit
25
bind browser y exit
26
26
27
# Use folders which match on \\.gz$ as gzipped folders:
28
# open-hook \\.gz$ "gzip -cd %f > %t"
29
# close-hook \\.gz$ "gzip -c %t > %f"
30
# append-hook \\.gz$ "gzip -c %t >> %f"
31
27
# If Mutt is unable to determine your site's domain name correctly, you can
32
# If Mutt is unable to determine your site's domain name correctly, you can
28
# set the default here.
33
# set the default here.
29
#
34
#
(-)mutt-1.5.17/mx.c (-1 / +41 lines)
Lines 30-35 Link Here
30
#include "keymap.h"
30
#include "keymap.h"
31
#include "url.h"
31
#include "url.h"
32
32
33
#ifdef USE_COMPRESSED
34
#include "compress.h"
35
#endif
36
33
#ifdef USE_IMAP
37
#ifdef USE_IMAP
34
#include "imap.h"
38
#include "imap.h"
35
#endif
39
#endif
Lines 445-450 Link Here
445
    return (-1);
449
    return (-1);
446
  }
450
  }
447
451
452
#ifdef USE_COMPRESSED
453
  if (magic == 0 && mutt_can_read_compressed (path))
454
    return M_COMPRESSED;
455
#endif
448
  return (magic);
456
  return (magic);
449
}
457
}
450
458
Lines 484-489 Link Here
484
{
492
{
485
  struct stat sb;
493
  struct stat sb;
486
494
495
#ifdef USE_COMPRESSED
496
  /* special case for appending to compressed folders -
497
   * even if we can not open them for reading */
498
  if (mutt_can_append_compressed (ctx->path))
499
    mutt_open_append_compressed (ctx);
500
#endif
501
487
  ctx->append = 1;
502
  ctx->append = 1;
488
503
489
#ifdef USE_IMAP
504
#ifdef USE_IMAP
Lines 647-653 Link Here
647
  }
662
  }
648
663
649
  ctx->magic = mx_get_magic (path);
664
  ctx->magic = mx_get_magic (path);
650
  
665
666
#ifdef USE_COMPRESSED
667
  if (ctx->magic == M_COMPRESSED)
668
    mutt_open_read_compressed (ctx);
669
#endif
670
651
  if(ctx->magic == 0)
671
  if(ctx->magic == 0)
652
    mutt_error (_("%s is not a mailbox."), path);
672
    mutt_error (_("%s is not a mailbox."), path);
653
673
Lines 748-753 Link Here
748
    mutt_free_header (&ctx->hdrs[i]);
768
    mutt_free_header (&ctx->hdrs[i]);
749
  FREE (&ctx->hdrs);
769
  FREE (&ctx->hdrs);
750
  FREE (&ctx->v2r);
770
  FREE (&ctx->v2r);
771
#ifdef USE_COMPRESSED
772
  if (ctx->compressinfo)
773
    mutt_fast_close_compressed (ctx);
774
#endif
751
  FREE (&ctx->path);
775
  FREE (&ctx->path);
752
  FREE (&ctx->pattern);
776
  FREE (&ctx->pattern);
753
  if (ctx->limit_pattern) 
777
  if (ctx->limit_pattern) 
Lines 800-805 Link Here
800
  
824
  
801
  if (tmp && tmp->new == 0)
825
  if (tmp && tmp->new == 0)
802
    mutt_update_mailbox (tmp);
826
    mutt_update_mailbox (tmp);
827
828
#ifdef USE_COMPRESSED
829
  if (rc == 0 && ctx->compressinfo)
830
    return mutt_sync_compressed (ctx);
831
#endif
832
803
  return rc;
833
  return rc;
804
}
834
}
805
835
Lines 1001-1006 Link Here
1001
      !mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
1031
      !mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
1002
    mx_unlink_empty (ctx->path);
1032
    mx_unlink_empty (ctx->path);
1003
1033
1034
#ifdef USE_COMPRESSED
1035
  if (ctx->compressinfo && mutt_slow_close_compressed (ctx))
1036
    return (-1);
1037
#endif
1038
1004
  mx_fastclose_mailbox (ctx);
1039
  mx_fastclose_mailbox (ctx);
1005
1040
1006
  return 0;
1041
  return 0;
Lines 1310-1315 Link Here
1310
{
1345
{
1311
  int rc;
1346
  int rc;
1312
1347
1348
#ifdef USE_COMPRESSED
1349
  if (ctx->compressinfo)
1350
    return mutt_check_mailbox_compressed (ctx);
1351
#endif
1352
1313
  if (ctx)
1353
  if (ctx)
1314
  {
1354
  {
1315
    if (ctx->locked) lock = 0;
1355
    if (ctx->locked) lock = 0;
(-)mutt-1.5.17/mx.h (+3 lines)
Lines 40-45 Link Here
40
#ifdef USE_POP
40
#ifdef USE_POP
41
  , M_POP
41
  , M_POP
42
#endif
42
#endif
43
#ifdef USE_COMPRESSED
44
  , M_COMPRESSED
45
#endif
43
};
46
};
44
47
45
WHERE short DefaultMagic INITVAL (M_MBOX);
48
WHERE short DefaultMagic INITVAL (M_MBOX);
(-)mutt-1.5.17/PATCHES (+1 lines)
Line 0 Link Here
1
patch-1.5.17.rr.compressed.1
(-)mutt-1.5.17/po/de.po (-8 / +46 lines)
Lines 1279-1284 Link Here
1279
msgid "Failed to figure out sender"
1279
msgid "Failed to figure out sender"
1280
msgstr "Kann Absender nicht ermitteln"
1280
msgstr "Kann Absender nicht ermitteln"
1281
1281
1282
#: compress.c:203 mbox.c:661
1283
msgid "Mailbox was corrupted!"
1284
msgstr "Mailbox wurde zerstört!"
1285
1286
#: compress.c:228 compress.c:253
1287
#, c-format
1288
msgid "Decompressing %s...\n"
1289
msgstr "Entpacke %s...\n"
1290
1291
#: compress.c:246 compress.c:367 compress.c:443 mbox.c:706
1292
msgid "Unable to lock mailbox!"
1293
msgstr "Kann Mailbox nicht für exklusiven Zugriff sperren!"
1294
1295
#: compress.c:264
1296
#, c-format
1297
msgid "Error executing: %s : unable to open the mailbox!\n"
1298
msgstr "Fehler beim Ausführen von %s : Kann die Mailbox nicht öffnen!\n"
1299
1300
#: compress.c:350 compress.c:377 compress.c:423 compress.c:454
1301
#, c-format
1302
msgid "Compressing %s...\n"
1303
msgstr "Komprimiere %s...\n"
1304
1305
#: compress.c:381
1306
#, c-format
1307
msgid ""
1308
"%s: Error compressing mailbox! Original mailbox deleted, uncompressed one "
1309
"kept!\n"
1310
msgstr ""
1311
"%s: Fehler beim Komprimieren der Mailbox! Ursprüngliche Mailbox gelöscht, "
1312
"entpackte gespeichert!\n"
1313
1314
#: compress.c:425 compress.c:456
1315
#, c-format
1316
msgid "Compressed-appending to %s...\n"
1317
msgstr "Hänge komprimiert an %s... an\n"
1318
1319
#: compress.c:461
1320
#, c-format
1321
msgid " %s: Error compressing mailbox!  Uncompressed one kept!\n"
1322
msgstr " %s: Fehler beim packen der Mailbox! Entpackte Mailbox gespeichert!\n"
1323
1282
#: crypt.c:69
1324
#: crypt.c:69
1283
#, c-format
1325
#, c-format
1284
msgid " (current time: %c)"
1326
msgid " (current time: %c)"
Lines 1948-1953 Link Here
1948
msgid "Bad history file format (line %d)"
1990
msgid "Bad history file format (line %d)"
1949
msgstr "Falsches Format der Datei früherer Eingaben (Zeile %d)"
1991
msgstr "Falsches Format der Datei früherer Eingaben (Zeile %d)"
1950
1992
1993
#: hook.c:96
1994
msgid "badly formatted command string"
1995
msgstr "Hook enthält nicht die Muster %f und %t"
1996
1951
#: hook.c:251
1997
#: hook.c:251
1952
#, c-format
1998
#, c-format
1953
msgid "unhook: Can't do unhook * from within a hook."
1999
msgid "unhook: Can't do unhook * from within a hook."
Lines 3463-3480 Link Here
3463
msgid "Mailbox is corrupt!"
3509
msgid "Mailbox is corrupt!"
3464
msgstr "Mailbox fehlerhaft!"
3510
msgstr "Mailbox fehlerhaft!"
3465
3511
3466
#: mbox.c:670
3467
msgid "Mailbox was corrupted!"
3468
msgstr "Mailbox wurde zerstört!"
3469
3470
#: mbox.c:711 mbox.c:964
3512
#: mbox.c:711 mbox.c:964
3471
msgid "Fatal error!  Could not reopen mailbox!"
3513
msgid "Fatal error!  Could not reopen mailbox!"
3472
msgstr "Fataler Fehler, konnte Mailbox nicht erneut öffnen!"
3514
msgstr "Fataler Fehler, konnte Mailbox nicht erneut öffnen!"
3473
3515
3474
#: mbox.c:720
3475
msgid "Unable to lock mailbox!"
3476
msgstr "Kann Mailbox nicht für exklusiven Zugriff sperren!"
3477
3478
#. this means ctx->changed or ctx->deleted was set, but no
3516
#. this means ctx->changed or ctx->deleted was set, but no
3479
#. * messages were found to be changed or deleted.  This should
3517
#. * messages were found to be changed or deleted.  This should
3480
#. * never happen, is we presume it is a bug in mutt.
3518
#. * never happen, is we presume it is a bug in mutt.
(-)mutt-1.5.17/po/POTFILES.in (+1 lines)
Lines 8-13 Link Here
8
color.c
8
color.c
9
commands.c
9
commands.c
10
compose.c
10
compose.c
11
compress.c
11
crypt-gpgme.c
12
crypt-gpgme.c
12
crypt.c
13
crypt.c
13
cryptglue.c
14
cryptglue.c
(-)mutt-1.5.17/status.c (+8 lines)
Lines 99-104 Link Here
99
99
100
    case 'f':
100
    case 'f':
101
      snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
101
      snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
102
#ifdef USE_COMPRESSED
103
      if (Context && Context->compressinfo && Context->realpath)
104
      {
105
	 strfcpy (tmp, Context->realpath, sizeof (tmp));
106
	 mutt_pretty_mailbox (tmp);
107
      }
108
      else
109
#endif
102
      if (Context && Context->path)
110
      if (Context && Context->path)
103
      {
111
      {
104
	strfcpy (tmp, Context->path, sizeof (tmp));
112
	strfcpy (tmp, Context->path, sizeof (tmp));

Return to bug 198242