]> granicus.if.org Git - neomutt/commitdiff
move Context.{size,changed,readonly,quiet,closing}
authorRichard Russon <rich@flatcap.org>
Wed, 5 Sep 2018 16:24:23 +0000 (17:24 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 9 Sep 2018 15:09:52 +0000 (16:09 +0100)
20 files changed:
compress.c
context.h
copy.c
curs_main.c
flags.c
imap/command.c
imap/imap.c
imap/message.c
mailbox.h
maildir/mh.c
mbox/mbox.c
mx.c
nntp/nntp.c
notmuch/mutt_notmuch.c
pager.c
pop/pop.c
pop/pop_lib.c
recvattach.c
sort.c
status.c

index fcf517d85b6b4b8e07ed36aae702fa772b64ec19..3f1a1b8bb253b3327fd10151af4cf69c2b3e47f1 100644 (file)
@@ -112,7 +112,7 @@ static int lock_realpath(struct Context *ctx, int excl)
   else if (excl == 0)
   {
     mutt_file_fclose(&ci->lockfp);
-    ctx->readonly = true;
+    ctx->mailbox->readonly = true;
     return 1;
   }
 
@@ -413,7 +413,7 @@ static int execute_command(struct Context *ctx, const char *command, const char
   if (!ctx || !command || !progress)
     return 0;
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     mutt_message(progress, ctx->mailbox->realpath);
   }
@@ -455,7 +455,7 @@ static int comp_mbox_open(struct Context *ctx)
 
   /* If there's no close-hook, or the file isn't writable */
   if (!ci->close || (access(ctx->mailbox->path, W_OK) != 0))
-    ctx->readonly = true;
+    ctx->mailbox->readonly = true;
 
   if (setup_paths(ctx) != 0)
     goto or_fail;
index 842f659ba42d9fdb480b02e838acecfe84d982db..a148b531fd526bc1bdf14aa46045cd7301716a13 100644 (file)
--- a/context.h
+++ b/context.h
@@ -61,7 +61,6 @@ struct Context
   FILE *fp;
   struct timespec atime;
   struct timespec mtime;
-  off_t size;
   off_t vsize;
   char *pattern;                 /**< limit pattern string */
   struct Pattern *limit_pattern; /**< compiled limit pattern */
@@ -83,13 +82,9 @@ struct Context
   unsigned char rights[(RIGHTSMAX + 7) / 8]; /**< ACL bits */
 
   bool locked : 1;    /**< is the mailbox locked? */
-  bool changed : 1;   /**< mailbox has been modified */
-  bool readonly : 1;  /**< don't allow changes to the mailbox */
   bool dontwrite : 1; /**< don't write the mailbox on close */
   bool append : 1;    /**< mailbox is opened in append mode */
-  bool quiet : 1;     /**< inhibit status messages? */
   bool collapsed : 1; /**< are all threads collapsed? */
-  bool closing : 1;   /**< mailbox is being closed */
   bool peekonly : 1;  /**< just taking a glance, revert atime */
 
 #ifdef USE_COMPRESSED
diff --git a/copy.c b/copy.c
index cc225f090049a5ff8d36c3c227c5e06d451fdcfe..519a7cabf2395540cbd511db7a413a0a864adb59 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -655,7 +655,7 @@ int mutt_copy_message_fp(FILE *fpout, FILE *fpin, struct Header *hdr, int flags,
         body->offset = new_offset;
 
         /* update the total size of the mailbox to reflect this deletion */
-        Context->size -= body->length - new_length;
+        Context->mailbox->size -= body->length - new_length;
         /* if the message is visible, update the visible size of the mailbox as well.  */
         if (Context->v2r[hdr->msgno] != -1)
           Context->vsize -= body->length - new_length;
index 56a7459f4383b0e72ac054dd0b9c6aa0356a87e1..19d0e47f71983399c9c32642ca511e1d54c517bd 100644 (file)
@@ -137,7 +137,7 @@ static const char *NoVisible = N_("No visible messages");
   }
 
 #define CHECK_READONLY                                                         \
-  if (Context->readonly)                                                       \
+  if (Context->mailbox->readonly)                                              \
   {                                                                            \
     mutt_flushinp();                                                           \
     mutt_error(_(Mailbox_is_read_only));                                       \
@@ -317,7 +317,7 @@ static int mx_toggle_write(struct Context *ctx)
   if (!ctx)
     return -1;
 
-  if (ctx->readonly)
+  if (ctx->mailbox->readonly)
   {
     mutt_error(_("Cannot toggle write on a readonly mailbox"));
     return -1;
@@ -1095,10 +1095,10 @@ int mutt_index_menu(void)
         /* avoid the message being overwritten by mailbox */
         do_mailbox_notify = false;
 
-        bool q = Context->quiet;
-        Context->quiet = true;
+        bool q = Context->mailbox->quiet;
+        Context->mailbox->quiet = true;
         update_index(menu, Context, check, oldcount, index_hint);
-        Context->quiet = q;
+        Context->mailbox->quiet = q;
 
         menu->redraw = REDRAW_FULL;
         menu->max = Context->vcount;
@@ -1421,12 +1421,12 @@ int mutt_index_menu(void)
           {
             struct Header *oldcur = CURHDR;
             struct Header *hdr = NULL;
-            bool quiet = Context->quiet;
+            bool quiet = Context->mailbox->quiet;
 
             if (rc2 < 0)
-              Context->quiet = true;
+              Context->mailbox->quiet = true;
             mutt_sort_headers(Context, (op == OP_RECONSTRUCT_THREAD));
-            Context->quiet = quiet;
+            Context->mailbox->quiet = quiet;
 
             /* Similar to OP_MAIN_ENTIRE_THREAD, keep displaying the old message, but
                update the index */
@@ -1557,7 +1557,24 @@ int mutt_index_menu(void)
           break;
         }
 
-        log_queue_save(fp);
+        // log_queue_save(fp);
+
+        fprintf(fp, "path:     %s\n", Context->mailbox->path);
+        // fprintf(fp, "realpath: %s\n", Context->realpath);
+        fprintf(fp, "mailbox->size:     %ld\n", Context->mailbox->size);
+        fprintf(fp, "vsize:    %ld\n", Context->vsize);
+        fprintf(fp, "\n");
+
+        struct MailboxNode *np = NULL;
+        STAILQ_FOREACH(np, &AllMailboxes, entries)
+        {
+          fprintf(fp, "path:     %s\n", np->b->path);
+          fprintf(fp, "size:     %ld\n", np->b->size);
+          // fprintf(fp, "realpath: %s\n", np->b->realpath);
+          // fprintf(fp, "desc:     %s\n", np->b->desc);
+          fprintf(fp, "\n");
+        }
+
         mutt_file_fclose(&fp);
 
         mutt_do_pager("messages", tempfile, MUTT_PAGER_LOGS, NULL);
@@ -1893,14 +1910,14 @@ int mutt_index_menu(void)
             if (message_is_tagged(Context, j))
             {
               Context->mailbox->hdrs[j]->quasi_deleted = true;
-              Context->changed = true;
+              Context->mailbox->changed = true;
             }
           }
         }
         else
         {
           CURHDR->quasi_deleted = true;
-          Context->changed = true;
+          Context->mailbox->changed = true;
         }
         break;
 
@@ -1973,7 +1990,7 @@ int mutt_index_menu(void)
           struct Progress progress;
           int px;
 
-          if (!Context->quiet)
+          if (!Context->mailbox->quiet)
           {
             char msgbuf[STRING];
             snprintf(msgbuf, sizeof(msgbuf), _("Update tags..."));
@@ -1989,7 +2006,7 @@ int mutt_index_menu(void)
             if (!message_is_tagged(Context, j))
               continue;
 
-            if (!Context->quiet)
+            if (!Context->mailbox->quiet)
               mutt_progress_update(&progress, ++px, -1);
             mx_tags_commit(Context, Context->mailbox->hdrs[j], buf);
             if (op == OP_MAIN_MODIFY_TAGS_THEN_HIDE)
@@ -2001,7 +2018,7 @@ int mutt_index_menu(void)
                     nm_message_is_still_queried(Context, Context->mailbox->hdrs[j]);
 #endif
               Context->mailbox->hdrs[j]->quasi_deleted = !still_queried;
-              Context->changed = true;
+              Context->mailbox->changed = true;
             }
           }
 #ifdef USE_NOTMUCH
