diff options
author | Kevin McCarthy <kevin@8t8.us> | 2018-07-25 17:52:40 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2018-07-25 18:21:40 -0700 |
commit | 9806d24984eeb09d249d25a8654626c713edb180 (patch) | |
tree | 99b62beb037ac2d32d72705e202fcffe9a6a935f /compress.c | |
parent | 7b99841610124b2985b4828104f4dd303b5851b9 (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.c | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -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, }; |