NeoMutt  2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
lib.h File Reference

Compressed mbox local mailbox type. More...

#include <stdbool.h>
#include <stdio.h>
Include dependency graph for lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CompressInfo
 Private data for compress. More...

Enumerations

enum  ExpandoDataCompress { ED_CMP_FROM = 1 , ED_CMP_TO }
 Expando UIDs for Compression. More...

Functions

bool mutt_comp_can_append (struct Mailbox *m)
 Can we append to this path?
bool mutt_comp_can_read (const char *path)
 Can we read from this file?

Variables

const struct MxOps MxCompOps
 Compressed Mailbox - Implements MxOps -.

Detailed Description

Compressed mbox local mailbox type.

Authors
  • Richard Russon
  • Tóth János

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file lib.h.

Enumeration Type Documentation

◆ ExpandoDataCompress

Expando UIDs for Compression.

See also
ED_COMPRESS, ExpandoDomain
Enumerator
ED_CMP_FROM 

'from' path

ED_CMP_TO 

'to' path

Definition at line 49 of file lib.h.

50{
51 ED_CMP_FROM = 1,
52 ED_CMP_TO,
53};
@ ED_CMP_FROM
'from' path
Definition lib.h:51
@ ED_CMP_TO
'to' path
Definition lib.h:52

Function Documentation

◆ mutt_comp_can_append()

bool mutt_comp_can_append ( struct Mailbox * m)

Can we append to this path?

Parameters
mMailbox
Return values
trueYes, we can append to the file
falseNo, appending isn't possible

To append to a file we can either use an 'append-hook' or a combination of 'open-hook' and 'close-hook'.

A match means it's our responsibility to append to the file.

Definition at line 313 of file compress.c.

314{
315 if (!m)
316 return false;
317
318 /* If this succeeds, we know there's an open-hook */
319 struct CompressInfo *ci = set_compress_info(m);
320 if (!ci)
321 return false;
322
323 /* We have an open-hook, so to append we need an append-hook,
324 * or a close-hook. */
325 if (ci->cmd_append || ci->cmd_close)
326 return true;
327
328 mutt_error(_("Can't append without an append-hook or close-hook : %s"), mailbox_path(m));
329 return false;
330}
static struct CompressInfo * set_compress_info(struct Mailbox *m)
Find the compress hooks for a mailbox.
Definition compress.c:220
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition mailbox.h:216
#define mutt_error(...)
Definition logging2.h:94
#define _(a)
Definition message.h:28
Private data for compress.
Definition lib.h:62
const struct Expando * cmd_close
close-hook command
Definition lib.h:64
const struct Expando * cmd_append
append-hook command
Definition lib.h:63
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mutt_comp_can_read()

bool mutt_comp_can_read ( const char * path)

Can we read from this file?

Parameters
pathPathname of file to be tested
Return values
trueYes, we can read the file
falseNo, we can't read the file

Search for an 'open-hook' with a regex that matches the path.

A match means it's our responsibility to open the file.

Definition at line 342 of file compress.c.

343{
344 if (!path)
345 return false;
346
347 if (mutt_find_hook(CMD_OPEN_HOOK, path))
348 return true;
349
350 return false;
351}
@ CMD_OPEN_HOOK
:open-hook
Definition command.h:103
struct Hook * mutt_find_hook(enum CommandId id, const char *pat)
Find a matching hook.
Definition exec.c:115
Here is the call graph for this function:
Here is the caller graph for this function: