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
.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,
};
int mx_access (const char*, int);
int mx_check_empty (const char *);
+int mx_msg_padding_size (CONTEXT *);
int mx_is_maildir (const char *);
int mx_is_mh (const char *);
return ((st.st_size == 0));
}
+static int mbox_msg_padding_size (CONTEXT *ctx)
+{
+ return 1;
+}
+
+static int mmdf_msg_padding_size (CONTEXT *ctx)
+{
+ return 10;
+}
+
struct mx_ops mx_mbox_ops = {
.open = mbox_open_mailbox,
.open_append = mbox_open_mailbox_append,
.open_new_msg = mbox_open_new_message,
.check = mbox_check_mailbox,
.sync = mbox_sync_mailbox,
+ .msg_padding_size = mbox_msg_padding_size,
};
struct mx_ops mx_mmdf_ops = {
.open_new_msg = mbox_open_new_message,
.check = mbox_check_mailbox,
.sync = mbox_sync_mailbox,
+ .msg_padding_size = mmdf_msg_padding_size,
};
int (*close_msg) (struct _context *, struct _message *);
int (*commit_msg) (struct _context *, struct _message *);
int (*open_new_msg) (struct _message *, struct _context *, HEADER *);
+ int (*msg_padding_size) (struct _context *);
};
typedef struct _context
/* not reached */
}
+/* mx_msg_padding_size: Returns the padding size between messages for the
+ * mailbox type pointed to by ctx.
+ *
+ * mmdf and mbox add separators, which leads a small discrepancy when computing
+ * vsize for a limited view.
+ */
+int mx_msg_padding_size (CONTEXT *ctx)
+{
+ if (!ctx->mx_ops || !ctx->mx_ops->msg_padding_size)
+ return 0;
+
+ return ctx->mx_ops->msg_padding_size (ctx);
+}
+
/* vim: set sw=2: */