@@ -2025,7 +2042,7 @@ int mutt_index_menu(void)
               still_queried = nm_message_is_still_queried(Context, CURHDR);
 #endif
             CURHDR->quasi_deleted = !still_queried;
-            Context->changed = true;
+            Context->mailbox->changed = true;
           }
           if (menu->menu == MENU_PAGER)
           {
@@ -2332,7 +2349,7 @@ int mutt_index_menu(void)
             menu->current = oldcur->virtual;
           }
 
-          Context->changed = true;
+          Context->mailbox->changed = true;
           mutt_message(_("Thread broken"));
 
           if (menu->menu == MENU_PAGER)
@@ -2374,7 +2391,7 @@ int mutt_index_menu(void)
             mutt_sort_headers(Context, true);
             menu->current = oldcur->virtual;
 
-            Context->changed = true;
+            Context->mailbox->changed = true;
             mutt_message(_("Threads linked"));
           }
           else
@@ -3029,7 +3046,8 @@ int mutt_index_menu(void)
           edit = true;
         }
         else if (op == OP_EDIT_OR_VIEW_RAW_MESSAGE)
-          edit = !Context->readonly && mutt_bit_isset(Context->rights, MUTT_ACL_INSERT);
+          edit = !Context->mailbox->readonly &&
+                 mutt_bit_isset(Context->rights, MUTT_ACL_INSERT);
         else
           edit = false;
 
@@ -3084,7 +3102,7 @@ int mutt_index_menu(void)
         rc = mutt_label_message(tag ? NULL : CURHDR);
         if (rc > 0)
         {
-          Context->changed = true;
+          Context->mailbox->changed = true;
           menu->redraw = REDRAW_FULL;
           /* L10N: This is displayed when the x-label on one or more
            * messages is edited. */
@@ -3439,7 +3457,7 @@ int mutt_index_menu(void)
         CHECK_VISIBLE;
         mutt_view_attachments(CURHDR);
         if (Context && CURHDR->attach_del)
-          Context->changed = true;
+          Context->mailbox->changed = true;
         menu->redraw = REDRAW_FULL;
         break;
 
diff --git a/flags.c b/flags.c
index 16173a3ece658c96b0fa35916a42d0afa2df1b59..0c228c0e767a5b1935b3abfb95a0767dd244f288 100644 (file)
--- a/flags.c
+++ b/flags.c
@@ -64,7 +64,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
   int mailbox = ctx->mailbox->msg_flagged;
   int update = false;
 
-  if (ctx->readonly && flag != MUTT_TAG)
+  if (ctx->mailbox->readonly && flag != MUTT_TAG)
     return; /* don't modify anything if we are read-only */
 
   switch (flag)
@@ -76,7 +76,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
 
       if (bf)
       {
-        if (!h->deleted && !ctx->readonly && (!h->flagged || !FlagSafe))
+        if (!h->deleted && !ctx->mailbox->readonly && (!h->flagged || !FlagSafe))
         {
           h->deleted = true;
           update = true;
@@ -89,7 +89,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
           {
             h->changed = true;
             if (upd_ctx)
-              ctx->changed = true;
+              ctx->mailbox->changed = true;
           }
 #endif
         }
@@ -106,7 +106,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
         {
           h->changed = true;
           if (upd_ctx)
-            ctx->changed = true;
+            ctx->mailbox->changed = true;
         }
 #endif
         /* If the user undeletes a message which is marked as
@@ -117,7 +117,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
          * driver.
          */
         if (ctx->mailbox->magic == MUTT_MAILDIR && upd_ctx && h->trash)
-          ctx->changed = true;
+          ctx->mailbox->changed = true;
       }
       break;
 
@@ -128,7 +128,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
 
       if (bf)
       {
-        if (!h->purge && !ctx->readonly)
+        if (!h->purge && !ctx->mailbox->readonly)
           h->purge = true;
       }
       else if (h->purge)
@@ -156,7 +156,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
           }
           h->changed = true;
           if (upd_ctx)
-            ctx->changed = true;
+            ctx->mailbox->changed = true;
         }
       }
       else if (!h->read)
@@ -170,7 +170,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
           ctx->mailbox->msg_unread--;
         h->changed = true;
         if (upd_ctx)
-          ctx->changed = true;
+          ctx->mailbox->changed = true;
       }
       break;
 
@@ -190,7 +190,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
               ctx->new --;
           h->changed = true;
           if (upd_ctx)
-            ctx->changed = true;
+            ctx->mailbox->changed = true;
         }
       }
       else if (h->old)
@@ -202,7 +202,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
             ctx->new ++;
         h->changed = true;
         if (upd_ctx)
-          ctx->changed = true;
+          ctx->mailbox->changed = true;
       }
       break;
 
@@ -224,7 +224,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
               ctx->new --;
           h->changed = true;
           if (upd_ctx)
-            ctx->changed = true;
+            ctx->mailbox->changed = true;
         }
       }
       else if (h->read)
@@ -238,7 +238,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
             ctx->new ++;
         h->changed = true;
         if (upd_ctx)
-          ctx->changed = true;
+          ctx->mailbox->changed = true;
       }
       break;
 
@@ -264,7 +264,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
           }
           h->changed = true;
           if (upd_ctx)
-            ctx->changed = true;
+            ctx->mailbox->changed = true;
         }
       }
       else if (h->replied)
@@ -273,7 +273,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
         h->replied = false;
         h->changed = true;
         if (upd_ctx)
-          ctx->changed = true;
+          ctx->mailbox->changed = true;
       }
       break;
 
@@ -292,7 +292,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
             ctx->mailbox->msg_flagged++;
           h->changed = true;
           if (upd_ctx)
-            ctx->changed = true;
+            ctx->mailbox->changed = true;
         }
       }
       else if (h->flagged)
@@ -303,7 +303,7 @@ void mutt_set_flag_update(struct Context *ctx, struct Header *h, int flag, bool
           ctx->mailbox->msg_flagged--;
         h->changed = true;
         if (upd_ctx)
-          ctx->changed = true;
+          ctx->mailbox->changed = true;
       }
       break;
 
index 02d116afb23503be6f20fbed11a018674de7bfdc..933a0e2c3278de16d7ffb2ca2261a0550cd52ae7 100644 (file)
@@ -1319,7 +1319,7 @@ void imap_cmd_finish(struct ImapData *idata)
     return;
   }
 
