projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Andreas Krennmair:
[apps/madmutt.git]
/
mx.c
diff --git
a/mx.c
b/mx.c
index
2186651
..
e45fda3
100644
(file)
--- a/
mx.c
+++ b/
mx.c
@@
-17,6
+17,10
@@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include "mutt.h"
#include "mx.h"
#include "rfc2047.h"
#include "mutt.h"
#include "mx.h"
#include "rfc2047.h"
@@
-26,6
+30,10
@@
#include "keymap.h"
#include "url.h"
#include "keymap.h"
#include "url.h"
+#ifdef USE_COMPRESSED
+#include "compress.h"
+#endif
+
#ifdef USE_IMAP
#include "imap.h"
#endif
#ifdef USE_IMAP
#include "imap.h"
#endif
@@
-475,6
+483,11
@@
int mx_get_magic (const char *path)
return (-1);
}
return (-1);
}
+#ifdef USE_COMPRESSED
+ if (magic == 0 && mutt_can_read_compressed (path))
+ return M_COMPRESSED;
+#endif
+
return (magic);
}
return (magic);
}
@@
-514,6
+527,13
@@
static int mx_open_mailbox_append (CONTEXT *ctx, int flags)
{
struct stat sb;
{
struct stat sb;
+#ifdef USE_COMPRESSED
+ /* special case for appending to compressed folders -
+ * even if we can not open them for reading */
+ if (mutt_can_append_compressed (ctx->path))
+ mutt_open_append_compressed (ctx);
+#endif
+
ctx->append = 1;
#ifdef USE_IMAP
ctx->append = 1;
#ifdef USE_IMAP
@@
-675,6
+695,11
@@
CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx)
ctx->magic = mx_get_magic (path);
ctx->magic = mx_get_magic (path);
+#ifdef USE_COMPRESSED
+ if (ctx->magic == M_COMPRESSED)
+ mutt_open_read_compressed (ctx);
+#endif
+
if(ctx->magic == 0)
mutt_error (_("%s is not a mailbox."), path);
if(ctx->magic == 0)
mutt_error (_("%s is not a mailbox."), path);
@@
-790,6
+815,10
@@
void mx_fastclose_mailbox (CONTEXT *ctx)
mutt_free_header (&ctx->hdrs[i]);
FREE (&ctx->hdrs);
FREE (&ctx->v2r);
mutt_free_header (&ctx->hdrs[i]);
FREE (&ctx->hdrs);
FREE (&ctx->v2r);
+#ifdef USE_COMPRESSED
+ if (ctx->compressinfo)
+ mutt_fast_close_compressed (ctx);
+#endif
FREE (&ctx->path);
FREE (&ctx->pattern);
if (ctx->limit_pattern)
FREE (&ctx->path);
FREE (&ctx->pattern);
if (ctx->limit_pattern)
@@
-853,6
+882,12
@@
static int sync_mailbox (CONTEXT *ctx, int *index_hint)
if (tmp && tmp->new == 0)
mutt_update_mailbox (tmp);
#endif
if (tmp && tmp->new == 0)
mutt_update_mailbox (tmp);
#endif
+
+#ifdef USE_COMPRESSED
+ if (rc == 0 && ctx->compressinfo)
+ return mutt_sync_compressed (ctx);
+#endif
+
return rc;
}
return rc;
}
@@
-1125,6
+1160,11
@@
int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
!mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
mx_unlink_empty (ctx->path);
!mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
mx_unlink_empty (ctx->path);
+#ifdef USE_COMPRESSED
+ if (ctx->compressinfo && mutt_slow_close_compressed (ctx))
+ return (-1);
+#endif
+
mx_fastclose_mailbox (ctx);
return 0;
mx_fastclose_mailbox (ctx);
return 0;
@@
-1269,6
+1309,8
@@
int mx_sync_mailbox (CONTEXT *ctx, int *index_hint)
ctx->deleted = 0;
}
}
ctx->deleted = 0;
}
}
+ else if (ctx->last_tag && ctx->last_tag->deleted)
+ ctx->last_tag = NULL; /* reset last tagged msg now useless */
}
/* really only for IMAP - imap_sync_mailbox results in a call to
}
/* really only for IMAP - imap_sync_mailbox results in a call to
@@
-1435,6
+1477,11
@@
int mx_check_mailbox (CONTEXT *ctx, int *index_hint, int lock)
{
int rc;
{
int rc;
+#ifdef USE_COMPRESSED
+ if (ctx->compressinfo)
+ return mutt_check_mailbox_compressed (ctx);
+#endif
+
if (ctx)
{
if (ctx->locked) lock = 0;
if (ctx)
{
if (ctx->locked) lock = 0;