You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

compressed-folders.patch 33KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188
  1. From: Roland Rosenfeld <roland@spinnaker.de>
  2. Date: Thu, 27 Feb 2014 15:46:00 +0100
  3. Subject: compressed-folders
  4. The home page for this patch is:
  5. http://www.spinnaker.de/mutt/compressed/
  6. * Patch last synced with upstream:
  7. - Date: 2008-05-20
  8. - File: http://www.spinnaker.de/mutt/compressed/patch-1.5.18.rr.compressed.1.gz
  9. * Changes made:
  10. - 2008-05-20 myon: refreshed to remove hunks in auto* files
  11. - 2009-09-15 myon: refreshed for mutt-1.5.19
  12. status.c:103: add sizeof (tmp) to mutt_pretty_mailbox
  13. - 2009-09-15 scotton: removed doc/Muttrc for mutt-1.5.19 (only patch doc/Muttrc.head)
  14. - 2009-09-11 antonio: removed DefaultMagic, see 541360
  15. - 2010-05-31 myon: remove commented paragraph "Use folders..." in
  16. doc/Muttrc.head, see #578096
  17. - 2014-03-17 evgeni: move remove_file and restore_path declaration before
  18. their first use
  19. Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
  20. Gbp-Pq: Topic features
  21. ---
  22. Makefile.am | 4 +-
  23. compress.c | 499 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  24. compress.h | 27 +++
  25. configure.ac | 5 +
  26. curs_main.c | 5 +
  27. doc/manual.xml.head | 199 +++++++++++++++++++++
  28. doc/muttrc.man.head | 18 ++
  29. hook.c | 14 ++
  30. init.h | 5 +
  31. main.c | 6 +
  32. mbox.c | 10 ++
  33. mutt.h | 10 ++
  34. mx.c | 42 ++++-
  35. mx.h | 3 +
  36. po/POTFILES.in | 1 +
  37. po/de.po | 30 ++++
  38. status.c | 8 +
  39. 17 files changed, 883 insertions(+), 3 deletions(-)
  40. create mode 100644 compress.c
  41. create mode 100644 compress.h
  42. diff --git a/Makefile.am b/Makefile.am
  43. index 8166b1b..09dd64b 100644
  44. --- a/Makefile.am
  45. +++ b/Makefile.am
  46. @@ -22,7 +22,7 @@ BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h conststrings.c $(HCVERSION)
  47. bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
  48. mutt_SOURCES = \
  49. addrbook.c alias.c attach.c base64.c browser.c buffy.c color.c \
  50. - crypt.c cryptglue.c \
  51. + crypt.c cryptglue.c compress.c \
  52. commands.c complete.c compose.c copy.c curs_lib.c curs_main.c date.c \
  53. edit.c enter.c flags.c init.c filter.c from.c \
  54. getdomain.c group.c \
  55. @@ -61,7 +61,7 @@ EXTRA_mutt_SOURCES = account.c bcache.c crypt-gpgme.c crypt-mod-pgp-classic.c \
  56. bcache.h browser.h hcache.h mbyte.h mutt_idna.h remailer.h url.h
  57. EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
  58. - configure account.h \
  59. + configure account.h compress.h \
  60. attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \
  61. globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
  62. mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
  63. diff --git a/compress.c b/compress.c
  64. new file mode 100644
  65. index 0000000..9bbf211
  66. --- /dev/null
  67. +++ b/compress.c
  68. @@ -0,0 +1,499 @@
  69. +/*
  70. + * Copyright (C) 1997 Alain Penders <Alain@Finale-Dev.com>
  71. + *
  72. + * This program is free software; you can redistribute it and/or modify
  73. + * it under the terms of the GNU General Public License as published by
  74. + * the Free Software Foundation; either version 2 of the License, or
  75. + * (at your option) any later version.
  76. + *
  77. + * This program is distributed in the hope that it will be useful,
  78. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  79. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  80. + * GNU General Public License for more details.
  81. + *
  82. + * You should have received a copy of the GNU General Public License
  83. + * along with this program; if not, write to the Free Software
  84. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  85. + */
  86. +
  87. +#if HAVE_CONFIG_H
  88. +# include "config.h"
  89. +#endif
  90. +
  91. +#include "mutt.h"
  92. +
  93. +#ifdef USE_COMPRESSED
  94. +
  95. +#include "mx.h"
  96. +#include "mailbox.h"
  97. +#include "mutt_curses.h"
  98. +
  99. +#include <errno.h>
  100. +#include <string.h>
  101. +#include <unistd.h>
  102. +#include <sys/stat.h>
  103. +
  104. +typedef struct
  105. +{
  106. + const char *close; /* close-hook command */
  107. + const char *open; /* open-hook command */
  108. + const char *append; /* append-hook command */
  109. + off_t size; /* size of real folder */
  110. +} COMPRESS_INFO;
  111. +
  112. +
  113. +/*
  114. + * ctx - context to lock
  115. + * excl - exclusive lock?
  116. + * retry - should retry if unable to lock?
  117. + */
  118. +int mbox_lock_compressed (CONTEXT *ctx, FILE *fp, int excl, int retry)
  119. +{
  120. + int r;
  121. +
  122. + if ((r = mx_lock_file (ctx->realpath, fileno (fp), excl, 1, retry)) == 0)
  123. + ctx->locked = 1;
  124. + else if (retry && !excl)
  125. + {
  126. + ctx->readonly = 1;
  127. + return 0;
  128. + }
  129. +
  130. + return (r);
  131. +}
  132. +
  133. +void mbox_unlock_compressed (CONTEXT *ctx, FILE *fp)
  134. +{
  135. + if (ctx->locked)
  136. + {
  137. + fflush (fp);
  138. +
  139. + mx_unlock_file (ctx->realpath, fileno (fp), 1);
  140. + ctx->locked = 0;
  141. + }
  142. +}
  143. +
  144. +static int is_new (const char *path)
  145. +{
  146. + return (access (path, W_OK) != 0 && errno == ENOENT) ? 1 : 0;
  147. +}
  148. +
  149. +static const char* find_compress_hook (int type, const char *path)
  150. +{
  151. + const char* c = mutt_find_hook (type, path);
  152. + return (!c || !*c) ? NULL : c;
  153. +}
  154. +
  155. +int mutt_can_read_compressed (const char *path)
  156. +{
  157. + return find_compress_hook (M_OPENHOOK, path) ? 1 : 0;
  158. +}
  159. +
  160. +/*
  161. + * if the file is new, we really do not append, but create, and so use
  162. + * close-hook, and not append-hook
  163. + */
  164. +static const char* get_append_command (const char *path, const CONTEXT* ctx)
  165. +{
  166. + COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
  167. + return (is_new (path)) ? ci->close : ci->append;
  168. +}
  169. +
  170. +int mutt_can_append_compressed (const char *path)
  171. +{
  172. + int magic;
  173. +
  174. + if (is_new (path))
  175. + {
  176. + char *dir_path = safe_strdup(path);
  177. + char *aux = strrchr(dir_path, '/');
  178. + int dir_valid = 1;
  179. + if (aux)
  180. + {
  181. + *aux='\0';
  182. + if (access(dir_path, W_OK|X_OK))
  183. + dir_valid = 0;
  184. + }
  185. + safe_free((void**)&dir_path);
  186. + return dir_valid && (find_compress_hook (M_CLOSEHOOK, path) ? 1 : 0);
  187. + }
  188. +
  189. + magic = mx_get_magic (path);
  190. +
  191. + if (magic != 0 && magic != M_COMPRESSED)
  192. + return 0;
  193. +
  194. + return (find_compress_hook (M_APPENDHOOK, path)
  195. + || (find_compress_hook (M_OPENHOOK, path)
  196. + && find_compress_hook (M_CLOSEHOOK, path))) ? 1 : 0;
  197. +}
  198. +
  199. +/* open a compressed mailbox */
  200. +static COMPRESS_INFO *set_compress_info (CONTEXT *ctx)
  201. +{
  202. + COMPRESS_INFO *ci;
  203. +
  204. + /* Now lets uncompress this thing */
  205. + ci = safe_malloc (sizeof (COMPRESS_INFO));
  206. + ctx->compressinfo = (void*) ci;
  207. + ci->append = find_compress_hook (M_APPENDHOOK, ctx->path);
  208. + ci->open = find_compress_hook (M_OPENHOOK, ctx->path);
  209. + ci->close = find_compress_hook (M_CLOSEHOOK, ctx->path);
  210. + return ci;
  211. +}
  212. +
  213. +static void set_path (CONTEXT* ctx)
  214. +{
  215. + char tmppath[_POSIX_PATH_MAX];
  216. +
  217. + /* Setup the right paths */
  218. + ctx->realpath = ctx->path;
  219. +
  220. + /* Uncompress to /tmp */
  221. + mutt_mktemp (tmppath, sizeof(tmppath));
  222. + ctx->path = safe_malloc (strlen (tmppath) + 1);
  223. + strcpy (ctx->path, tmppath);
  224. +}
  225. +
  226. +static int get_size (const char* path)
  227. +{
  228. + struct stat sb;
  229. + if (stat (path, &sb) != 0)
  230. + return 0;
  231. + return (sb.st_size);
  232. +}
  233. +
  234. +static void store_size (CONTEXT* ctx)
  235. +{
  236. + COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
  237. + ci->size = get_size (ctx->realpath);
  238. +}
  239. +
  240. +static const char *
  241. +compresshook_format_str (char *dest, size_t destlen, size_t col, char op,
  242. + const char *src, const char *fmt,
  243. + const char *ifstring, const char *elsestring,
  244. + unsigned long data, format_flag flags)
  245. +{
  246. + char tmp[SHORT_STRING];
  247. +
  248. + CONTEXT *ctx = (CONTEXT *) data;
  249. + switch (op)
  250. + {
  251. + case 'f':
  252. + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
  253. + snprintf (dest, destlen, tmp, ctx->realpath);
  254. + break;
  255. + case 't':
  256. + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
  257. + snprintf (dest, destlen, tmp, ctx->path);
  258. + break;
  259. + }
  260. + return (src);
  261. +}
  262. +
  263. +/*
  264. + * check that the command has both %f and %t
  265. + * 0 means OK, -1 means error
  266. + */
  267. +int mutt_test_compress_command (const char* cmd)
  268. +{
  269. + return (strstr (cmd, "%f") && strstr (cmd, "%t")) ? 0 : -1;
  270. +}
  271. +
  272. +static char *get_compression_cmd (const char* cmd, const CONTEXT* ctx)
  273. +{
  274. + char expanded[_POSIX_PATH_MAX];
  275. + mutt_FormatString (expanded, sizeof (expanded), 0, cmd,
  276. + compresshook_format_str, (unsigned long) ctx, 0);
  277. + return safe_strdup (expanded);
  278. +}
  279. +
  280. +int mutt_check_mailbox_compressed (CONTEXT* ctx)
  281. +{
  282. + COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
  283. + if (ci->size != get_size (ctx->realpath))
  284. + {
  285. + FREE (&ctx->compressinfo);
  286. + FREE (&ctx->realpath);
  287. + mutt_error _("Mailbox was corrupted!");
  288. + return (-1);
  289. + }
  290. + return (0);
  291. +}
  292. +
  293. +void restore_path (CONTEXT* ctx)
  294. +{
  295. + FREE (&ctx->path);
  296. + ctx->path = ctx->realpath;
  297. +}
  298. +
  299. +/* remove the temporary mailbox */
  300. +void remove_file (CONTEXT* ctx)
  301. +{
  302. + if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
  303. + remove (ctx->path);
  304. +}
  305. +
  306. +int mutt_open_read_compressed (CONTEXT *ctx)
  307. +{
  308. + char *cmd;
  309. + FILE *fp;
  310. + int rc;
  311. +
  312. + COMPRESS_INFO *ci = set_compress_info (ctx);
  313. + if (!ci->open) {
  314. + ctx->magic = 0;
  315. + FREE (&ctx->compressinfo);
  316. + return (-1);
  317. + }
  318. + if (!ci->close || access (ctx->path, W_OK) != 0)
  319. + ctx->readonly = 1;
  320. +
  321. + set_path (ctx);
  322. + store_size (ctx);
  323. +
  324. + if (!ctx->quiet)
  325. + mutt_message (_("Decompressing %s..."), ctx->realpath);
  326. +
  327. + cmd = get_compression_cmd (ci->open, ctx);
  328. + if (cmd == NULL)
  329. + return (-1);
  330. + dprint (2, (debugfile, "DecompressCmd: '%s'\n", cmd));
  331. +
  332. + if ((fp = fopen (ctx->realpath, "r")) == NULL)
  333. + {
  334. + mutt_perror (ctx->realpath);
  335. + FREE (&cmd);
  336. + return (-1);
  337. + }
  338. + mutt_block_signals ();
  339. + if (mbox_lock_compressed (ctx, fp, 0, 1) == -1)
  340. + {
  341. + fclose (fp);
  342. + mutt_unblock_signals ();
  343. + mutt_error _("Unable to lock mailbox!");
  344. + FREE (&cmd);
  345. + return (-1);
  346. + }
  347. +
  348. + endwin ();
  349. + fflush (stdout);
  350. + fprintf (stderr, _("Decompressing %s...\n"),ctx->realpath);
  351. + rc = mutt_system (cmd);
  352. + mbox_unlock_compressed (ctx, fp);
  353. + mutt_unblock_signals ();
  354. + fclose (fp);
  355. +
  356. + if (rc)
  357. + {
  358. + mutt_any_key_to_continue (NULL);
  359. + ctx->magic = 0;
  360. + FREE (&ctx->compressinfo);
  361. + mutt_error (_("Error executing: %s : unable to open the mailbox!\n"), cmd);
  362. + // remove the partial uncompressed file
  363. + remove_file (ctx);
  364. + restore_path (ctx);
  365. + }
  366. + FREE (&cmd);
  367. + if (rc)
  368. + return (-1);
  369. +
  370. + if (mutt_check_mailbox_compressed (ctx))
  371. + return (-1);
  372. +
  373. + ctx->magic = mx_get_magic (ctx->path);
  374. +
  375. + return (0);
  376. +}
  377. +
  378. +int mutt_open_append_compressed (CONTEXT *ctx)
  379. +{
  380. + FILE *fh;
  381. + COMPRESS_INFO *ci = set_compress_info (ctx);
  382. +
  383. + if (!get_append_command (ctx->path, ctx))
  384. + {
  385. + if (ci->open && ci->close)
  386. + return (mutt_open_read_compressed (ctx));
  387. +
  388. + ctx->magic = 0;
  389. + FREE (&ctx->compressinfo);
  390. + return (-1);
  391. + }
  392. +
  393. + set_path (ctx);
  394. +
  395. + if (!is_new (ctx->realpath))
  396. + if ((fh = fopen (ctx->path, "w")))
  397. + fclose (fh);
  398. + /* No error checking - the parent function will catch it */
  399. +
  400. + return (0);
  401. +}
  402. +
  403. +/* close a compressed mailbox */
  404. +void mutt_fast_close_compressed (CONTEXT *ctx)
  405. +{
  406. + dprint (2, (debugfile, "mutt_fast_close_compressed called on '%s'\n",
  407. + ctx->path));
  408. +
  409. + if (ctx->compressinfo)
  410. + {
  411. + if (ctx->fp)
  412. + fclose (ctx->fp);
  413. + ctx->fp = NULL;
  414. + /* if the folder was removed, remove the gzipped folder too */
  415. + if ((ctx->magic > 0)
  416. + && (access (ctx->path, F_OK) != 0)
  417. + && ! option (OPTSAVEEMPTY))
  418. + remove (ctx->realpath);
  419. + else
  420. + remove_file (ctx);
  421. +
  422. + restore_path (ctx);
  423. + FREE (&ctx->compressinfo);
  424. + }
  425. +}
  426. +
  427. +/* return 0 on success, -1 on failure */
  428. +int mutt_sync_compressed (CONTEXT* ctx)
  429. +{
  430. + char *cmd;
  431. + int rc = 0;
  432. + FILE *fp;
  433. + COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
  434. +
  435. + if (!ctx->quiet)
  436. + mutt_message (_("Compressing %s..."), ctx->realpath);
  437. +
  438. + cmd = get_compression_cmd (ci->close, 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. + store_size (ctx);
  455. + FREE (&cmd);
  456. + return (-1);
  457. + }
  458. +
  459. + dprint (2, (debugfile, "CompressCommand: '%s'\n", cmd));
  460. +
  461. + endwin ();
  462. + fflush (stdout);
  463. + fprintf (stderr, _("Compressing %s...\n"), ctx->realpath);
  464. + if (mutt_system (cmd))
  465. + {
  466. + mutt_any_key_to_continue (NULL);
  467. + mutt_error (_("%s: Error compressing mailbox! Original mailbox deleted, uncompressed one kept!\n"), ctx->path);
  468. + rc = -1;
  469. + }
  470. +
  471. + mbox_unlock_compressed (ctx, fp);
  472. + mutt_unblock_signals ();
  473. + fclose (fp);
  474. +
  475. + FREE (&cmd);
  476. +
  477. + store_size (ctx);
  478. +
  479. + return (rc);
  480. +}
  481. +
  482. +int mutt_slow_close_compressed (CONTEXT *ctx)
  483. +{
  484. + FILE *fp;
  485. + const char *append;
  486. + char *cmd;
  487. + COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
  488. +
  489. + dprint (2, (debugfile, "mutt_slow_close_compressed called on '%s'\n",
  490. + ctx->path));
  491. +
  492. + if (! (ctx->append
  493. + && ((append = get_append_command (ctx->realpath, ctx))
  494. + || (append = ci->close))))
  495. + {
  496. + /* if we can not or should not append, we only have to remove the */
  497. + /* compressed info, because sync was already called */
  498. + mutt_fast_close_compressed (ctx);
  499. + return (0);
  500. + }
  501. +
  502. + if (ctx->fp)
  503. + fclose (ctx->fp);
  504. + ctx->fp = NULL;
  505. +
  506. + if (!ctx->quiet)
  507. + {
  508. + if (append == ci->close)
  509. + mutt_message (_("Compressing %s..."), ctx->realpath);
  510. + else
  511. + mutt_message (_("Compressed-appending to %s..."), ctx->realpath);
  512. + }
  513. +
  514. + cmd = get_compression_cmd (append, ctx);
  515. + if (cmd == NULL)
  516. + return (-1);
  517. +
  518. + if ((fp = fopen (ctx->realpath, "a")) == NULL)
  519. + {
  520. + mutt_perror (ctx->realpath);
  521. + FREE (&cmd);
  522. + return (-1);
  523. + }
  524. + mutt_block_signals ();
  525. + if (mbox_lock_compressed (ctx, fp, 1, 1) == -1)
  526. + {
  527. + fclose (fp);
  528. + mutt_unblock_signals ();
  529. + mutt_error _("Unable to lock mailbox!");
  530. + FREE (&cmd);
  531. + return (-1);
  532. + }
  533. +
  534. + dprint (2, (debugfile, "CompressCmd: '%s'\n", cmd));
  535. +
  536. + endwin ();
  537. + fflush (stdout);
  538. +
  539. + if (append == ci->close)
  540. + fprintf (stderr, _("Compressing %s...\n"), ctx->realpath);
  541. + else
  542. + fprintf (stderr, _("Compressed-appending to %s...\n"), ctx->realpath);
  543. +
  544. + if (mutt_system (cmd))
  545. + {
  546. + mutt_any_key_to_continue (NULL);
  547. + mutt_error (_(" %s: Error compressing mailbox! Uncompressed one kept!\n"),
  548. + ctx->path);
  549. + FREE (&cmd);
  550. + mbox_unlock_compressed (ctx, fp);
  551. + mutt_unblock_signals ();
  552. + fclose (fp);
  553. + return (-1);
  554. + }
  555. +
  556. + mbox_unlock_compressed (ctx, fp);
  557. + mutt_unblock_signals ();
  558. + fclose (fp);
  559. + remove_file (ctx);
  560. + restore_path (ctx);
  561. + FREE (&cmd);
  562. + FREE (&ctx->compressinfo);
  563. +
  564. + return (0);
  565. +}
  566. +
  567. +#endif /* USE_COMPRESSED */
  568. diff --git a/compress.h b/compress.h
  569. new file mode 100644
  570. index 0000000..9dbf027
  571. --- /dev/null
  572. +++ b/compress.h
  573. @@ -0,0 +1,27 @@
  574. +/*
  575. + * Copyright (C) 1997 Alain Penders <Alain@Finale-Dev.com>
  576. + *
  577. + * This program is free software; you can redistribute it and/or modify
  578. + * it under the terms of the GNU General Public License as published by
  579. + * the Free Software Foundation; either version 2 of the License, or
  580. + * (at your option) any later version.
  581. + *
  582. + * This program is distributed in the hope that it will be useful,
  583. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  584. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  585. + * GNU General Public License for more details.
  586. + *
  587. + * You should have received a copy of the GNU General Public License
  588. + * along with this program; if not, write to the Free Software
  589. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  590. + */
  591. +
  592. +int mutt_can_read_compressed (const char *);
  593. +int mutt_can_append_compressed (const char *);
  594. +int mutt_open_read_compressed (CONTEXT *);
  595. +int mutt_open_append_compressed (CONTEXT *);
  596. +int mutt_slow_close_compressed (CONTEXT *);
  597. +int mutt_sync_compressed (CONTEXT *);
  598. +int mutt_test_compress_command (const char *);
  599. +int mutt_check_mailbox_compressed (CONTEXT *);
  600. +void mutt_fast_close_compressed (CONTEXT *);
  601. diff --git a/configure.ac b/configure.ac
  602. index 3d5f11b..e7ebe01 100644
  603. --- a/configure.ac
  604. +++ b/configure.ac
  605. @@ -812,6 +812,11 @@ AC_ARG_ENABLE(locales-fix, AS_HELP_STRING([--enable-locales-fix],[The result of
  606. AC_DEFINE(LOCALES_HACK,1,[ Define if the result of isprint() is unreliable. ])
  607. fi])
  608. +AC_ARG_ENABLE(compressed, AC_HELP_STRING([--enable-compressed], [Enable compressed folders support]),
  609. + [if test x$enableval = xyes; then
  610. + AC_DEFINE(USE_COMPRESSED,1, [ Define to support compressed folders. ])
  611. + fi])
  612. +
  613. AC_ARG_WITH(exec-shell, AS_HELP_STRING([--with-exec-shell=SHELL],[Specify alternate shell (ONLY if /bin/sh is broken)]),
  614. [if test $withval != yes; then
  615. AC_DEFINE_UNQUOTED(EXECSHELL, "$withval",
  616. diff --git a/curs_main.c b/curs_main.c
  617. index d266708..e7f11bd 100644
  618. --- a/curs_main.c
  619. +++ b/curs_main.c
  620. @@ -1154,6 +1154,11 @@ int mutt_index_menu (void)
  621. {
  622. int check;
  623. +#ifdef USE_COMPRESSED
  624. + if (Context->compressinfo && Context->realpath)
  625. + mutt_str_replace (&LastFolder, Context->realpath);
  626. + else
  627. +#endif
  628. mutt_str_replace (&LastFolder, Context->path);
  629. oldcount = Context ? Context->msgcount : 0;
  630. diff --git a/doc/manual.xml.head b/doc/manual.xml.head
  631. index 18ae918..4366758 100644
  632. --- a/doc/manual.xml.head
  633. +++ b/doc/manual.xml.head
  634. @@ -6121,6 +6121,205 @@ selection. Highest priority has the mailbox given with the
  635. </chapter>
  636. +<sect1 id="compressedfolders">
  637. +<title>Compressed folders Support (OPTIONAL)</title>
  638. +
  639. +<para>
  640. +If Mutt was compiled with compressed folders support (by running the
  641. +<emphasis>configure</emphasis> script with the
  642. +<emphasis>--enable-compressed</emphasis> flag), Mutt can open folders
  643. +stored in an arbitrary format, provided that the user has a script to
  644. +convert from/to this format to one of the accepted.
  645. +
  646. +The most common use is to open compressed archived folders e.g. with
  647. +gzip.
  648. +
  649. +In addition, the user can provide a script that gets a folder in an
  650. +accepted format and appends its context to the folder in the
  651. +user-defined format, which may be faster than converting the entire
  652. +folder to the accepted format, appending to it and converting back to
  653. +the user-defined format.
  654. +
  655. +There are three hooks defined (<link
  656. +linkend="open-hook">open-hook</link>, <link
  657. +linkend="close-hook">close-hook</link> and <link
  658. +linkend="append-hook">append-hook</link>) which define commands to
  659. +uncompress and compress a folder and to append messages to an existing
  660. +compressed folder respectively.
  661. +
  662. +For example:
  663. +
  664. +<screen>
  665. +open-hook \\.gz$ "gzip -cd %f &gt; %t"
  666. +close-hook \\.gz$ "gzip -c %t &gt; %f"
  667. +append-hook \\.gz$ "gzip -c %t &gt;&gt; %f"
  668. +</screen>
  669. +
  670. +You do not have to specify all of the commands. If you omit <link
  671. +linkend="append-hook">append-hook</link>, the folder will be open and
  672. +closed again each time you will add to it. If you omit <link
  673. +linkend="close-hook">close-hook</link> (or give empty command) , the
  674. +folder will be open in the mode. If you specify <link
  675. +linkend="append-hook">append-hook</link> though you'll be able to
  676. +append to the folder.
  677. +
  678. +Note that Mutt will only try to use hooks if the file is not in one of
  679. +the accepted formats. In particular, if the file is empty, mutt
  680. +supposes it is not compressed. This is important because it allows the
  681. +use of programs that do not have well defined extensions. Just use
  682. +&quot;.&quot; as a regexp. But this may be surprising if your
  683. +compressing script produces empty files. In this situation, unset
  684. +<link linkend="save-empty">&dollar;save&lowbar;empty</link>, so that
  685. +the compressed file will be removed if you delete all of the messages.
  686. +</para>
  687. +
  688. +<sect2 id="open-hook">
  689. +<title>Open a compressed mailbox for reading</title>
  690. +
  691. +<para>
  692. +Usage: <literal>open-hook</literal> <emphasis>regexp</emphasis> &quot;<emphasis>command</emphasis>&quot;
  693. +
  694. +The <emphasis>command</emphasis> is the command that can be used for
  695. +opening the folders whose names match <emphasis>regexp</emphasis>.
  696. +
  697. +The <emphasis>command</emphasis> string is the printf-like format
  698. +string, and it should accept two parameters: &percnt;f, which is
  699. +replaced with the (compressed) folder name, and &percnt;t which is
  700. +replaced with the name of the temporary folder to which to write.
  701. +
  702. +&percnt;f and &percnt;t can be repeated any number of times in the
  703. +command string, and all of the entries are replaced with the
  704. +appropriate folder name. In addition, &percnt;&percnt; is replaced by
  705. +&percnt;, as in printf, and any other &percnt;anything is left as is.
  706. +
  707. +The <emphasis>command</emphasis> should <emphasis
  708. +role="bold">not</emphasis> remove the original compressed 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. +open-hook \\.gz$ "gzip -cd %f &gt; %t"
  716. +</screen>
  717. +
  718. +If the <emphasis>command</emphasis> is empty, this operation is
  719. +disabled for this file type.
  720. +</para>
  721. +</sect2>
  722. +
  723. +<sect2 id="close-hook">
  724. +<title>Write a compressed mailbox</title>
  725. +
  726. +<para>
  727. +Usage: <literal>close-hook</literal> <emphasis>regexp</emphasis> &quot;<emphasis>command</emphasis>&quot;
  728. +
  729. +This is used to close the folder that was open with the <link
  730. +linkend="open-hook">open-hook</link> command after some changes were
  731. +made to it.
  732. +
  733. +The <emphasis>command</emphasis> string is the command that can be
  734. +used for closing the folders whose names match
  735. +<emphasis>regexp</emphasis>. It has the same format as in the <link
  736. +linkend="open-hook">open-hook</link> command. Temporary folder in this
  737. +case is the folder previously produced by the <link
  738. +linkend="open-hook">open-hook</link> command.
  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. +close-hook \\.gz$ "gzip -c %t &gt; %f"
  749. +</screen>
  750. +
  751. +If the <emphasis>command</emphasis> is empty, this operation is
  752. +disabled for this file type, and the file can only be open in the
  753. +read-only mode.
  754. +
  755. +<link linkend="close-hook">close-hook</link> is not called when you
  756. +exit from the folder if the folder was not changed.
  757. +</para>
  758. +</sect2>
  759. +
  760. +<sect2 id="append-hook">
  761. +<title>Append a message to a compressed mailbox</title>
  762. +
  763. +<para>
  764. +Usage: <literal>append-hook</literal> <emphasis>regexp</emphasis> &quot;<emphasis>command</emphasis>&quot;
  765. +
  766. +This command is used for saving to an existing compressed folder. The
  767. +<emphasis>command</emphasis> is the command that can be used for
  768. +appending to the folders whose names match
  769. +<emphasis>regexp</emphasis>. It has the same format as in the <link
  770. +linkend="open-hook">open-hook</link> command. The temporary folder in
  771. +this case contains the messages that are being appended.
  772. +
  773. +The <emphasis>command</emphasis> should <emphasis
  774. +role="bold">not</emphasis> remove the decompressed file. The
  775. +<emphasis>command</emphasis> should return non-zero exit status if it
  776. +fails, so mutt knows something's wrong.
  777. +
  778. +Example:
  779. +
  780. +<screen>
  781. +append-hook \\.gz$ "gzip -c %t &gt;&gt; %f"
  782. +</screen>
  783. +
  784. +When <link linkend="append-hook">append-hook</link> is used, the folder
  785. +is not opened, which saves time, but this means that we can not find
  786. +out what the folder type is. Thus the default (<link
  787. +linkend="mbox-type">&dollar;mbox&lowbar;type</link>) type is always
  788. +supposed (i.e. this is the format used for the temporary folder).
  789. +
  790. +If the file does not exist when you save to it, <link
  791. +linkend="close-hook">close-hook</link> is called, and not <link
  792. +linkend="append-hook">append-hook</link>. <link
  793. +linkend="append-hook">append-hook</link> is only for appending to
  794. +existing folders.
  795. +
  796. +If the <emphasis>command</emphasis> is empty, this operation is
  797. +disabled for this file type. In this case, the folder will be open and
  798. +closed again (using <link linkend="open-hook">open-hook</link> and
  799. +<link linkend="close-hook">close-hook</link>respectively) each time you
  800. +will add to it.
  801. +</para>
  802. +</sect2>
  803. +
  804. +<sect2>
  805. +<title>Encrypted folders</title>
  806. +
  807. +<para>
  808. +The compressed folders support can also be used to handle encrypted
  809. +folders. If you want to encrypt a folder with PGP, you may want to use
  810. +the following hooks:
  811. +
  812. +<screen>
  813. +open-hook \\.pgp$ "pgp -f &lt; %f &gt; %t"
  814. +close-hook \\.pgp$ "pgp -fe YourPgpUserIdOrKeyId &lt; %t &gt; %f"
  815. +</screen>
  816. +
  817. +Please note, that PGP does not support appending to an encrypted
  818. +folder, so there is no append-hook defined.
  819. +
  820. +If you are using GnuPG instead of PGP, you may use the following hooks
  821. +instead:
  822. +
  823. +<screen>
  824. +open-hook \\.gpg$ "gpg --decrypt &lt; %f &gt; %t"
  825. +close-hook \\.gpg$ "gpg --encrypt --recipient YourGpgUserIdOrKeyId &lt; %t &gt; %f"
  826. +</screen>
  827. +
  828. +<emphasis role="bold">Note:</emphasis> the folder is temporary stored
  829. +decrypted in the /tmp directory, where it can be read by your system
  830. +administrator. So think about the security aspects of this.
  831. +</para>
  832. +</sect2>
  833. +</sect1>
  834. +
  835. <chapter id="mimesupport">
  836. <title>Mutt's MIME Support</title>
  837. diff --git a/doc/muttrc.man.head b/doc/muttrc.man.head
  838. index 30b96a2..b0ed18c 100644
  839. --- a/doc/muttrc.man.head
  840. +++ b/doc/muttrc.man.head
  841. @@ -354,6 +354,24 @@ specify the ID of the public key to be used when encrypting messages
  842. to a certain recipient. The meaning of "key ID" is to be taken
  843. broadly: This can be a different e-mail address, a numerical key ID,
  844. or even just an arbitrary search string.
  845. +.PP
  846. +.nf
  847. +\fBopen-hook\fP \fIregexp\fP "\fIcommand\fP"
  848. +\fBclose-hook\fP \fIregexp\fP "\fIcommand\fP"
  849. +\fBappend-hook\fP \fIregexp\fP "\fIcommand\fP"
  850. +.fi
  851. +.IP
  852. +These commands provide a way to handle compressed folders. The given
  853. +\fBregexp\fP specifies which folders are taken as compressed (e.g.
  854. +"\fI\\\\.gz$\fP"). The commands tell Mutt how to uncompress a folder
  855. +(\fBopen-hook\fP), compress a folder (\fBclose-hook\fP) or append a
  856. +compressed mail to a compressed folder (\fBappend-hook\fP). The
  857. +\fIcommand\fP string is the
  858. +.BR printf (3)
  859. +like format string, and it should accept two parameters: \fB%f\fP,
  860. +which is replaced with the (compressed) folder name, and \fB%t\fP
  861. +which is replaced with the name of the temporary folder to which to
  862. +write.
  863. .TP
  864. \fBpush\fP \fIstring\fP
  865. This command adds the named \fIstring\fP to the keyboard buffer.
  866. diff --git a/hook.c b/hook.c
  867. index 34f3106..2a27419 100644
  868. --- a/hook.c
  869. +++ b/hook.c
  870. @@ -24,6 +24,10 @@
  871. #include "mailbox.h"
  872. #include "mutt_crypt.h"
  873. +#ifdef USE_COMPRESSED
  874. +#include "compress.h"
  875. +#endif
  876. +
  877. #include <limits.h>
  878. #include <string.h>
  879. #include <stdlib.h>
  880. @@ -92,6 +96,16 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
  881. memset (&pattern, 0, sizeof (pattern));
  882. pattern.data = safe_strdup (path);
  883. }
  884. +#ifdef USE_COMPRESSED
  885. + else if (data & (M_APPENDHOOK | M_OPENHOOK | M_CLOSEHOOK))
  886. + {
  887. + if (mutt_test_compress_command (command.data))
  888. + {
  889. + strfcpy (err->data, _("badly formatted command string"), err->dsize);
  890. + return (-1);
  891. + }
  892. + }
  893. +#endif
  894. else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ICONVHOOK | M_ACCOUNTHOOK))
  895. && (!WithCrypto || !(data & M_CRYPTHOOK))
  896. )
  897. diff --git a/init.h b/init.h
  898. index a64992a..0e4f47f 100644
  899. --- a/init.h
  900. +++ b/init.h
  901. @@ -3578,6 +3578,11 @@ const struct command_t Commands[] = {
  902. { "fcc-hook", mutt_parse_hook, M_FCCHOOK },
  903. { "fcc-save-hook", mutt_parse_hook, M_FCCHOOK | M_SAVEHOOK },
  904. { "folder-hook", mutt_parse_hook, M_FOLDERHOOK },
  905. +#ifdef USE_COMPRESSED
  906. + { "open-hook", mutt_parse_hook, M_OPENHOOK },
  907. + { "close-hook", mutt_parse_hook, M_CLOSEHOOK },
  908. + { "append-hook", mutt_parse_hook, M_APPENDHOOK },
  909. +#endif
  910. { "group", parse_group, M_GROUP },
  911. { "ungroup", parse_group, M_UNGROUP },
  912. { "hdr_order", parse_list, UL &HeaderOrderList },
  913. diff --git a/main.c b/main.c
  914. index 0ce245b..5ab1868 100644
  915. --- a/main.c
  916. +++ b/main.c
  917. @@ -431,6 +431,12 @@ static void show_version (void)
  918. #else
  919. "-LOCALES_HACK "
  920. #endif
  921. +
  922. +#ifdef USE_COMPRESSED
  923. + "+COMPRESSED "
  924. +#else
  925. + "-COMPRESSED "
  926. +#endif
  927. #ifdef HAVE_WC_FUNCS
  928. "+HAVE_WC_FUNCS "
  929. diff --git a/mbox.c b/mbox.c
  930. index 253061a..6d3b6bd 100644
  931. --- a/mbox.c
  932. +++ b/mbox.c
  933. @@ -29,6 +29,10 @@
  934. #include "copy.h"
  935. #include "mutt_curses.h"
  936. +#ifdef USE_COMPRESSED
  937. +#include "compress.h"
  938. +#endif
  939. +
  940. #include <sys/stat.h>
  941. #include <dirent.h>
  942. #include <string.h>
  943. @@ -1069,6 +1073,12 @@ bail: /* Come here in case of disaster */
  944. int mbox_close_mailbox (CONTEXT *ctx)
  945. {
  946. mx_unlock_file (ctx->path, fileno (ctx->fp), 1);
  947. +
  948. +#ifdef USE_COMPRESSED
  949. + if (ctx->compressinfo)
  950. + mutt_slow_close_compressed (ctx);
  951. +#endif
  952. +
  953. mutt_unblock_signals ();
  954. mx_fastclose_mailbox (ctx);
  955. return 0;
  956. diff --git a/mutt.h b/mutt.h
  957. index 8cee3d2..b71f071 100644
  958. --- a/mutt.h
  959. +++ b/mutt.h
  960. @@ -144,6 +144,11 @@ typedef enum
  961. #define M_ACCOUNTHOOK (1<<9)
  962. #define M_REPLYHOOK (1<<10)
  963. #define M_SEND2HOOK (1<<11)
  964. +#ifdef USE_COMPRESSED
  965. +#define M_OPENHOOK (1<<12)
  966. +#define M_APPENDHOOK (1<<13)
  967. +#define M_CLOSEHOOK (1<<14)
  968. +#endif
  969. /* tree characters for linearize_tree and print_enriched_string */
  970. #define M_TREE_LLCORNER 1
  971. @@ -889,6 +894,11 @@ typedef struct _context
  972. int flagged; /* how many flagged messages */
  973. int msgnotreadyet; /* which msg "new" in pager, -1 if none */
  974. +#ifdef USE_COMPRESSED
  975. + void *compressinfo; /* compressed mbox module private data */
  976. + char *realpath; /* path to compressed mailbox */
  977. +#endif /* USE_COMPRESSED */
  978. +
  979. short magic; /* mailbox type */
  980. unsigned char rights[(RIGHTSMAX + 7)/8]; /* ACL bits */
  981. diff --git a/mx.c b/mx.c
  982. index cc60517..07dba0c 100644
  983. --- a/mx.c
  984. +++ b/mx.c
  985. @@ -30,6 +30,10 @@
  986. #include "keymap.h"
  987. #include "url.h"
  988. +#ifdef USE_COMPRESSED
  989. +#include "compress.h"
  990. +#endif
  991. +
  992. #ifdef USE_IMAP
  993. #include "imap.h"
  994. #endif
  995. @@ -414,6 +418,10 @@ int mx_get_magic (const char *path)
  996. return (-1);
  997. }
  998. +#ifdef USE_COMPRESSED
  999. + if (magic == 0 && mutt_can_read_compressed (path))
  1000. + return M_COMPRESSED;
  1001. +#endif
  1002. return (magic);
  1003. }
  1004. @@ -453,6 +461,13 @@ static int mx_open_mailbox_append (CONTEXT *ctx, int flags)
  1005. {
  1006. struct stat sb;
  1007. +#ifdef USE_COMPRESSED
  1008. + /* special case for appending to compressed folders -
  1009. + * even if we can not open them for reading */
  1010. + if (mutt_can_append_compressed (ctx->path))
  1011. + mutt_open_append_compressed (ctx);
  1012. +#endif
  1013. +
  1014. ctx->append = 1;
  1015. #ifdef USE_IMAP
  1016. @@ -616,7 +631,12 @@ CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx)
  1017. }
  1018. ctx->magic = mx_get_magic (path);
  1019. -
  1020. +
  1021. +#ifdef USE_COMPRESSED
  1022. + if (ctx->magic == M_COMPRESSED)
  1023. + mutt_open_read_compressed (ctx);
  1024. +#endif
  1025. +
  1026. if(ctx->magic == 0)
  1027. mutt_error (_("%s is not a mailbox."), path);
  1028. @@ -721,6 +741,10 @@ void mx_fastclose_mailbox (CONTEXT *ctx)
  1029. mutt_free_header (&ctx->hdrs[i]);
  1030. FREE (&ctx->hdrs);
  1031. FREE (&ctx->v2r);
  1032. +#ifdef USE_COMPRESSED
  1033. + if (ctx->compressinfo)
  1034. + mutt_fast_close_compressed (ctx);
  1035. +#endif
  1036. FREE (&ctx->path);
  1037. FREE (&ctx->pattern);
  1038. if (ctx->limit_pattern)
  1039. @@ -773,6 +797,12 @@ static int sync_mailbox (CONTEXT *ctx, int *index_hint)
  1040. if (tmp && tmp->new == 0)
  1041. mutt_update_mailbox (tmp);
  1042. +
  1043. +#ifdef USE_COMPRESSED
  1044. + if (rc == 0 && ctx->compressinfo)
  1045. + return mutt_sync_compressed (ctx);
  1046. +#endif
  1047. +
  1048. return rc;
  1049. }
  1050. @@ -1043,6 +1073,11 @@ int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
  1051. !mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
  1052. mx_unlink_empty (ctx->path);
  1053. +#ifdef USE_COMPRESSED
  1054. + if (ctx->compressinfo && mutt_slow_close_compressed (ctx))
  1055. + return (-1);
  1056. +#endif
  1057. +
  1058. mx_fastclose_mailbox (ctx);
  1059. return 0;
  1060. @@ -1361,6 +1396,11 @@ int mx_check_mailbox (CONTEXT *ctx, int *index_hint, int lock)
  1061. {
  1062. int rc;
  1063. +#ifdef USE_COMPRESSED
  1064. + if (ctx->compressinfo)
  1065. + return mutt_check_mailbox_compressed (ctx);
  1066. +#endif
  1067. +
  1068. if (ctx)
  1069. {
  1070. if (ctx->locked) lock = 0;
  1071. diff --git a/mx.h b/mx.h
  1072. index 4a00715..2ef4ec7 100644
  1073. --- a/mx.h
  1074. +++ b/mx.h
  1075. @@ -36,6 +36,9 @@ enum
  1076. M_MAILDIR,
  1077. M_IMAP,
  1078. M_POP
  1079. +#ifdef USE_COMPRESSED
  1080. + , M_COMPRESSED
  1081. +#endif
  1082. };
  1083. WHERE short DefaultMagic INITVAL (M_MBOX);
  1084. diff --git a/po/POTFILES.in b/po/POTFILES.in
  1085. index 2d01add..3654ad1 100644
  1086. --- a/po/POTFILES.in
  1087. +++ b/po/POTFILES.in
  1088. @@ -8,6 +8,7 @@ charset.c
  1089. color.c
  1090. commands.c
  1091. compose.c
  1092. +compress.c
  1093. crypt-gpgme.c
  1094. crypt.c
  1095. cryptglue.c
  1096. diff --git a/po/de.po b/po/de.po
  1097. index dd2dda5..75d56f3 100644
  1098. --- a/po/de.po
  1099. +++ b/po/de.po
  1100. @@ -5178,6 +5178,36 @@ msgstr "Extrahiere unterst
  1101. msgid "show S/MIME options"
  1102. msgstr "Zeige S/MIME Optionen"
  1103. +
  1104. +#: compress.c:228 compress.c:253
  1105. +#, c-format
  1106. +msgid "Decompressing %s...\n"
  1107. +msgstr "Entpacke %s...\n"
  1108. +
  1109. +#: compress.c:350 compress.c:377 compress.c:423 compress.c:454
  1110. +#, c-format
  1111. +msgid "Compressing %s...\n"
  1112. +msgstr "Komprimiere %s...\n"
  1113. +
  1114. +#: compress.c:381
  1115. +#, c-format
  1116. +msgid ""
  1117. +"%s: Error compressing mailbox! Original mailbox deleted, uncompressed one "
  1118. +"kept!\n"
  1119. +msgstr ""
  1120. +"%s: Fehler beim Komprimieren der Mailbox! Ursprüngliche Mailbox gelöscht, "
  1121. +"entpackte gespeichert!\n"
  1122. +
  1123. +#: compress.c:425 compress.c:456
  1124. +#, c-format
  1125. +msgid "Compressed-appending to %s...\n"
  1126. +msgstr "Hänge komprimiert an %s... an\n"
  1127. +
  1128. +#: compress.c:461
  1129. +#, c-format
  1130. +msgid " %s: Error compressing mailbox! Uncompressed one kept!\n"
  1131. +msgstr " %s: Fehler beim packen der Mailbox! Entpackte Mailbox gespeichert!\n"
  1132. +
  1133. #~ msgid "Clear"
  1134. #~ msgstr "Klartext"
  1135. diff --git a/status.c b/status.c
  1136. index 6051e3a..e8693c8 100644
  1137. --- a/status.c
  1138. +++ b/status.c
  1139. @@ -96,6 +96,14 @@ status_format_str (char *buf, size_t buflen, size_t col, char op, const char *sr
  1140. case 'f':
  1141. snprintf (fmt, sizeof(fmt), "%%%ss", prefix);
  1142. +#ifdef USE_COMPRESSED
  1143. + if (Context && Context->compressinfo && Context->realpath)
  1144. + {
  1145. + strfcpy (tmp, Context->realpath, sizeof (tmp));
  1146. + mutt_pretty_mailbox (tmp, sizeof (tmp));
  1147. + }
  1148. + else
  1149. +#endif
  1150. if (Context && Context->path)
  1151. {
  1152. strfcpy (tmp, Context->path, sizeof (tmp));