-  if (!(idata->state >= IMAP_SELECTED) || idata->ctx->closing)
+  if (!(idata->state >= IMAP_SELECTED) || idata->ctx->mailbox->closing)
     return;
 
   if (idata->reopen & IMAP_REOPEN_ALLOW)
index 106a7037b2ebf07c133a5353ce3cca9a796c7d8c..1a79f32d48b59a4bab69d2c02b5ed9d6d7438cd5 100644 (file)
@@ -853,7 +853,7 @@ void imap_expunge_mailbox(struct ImapData *idata)
       mutt_debug(2, "Expunging message UID %u.\n", HEADER_DATA(h)->uid);
 
       h->active = false;
-      idata->ctx->size -= h->content->length;
+      idata->ctx->mailbox->size -= h->content->length;
 
       imap_cache_del(idata, h);
 #ifdef USE_HCACHE
@@ -2082,7 +2082,7 @@ static int imap_mbox_open(struct Context *ctx)
     condstore = "";
 
   snprintf(bufout, sizeof(bufout), "%s %s%s",
-           ctx->readonly ? "EXAMINE" : "SELECT", buf, condstore);
+           ctx->mailbox->readonly ? "EXAMINE" : "SELECT", buf, condstore);
 
   idata->state = IMAP_SELECTED;
 
@@ -2185,7 +2185,7 @@ static int imap_mbox_open(struct Context *ctx)
       !mutt_bit_isset(idata->capabilities, ACL))
   {
     mutt_debug(2, "Mailbox is read-only.\n");
-    ctx->readonly = true;
+    ctx->mailbox->readonly = true;
   }
 
   /* dump the mailbox flags we've found */
@@ -2213,7 +2213,7 @@ static int imap_mbox_open(struct Context *ctx)
         mutt_bit_isset(idata->ctx->rights, MUTT_ACL_WRITE) ||
         mutt_bit_isset(idata->ctx->rights, MUTT_ACL_INSERT)))
   {
-    ctx->readonly = true;
+    ctx->mailbox->readonly = true;
   }
 
   ctx->mailbox->hdrmax = count;
