summaryrefslogtreecommitdiffstats
path: root/commands.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2016-11-13 20:02:33 -0800
committerKevin McCarthy <kevin@8t8.us>2016-11-13 20:02:33 -0800
commit9bf6d74e9cc5a7b6b7a62fdefd6d953d60a422db (patch)
tree52c3e9f8c6c89cc6f79ec27765c3bc5c3b4f4864 /commands.c
parentb17cd67312913bc98269840652bc5c54eba9fc20 (diff)
Compress patch from the neomutt repository.
With the following changes: - po/de.po changes trimmed to just the compress additions. - Move the sample muttrc to contrib, and add it to the Makefile.am so it is distributed. Remove the sample vimrc. - Remove extra fluff from manual. Thanks to Roland Rosenfeld for the original patch, and to the NeoMutt team for their work cleaning up the patch.
Diffstat (limited to 'commands.c')
-rw-r--r--commands.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/commands.c b/commands.c
index 42436231..25b22262 100644
--- a/commands.c
+++ b/commands.c
@@ -837,6 +837,16 @@ int mutt_save_message (HEADER *h, int delete,
if (mx_open_mailbox (buf, MUTT_APPEND, &ctx) != NULL)
{
+#ifdef USE_COMPRESSED
+ /* If we're saving to a compressed mailbox, the stats won't be updated
+ * until the next open. Until then, improvise. */
+ BUFFY *cm = NULL;
+ if (ctx.compress_info)
+ cm = mutt_find_mailbox (ctx.realpath);
+ /* We probably haven't been opened yet */
+ if (cm && (cm->msg_count == 0))
+ cm = NULL;
+#endif
if (h)
{
if (_mutt_save_message(h, &ctx, delete, decode, decrypt) != 0)
@@ -844,6 +854,16 @@ int mutt_save_message (HEADER *h, int delete,
mx_close_mailbox (&ctx, NULL);
return -1;
}
+#ifdef USE_COMPRESSED
+ if (cm)
+ {
+ cm->msg_count++;
+ if (!h->read)
+ cm->msg_unread++;
+ if (h->flagged)
+ cm->msg_flagged++;
+ }
+#endif
}
else
{
@@ -858,6 +878,17 @@ int mutt_save_message (HEADER *h, int delete,
mx_close_mailbox (&ctx, NULL);
return -1;
}
+#ifdef USE_COMPRESSED
+ if (cm)
+ {
+ HEADER *h = Context->hdrs[Context->v2r[i]];
+ cm->msg_count++;
+ if (!h->read)
+ cm->msg_unread++;
+ if (h->flagged)
+ cm->msg_flagged++;
+ }
+#endif
}
}
}