NeoMutt  2024-11-14-138-ge5ca67
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
expando.c
Go to the documentation of this file.
1
29#include <stdbool.h>
30#include <stdio.h>
31#include "mutt/lib.h"
32#include "core/lib.h"
33#include "expando.h"
34#include "lib.h"
35#include "expando/lib.h"
36
40static void compress_from(const struct ExpandoNode *node, void *data,
41 MuttFormatFlags flags, struct Buffer *buf)
42{
43 const struct Mailbox *m = data;
44
45 struct Buffer *quoted = buf_pool_get();
46 buf_quote_filename(quoted, m->realpath, false);
47 buf_copy(buf, quoted);
48 buf_pool_release(&quoted);
49}
50
54static void compress_to(const struct ExpandoNode *node, void *data,
55 MuttFormatFlags flags, struct Buffer *buf)
56{
57 const struct Mailbox *m = data;
58
59 struct Buffer *quoted = buf_pool_get();
60 buf_quote_filename(quoted, mailbox_path(m), false);
61 buf_copy(buf, quoted);
62 buf_pool_release(&quoted);
63}
64
71 // clang-format off
74 { -1, -1, NULL, NULL },
75 // clang-format on
76};
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:601
const struct ExpandoRenderCallback CompressRenderCallbacks[]
Callbacks for Compression Hook Expandos.
Definition: expando.c:70
@ ED_CMP_FROM
'from' path
Definition: lib.h:50
@ ED_CMP_TO
'to' path
Definition: lib.h:51
Convenience wrapper for the core headers.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:223
@ ED_COMPRESS
Compress ED_CMP_ ExpandoDataCompress.
Definition: domain.h:40
Parse Expando string.
void buf_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell's quoting rules.
Definition: file.c:933
static void compress_from(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Compress: From filename - Implements get_string_t -.
Definition: expando.c:40
static void compress_to(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Compress: To filename - Implements get_string_t -.
Definition: expando.c:54
Convenience wrapper for the library headers.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:82
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:96
uint8_t MuttFormatFlags
Flags for expando_render(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: render.h:32
Sidebar Expando definitions.
Key value store.
String manipulation buffer.
Definition: buffer.h:36
char * data
Pointer to data.
Definition: buffer.h:37
Basic Expando Node.
Definition: node.h:67
A mailbox.
Definition: mailbox.h:79
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:81