@@ -2527,7 +2527,7 @@ int imap_sync_mailbox(struct Context *ctx, bool expunge)
 
   if (rc < 0)
   {
-    if (ctx->closing)
+    if (ctx->mailbox->closing)
     {
       if (mutt_yesorno(_("Error saving flags. Close anyway?"), 0) == MUTT_YES)
       {
@@ -2554,10 +2554,10 @@ int imap_sync_mailbox(struct Context *ctx, bool expunge)
     HEADER_DATA(ctx->mailbox->hdrs[i])->replied = ctx->mailbox->hdrs[i]->replied;
     ctx->mailbox->hdrs[i]->changed = false;
   }
-  ctx->changed = false;
+  ctx->mailbox->changed = false;
 
   /* We must send an EXPUNGE command if we're not closing. */
-  if (expunge && !(ctx->closing) && mutt_bit_isset(ctx->rights, MUTT_ACL_DELETE))
+  if (expunge && !(ctx->mailbox->closing) && mutt_bit_isset(ctx->rights, MUTT_ACL_DELETE))
   {
     mutt_message(_("Expunging messages from server..."));
     /* Set expunge bit so we don't get spurious reopened messages */
@@ -2572,7 +2572,7 @@ int imap_sync_mailbox(struct Context *ctx, bool expunge)
     idata->reopen &= ~IMAP_EXPUNGE_EXPECTED;
   }
 
-  if (expunge && ctx->closing)
+  if (expunge && ctx->mailbox->closing)
   {
     imap_exec(idata, "CLOSE", IMAP_CMD_QUEUE);
     idata->state = IMAP_AUTHENTICATED;
index cd72a1f86b3b86d5d1c2f139bec18874c0b2d5fd..5e5fb3b5574a72dfb8f9a7f96c4a8f54fef5bcc8 100644 (file)
@@ -754,7 +754,7 @@ static int read_headers_normal_eval_cache(struct ImapData *idata,
                             mutt_str_strdup(h.data->flags_remote));
 
         ctx->mailbox->msg_count++;
-        ctx->size += ctx->mailbox->hdrs[idx]->content->length;
+        ctx->mailbox->size += ctx->mailbox->hdrs[idx]->content->length;
 
         /* If this is the first time we are fetching, we need to
          * store the current state of flags back into the header cache */
@@ -832,7 +832,7 @@ static int read_headers_qresync_eval_cache(struct ImapData *idata, char *uid_seq
       ihd->uid = uid;
       mutt_hash_int_insert(idata->uid_hash, uid, h);
 
-      ctx->size += h->content->length;
+      ctx->mailbox->size += h->content->length;
       ctx->mailbox->hdrs[ctx->mailbox->msg_count++] = h;
 
       msn++;
@@ -910,7 +910,7 @@ static int read_headers_condstore_qresync_updates(struct ImapData *idata,
   /* The IMAP flag setting as part of cmd_parse_fetch() ends up
    * flipping these on. */
   idata->check_status &= ~IMAP_FLAGS_PENDING;
-  ctx->changed = false;
+  ctx->mailbox->changed = false;
 
   /* VANISHED handling: we need to empty out the messages */
   if (idata->reopen & IMAP_EXPUNGE_PENDING)
@@ -1087,7 +1087,7 @@ static int read_headers_fetch_new(struct ImapData *idata, unsigned int msn_begin
             mutt_rfc822_read_header(fp, ctx->mailbox->hdrs[idx], false, false);
         /* content built as a side-effect of mutt_rfc822_read_header */
         ctx->mailbox->hdrs[idx]->content->length = h.content_length;
-        ctx->size += h.content_length;
+        ctx->mailbox->size += h.content_length;
 
 #ifdef USE_HCACHE
         imap_hcache_put(idata, ctx->mailbox->hdrs[idx]);
@@ -2001,8 +2001,8 @@ char *imap_set_flags(struct ImapData *idata, struct Header *h, char *s, int *ser
    * read-write even if it's read-only, so *server* updates of
    * flags can be processed by mutt_set_flag. ctx->changed must
    * be restored afterwards */
-  readonly = ctx->readonly;
-  ctx->readonly = false;
+  readonly = ctx->mailbox->readonly;
+  ctx->mailbox->readonly = false;
 
   /* This is redundant with the following two checks. Removing:
    * mutt_set_flag (ctx, h, MUTT_NEW, !(hd->read || hd->old));
@@ -2022,8 +2022,8 @@ char *imap_set_flags(struct ImapData *idata, struct Header *h, char *s, int *ser
    * marks things changed as a side-effect) */
   if (!local_changes)
     h->changed = false;
-  ctx->changed &= !readonly;
-  ctx->readonly = readonly;
+  ctx->mailbox->changed &= !readonly;
+  ctx->mailbox->readonly = readonly;
 
   return s;
 }
index b1ae3d7f8cf5b91f4db4fe12b17562464f0a46c7..e99175433cbb7c98411c4f093db977a63aad0eb7 100644 (file)
--- a/mailbox.h
+++ b/mailbox.h
@@ -77,6 +77,11 @@ struct Mailbox
   void *data; /**< driver specific data */
   const struct MxOps *mx_ops;
 
+  bool changed : 1;   /**< mailbox has been modified */
+  bool readonly : 1;  /**< don't allow changes to the mailbox */
+  bool quiet : 1;     /**< inhibit status messages? */
+  bool closing : 1;   /**< mailbox is being closed */
+
   int flags; /**< e.g. #MB_NORMAL */
 };
 
index 1ae06e0106707edcc15d6e2ff6df1a655b3d48cb..3651ddaec9ec27da04d831870df9e876030cd1ef 100644 (file)
@@ -990,7 +990,7 @@ static int maildir_parse_dir(struct Context *ctx, struct Maildir ***last,
     if (count)
     {
       (*count)++;
-      if (!ctx->quiet && progress)
+      if (!ctx->mailbox->quiet && progress)
         mutt_progress_update(progress, *count, -1);
     }
 
@@ -1045,8 +1045,8 @@ static bool maildir_add_to_context(struct Context *ctx, struct Maildir *md)
 
       ctx->mailbox->hdrs[ctx->mailbox->msg_count] = md->h;
       ctx->mailbox->hdrs[ctx->mailbox->msg_count]->index = ctx->mailbox->msg_count;
-      ctx->size += md->h->content->length + md->h->content->offset -
-                   md->h->content->hdr_offset;
+      ctx->mailbox->size += md->h->content->length + md->h->content->offset -
+                            md->h->content->hdr_offset;
 
       md->h = NULL;
       ctx->mailbox->msg_count++;
@@ -1325,7 +1325,7 @@ static void maildir_delayed_parsing(struct Context *ctx, struct Maildir **md,
       continue;
     }
 
-    if (!ctx->quiet && progress)
+    if (!ctx->mailbox->quiet && progress)
       mutt_progress_update(progress, count, -1);
 
     if (!sort)
@@ -1442,7 +1442,7 @@ static int mh_read_dir(struct Context *ctx, const char *subdir)
   char msgbuf[STRING];
   struct Progress progress;
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     snprintf(msgbuf, sizeof(msgbuf), _("Scanning %s..."), ctx->mailbox->path);
     mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, ReadInc, 0);
@@ -1462,7 +1462,7 @@ static int mh_read_dir(struct Context *ctx, const char *subdir)
   if (maildir_parse_dir(ctx, &last, subdir, &count, &progress) == -1)
     return -1;
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     snprintf(msgbuf, sizeof(msgbuf), _("Reading %s..."), ctx->mailbox->path);
     mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, ReadInc, count);
@@ -2633,7 +2633,7 @@ static int mh_mbox_sync(struct Context *ctx, int *index_hint)
     hc = mutt_hcache_open(HeaderCache, ctx->mailbox->path, NULL);
 #endif
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     snprintf(msgbuf, sizeof(msgbuf), _("Writing %s..."), ctx->mailbox->path);
     mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc,
@@ -2642,7 +2642,7 @@ static int mh_mbox_sync(struct Context *ctx, int *index_hint)
 
   for (i = 0; i < ctx->mailbox->msg_count; i++)
   {
-    if (!ctx->quiet)
+    if (!ctx->mailbox->quiet)
       mutt_progress_update(&progress, i, -1);
 
 #ifdef USE_HCACHE
@@ -2700,7 +2700,7 @@ bool maildir_update_flags(struct Context *ctx, struct Header *o, struct Header *
   /* save the global state here so we can reset it at the
    * end of list block if required.
    */
-  bool context_changed = ctx->changed;
+  bool context_changed = ctx->mailbox->changed;
   bool header_changed;
 
   /* user didn't modify this message.  alter the flags to match the
@@ -2730,7 +2730,7 @@ bool maildir_update_flags(struct Context *ctx, struct Header *o, struct Header *
    * be synchronized.
    */
   if (!context_changed)
-    ctx->changed = false;
+    ctx->mailbox->changed = false;
 
   return header_changed;
 }
index 50e097b9c25ce8b1dafed46501101812a538c7d0..03af4746f21bd68eaedcb57c03e5199291e84e3b 100644 (file)
@@ -83,7 +83,7 @@ static int mbox_lock_mailbox(struct Context *ctx, int excl, int retry)
     ctx->locked = true;
   else if (retry && !excl)
   {
-    ctx->readonly = true;
+    ctx->mailbox->readonly = true;
     return 0;
   }
 
@@ -131,11 +131,11 @@ static int mmdf_parse_mailbox(struct Context *ctx)
   }
   mutt_get_stat_timespec(&ctx->atime, &sb, MUTT_STAT_ATIME);
   mutt_get_stat_timespec(&ctx->mtime, &sb, MUTT_STAT_MTIME);
-  ctx->size = sb.st_size;
+  ctx->mailbox->size = sb.st_size;
 
   buf[sizeof(buf) - 1] = '\0';
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     char msgbuf[STRING];
     snprintf(msgbuf, sizeof(msgbuf), _("Reading %s..."), ctx->mailbox->path);
@@ -157,8 +157,9 @@ static int mmdf_parse_mailbox(struct Context *ctx)
         return -1;
 
       count++;
-      if (!ctx->quiet)
-        mutt_progress_update(&progress, count, (int) (loc / (ctx->size / 100 + 1)));
+      if (!ctx->mailbox->quiet)
+        mutt_progress_update(&progress, count,
+                             (int) (loc / (ctx->mailbox->size / 100 + 1)));
 
       if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax)
         mx_alloc_memory(ctx);
@@ -198,7 +199,7 @@ static int mmdf_parse_mailbox(struct Context *ctx)
       {
         tmploc = loc + hdr->content->length;
 
-        if ((tmploc > 0) && (tmploc < ctx->size))
+        if ((tmploc > 0) && (tmploc < ctx->mailbox->size))
         {
           if (fseeko(ctx->fp, tmploc, SEEK_SET) != 0 ||
               !fgets(buf, sizeof(buf) - 1, ctx->fp) ||
@@ -290,14 +291,14 @@ static int mbox_parse_mailbox(struct Context *ctx)
     return -1;
   }
 
-  ctx->size = sb.st_size;
+  ctx->mailbox->size = sb.st_size;
   mutt_get_stat_timespec(&ctx->mtime, &sb, MUTT_STAT_MTIME);
   mutt_get_stat_timespec(&ctx->atime, &sb, MUTT_STAT_ATIME);
 
-  if (!ctx->readonly)
-    ctx->readonly = access(ctx->mailbox->path, W_OK) ? true : false;
+  if (!ctx->mailbox->readonly)
+    ctx->mailbox->readonly = access(ctx->mailbox->path, W_OK) ? true : false;
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     char msgbuf[STRING];
     snprintf(msgbuf, sizeof(msgbuf), _("Reading %s..."), ctx->mailbox->path);
@@ -325,10 +326,10 @@ static int mbox_parse_mailbox(struct Context *ctx)
 
       count++;
 
-      if (!ctx->quiet)
+      if (!ctx->mailbox->quiet)
       {
         mutt_progress_update(&progress, count,
-                             (int) (ftello(ctx->fp) / (ctx->size / 100 + 1)));
+                             (int) (ftello(ctx->fp) / (ctx->mailbox->size / 100 + 1)));
       }
 
       if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax)
@@ -355,11 +356,11 @@ static int mbox_parse_mailbox(struct Context *ctx)
         /* The test below avoids a potential integer overflow if the
          * content-length is huge (thus necessarily invalid).
          */
-        tmploc = (curhdr->content->length < ctx->size) ?
+        tmploc = (curhdr->content->length < ctx->mailbox->size) ?
                      (loc + curhdr->content->length + 1) :
                      -1;
 
-        if ((tmploc > 0) && (tmploc < ctx->size))
+        if ((tmploc > 0) && (tmploc < ctx->mailbox->size))
         {
           /* check to see if the content-length looks valid.  we expect to
            * to see a valid message separator at this point in the stream
@@ -378,7 +379,7 @@ static int mbox_parse_mailbox(struct Context *ctx)
             curhdr->content->length = -1;
           }
         }
-        else if (tmploc != ctx->size)
+        else if (tmploc != ctx->mailbox->size)
         {
           /* content-length would put us past the end of the file, so it
            * must be wrong
@@ -642,9 +643,9 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint)
   int rc = -1;
 
   /* silent operations */
-  ctx->quiet = true;
+  ctx->mailbox->quiet = true;
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
     mutt_message(_("Reopening mailbox..."));
 
   /* our heuristics require the old mailbox to be unsorted */
@@ -669,7 +670,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint)
   mutt_hash_destroy(&ctx->label_hash);
   mutt_clear_threads(ctx);
   FREE(&ctx->v2r);
-  if (ctx->readonly)
+  if (ctx->mailbox->readonly)
   {
     for (i = 0; i < ctx->mailbox->msg_count; i++)
       mutt_header_free(&(ctx->mailbox->hdrs[i])); /* nothing to do! */
@@ -692,7 +693,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint)
   ctx->new = 0;
   ctx->mailbox->msg_unread = 0;
   ctx->mailbox->msg_flagged = 0;
-  ctx->changed = false;
+  ctx->mailbox->changed = false;
   ctx->id_hash = NULL;
   ctx->subj_hash = NULL;
   mutt_make_label_hash(ctx);
@@ -723,7 +724,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint)
       mutt_header_free(&(old_hdrs[j]));
     FREE(&old_hdrs);
 
-    ctx->quiet = false;
+    ctx->mailbox->quiet = false;
     return -1;
   }
 
@@ -733,7 +734,7 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint)
 
   index_hint_set = (index_hint == NULL);
 
