From: Richard Russon Date: Thu, 18 Oct 2018 20:46:08 +0000 (+0100) Subject: Compress: add Account X-Git-Tag: 2019-10-25~593^2~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=829c5c7b1c1d1183fe2cba7f9c76ef81a93fc614;p=neomutt Compress: add Account --- diff --git a/compress.c b/compress.c index d7d1d0b8e..80f77bb2f 100644 --- a/compress.c +++ b/compress.c @@ -4,7 +4,7 @@ * * @authors * Copyright (C) 1997 Alain Penders - * Copyright (C) 2016 Richard Russon + * Copyright (C) 2016-2018 Richard Russon * * @copyright * This program is free software: you can redistribute it and/or modify it under @@ -42,6 +42,7 @@ #include "mutt/mutt.h" #include "config/lib.h" #include "compress.h" +#include "account.h" #include "context.h" #include "curs_lib.h" #include "format_flags.h" @@ -465,6 +466,33 @@ int mutt_comp_valid_command(const char *cmd) return strstr(cmd, "%f") && strstr(cmd, "%t"); } +/** + * comp_ac_find - Find a Account that matches a Mailbox path + */ +struct Account *comp_ac_find(struct Account *a, const char *path) +{ + return NULL; +} + +/** + * comp_ac_add - Add a Mailbox to a Account + */ +int comp_ac_add(struct Account *a, struct Mailbox *m) +{ + if (!a || !m) + return -1; + + if (m->magic != MUTT_COMPRESSED) + return -1; + + m->account = a; + + struct MailboxNode *np = mutt_mem_calloc(1, sizeof(*np)); + np->m = m; + STAILQ_INSERT_TAIL(&a->mailboxes, np, entries); + return 0; +} + /** * comp_mbox_open - Implements MxOps::mbox_open() * @@ -1001,6 +1029,8 @@ int comp_path_parent(char *buf, size_t buflen) struct MxOps mx_comp_ops = { .magic = MUTT_COMPRESSED, .name = "compressed", + .ac_find = comp_ac_find, + .ac_add = comp_ac_add, .mbox_open = comp_mbox_open, .mbox_open_append = comp_mbox_open_append, .mbox_check = comp_mbox_check,