1 /**
2  * @file
3  * Container for Accounts, Notifications
4  *
5  * @authors
6  * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
7  *
8  * @copyright
9  * This program is free software: you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License as published by the Free Software
11  * Foundation, either version 2 of the License, or (at your option) any later
12  * version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License along with
20  * this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef MUTT_CORE_NEOMUTT_H
24 #define MUTT_CORE_NEOMUTT_H
25 
26 #include <stddef.h>
27 #include <stdbool.h>
28 #include "account.h"
29 #include "mailbox.h"
30 
31 struct ConfigSet;
32 
33 /**
34  * struct NeoMutt - Container for Accounts, Notifications
35  */
36 struct NeoMutt
37 {
38   struct Notify *notify;       ///< Notifications handler
39   struct ConfigSubset *sub;    ///< Inherited config items
40   struct AccountList accounts; ///< List of all Accounts
41 };
42 
43 extern struct NeoMutt *NeoMutt;
44 
45 /**
46  * enum NotifyGlobal - Events not associated with an object
47  */
48 enum NotifyGlobal
49 {
50   NT_GLOBAL_STARTUP = 1, ///< NeoMutt is initialised
51   NT_GLOBAL_SHUTDOWN,    ///< NeoMutt is about to close
52   NT_GLOBAL_TIMEOUT,     ///< A timer has elapsed
53 };
54 
55 bool            neomutt_account_add   (struct NeoMutt *n, struct Account *a);
56 bool            neomutt_account_remove(struct NeoMutt *n, struct Account *a);
57 void            neomutt_free          (struct NeoMutt **ptr);
58 struct NeoMutt *neomutt_new           (struct ConfigSet *cs);
59 
60 void   neomutt_mailboxlist_clear  (struct MailboxList *ml);
61 size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type);
62 
63 #endif /* MUTT_CORE_NEOMUTT_H */
64