-  if (!ctx->readonly)
+  if (!ctx->mailbox->readonly)
   {
     for (i = 0; i < ctx->mailbox->msg_count; i++)
     {
@@ -806,9 +807,9 @@ static int reopen_mailbox(struct Context *ctx, int *index_hint)
     FREE(&old_hdrs);
   }
 
-  ctx->quiet = false;
+  ctx->mailbox->quiet = false;
 
-  return (ctx->changed || msg_mod) ? MUTT_REOPENED : MUTT_NEW_MAIL;
+  return (ctx->mailbox->changed || msg_mod) ? MUTT_REOPENED : MUTT_NEW_MAIL;
 }
 
 /**
@@ -830,19 +831,19 @@ static int mbox_mbox_check(struct Context *ctx, int *index_hint)
   if (stat(ctx->mailbox->path, &st) == 0)
   {
     if ((mutt_stat_timespec_compare(&st, MUTT_STAT_MTIME, &ctx->mtime) == 0) &&
-        st.st_size == ctx->size)
+        st.st_size == ctx->mailbox->size)
     {
       return 0;
     }
 
-    if (st.st_size == ctx->size)
+    if (st.st_size == ctx->mailbox->size)
     {
       /* the file was touched, but it is still the same length, so just exit */
       mutt_get_stat_timespec(&ctx->mtime, &st, MUTT_STAT_MTIME);
       return 0;
     }
 
