83 { NULL, NULL, 0, -1, NULL }
296 if (!m || !exp || !progress)
311 sys_cmd->
dsize, sys_cmd);
391 return strstr(cmd,
"%f") && strstr(cmd,
"%t");
446 mutt_error(
_(
"Can't identify the contents of the compressed file"));
485 mutt_error(
_(
"Can't append without an append-hook or close-hook : %s"),
519 mutt_error(
_(
"Unsupported mailbox type for appending"));
567 if (size == ci->
size)
600 mutt_error(
_(
"Can't sync a compressed file without a close-hook"));
661 const struct Expando *append = NULL;
662 const char *msg = NULL;
668 msg =
_(
"Compressed-appending to %s...");
673 msg =
_(
"Compressing %s");
703 m->
realpath, strerror(errno), errno);
867 if (!st || !S_ISREG(st->st_mode))
894 .name =
"compressed",
901 .mbox_check_stats = NULL,
914 .path_is_empty = NULL,
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
static struct CompressInfo * set_compress_info(struct Mailbox *m)
Find the compress hooks for a mailbox.
static void compress_info_free(struct Mailbox *m)
Frees the compress info members and structure.
static int setup_paths(struct Mailbox *m)
Set the mailbox paths.
const struct ExpandoDefinition CompressFormatDef[]
Expando definitions.
void mutt_comp_init(void)
Setup feature commands.
static void store_size(const struct Mailbox *m)
Save the size of the compressed file.
static bool lock_realpath(struct Mailbox *m, bool excl)
Try to lock the Mailbox.realpath.
bool mutt_comp_can_append(struct Mailbox *m)
Can we append to this path?
static void unlock_realpath(struct Mailbox *m)
Unlock the mailbox->realpath.
static const struct Command CompCommands[]
Compression Commands.
int mutt_comp_valid_command(const char *cmd)
Is this command string allowed?
static bool execute_command(struct Mailbox *m, const struct Expando *exp, const char *progress)
Run a system command.
static struct Expando * validate_compress_expando(const char *s)
Validate the Compress hooks.
bool mutt_comp_can_read(const char *path)
Can we read from this file?
const struct ExpandoRenderCallback CompressRenderCallbacks[]
Callbacks for Compression Hook Expandos.
unsigned char cs_subset_enum(const struct ConfigSubset *sub, const char *name)
Get a enumeration config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
char * HomeDir
User's home directory.
void commands_register(const struct Command *cmds, const size_t num_cmds)
Add commands to Commands array.
Convenience wrapper for the core headers.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
MailboxType
Supported mailbox formats.
@ MUTT_MMDF
'mmdf' Mailbox type
@ MUTT_MBOX
'mbox' Mailbox type
@ MUTT_COMPRESSED
Compressed file Mailbox type.
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
void mutt_endwin(void)
Shutdown curses.
@ ED_COMPRESS
Compress ED_CMP_ ExpandoDataCompress.
struct Expando * expando_parse(const char *str, const struct ExpandoDefinition *defs, struct Buffer *err)
Parse an Expando string.
void expando_free(struct Expando **ptr)
Free an Expando object.
int expando_render(const struct Expando *exp, const struct ExpandoRenderCallback *erc, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando + data into a string.
int mutt_file_lock(int fd, bool excl, bool timeout)
(Try to) Lock a file using fcntl()
int mutt_file_unlock(int fd)
Unlock a file previously locked by mutt_file_lock()
long mutt_file_get_size(const char *path)
Get the size of a file.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
enum CommandResult mutt_parse_hook(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'hook' family of commands - Implements Command::parse() -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
static bool comp_ac_add(struct Account *a, struct Mailbox *m)
Add a Mailbox to an Account - Implements MxOps::ac_add() -.
static bool comp_ac_owns_path(struct Account *a, const char *path)
Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -.
const struct MxOps MxCompOps
Compressed Mailbox - Implements MxOps -.
static enum MxStatus comp_mbox_check(struct Mailbox *m)
Check for new mail - Implements MxOps::mbox_check() -.
static enum MxStatus comp_mbox_close(struct Mailbox *m)
Close a Mailbox - Implements MxOps::mbox_close() -.
static bool comp_mbox_open_append(struct Mailbox *m, OpenMailboxFlags flags)
Open a Mailbox for appending - Implements MxOps::mbox_open_append() -.
static enum MxOpenReturns comp_mbox_open(struct Mailbox *m)
Open a Mailbox - Implements MxOps::mbox_open() -.
static enum MxStatus comp_mbox_sync(struct Mailbox *m)
Save changes to the Mailbox - Implements MxOps::mbox_sync() -.
static int comp_msg_close(struct Mailbox *m, struct Message *msg)
Close an email - Implements MxOps::msg_close() -.
static int comp_msg_commit(struct Mailbox *m, struct Message *msg)
Save changes to an email - Implements MxOps::msg_commit() -.
static bool comp_msg_open_new(struct Mailbox *m, struct Message *msg, const struct Email *e)
Open a new message in a Mailbox - Implements MxOps::msg_open_new() -.
static bool comp_msg_open(struct Mailbox *m, struct Message *msg, struct Email *e)
Open an email message in a Mailbox - Implements MxOps::msg_open() -.
static int comp_msg_padding_size(struct Mailbox *m)
Bytes of padding between messages - Implements MxOps::msg_padding_size() -.
static int comp_msg_save_hcache(struct Mailbox *m, struct Email *e)
Save message to the header cache - Implements MxOps::msg_save_hcache() -.
static int comp_path_canon(struct Buffer *path)
Canonicalise a Mailbox path - Implements MxOps::path_canon() -.
static enum MailboxType comp_path_probe(const char *path, const struct stat *st)
Is this a compressed Mailbox? - Implements MxOps::path_probe() -.
Convenience wrapper for the gui headers.
char * mutt_find_hook(HookFlags type, const char *pat)
Find a matching hook.
Parse and execute user-defined hooks.
#define MUTT_OPEN_HOOK
open-hook: to read a compressed mailbox
#define MUTT_CLOSE_HOOK
close-hook: write to a compressed mailbox
#define MUTT_APPEND_HOOK
append-hook: append to a compressed mailbox
@ LL_DEBUG1
Log at debug level 1.
#define MUTT_MEM_CALLOC(n, type)
#define mutt_array_size(x)
Convenience wrapper for the library headers.
bool mutt_path_canon(struct Buffer *path, const char *homedir, bool is_dir)
Create the canonical version of a path.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
const struct MxOps * mx_get_ops(enum MailboxType type)
Get mailbox operations.
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
uint8_t OpenMailboxFlags
Flags for mutt_open_mailbox(), e.g. MUTT_NOSORT.
MxOpenReturns
Return values for mbox_open()
@ MX_OPEN_ERROR
Open failed with an error.
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_sync(), and mbox_close()
@ MX_STATUS_ERROR
An error occurred.
@ MX_STATUS_OK
No changes.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Prototypes for many functions.
int mutt_system(const char *cmd)
Run an external command.
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
void mutt_sig_block(void)
Block signals during critical operations.
void mutt_sig_unblock(void)
Restore previously blocked signals.
#define STR_COMMAND
Enough space for a long command line.
A group of associated Mailboxes.
enum MailboxType type
Type of Mailboxes this Account contains.
String manipulation buffer.
size_t dsize
Length of data.
Private data for compress.
struct Expando * cmd_open
open-hook command
FILE * fp_lock
fp used for locking
struct Expando * cmd_append
append-hook command
const struct MxOps * child_ops
callbacks of de-compressed file
bool locked
if realpath is locked
long size
size of the compressed file
struct Expando * cmd_close
close-hook command
The envelope/body of an email.
Definition of a format string.
const char * string
Pointer to the parsed string.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
bool append
Mailbox is opened in append mode.
enum MailboxType type
Mailbox type.
struct Buffer pathbuf
Path of the Mailbox.
struct Account * account
Account that owns this Mailbox.
void * compress_info
Compressed mbox module private data.
bool readonly
Don't allow changes to the mailbox.
bool verbose
Display status messages?
A local copy of an email.
bool(* msg_open)(struct Mailbox *m, struct Message *msg, struct Email *e)
int(* tags_commit)(struct Mailbox *m, struct Email *e, const char *buf)
int(* msg_save_hcache)(struct Mailbox *m, struct Email *e)
enum MailboxType type
Mailbox type, e.g. MUTT_IMAP.
int(* msg_padding_size)(struct Mailbox *m)
int(* tags_edit)(struct Mailbox *m, const char *tags, struct Buffer *buf)
int(* msg_commit)(struct Mailbox *m, struct Message *msg)
enum MxOpenReturns(* mbox_open)(struct Mailbox *m)
int(* msg_close)(struct Mailbox *m, struct Message *msg)
bool(* msg_open_new)(struct Mailbox *m, struct Message *msg, const struct Email *e)
enum MxStatus(* mbox_close)(struct Mailbox *m)
enum MxStatus(* mbox_sync)(struct Mailbox *m)
bool(* mbox_open_append)(struct Mailbox *m, OpenMailboxFlags flags)
enum MxStatus(* mbox_check)(struct Mailbox *m)
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.