summaryrefslogtreecommitdiffstats
path: root/compress.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2018-07-25 17:52:40 -0700
committerKevin McCarthy <kevin@8t8.us>2018-07-25 18:21:40 -0700
commit9806d24984eeb09d249d25a8654626c713edb180 (patch)
tree99b62beb037ac2d32d72705e202fcffe9a6a935f /compress.c
parent7b99841610124b2985b4828104f4dd303b5851b9 (diff)
Add mx_ops.msg_padding_size to return the padding for a mx type.
Mbox pads with a 1 byte, while mmdf pads with 10. Because compress depends on the child type, we create a mx_ops, which allows compress.c to delegate to the child ops.
Diffstat (limited to 'compress.c')
-rw-r--r--compress.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/compress.c b/compress.c
index 68a54b7a..a09295d8 100644
--- a/compress.c
+++ b/compress.c
@@ -939,6 +939,29 @@ mutt_comp_valid_command (const char *cmd)
return (strstr (cmd, "%f") && strstr (cmd, "%t"));
}
+/**
+ * compress_msg_padding_size - Returns the padding between messages.
+ */
+static int
+compress_msg_padding_size (CONTEXT *ctx)
+{
+ COMPRESS_INFO *ci;
+ struct mx_ops *ops;
+
+ if (!ctx)
+ return 0;
+
+ ci = ctx->compress_info;
+ if (!ci)
+ return 0;
+
+ ops = ci->child_ops;
+ if (!ops || !ops->msg_padding_size)
+ return 0;
+
+ return ops->msg_padding_size (ctx);
+}
+
/**
* mx_comp_ops - Mailbox callback functions
@@ -956,6 +979,7 @@ struct mx_ops mx_comp_ops =
.open_msg = open_message,
.close_msg = close_message,
.commit_msg = commit_message,
- .open_new_msg = open_new_message
+ .open_new_msg = open_new_message,
+ .msg_padding_size = compress_msg_padding_size,
};