-    if (st.st_size > ctx->size)
+    if (st.st_size > ctx->mailbox->size)
     {
       /* lock the file if it isn't already */
       if (!ctx->locked)
@@ -866,14 +867,14 @@ static int mbox_mbox_check(struct Context *ctx, int *index_hint)
        * folder.
        */
       char buffer[LONG_STRING];
-      if (fseeko(ctx->fp, ctx->size, SEEK_SET) != 0)
+      if (fseeko(ctx->fp, ctx->mailbox->size, SEEK_SET) != 0)
         mutt_debug(1, "#1 fseek() failed\n");
       if (fgets(buffer, sizeof(buffer), ctx->fp))
       {
         if ((ctx->mailbox->magic == MUTT_MBOX && (mutt_str_strncmp("From ", buffer, 5) == 0)) ||
             (ctx->mailbox->magic == MUTT_MMDF && (mutt_str_strcmp(MMDF_SEP, buffer) == 0)))
         {
-          if (fseeko(ctx->fp, ctx->size, SEEK_SET) != 0)
+          if (fseeko(ctx->fp, ctx->mailbox->size, SEEK_SET) != 0)
             mutt_debug(1, "#2 fseek() failed\n");
           if (ctx->mailbox->magic == MUTT_MBOX)
             mbox_parse_mailbox(ctx);
@@ -1091,7 +1092,7 @@ static int mbox_mbox_sync(struct Context *ctx, int *index_hint)
   new_offset = mutt_mem_calloc(ctx->mailbox->msg_count - first, sizeof(struct MUpdate));
   old_offset = mutt_mem_calloc(ctx->mailbox->msg_count - first, sizeof(struct MUpdate));
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     snprintf(msgbuf, sizeof(msgbuf), _("Writing %s..."), ctx->mailbox->path);
     mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc,
@@ -1100,8 +1101,9 @@ static int mbox_mbox_sync(struct Context *ctx, int *index_hint)
 
   for (i = first, j = 0; i < ctx->mailbox->msg_count; i++)
   {
-    if (!ctx->quiet)
-      mutt_progress_update(&progress, i, (int) (ftello(ctx->fp) / (ctx->size / 100 + 1)));
+    if (!ctx->mailbox->quiet)
+      mutt_progress_update(&progress, i,
+                           (int) (ftello(ctx->fp) / (ctx->mailbox->size / 100 + 1)));
     /* back up some information which is needed to restore offsets when
      * something fails.
      */
@@ -1223,7 +1225,7 @@ static int mbox_mbox_sync(struct Context *ctx, int *index_hint)
       /* copy the temp mailbox back into place starting at the first
        * change/deleted message
        */
-      if (!ctx->quiet)
+      if (!ctx->mailbox->quiet)
         mutt_message(_("Committing changes..."));
       i = mutt_file_copy_stream(fp, ctx->fp);
 
@@ -1232,8 +1234,8 @@ static int mbox_mbox_sync(struct Context *ctx, int *index_hint)
     }
     if (i == 0)
     {
-      ctx->size = ftello(ctx->fp); /* update the size of the mailbox */
-      if ((ctx->size < 0) || (ftruncate(fileno(ctx->fp), ctx->size) != 0))
+      ctx->mailbox->size = ftello(ctx->fp); /* update the mailbox->size of the mailbox */
+      if ((ctx->mailbox->size < 0) || (ftruncate(fileno(ctx->fp), ctx->mailbox->size) != 0))
       {
         i = -1;
         mutt_debug(1, "ftruncate() failed\n");
diff --git a/mx.c b/mx.c
index 25eb92304aa030163fba012b8d67338a00393224..707ae7778192ced2c993509c78f1d504e44b6da0 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -267,9 +267,9 @@ struct Context *mx_mbox_open(const char *path, int flags)
     mutt_bit_set(ctx->rights, rc);
 
   if (flags & MUTT_QUIET)
-    ctx->quiet = true;
+    ctx->mailbox->quiet = true;
   if (flags & MUTT_READONLY)
-    ctx->readonly = true;
+    ctx->mailbox->readonly = true;
   if (flags & MUTT_PEEK)
     ctx->peekonly = true;
 
@@ -309,7 +309,7 @@ struct Context *mx_mbox_open(const char *path, int flags)
    */
   OptForceRefresh = true;
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
     mutt_message(_("Reading %s..."), ctx->mailbox->path);
 
   rc = ctx->mailbox->mx_ops->mbox_open(ctx);
@@ -324,7 +324,7 @@ struct Context *mx_mbox_open(const char *path, int flags)
       OptNeedRescore = false;
       mutt_sort_headers(ctx, true);
     }
-    if (!ctx->quiet)
+    if (!ctx->mailbox->quiet)
       mutt_clear_error();
     if (rc == -2)
       mutt_error(_("Reading from %s interrupted..."), ctx->mailbox->path);
@@ -402,14 +402,14 @@ static int sync_mailbox(struct Context *ctx, int *index_hint)
   if (!ctx->mailbox->mx_ops || !ctx->mailbox->mx_ops->mbox_sync)
     return -1;
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     /* L10N: Displayed before/as a mailbox is being synced */
     mutt_message(_("Writing %s..."), ctx->mailbox->path);
   }
 
   int rc = ctx->mailbox->mx_ops->mbox_sync(ctx, index_hint);
-  if ((rc != 0) && !ctx->quiet)
+  if ((rc != 0) && !ctx->mailbox->quiet)
   {
     /* L10N: Displayed if a mailbox sync fails */
     mutt_error(_("Unable to write %s"), ctx->mailbox->path);
@@ -524,9 +524,9 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
   char mbox[PATH_MAX];
   char buf[PATH_MAX + 64];
 
-  ctx->closing = true;
+  ctx->mailbox->closing = true;
 
-  if (ctx->readonly || ctx->dontwrite || ctx->append)
+  if (ctx->mailbox->readonly || ctx->dontwrite || ctx->append)
   {
     mx_fastclose_mailbox(ctx);
     FREE(pctx);
@@ -543,7 +543,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
       int rc = query_quadoption(CatchupNewsgroup, _("Mark all articles read?"));
       if (rc == MUTT_ABORT)
       {
-        ctx->closing = false;
+        ctx->mailbox->closing = false;
         return -1;
       }
       else if (rc == MUTT_YES)
@@ -593,7 +593,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
       move_messages = query_quadoption(Move, buf);
       if (move_messages == MUTT_ABORT)
       {
-        ctx->closing = false;
+        ctx->mailbox->closing = false;
         return -1;
       }
     }
@@ -610,7 +610,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
     purge = query_quadoption(Delete, buf);
     if (purge == MUTT_ABORT)
     {
-      ctx->closing = false;
+      ctx->mailbox->closing = false;
       return -1;
     }
   }
@@ -627,7 +627,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
 
   if (move_messages)
   {
-    if (!ctx->quiet)
+    if (!ctx->mailbox->quiet)
       mutt_message(_("Moving read messages to %s..."), mbox);
 
 #ifdef USE_IMAP
@@ -657,7 +657,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
       mutt_clear_error();
     else if (i == -1) /* horrible error, bail */
     {
-      ctx->closing = false;
+      ctx->mailbox->closing = false;
       return -1;
     }
     else /* use regular append-copy mode */
@@ -666,7 +666,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
       struct Context *f = mx_mbox_open(mbox, MUTT_APPEND);
       if (!f)
       {
-        ctx->closing = false;
+        ctx->mailbox->closing = false;
         return -1;
       }
 
@@ -683,7 +683,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
           else
           {
             mx_mbox_close(&f, NULL);
-            ctx->closing = false;
+            ctx->mailbox->closing = false;
             return -1;
           }
         }
@@ -692,9 +692,9 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
       mx_mbox_close(&f, NULL);
     }
   }
-  else if (!ctx->changed && ctx->deleted == 0)
+  else if (!ctx->mailbox->changed && ctx->deleted == 0)
   {
-    if (!ctx->quiet)
+    if (!ctx->mailbox->quiet)
       mutt_message(_("Mailbox is unchanged"));
     if (ctx->mailbox->magic == MUTT_MBOX || ctx->mailbox->magic == MUTT_MMDF)
       mbox_reset_atime(ctx, NULL);
@@ -708,7 +708,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
   {
     if (trash_append(ctx) != 0)
     {
-      ctx->closing = false;
+      ctx->mailbox->closing = false;
       return -1;
     }
   }
@@ -720,7 +720,7 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
     int check = imap_sync_mailbox(ctx, (purge != MUTT_NO));
     if (check != 0)
     {
-      ctx->closing = false;
+      ctx->mailbox->closing = false;
       return check;
     }
   }
@@ -737,18 +737,18 @@ int mx_mbox_close(struct Context **pctx, int *index_hint)
       ctx->deleted = 0;
     }
 
