]> granicus.if.org Git - neomutt/commitdiff
move Context.compress
authorRichard Russon <rich@flatcap.org>
Fri, 7 Sep 2018 19:46:12 +0000 (20:46 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 9 Sep 2018 15:11:31 +0000 (16:11 +0100)
commands.c
compress.c
context.h
curs_main.c
mailbox.h
status.c

index f6cc68195fc3baecf0f16d2014bb7fbf8fbfc95b..3269eeef87f2e7fdbaa0c2236888c71ca9b864b9 100644 (file)
@@ -994,7 +994,7 @@ int mutt_save_message(struct Header *h, bool delete, bool decode, bool decrypt)
     /* If we're saving to a compressed mailbox, the stats won't be updated
      * until the next open.  Until then, improvise. */
     struct Mailbox *cm = NULL;
-    if (savectx->compress_info)
+    if (savectx->mailbox->compress_info)
     {
       cm = mutt_find_mailbox(savectx->mailbox->realpath);
     }
index d41376fdca7f2b653f3fe786f1e3cfe397e5ae4c..b60332efd6e5f14b7093b0a0e87b53a969f20758 100644 (file)
@@ -88,7 +88,7 @@ static int lock_realpath(struct Context *ctx, int excl)
   if (!ctx)
     return 0;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return 0;
 
@@ -130,7 +130,7 @@ static void unlock_realpath(struct Context *ctx)
   if (!ctx)
     return;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return;
 
@@ -204,7 +204,7 @@ static void store_size(const struct Context *ctx)
   if (!ctx)
     return;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return;
 
@@ -252,8 +252,8 @@ static struct CompressInfo *set_compress_info(struct Context *ctx)
   if (!ctx || !ctx->mailbox->path)
     return NULL;
 
-  if (ctx->compress_info)
-    return ctx->compress_info;
+  if (ctx->mailbox->compress_info)
+    return ctx->mailbox->compress_info;
 
   /* Open is compulsory */
   const char *o = find_hook(MUTT_OPEN_HOOK, ctx->mailbox->path);
@@ -264,7 +264,7 @@ static struct CompressInfo *set_compress_info(struct Context *ctx)
   const char *a = find_hook(MUTT_APPEND_HOOK, ctx->mailbox->path);
 
   struct CompressInfo *ci = mutt_mem_calloc(1, sizeof(struct CompressInfo));
-  ctx->compress_info = ci;
+  ctx->mailbox->compress_info = ci;
 
   ci->open = mutt_str_strdup(o);
   ci->close = mutt_str_strdup(c);
@@ -281,17 +281,17 @@ static void free_compress_info(struct Context *ctx)
 {
   struct CompressInfo *ci = NULL;
 
-  if (!ctx || !ctx->compress_info)
+  if (!ctx || !ctx->mailbox->compress_info)
     return;
 
-  ci = ctx->compress_info;
+  ci = ctx->mailbox->compress_info;
   FREE(&ci->open);
   FREE(&ci->close);
   FREE(&ci->append);
 
   unlock_realpath(ctx);
 
-  FREE(&ctx->compress_info);
+  FREE(&ctx->mailbox->compress_info);
 }
 
 /**
@@ -587,7 +587,7 @@ static int comp_mbox_close(struct Context *ctx)
   if (!ctx)
     return -1;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return -1;
 
@@ -667,7 +667,7 @@ static int comp_mbox_check(struct Context *ctx, int *index_hint)
   if (!ctx)
     return -1;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return -1;
 
@@ -702,7 +702,7 @@ static int comp_msg_open(struct Context *ctx, struct Message *msg, int msgno)
   if (!ctx)
     return -1;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return -1;
 
@@ -722,7 +722,7 @@ static int comp_msg_close(struct Context *ctx, struct Message *msg)
   if (!ctx)
     return -1;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return -1;
 
@@ -742,7 +742,7 @@ static int comp_msg_commit(struct Context *ctx, struct Message *msg)
   if (!ctx)
     return -1;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return -1;
 
@@ -762,7 +762,7 @@ static int comp_msg_open_new(struct Context *ctx, struct Message *msg, struct He
   if (!ctx)
     return -1;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return -1;
 
@@ -837,7 +837,7 @@ static int comp_mbox_sync(struct Context *ctx, int *index_hint)
   if (!ctx)
     return -1;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return -1;
 
@@ -907,7 +907,7 @@ static int comp_msg_padding_size(struct Context *ctx)
   if (!ctx)
     return 0;
 
-  struct CompressInfo *ci = ctx->compress_info;
+  struct CompressInfo *ci = ctx->mailbox->compress_info;
   if (!ci)
     return 0;
 
index 1e3e009dc952c5262a44cec91a8e75b54183d563..713c53887531f5bc75b5fb1dd49a52d9d09ba0ff 100644 (file)
--- a/context.h
+++ b/context.h
@@ -57,10 +57,6 @@ struct Context
   bool collapsed : 1; /**< are all threads collapsed? */
   bool peekonly : 1;  /**< just taking a glance, revert atime */
 
-#ifdef USE_COMPRESSED
-  void *compress_info; /**< compressed mbox module private data */
-#endif                 /**< USE_COMPRESSED */
-
   struct Mailbox *mailbox;
 };
 
index 947cf99f2e9e961767858c4defb86bdf520684de..c9ad06b655b04d9956aa5b6d857744f52cd197e8 100644 (file)
@@ -573,7 +573,7 @@ static int main_change_folder(struct Menu *menu, int op, char *buf,
     int monitor_remove_rc = mutt_monitor_remove(NULL);
 #endif
 #ifdef USE_COMPRESSED
-    if (Context->compress_info && Context->mailbox->realpath)
+    if (Context->mailbox->compress_info && Context->mailbox->realpath)
       new_last_folder = mutt_str_strdup(Context->mailbox->realpath);
     else
 #endif
index c103e900f85df323b8935eb8085f7e0149b0a413..c8fa89e5290f7b7d16c96514d857777fbb15e665 100644 (file)
--- a/mailbox.h
+++ b/mailbox.h
@@ -106,6 +106,10 @@ struct Mailbox
 
   unsigned char rights[(RIGHTSMAX + 7) / 8]; /**< ACL bits */
 
+#ifdef USE_COMPRESSED
+  void *compress_info; /**< compressed mbox module private data */
+#endif
+
   int flags; /**< e.g. #MB_NORMAL */
 };
 
index 62400872a55f9fcf755b4c8356ef4ce3c92ff393..2d293234f9d063be0cce6c7859b6016e34a51fd9 100644 (file)
--- a/status.c
+++ b/status.c
@@ -131,7 +131,7 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c
       else
 #endif
 #ifdef USE_COMPRESSED
-          if (Context && Context->compress_info && Context->mailbox->realpath)
+          if (Context && Context->mailbox->compress_info && Context->mailbox->realpath)
       {
         mutt_str_strfcpy(tmp, Context->mailbox->realpath, sizeof(tmp));
         mutt_pretty_mailbox(tmp, sizeof(tmp));