-    if (ctx->changed || ctx->deleted)
+    if (ctx->mailbox->changed || ctx->deleted)
     {
       int check = sync_mailbox(ctx, index_hint);
       if (check != 0)
       {
-        ctx->closing = false;
+        ctx->mailbox->closing = false;
         return check;
       }
     }
   }
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     if (move_messages)
     {
@@ -807,7 +807,7 @@ void mx_update_tables(struct Context *ctx, bool committing)
   ctx->deleted = 0;
   ctx->new = 0;
   ctx->mailbox->msg_unread = 0;
-  ctx->changed = false;
+  ctx->mailbox->changed = false;
   ctx->mailbox->msg_flagged = 0;
   padding = mx_msg_padding_size(ctx);
   for (i = 0, j = 0; i < ctx->mailbox->msg_count; i++)
@@ -834,7 +834,7 @@ void mx_update_tables(struct Context *ctx, bool committing)
       if (committing)
         ctx->mailbox->hdrs[j]->changed = false;
       else if (ctx->mailbox->hdrs[j]->changed)
-        ctx->changed = true;
+        ctx->mailbox->changed = true;
 
       if (!committing || (ctx->mailbox->magic == MUTT_MAILDIR && MaildirTrash))
       {
@@ -859,9 +859,9 @@ void mx_update_tables(struct Context *ctx, bool committing)
     {
       if (ctx->mailbox->magic == MUTT_MH || ctx->mailbox->magic == MUTT_MAILDIR)
       {
-        ctx->size -= (ctx->mailbox->hdrs[i]->content->length +
-                      ctx->mailbox->hdrs[i]->content->offset -
-                      ctx->mailbox->hdrs[i]->content->hdr_offset);
+        ctx->mailbox->size -= (ctx->mailbox->hdrs[i]->content->length +
+                               ctx->mailbox->hdrs[i]->content->offset -
+                               ctx->mailbox->hdrs[i]->content->hdr_offset);
       }
       /* remove message from the hash tables */
       if (ctx->subj_hash && ctx->mailbox->hdrs[i]->env->real_subj)
@@ -908,15 +908,15 @@ int mx_mbox_sync(struct Context *ctx, int *index_hint)
     mutt_error(_("Mailbox is marked unwritable. %s"), tmp);
     return -1;
   }
-  else if (ctx->readonly)
+  else if (ctx->mailbox->readonly)
   {
     mutt_error(_("Mailbox is read-only"));
     return -1;
   }
 
-  if (!ctx->changed && !ctx->deleted)
+  if (!ctx->mailbox->changed && !ctx->deleted)
   {
-    if (!ctx->quiet)
+    if (!ctx->mailbox->quiet)
       mutt_message(_("Mailbox is unchanged"));
     return 0;
   }
@@ -933,7 +933,7 @@ int mx_mbox_sync(struct Context *ctx, int *index_hint)
       return -1;
     else if (purge == MUTT_NO)
     {
-      if (!ctx->changed)
+      if (!ctx->mailbox->changed)
         return 0; /* nothing to do! */
       /* let IMAP servers hold on to D flags */
       if (ctx->mailbox->magic != MUTT_IMAP)
@@ -972,13 +972,13 @@ int mx_mbox_sync(struct Context *ctx, int *index_hint)
 #ifdef USE_IMAP
     if (ctx->mailbox->magic == MUTT_IMAP && !purge)
     {
-      if (!ctx->quiet)
+      if (!ctx->mailbox->quiet)
         mutt_message(_("Mailbox checkpointed"));
     }
     else
 #endif
     {
-      if (!ctx->quiet)
+      if (!ctx->mailbox->quiet)
         mutt_message(_("%d kept, %d deleted"), msgcount - deleted, deleted);
     }
 
@@ -1259,7 +1259,7 @@ void mx_update_context(struct Context *ctx, int new_messages)
       mutt_score_message(ctx, h, false);
 
     if (h->changed)
-      ctx->changed = true;
+      ctx->mailbox->changed = true;
     if (h->flagged)
       ctx->mailbox->msg_flagged++;
     if (h->deleted)
index 93e20e1ea9e3447cfcefa53488a6c07c6801190f..725e65e652763566e9ce93278e1f2b61f03817e7 100644 (file)
@@ -1148,7 +1148,7 @@ static int parse_overview_line(char *line, void *data)
   if (!fc->messages[anum - fc->first])
   {
     /* progress */
-    if (!ctx->quiet)
+    if (!ctx->mailbox->quiet)
       mutt_progress_update(&fc->progress, anum - fc->first + 1, -1);
     return 0;
   }
@@ -1259,7 +1259,7 @@ static int parse_overview_line(char *line, void *data)
     mutt_header_free(&hdr);
 
   /* progress */
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
     mutt_progress_update(&fc->progress, anum - fc->first + 1, -1);
   return 0;
 }
@@ -1308,7 +1308,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
   /* fetch list of articles */
   if (NntpListgroup && nntp_data->nserv->hasLISTGROUP && !nntp_data->deleted)
   {
-    if (!ctx->quiet)
+    if (!ctx->mailbox->quiet)
       mutt_message(_("Fetching list of articles..."));
     if (nntp_data->nserv->hasLISTGROUPrange)
       snprintf(buf, sizeof(buf), "LISTGROUP %s %u-%u\r\n", nntp_data->group, first, last);
@@ -1350,14 +1350,14 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
   }
 
   /* fetching header from cache or server, or fallback to fetch overview */
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     mutt_progress_init(&fc.progress, _("Fetching message headers..."),
                        MUTT_PROGRESS_MSG, ReadInc, last - first + 1);
   }
   for (current = first; current <= last && rc == 0; current++)
   {
-    if (!ctx->quiet)
+    if (!ctx->mailbox->quiet)
       mutt_progress_update(&fc.progress, current - first + 1, -1);
 
 #ifdef USE_HCACHE
@@ -1548,7 +1548,7 @@ static int nntp_mbox_open(struct Context *ctx)
 
   mutt_bit_unset(ctx->rights, MUTT_ACL_INSERT);
   if (!nntp_data->newsrc_ent && !nntp_data->subscribed && !SaveUnsubscribed)
-    ctx->readonly = true;
+    ctx->mailbox->readonly = true;
 
   /* select newsgroup */
   mutt_message(_("Selecting %s..."), group);
@@ -2083,7 +2083,7 @@ static int check_mailbox(struct Context *ctx)
     ctx->new = 0;
     ctx->mailbox->msg_unread = 0;
     ctx->mailbox->msg_flagged = 0;
-    ctx->changed = false;
+    ctx->mailbox->changed = false;
     ctx->id_hash = NULL;
     ctx->subj_hash = NULL;
     mx_update_context(ctx, ctx->mailbox->msg_count);
@@ -2093,8 +2093,8 @@ static int check_mailbox(struct Context *ctx)
   if (nntp_data->last_message > nntp_data->last_loaded)
   {
     int oldmsgcount = ctx->mailbox->msg_count;
-    bool quiet = ctx->quiet;
-    ctx->quiet = true;
+    bool quiet = ctx->mailbox->quiet;
+    ctx->mailbox->quiet = true;
 #ifdef USE_HCACHE
     if (!hc)
     {
@@ -2103,7 +2103,7 @@ static int check_mailbox(struct Context *ctx)
     }
 #endif
     rc = nntp_fetch_headers(ctx, hc, nntp_data->last_loaded + 1, nntp_data->last_message, 0);
-    ctx->quiet = quiet;
+    ctx->mailbox->quiet = quiet;
     if (rc >= 0)
       nntp_data->last_loaded = nntp_data->last_message;
     if (ret == 0 && ctx->mailbox->msg_count > oldmsgcount)
@@ -2592,8 +2592,8 @@ int nntp_check_children(struct Context *ctx, const char *msgid)
   }
 
   /* fetch all found messages */
-  quiet = ctx->quiet;
-  ctx->quiet = true;
+  quiet = ctx->mailbox->quiet;
+  ctx->mailbox->quiet = true;
 #ifdef USE_HCACHE
   hc = nntp_hcache_open(nntp_data);
 #endif
@@ -2606,7 +2606,7 @@ int nntp_check_children(struct Context *ctx, const char *msgid)
 #ifdef USE_HCACHE
   mutt_hcache_close(hc);
 #endif
-  ctx->quiet = quiet;
+  ctx->mailbox->quiet = quiet;
   FREE(&cc.child);
   return (rc < 0) ? -1 : 0;
 }
index c888248eba2d19b255004d933f7c19515384dc9a..8670ae735a33684d5e56f486797580a3d7204360 100644 (file)
@@ -1028,7 +1028,7 @@ static void progress_reset(struct Context *ctx)
 {
   struct NmCtxData *data = NULL;
 
-  if (ctx->quiet)
+  if (ctx->mailbox->quiet)
     return;
 
   data = get_ctxdata(ctx);
@@ -1051,7 +1051,7 @@ static void progress_update(struct Context *ctx, notmuch_query_t *q)
 {
   struct NmCtxData *data = get_ctxdata(ctx);
 
-  if (ctx->quiet || !data || data->noprogress)
+  if (ctx->mailbox->quiet || !data || data->noprogress)
     return;
 
   if (!data->progress_ready && q)
@@ -1194,7 +1194,7 @@ static void append_message(struct Context *ctx, notmuch_query_t *q,
 
   h->active = true;
   h->index = ctx->mailbox->msg_count;
-  ctx->size += h->content->length + h->content->offset - h->content->hdr_offset;
+  ctx->mailbox->size += h->content->length + h->content->offset - h->content->hdr_offset;
   ctx->mailbox->hdrs[ctx->mailbox->msg_count] = h;
   ctx->mailbox->msg_count++;
 
@@ -2659,7 +2659,7 @@ static int nm_mbox_sync(struct Context *ctx, int *index_hint)
 
   mutt_debug(1, "nm: sync start ...\n");
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     /* all is in this function so we don't use data->progress here */
     char msgbuf[PATH_MAX + 64];
@@ -2674,7 +2674,7 @@ static int nm_mbox_sync(struct Context *ctx, int *index_hint)
     struct Header *h = ctx->mailbox->hdrs[i];
     struct NmHdrData *hd = h->data;
 
-    if (!ctx->quiet)
+    if (!ctx->mailbox->quiet)
       mutt_progress_update(&progress, i, -1);
 
     *old = '\0';
diff --git a/pager.c b/pager.c
index f66eb65a3351c479b8e51f6e682ce862c4137b1b..50083655cd9dd24e8bdd61972b1e01021330751d 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -112,7 +112,7 @@ static struct Header *OldHdr = NULL;
   }
 
 #define CHECK_READONLY                                                         \
-  if (!Context || Context->readonly)                                           \
+  if (!Context || Context->mailbox->readonly)                                  \
   {                                                                            \
     mutt_flushinp();                                                           \
     mutt_error(_(Mailbox_is_read_only));                                       \
@@ -2378,10 +2378,10 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
                 MIN(rd.index->current, (Context->mailbox->msg_count - 1));
             index_hint = Context->mailbox->hdrs[Context->v2r[rd.index->current]]->index;
 
-            bool q = Context->quiet;
-            Context->quiet = true;
+            bool q = Context->mailbox->quiet;
+            Context->mailbox->quiet = true;
             update_index(rd.index, Context, check, oldcount, index_hint);
-            Context->quiet = q;
+            Context->mailbox->quiet = q;
 
             rd.index->max = Context->vcount;
 
@@ -3354,7 +3354,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
         CHECK_MODE(IsHeader(extra));
         mutt_view_attachments(extra->hdr);
         if (Context && extra->hdr->attach_del)
-          Context->changed = true;
+          Context->mailbox->changed = true;
         pager_menu->redraw = REDRAW_FULL;
         break;
 
@@ -3375,7 +3375,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
         rc = mutt_label_message(extra->hdr);
         if (rc > 0)
         {
-          Context->changed = true;
+          Context->mailbox->changed = true;
           pager_menu->redraw = REDRAW_FULL;
           mutt_message(ngettext("%d label changed", "%d labels changed", rc), rc);
         }
index 32a9652a8552bf186506ab741390aade9034f3a0..f59e95278ee8d44c634af9e3e371e836106f4bde 100644 (file)
--- a/pop/pop.c
+++ b/pop/pop.c
@@ -351,7 +351,7 @@ static int pop_fetch_headers(struct Context *ctx)
     }
   }
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
   {
     mutt_progress_init(&progress, _("Fetching message headers..."),
                        MUTT_PROGRESS_MSG, ReadInc, new_count - old_count);
@@ -379,7 +379,7 @@ static int pop_fetch_headers(struct Context *ctx)
     bool hcached = false;
     for (i = old_count; i < new_count; i++)
     {
-      if (!ctx->quiet)
+      if (!ctx->mailbox->quiet)
         mutt_progress_update(&progress, i + 1 - old_count, -1);
 #ifdef USE_HCACHE
       void *data = mutt_hcache_fetch(hc, ctx->mailbox->hdrs[i]->data,
@@ -532,7 +532,7 @@ static int pop_mbox_open(struct Context *ctx)
     if (pop_reconnect(ctx) < 0)
       return -1;
 
-    ctx->size = pop_data->size;
+    ctx->mailbox->size = pop_data->size;
 
     mutt_message(_("Fetching list of messages..."));
 
@@ -799,7 +799,7 @@ static int pop_mbox_sync(struct Context *ctx, int *index_hint)
       if (ctx->mailbox->hdrs[i]->deleted && ctx->mailbox->hdrs[i]->refno != -1)
       {
         j++;
-        if (!ctx->quiet)
+        if (!ctx->mailbox->quiet)
           mutt_progress_update(&progress, j, -1);
         snprintf(buf, sizeof(buf), "DELE %d\r\n", ctx->mailbox->hdrs[i]->refno);
         ret = pop_query(pop_data, buf, sizeof(buf));
@@ -870,7 +870,7 @@ static int pop_mbox_check(struct Context *ctx, int *index_hint)
   if (pop_open_connection(pop_data) < 0)
     return -1;
 
-  ctx->size = pop_data->size;
+  ctx->mailbox->size = pop_data->size;
 
   mutt_message(_("Checking for new messages..."));
 
index 47179a49955b39e15dc78ee73ee18c6ef194e932..3dc040325d109efd86a1d6e34a4a7bcb048cbfb5 100644 (file)
@@ -429,7 +429,7 @@ void pop_logout(struct Context *ctx)
     char buf[LONG_STRING];
     mutt_message(_("Closing connection to POP server..."));
 
-    if (ctx->readonly)
+    if (ctx->mailbox->readonly)
     {
       mutt_str_strfcpy(buf, "RSET\r\n", sizeof(buf));
       ret = pop_query(pop_data, buf, sizeof(buf));
index 00c33695133429574921abef392b3c2b33a3d332..c901e8046b19ec22834b1b0173e52793f0266cb0 100644 (file)
@@ -74,7 +74,7 @@ static void mutt_update_recvattach_menu(struct AttachCtx *actx, struct Menu *men
 static const char *Mailbox_is_read_only = N_("Mailbox is read-only");
 
 #define CHECK_READONLY                                                         \
-  if (Context->readonly)                                                       \
+  if (Context->mailbox->readonly)                                              \
   {                                                                            \
     mutt_flushinp();                                                           \
     mutt_error(_(Mailbox_is_read_only));                                       \
diff --git a/sort.c b/sort.c
index 082fd34aa2027ddf989afba246392f5cbca59a15..fb8d9eff6895ba11a289aac86123ac1a7573c3b3 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -372,7 +372,7 @@ void mutt_sort_headers(struct Context *ctx, bool init)
     return; /* nothing to do! */
   }
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
     mutt_message(_("Sorting mailbox..."));
 
   if (OptNeedRescore && Score)
@@ -447,6 +447,6 @@ void mutt_sort_headers(struct Context *ctx, bool init)
     mutt_set_virtual(ctx);
   }
 
-  if (!ctx->quiet)
+  if (!ctx->mailbox->quiet)
     mutt_clear_error();
 }
index 99cb65eda42e35711e26c14d00653122995da900..6360a12209ae54e1a499660d8331a1d04f70f636 100644 (file)
--- a/status.c
+++ b/status.c
@@ -169,10 +169,10 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c
       if (!optional)
       {
         snprintf(fmt, sizeof(fmt), "%%%ss", prec);
-        mutt_str_pretty_size(tmp, sizeof(tmp), Context ? Context->size : 0);
+        mutt_str_pretty_size(tmp, sizeof(tmp), Context ? Context->mailbox->size : 0);
         snprintf(buf, buflen, fmt, tmp);
       }
-      else if (!Context || !Context->size)
+      else if (!Context || !Context->mailbox->size)
         optional = 0;
       break;
 
@@ -268,9 +268,9 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c
       {
         i = OptAttachMsg ?
                 3 :
-                ((Context->readonly || Context->dontwrite) ?
+                ((Context->mailbox->readonly || Context->dontwrite) ?
                      2 :
-                     (Context->changed ||
+                     (Context->mailbox->changed ||
                       /* deleted doesn't necessarily mean changed in IMAP */
                       (Context->mailbox->magic != MUTT_IMAP && Context->deleted)) ?
                      1 :