###############################################################################
# neomutt
NEOMUTT= neomutt$(EXEEXT)
-NEOMUTTOBJS= account.o addrbook.o alias.o bcache.o browser.o color.o commands.o \
+NEOMUTTOBJS= addrbook.o alias.o bcache.o browser.o color.o commands.o \
complete.o compose.o compress.o conststrings.o context.o copy.o \
curs_lib.o edit.o editmsg.o enriched.o enter.o \
filter.o flags.o git_ver.o handler.o hdrline.o help.o hook.o \
- index.o init.o keymap.o mailbox.o main.o menu.o muttlib.o \
+ index.o init.o keymap.o main.o menu.o muttlib.o \
mutt_account.o mutt_attach.o mutt_body.o mutt_header.o \
mutt_history.o mutt_logging.o mutt_mailbox.o mutt_parse.o mutt_signal.o \
mutt_socket.o mutt_thread.o mutt_window.o mx.o myvar.o \
- neomutt.o pager.o pattern.o postpone.o progress.o query.o recvattach.o \
+ pager.o pattern.o postpone.o progress.o query.o recvattach.o \
recvcmd.o resize.o rfc1524.o rfc3676.o \
score.o send.o sendlib.o sidebar.o smtp.o sort.o state.o \
status.o system.o terminal.o version.o icommands.o
CLEANFILES+= $(PGPEWRAP) $(PGPEWRAPOBJS)
ALLOBJS+= $(PGPEWRAPOBJS)
+###############################################################################
+# libcore
+LIBCORE= libcore.a
+LIBCOREOBJS= core/account.o core/mailbox.o core/neomutt.o
+
+CLEANFILES+= $(LIBCORE) $(LIBCOREOBJS)
+MUTTLIBS+= $(LIBCORE)
+ALLOBJS+= $(LIBCOREOBJS)
+
###############################################################################
# libconfig
LIBCONFIG= libconfig.a
$(PWD)/conn:
$(MKDIR_P) $(PWD)/conn
+# libcore
+$(LIBCORE): $(PWD)/core $(LIBCOREOBJS)
+ $(AR) cr $@ $(LIBCOREOBJS)
+ $(RANLIB) $@
+$(PWD)/core:
+ $(MKDIR_P) $(PWD)/core
+
# libconfig
$(LIBCONFIG): $(PWD)/config $(LIBCONFIGOBJS)
$(AR) cr $@ $(LIBCONFIGOBJS)
#include "mutt.h"
#include "browser.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "format_flags.h"
#include "globals.h"
#include "keymap.h"
-#include "mailbox.h"
#include "maildir/lib.h"
#include "mutt_attach.h"
#include "mutt_mailbox.h"
#include "mutt_window.h"
#include "muttlib.h"
#include "mx.h"
-#include "neomutt.h"
#include "opcodes.h"
#include "options.h"
#include "sendlib.h"
#include "mutt.h"
#include "color.h"
#include "context.h"
+#include "core/lib.h"
#include "globals.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_commands.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "alias.h"
#include "context.h"
#include "copy.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "filter.h"
#include "format_flags.h"
#include "hook.h"
#include "icommands.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_logging.h"
#include "mutt_mailbox.h"
struct Mailbox *m_comp = NULL;
if (ctx_save->mailbox->compress_info)
{
- m_comp = mutt_mailbox_find(ctx_save->mailbox->realpath);
+ m_comp = mailbox_find(ctx_save->mailbox->realpath);
}
/* We probably haven't been opened yet */
if (m_comp && (m_comp->msg_count == 0))
#include "browser.h"
#include "commands.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "edit.h"
#include "format_flags.h"
#include "hook.h"
#include "index.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_attach.h"
#include "mutt_curses.h"
#include "mutt_header.h"
#include "mutt/mutt.h"
#include "config/lib.h"
#include "compress.h"
-#include "account.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "format_flags.h"
#include "globals.h"
#include "hook.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "muttlib.h"
#include "mx.h"
if ((m->magic == MUTT_NOTMUCH) || (m->magic == MUTT_MH) ||
(m->magic == MUTT_MAILDIR) || (m->magic == MUTT_IMAP))
{
- mutt_mailbox_size_sub(m, m->emails[i]);
+ mailbox_size_sub(m, m->emails[i]);
}
/* remove message from the hash tables */
if (m->subj_hash && m->emails[i]->env->real_subj)
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
-#include "mailbox.h"
+#include "core/lib.h"
#include "pattern.h"
struct EmailList;
#include "mutt.h"
#include "copy.h"
#include "context.h"
+#include "core/lib.h"
#include "globals.h"
#include "handler.h"
#include "hdrline.h"
-#include "mailbox.h"
#include "mutt_window.h"
#include "muttlib.h"
#include "mx.h"
* A group of associated Mailboxes
* @authors
- * Copyright (C) 2018 Richard Russon <rich@flatcap.org>
+ * Copyright (C) 2018-2019 Richard Russon <rich@flatcap.org>
*
* @copyright
* This program is free software: you can redistribute it and/or modify it under
*/
/**
- * @page account A group of associated Mailboxes
+ * @page core_account A group of associated Mailboxes
*
* A group of associated Mailboxes
*/
#include "config.h"
+#include <stddef.h>
#include "mutt/mutt.h"
+#include "config/lib.h"
#include "account.h"
+#include "mailbox.h"
#include "neomutt.h"
/**
* account_new - Create a new Account
- * @param name Name for the Account
- * @param parent Parent Config Subset
+ * @param name Name for the Account
+ * @param sub Parent Config Subset
* @retval ptr New Account
*/
-struct Account *account_new(const char *name, struct ConfigSubset *parent)
+struct Account *account_new(const char *name, struct ConfigSubset *sub)
{
struct Account *a = mutt_mem_calloc(1, sizeof(struct Account));
+
STAILQ_INIT(&a->mailboxes);
a->notify = notify_new(a, NT_ACCOUNT);
a->name = mutt_str_strdup(name);
- a->sub = cs_subset_new(name, parent);
+ a->sub = cs_subset_new(name, sub);
return a;
}
* @param a Account
* @param m Mailbox to remove
*
- * @note If m is NULL, all the mailboxes will be removed.
+ * @note If m is NULL, all the mailboxes will be removed
*/
bool account_mailbox_remove(struct Account *a, struct Mailbox *m)
{
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MUTT_ACCOUNT_H
-#define MUTT_ACCOUNT_H
+#ifndef MUTT_CORE_ACCOUNT_H
+#define MUTT_CORE_ACCOUNT_H
#include <stdbool.h>
#include "mutt/mutt.h"
-#include "config/lib.h"
#include "mailbox.h"
-struct ConnAccount;
-struct Notify;
+struct ConfigSubset;
/**
* struct Account - A group of associated Mailboxes
struct Account
{
enum MailboxType magic; ///< Type of Mailboxes this Account contains
+ char *name; ///< Name of Account
+ struct ConfigSubset *sub; ///< Inherited config items
struct MailboxList mailboxes; ///< List of Mailboxes
- TAILQ_ENTRY(Account) entries; ///< Linked list of Accounts
struct Notify *notify; ///< Notifications handler
void *adata; ///< Private data (for Mailbox backends)
void (*free_adata)(void **); ///< Callback function to free private data
-
- char *name; ///< Name of Account
- struct ConfigSubset *sub; ///< Inherited config items
+ TAILQ_ENTRY(Account) entries; ///< Linked list of Accounts
};
TAILQ_HEAD(AccountList, Account);
NT_ACCOUNT_REMOVE, ///< An Account is about to be destroyed
};
-void account_free(struct Account **ptr);
-bool account_mailbox_add(struct Account *a, struct Mailbox *m);
+void account_free (struct Account **ptr);
+bool account_mailbox_add (struct Account *a, struct Mailbox *m);
bool account_mailbox_remove(struct Account *a, struct Mailbox *m);
-struct Account *account_new(const char *name, struct ConfigSubset *parent);
+struct Account *account_new (const char *name, struct ConfigSubset *sub);
-#endif /* MUTT_ACCOUNT_H */
+#endif /* MUTT_CORE_ACCOUNT_H */
--- /dev/null
+/**
+ * @file
+ * Convenience wrapper for the core headers
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * 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/>.
+ */
+
+/**
+ * @page core CORE: Backbone objects of NeoMutt
+ *
+ * Backbone objects of NeoMutt
+ *
+ * | File | Description |
+ * | :------------------ | :------------------------- |
+ * | core/account.c | @subpage core_account |
+ * | core/mailbox.c | @subpage core_mailbox |
+ * | core/neomutt.c | @subpage core_neomutt |
+ */
+
+#ifndef MUTT_CORE_LIB_H
+#define MUTT_CORE_LIB_H
+
+#include "account.h"
+#include "mailbox.h"
+#include "neomutt.h"
+
+#endif /* MUTT_CORE_LIB_H */
* @authors
* Copyright (C) 1996-2000,2010,2013 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2016-2017 Kevin J. McCarthy <kevin@8t8.us>
- * Copyright (C) 2018 Richard Russon <rich@flatcap.org>
+ * Copyright (C) 2018-2019 Richard Russon <rich@flatcap.org>
*
* @copyright
* This program is free software: you can redistribute it and/or modify it under
*/
/**
- * @page mailbox Representation of a mailbox
+ * @page core_mailbox Representation of a Mailbox
*
- * Representation of a mailbox
+ * Representation of a Mailbox
*/
#include "config.h"
#include <sys/stat.h>
-#include <utime.h>
+#include "config/lib.h"
#include "email/lib.h"
#include "mailbox.h"
-#include "globals.h"
-#include "maildir/lib.h"
#include "neomutt.h"
/**
* mailbox_new - Create a new Mailbox
+ * @param name Name for the Mailbox
* @retval ptr New Mailbox
*/
struct Mailbox *mailbox_new(void)
return;
struct Mailbox *m = *ptr;
- mutt_mailbox_changed(m, MBN_CLOSED);
+ mailbox_changed(m, MBN_CLOSED);
notify_free(&m->notify);
mutt_buffer_free(&m->pathbuf);
}
/**
- * mutt_mailbox_cleanup - Restore the timestamp of a mailbox
- * @param path Path to the mailbox
- * @param st Timestamp info from stat()
- *
- * Fix up the atime and mtime after mbox/mmdf mailbox was modified according to
- * stat() info taken before a modification.
- */
-void mutt_mailbox_cleanup(const char *path, struct stat *st)
-{
-#ifdef HAVE_UTIMENSAT
- struct timespec ts[2];
-#else
- struct utimbuf ut;
-#endif
-
- if (C_CheckMboxSize)
- {
- struct Mailbox *m = mutt_mailbox_find(path);
- if (m && !m->has_new)
- mutt_mailbox_update(m);
- }
- else
- {
- /* fix up the times so mailbox won't get confused */
- if (st->st_mtime > st->st_atime)
- {
-#ifdef HAVE_UTIMENSAT
- ts[0].tv_sec = 0;
- ts[0].tv_nsec = UTIME_OMIT;
- ts[1].tv_sec = 0;
- ts[1].tv_nsec = UTIME_NOW;
- utimensat(0, buf, ts, 0);
-#else
- ut.actime = st->st_atime;
- ut.modtime = time(NULL);
- utime(path, &ut);
-#endif
- }
- else
- {
-#ifdef HAVE_UTIMENSAT
- ts[0].tv_sec = 0;
- ts[0].tv_nsec = UTIME_NOW;
- ts[1].tv_sec = 0;
- ts[1].tv_nsec = UTIME_NOW;
- utimensat(0, buf, ts, 0);
-#else
- utime(path, NULL);
-#endif
- }
- }
-}
-
-/**
- * mutt_mailbox_find - Find the mailbox with a given path
+ * mailbox_find - Find the mailbox with a given path
* @param path Path to match
* @retval ptr Matching Mailbox
*/
-struct Mailbox *mutt_mailbox_find(const char *path)
+struct Mailbox *mailbox_find(const char *path)
{
if (!path)
return NULL;
}
/**
- * mutt_mailbox_find_name - Find the mailbox with a given name
+ * mailbox_find_name - Find the mailbox with a given name
* @param name Name to match
* @retval ptr Matching Mailbox
* @retval NULL No matching mailbox found
*
* @note This searches across all Accounts
*/
-struct Mailbox *mutt_mailbox_find_name(const char *name)
+struct Mailbox *mailbox_find_name(const char *name)
{
if (!name)
return NULL;
}
/**
- * mutt_mailbox_update - Get the mailbox's current size
+ * mailbox_update - Get the mailbox's current size
* @param m Mailbox to check
+ *
+ * @note Only applies to local Mailboxes
*/
-void mutt_mailbox_update(struct Mailbox *m)
+void mailbox_update(struct Mailbox *m)
{
struct stat sb;
}
/**
- * mutt_mailbox_changed - Notify observers of a change to a Mailbox
+ * mailbox_changed - Notify observers of a change to a Mailbox
* @param m Mailbox
* @param action Change to Mailbox
*/
-void mutt_mailbox_changed(struct Mailbox *m, enum MailboxNotification action)
+void mailbox_changed(struct Mailbox *m, enum MailboxNotification action)
{
if (!m)
return;
}
/**
- * mutt_mailbox_size_add - Add an email's size to the total size of a Mailbox
+ * mailbox_size_add - Add an email's size to the total size of a Mailbox
* @param m Mailbox
* @param e Email
*/
-void mutt_mailbox_size_add(struct Mailbox *m, const struct Email *e)
+void mailbox_size_add(struct Mailbox *m, const struct Email *e)
{
m->size += mutt_email_size(e);
}
/**
- * mutt_mailbox_size_sub - Subtract an email's size from the total size of a Mailbox
+ * mailbox_size_sub - Subtract an email's size from the total size of a Mailbox
* @param m Mailbox
* @param e Email
*/
-void mutt_mailbox_size_sub(struct Mailbox *m, const struct Email *e)
+void mailbox_size_sub(struct Mailbox *m, const struct Email *e)
{
m->size -= mutt_email_size(e);
}
--- /dev/null
+/**
+ * @file
+ * Representation of a mailbox
+ *
+ * @authors
+ * Copyright (C) 1996-2000,2010,2013 Michael R. Elkins <me@mutt.org>
+ * Copyright (C) 2018-2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * 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/>.
+ */
+
+#ifndef MUTT_CORE_MAILBOX_H
+#define MUTT_CORE_MAILBOX_H
+
+#include "config.h"
+#include <stdbool.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <time.h>
+#include "mutt/mutt.h"
+
+struct ConfigSubset;
+struct Email;
+
+#define MB_NORMAL 0
+#define MB_HIDDEN 1
+
+/**
+ * enum MailboxType - Supported mailbox formats
+ */
+enum MailboxType
+{
+ MUTT_MAILBOX_ANY = -2, ///< Match any Mailbox type
+ MUTT_MAILBOX_ERROR = -1, ///< Error occurred examining Mailbox
+ MUTT_UNKNOWN = 0, ///< Mailbox wasn't recognised
+ MUTT_MBOX, ///< 'mbox' Mailbox type
+ MUTT_MMDF, ///< 'mmdf' Mailbox type
+ MUTT_MH, ///< 'MH' Mailbox type
+ MUTT_MAILDIR, ///< 'Maildir' Mailbox type
+ MUTT_NNTP, ///< 'NNTP' (Usenet) Mailbox type
+ MUTT_IMAP, ///< 'IMAP' Mailbox type
+ MUTT_NOTMUCH, ///< 'Notmuch' (virtual) Mailbox type
+ MUTT_POP, ///< 'POP3' Mailbox type
+ MUTT_COMPRESSED, ///< Compressed file Mailbox type
+};
+
+/**
+ * enum MailboxNotification - Notifications about changes to a Mailbox
+ */
+enum MailboxNotification
+{
+ MBN_CLOSED = 1, ///< Mailbox was closed
+ MBN_INVALID, ///< Email list was changed
+ MBN_RESORT, ///< Email list needs resorting
+ MBN_UPDATE, ///< Update internal tables
+ MBN_UNTAG, ///< Clear the 'last-tagged' pointer
+};
+
+/**
+ * ACL Rights - These show permission to...
+ */
+typedef uint16_t AclFlags; ///< Flags, e.g. #MUTT_ACL_ADMIN
+#define MUTT_ACL_NO_FLAGS 0 ///< No flags are set
+#define MUTT_ACL_ADMIN (1 << 0) ///< Administer the account (get/set permissions)
+#define MUTT_ACL_CREATE (1 << 1) ///< Create a mailbox
+#define MUTT_ACL_DELETE (1 << 2) ///< Delete a message
+#define MUTT_ACL_DELMX (1 << 3) ///< Delete a mailbox
+#define MUTT_ACL_EXPUNGE (1 << 4) ///< Expunge messages
+#define MUTT_ACL_INSERT (1 << 5) ///< Add/copy into the mailbox (used when editing a message)
+#define MUTT_ACL_LOOKUP (1 << 6) ///< Lookup mailbox (visible to 'list')
+#define MUTT_ACL_POST (1 << 7) ///< Post (submit messages to the server)
+#define MUTT_ACL_READ (1 << 8) ///< Read the mailbox
+#define MUTT_ACL_SEEN (1 << 9) ///< Change the 'seen' status of a message
+#define MUTT_ACL_WRITE (1 << 10) ///< Write to a message (for flagging or linking threads)
+
+#define MUTT_ACL_ALL ((1 << 11) - 1)
+
+/**
+ * struct Mailbox - A mailbox
+ */
+struct Mailbox
+{
+ struct Buffer *pathbuf;
+ char *realpath; ///< Used for duplicate detection, context comparison, and the sidebar
+ char *name; ///< A short name for the Mailbox
+ struct ConfigSubset *sub; ///< Inherited config items
+ off_t size; ///< Size of the Mailbox
+ bool has_new; ///< Mailbox has new mail
+
+ // These next three are only set when MailCheckStats is set
+ int msg_count; ///< Total number of messages
+ int msg_unread; ///< Number of unread messages
+ int msg_flagged; ///< Number of flagged messages
+
+ int msg_new; ///< Number of new messages
+ int msg_deleted; ///< Number of deleted messages
+ int msg_tagged; ///< How many messages are tagged?
+
+ struct Email **emails; ///< Array of Emails
+ int email_max; ///< Number of pointers in emails
+ int *v2r; ///< Mapping from virtual to real msgno
+ int vcount; ///< The number of virtual messages
+
+ bool notified; ///< User has been notified
+ enum MailboxType magic; ///< Mailbox type
+ bool newly_created; ///< Mbox or mmdf just popped into existence
+ struct timespec mtime; ///< Time Mailbox was last changed
+ struct timespec last_visited; ///< Time of last exit from this mailbox
+ struct timespec stats_last_checked; ///< Mtime of mailbox the last time stats where checked.
+
+ const struct MxOps *mx_ops; ///< MXAPI callback functions
+
+ bool append : 1; ///< Mailbox is opened in append mode
+ bool changed : 1; ///< Mailbox has been modified
+ bool dontwrite : 1; ///< Don't write the mailbox on close
+ bool first_check_stats_done : 1; ///< True when the check have been done at least on time
+ bool peekonly : 1; ///< Just taking a glance, revert atime
+ bool quiet : 1; ///< Inhibit status messages?
+ bool readonly : 1; ///< Don't allow changes to the mailbox
+
+ AclFlags rights; ///< ACL bits, see #AclFlags
+
+#ifdef USE_COMPRESSED
+ void *compress_info; ///< Compressed mbox module private data
+#endif
+
+ struct Hash *id_hash; ///< Hash table by msg id
+ struct Hash *subj_hash; ///< Hash table by subject
+ struct Hash *label_hash; ///< Hash table for x-labels
+
+ struct Account *account; ///< Account that owns this Mailbox
+ int opened; ///< Number of times mailbox is opened
+
+ int flags; ///< e.g. #MB_NORMAL
+
+ void *mdata; ///< Driver specific data
+ void (*free_mdata)(void **); ///< Driver-specific data free function
+
+ struct Notify *notify; ///< Notifications handler
+};
+
+/**
+ * struct MailboxNode - List of Mailboxes
+ */
+struct MailboxNode
+{
+ struct Mailbox *mailbox; ///< Mailbox in the list
+ STAILQ_ENTRY(MailboxNode) entries; ///< Linked list
+};
+STAILQ_HEAD(MailboxList, MailboxNode);
+
+/**
+ * struct EventMailbox - An Event that happened to a Mailbox
+ */
+struct EventMailbox
+{
+ struct Mailbox *mailbox; ///< The Mailbox this Event relates to
+};
+
+/**
+ * enum NotifyMailbox - Types of Mailbox Event
+ */
+enum NotifyMailbox
+{
+ NT_MAILBOX_ADD = 1, ///< A new Mailbox has been created
+ NT_MAILBOX_REMOVE, ///< A Mailbox is about to be destroyed
+};
+
+void mailbox_changed (struct Mailbox *m, enum MailboxNotification action);
+struct Mailbox *mailbox_find (const char *path);
+struct Mailbox *mailbox_find_name (const char *name);
+void mailbox_free (struct Mailbox **ptr);
+struct Mailbox *mailbox_new (void);
+void mailbox_size_add (struct Mailbox *m, const struct Email *e);
+void mailbox_size_sub (struct Mailbox *m, const struct Email *e);
+void mailbox_update (struct Mailbox *m);
+
+#endif /* MUTT_CORE_MAILBOX_H */
*/
/**
- * @page neomutt Container for Accounts, Notifications
+ * @page core_neomutt Container for Accounts, Notifications
*
* Container for Accounts, Notifications
*/
#include "config.h"
+#include <stddef.h>
#include "mutt/mutt.h"
+#include "config/lib.h"
#include "neomutt.h"
#include "account.h"
+#include "mailbox.h"
struct NeoMutt *NeoMutt; ///< Global NeoMutt object
/**
* neomutt_new - Create the master NeoMutt object
+ * @param cs Config Set
* @retval ptr New NeoMutt
*/
struct NeoMutt *neomutt_new(struct ConfigSet *cs)
{
+ if (!cs)
+ return NULL;
+
struct NeoMutt *n = mutt_mem_calloc(1, sizeof(*NeoMutt));
TAILQ_INIT(&n->accounts);
/**
* neomutt_mailboxlist_clear - Free a Mailbox List
* @param ml Mailbox List to free
+ *
+ * @note The Mailboxes aren't freed
*/
void neomutt_mailboxlist_clear(struct MailboxList *ml)
{
/**
* neomutt_mailboxlist_get_all - Get a List of all Mailboxes
- * @param n NeoMutt
- * @param type Type of Account to match, see #MailboxType
+ * @param n NeoMutt
+ * @param magic Type of Account to match, see #MailboxType
* @retval obj List of Mailboxes
*
- * @note If type is #MUTT_MAILBOX_ANY then all Mailbox types will be matched
+ * @note If magic is #MUTT_MAILBOX_ANY then all Mailbox types will be matched
*/
struct MailboxList neomutt_mailboxlist_get_all(struct NeoMutt *n, enum MailboxType magic)
{
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MUTT_NEOMUTT_H
-#define MUTT_NEOMUTT_H
+#ifndef MUTT_CORE_NEOMUTT_H
+#define MUTT_CORE_NEOMUTT_H
#include <stdbool.h>
#include "account.h"
+#include "mailbox.h"
-struct Notify;
+struct ConfigSet;
/**
* struct NeoMutt - Container for Accounts, Notifications
NT_GLOBAL_TIMEOUT, ///< A timer has elapsed
};
-bool neomutt_account_add(struct NeoMutt *n, struct Account *a);
+bool neomutt_account_add (struct NeoMutt *n, struct Account *a);
bool neomutt_account_remove(struct NeoMutt *n, struct Account *a);
-void neomutt_free(struct NeoMutt **ptr);
-struct NeoMutt *neomutt_new(struct ConfigSet *cs);
+void neomutt_free (struct NeoMutt **ptr);
+struct NeoMutt *neomutt_new (struct ConfigSet *cs);
-void neomutt_mailboxlist_clear(struct MailboxList *ml);
+void neomutt_mailboxlist_clear (struct MailboxList *ml);
struct MailboxList neomutt_mailboxlist_get_all(struct NeoMutt *n, enum MailboxType magic);
-#endif /* MUTT_NEOMUTT_H */
+#endif /* MUTT_CORE_NEOMUTT_H */
#include "curs_lib.h"
#include "browser.h"
#include "context.h"
+#include "core/lib.h"
#include "enter_state.h"
#include "globals.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "email/lib.h"
#include "alias.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "hdrline.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_header.h"
#include "mutt_window.h"
#include "mutt.h"
#include "context.h"
#include "copy.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
-#include "mailbox.h"
#include "muttlib.h"
#include "mx.h"
#include "protos.h"
#include "alias.h"
#include "browser.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "enter_state.h"
#include "globals.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_history.h"
#include "mutt_mailbox.h"
#include "email/lib.h"
#include "mutt.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "index.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mutt_window.h"
#include "hdrline.h"
#include "alias.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "format_flags.h"
#include "globals.h"
#include "hook.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mutt_parse.h"
#include "conn/conn.h"
#include "mutt.h"
#include "browser.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "imap/imap.h"
-#include "mailbox.h"
#include "mutt_logging.h"
#include "muttlib.h"
-#include "neomutt.h"
/**
* add_folder - Format and add an IMAP folder to the browser
#include "email/lib.h"
#include "conn/conn.h"
#include "mutt.h"
+#include "core/lib.h"
#include "globals.h"
-#include "mailbox.h"
#include "message.h"
#include "mutt_account.h"
#include "mutt_logging.h"
#include "conn/conn.h"
#include "mutt.h"
#include "imap.h"
-#include "account.h"
#include "auth.h"
#include "commands.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "hook.h"
-#include "mailbox.h"
#include "message.h"
#include "mutt_account.h"
#include "mutt_logging.h"
#include "mutt_socket.h"
#include "muttlib.h"
#include "mx.h"
-#include "neomutt.h"
#include "pattern.h"
#include "progress.h"
#include "sort.h"
imap_hcache_close(mdata);
#endif
- mutt_mailbox_changed(m, MBN_UPDATE);
- mutt_mailbox_changed(m, MBN_RESORT);
+ mailbox_changed(m, MBN_UPDATE);
+ mailbox_changed(m, MBN_RESORT);
}
/**
#include "mutt.h"
#include "message.h"
#include "bcache.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "hcache/hcache.h"
#include "imap/imap.h"
-#include "mailbox.h"
#include "mutt_account.h"
#include "mutt_curses.h"
#include "mutt_logging.h"
FREE(&tags_copy);
m->msg_count++;
- mutt_mailbox_size_add(m, m->emails[idx]);
+ mailbox_size_add(m, m->emails[idx]);
/* If this is the first time we are fetching, we need to
* store the current state of flags back into the header cache */
edata->uid = uid;
mutt_hash_int_insert(mdata->uid_hash, uid, e);
- mutt_mailbox_size_add(m, e);
+ mailbox_size_add(m, e);
m->emails[m->msg_count++] = e;
msn++;
m->emails[idx]->env = mutt_rfc822_read_header(fp, m->emails[idx], false, false);
/* content built as a side-effect of mutt_rfc822_read_header */
m->emails[idx]->content->length = h.content_length;
- mutt_mailbox_size_add(m, m->emails[idx]);
+ mailbox_size_add(m, m->emails[idx]);
#ifdef USE_HCACHE
imap_hcache_put(mdata, m->emails[idx]);
#include "config/lib.h"
#include "email/lib.h"
#include "conn/conn.h"
-#include "account.h"
#include "bcache.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "hcache/hcache.h"
#include "imap/imap.h"
-#include "mailbox.h"
#include "message.h"
#include "mutt_account.h"
-#include "neomutt.h"
#include "options.h"
/* These Config Variables are only used in imap/util.c */
#include "conn/conn.h"
#include "mutt.h"
#include "index.h"
-#include "account.h"
#include "alias.h"
#include "browser.h"
#include "commands.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "format_flags.h"
#include "globals.h"
#include "hdrline.h"
#include "hook.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_account.h"
#include "mutt_curses.h"
#include "mutt_header.h"
#include "muttlib.h"
#include "mx.h"
#include "ncrypt/ncrypt.h"
-#include "neomutt.h"
#include "opcodes.h"
#include "options.h"
#include "pager.h"
{
// Try to see if the buffer matches a description before we bail.
// We'll receive a non-null pointer if there is a corresponding mailbox.
- m = mutt_mailbox_find_name(buf);
+ m = mailbox_find_name(buf);
if (m)
{
mutt_str_strfcpy(buf, mutt_b2s(m->pathbuf), buflen);
#include "email/lib.h"
#include "mutt.h"
#include "init.h"
-#include "account.h"
#include "alias.h"
#include "context.h"
+#include "core/lib.h"
#include "filter.h"
#include "hcache/hcache.h"
#include "keymap.h"
#include "mx.h"
#include "myvar.h"
#include "ncrypt/ncrypt.h"
-#include "neomutt.h"
#include "options.h"
#include "protos.h"
#include "sidebar.h"
#include "imap/imap.h"
#include "index.h"
#include "keymap.h"
-#include "mailbox.h"
+#include "core/lib.h"
#include "maildir/lib.h"
#include "main.h"
#include "mutt_account.h"
+++ /dev/null
-/**
- * @file
- * Representation of a mailbox
- *
- * @authors
- * Copyright (C) 1996-2000,2010,2013 Michael R. Elkins <me@mutt.org>
- * Copyright (C) 2018 Richard Russon <rich@flatcap.org>
- *
- * @copyright
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 2 of the License, or (at your option) any later
- * version.
- *
- * 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/>.
- */
-
-#ifndef MUTT_MAILBOX_H
-#define MUTT_MAILBOX_H
-
-#include <stdbool.h>
-#include <sys/types.h>
-#include <time.h>
-#include "mutt/mutt.h"
-#include "config.h"
-#include <stdint.h>
-
-struct Email;
-struct stat;
-
-#define MB_NORMAL 0
-#define MB_HIDDEN 1
-
-/**
- * enum MailboxType - Supported mailbox formats
- */
-enum MailboxType
-{
- MUTT_MAILBOX_ANY = -2, ///< Match any Mailbox type
- MUTT_MAILBOX_ERROR = -1, ///< Error occurred examining Mailbox
- MUTT_UNKNOWN = 0, ///< Mailbox wasn't recognised
- MUTT_MBOX, ///< 'mbox' Mailbox type
- MUTT_MMDF, ///< 'mmdf' Mailbox type
- MUTT_MH, ///< 'MH' Mailbox type
- MUTT_MAILDIR, ///< 'Maildir' Mailbox type
- MUTT_NNTP, ///< 'NNTP' (Usenet) Mailbox type
- MUTT_IMAP, ///< 'IMAP' Mailbox type
- MUTT_NOTMUCH, ///< 'Notmuch' (virtual) Mailbox type
- MUTT_POP, ///< 'POP3' Mailbox type
- MUTT_COMPRESSED, ///< Compressed file Mailbox type
-};
-
-/**
- * enum MailboxNotification - Notifications about changes to a Mailbox
- */
-enum MailboxNotification
-{
- MBN_CLOSED = 1, ///< Mailbox was closed
- MBN_INVALID, ///< Email list was changed
- MBN_RESORT, ///< Email list needs resorting
- MBN_UPDATE, ///< Update internal tables
- MBN_UNTAG, ///< Clear the 'last-tagged' pointer
-};
-
-/**
- * ACL Rights - These show permission to...
- */
-typedef uint16_t AclFlags; ///< Flags, e.g. #MUTT_ACL_ADMIN
-#define MUTT_ACL_NO_FLAGS 0 ///< No flags are set
-#define MUTT_ACL_ADMIN (1 << 0) ///< Administer the account (get/set permissions)
-#define MUTT_ACL_CREATE (1 << 1) ///< Create a mailbox
-#define MUTT_ACL_DELETE (1 << 2) ///< Delete a message
-#define MUTT_ACL_DELMX (1 << 3) ///< Delete a mailbox
-#define MUTT_ACL_EXPUNGE (1 << 4) ///< Expunge messages
-#define MUTT_ACL_INSERT (1 << 5) ///< Add/copy into the mailbox (used when editing a message)
-#define MUTT_ACL_LOOKUP (1 << 6) ///< Lookup mailbox (visible to 'list')
-#define MUTT_ACL_POST (1 << 7) ///< Post (submit messages to the server)
-#define MUTT_ACL_READ (1 << 8) ///< Read the mailbox
-#define MUTT_ACL_SEEN (1 << 9) ///< Change the 'seen' status of a message
-#define MUTT_ACL_WRITE (1 << 10) ///< Write to a message (for flagging or linking threads)
-
-#define MUTT_ACL_ALL ((1 << 11) - 1)
-
-/**
- * struct Mailbox - A mailbox
- */
-struct Mailbox
-{
- struct Buffer *pathbuf;
- char *realpath; ///< used for duplicate detection, context comparison, and the sidebar
- char *name;
- struct ConfigSubset *sub; ///< Inherited config items
- off_t size;
- bool has_new; /**< mailbox has new mail */
-
- /* These next three are only set when MailCheckStats is set */
- int msg_count; /**< total number of messages */
- int msg_unread; /**< number of unread messages */
- int msg_flagged; /**< number of flagged messages */
- int msg_new; /**< number of new messages */
- int msg_deleted; /**< number of deleted messages */
- int msg_tagged; /**< how many messages are tagged? */
-
- struct Email **emails;
- int email_max; /**< number of pointers in emails */
- int *v2r; /**< mapping from virtual to real msgno */
- int vcount; /**< the number of virtual messages */
-
- bool notified; /**< user has been notified */
- enum MailboxType magic; /**< mailbox type */
- bool newly_created; /**< mbox or mmdf just popped into existence */
- struct timespec mtime;
- struct timespec last_visited; /**< time of last exit from this mailbox */
- struct timespec stats_last_checked; /**< mtime of mailbox the last time stats where checked. */
-
- const struct MxOps *mx_ops;
-
- bool append : 1; /**< mailbox is opened in append mode */
- bool changed : 1; /**< mailbox has been modified */
- bool dontwrite : 1; /**< don't write the mailbox on close */
- bool first_check_stats_done : 1; /**< true when the check have been done at least on time */
- bool peekonly : 1; /**< just taking a glance, revert atime */
- bool quiet : 1; /**< inhibit status messages? */
- bool readonly : 1; /**< don't allow changes to the mailbox */
-
- AclFlags rights; /**< ACL bits, see #AclFlags */
-
-#ifdef USE_COMPRESSED
- void *compress_info; /**< compressed mbox module private data */
-#endif
-
- struct Hash *id_hash; /**< hash table by msg id */
- struct Hash *subj_hash; /**< hash table by subject */
- struct Hash *label_hash; /**< hash table for x-labels */
-
- struct Account *account;
- int opened; /**< number of times mailbox is opened */
-
- int flags; /**< e.g. #MB_NORMAL */
-
- void *mdata; /**< driver specific data */
- void (*free_mdata)(void **); /**< driver-specific data free function */
-
- struct Notify *notify; ///< Notifications handler
-};
-
-/**
- * struct MailboxNode - List of Mailboxes
- */
-struct MailboxNode
-{
- struct Mailbox *mailbox;
- STAILQ_ENTRY(MailboxNode) entries;
-};
-STAILQ_HEAD(MailboxList, MailboxNode);
-
-/**
- * struct EventMailbox - An Event that happened to a Mailbox
- */
-struct EventMailbox
-{
- struct Mailbox *mailbox; ///< The Mailbox this Event relates to
-};
-
-/**
- * enum NotifyMailbox - Types of Mailbox Event
- */
-enum NotifyMailbox
-{
- NT_MAILBOX_ADD = 1, ///< A new Mailbox has been created
- NT_MAILBOX_REMOVE, ///< A Mailbox is about to be destroyed
-};
-
-void mailbox_free (struct Mailbox **ptr);
-struct Mailbox *mailbox_new (void);
-void mutt_mailbox_changed (struct Mailbox *m, enum MailboxNotification action);
-void mutt_mailbox_cleanup (const char *path, struct stat *st);
-struct Mailbox *mutt_mailbox_find (const char *path);
-struct Mailbox *mutt_mailbox_find_name (const char *name);
-void mutt_mailbox_size_add (struct Mailbox *m, const struct Email *e);
-void mutt_mailbox_size_sub (struct Mailbox *m, const struct Email *e);
-void mutt_mailbox_update (struct Mailbox *m);
-
-#endif /* MUTT_MAILBOX_H */
#include "mutt/mutt.h"
#include "config/lib.h"
#include "email/lib.h"
+#include "core/lib.h"
#include "globals.h"
#include "hcache/hcache.h"
-#include "mailbox.h"
#include "maildir/lib.h"
#include "monitor.h"
#include "muttlib.h"
/* If we didn't just get new mail, update the tables. */
if (occult)
- mutt_mailbox_changed(m, MBN_RESORT);
+ mailbox_changed(m, MBN_RESORT);
/* do any delayed parsing we need to do. */
maildir_delayed_parsing(m, &md, NULL);
num_new = maildir_move_to_mailbox(m, &md);
if (num_new > 0)
{
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
m->changed = true;
}
#include <sys/types.h>
#include <time.h>
#include "config/lib.h"
-#include "mailbox.h"
+#include "core/lib.h"
struct Account;
struct Buffer;
#include "mutt/mutt.h"
#include "config/lib.h"
#include "email/lib.h"
+#include "core/lib.h"
#include "errno.h"
#include "globals.h"
#include "lib.h"
-#include "mailbox.h"
#include "monitor.h"
#include "mx.h"
/* If we didn't just get new mail, update the tables. */
if (occult)
- mutt_mailbox_changed(m, MBN_RESORT);
+ mailbox_changed(m, MBN_RESORT);
/* Incorporate new messages */
num_new = maildir_move_to_mailbox(m, &md);
if (num_new > 0)
{
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
m->changed = true;
}
#include "mutt.h"
#include "context.h"
#include "copy.h"
+#include "core/lib.h"
#include "globals.h"
#include "hcache/hcache.h"
#include "lib.h"
-#include "mailbox.h"
#include "mutt_thread.h"
#include "muttlib.h"
#include "mx.h"
m->emails[m->msg_count] = md->email;
m->emails[m->msg_count]->index = m->msg_count;
- mutt_mailbox_size_add(m, md->email);
+ mailbox_size_add(m, md->email);
md->email = NULL;
m->msg_count++;
#include "email/lib.h"
#include "conn/conn.h"
#include "mutt.h"
-#include "account.h"
#include "alias.h"
#include "browser.h"
#include "color.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "hook.h"
#include "index.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_attach.h"
#include "mutt_curses.h"
#include "mutt_history.h"
#include "muttlib.h"
#include "mx.h"
#include "ncrypt/ncrypt.h"
-#include "neomutt.h"
#include "options.h"
#include "protos.h"
#include "send.h"
if (C_Spoolfile)
{
// Check if C_Spoolfile corresponds a mailboxes' description.
- struct Mailbox *m_desc = mutt_mailbox_find_name(C_Spoolfile);
+ struct Mailbox *m_desc = mailbox_find_name(C_Spoolfile);
if (m_desc)
mutt_buffer_strcpy(folder, m_desc->realpath);
else
#include "email/lib.h"
#include "mutt.h"
#include "mbox.h"
-#include "account.h"
#include "context.h"
#include "copy.h"
+#include "core/lib.h"
#include "globals.h"
-#include "mailbox.h"
#include "mutt_header.h"
#include "muttlib.h"
#include "mx.h"
{
short old_sort = C_Sort;
C_Sort = SORT_ORDER;
- mutt_mailbox_changed(m, MBN_RESORT);
+ mailbox_changed(m, MBN_RESORT);
C_Sort = old_sort;
}
old_msg_count = 0;
/* simulate a close */
- mutt_mailbox_changed(m, MBN_CLOSED);
+ mailbox_changed(m, MBN_CLOSED);
mutt_hash_free(&m->id_hash);
mutt_hash_free(&m->subj_hash);
mutt_hash_free(&m->label_hash);
{
if (mbox_mbox_open(m) < 0)
return -1;
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
}
struct stat st;
mmdf_parse_mailbox(m);
if (m->msg_count > old_msg_count)
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
/* Only unlock the folder if it was locked inside of this routine.
* It may have been locked elsewhere, like in
{
if (reopen_mailbox(m, index_hint) != -1)
{
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
if (unlock)
{
mbox_unlock_mailbox(m);
{
save_sort = C_Sort;
C_Sort = SORT_ORDER;
- mutt_mailbox_changed(m, MBN_RESORT);
+ mailbox_changed(m, MBN_RESORT);
C_Sort = save_sort;
need_sort = 1;
}
if (C_CheckMboxSize)
{
- struct Mailbox *m_tmp = mutt_mailbox_find(mutt_b2s(m->pathbuf));
+ struct Mailbox *m_tmp = mailbox_find(mutt_b2s(m->pathbuf));
if (m_tmp && !m_tmp->has_new)
- mutt_mailbox_update(m_tmp);
+ mailbox_update(m_tmp);
}
return 0; /* signal success */
{
/* if the mailbox was reopened, the thread tree will be invalid so make
* sure to start threading from scratch. */
- mutt_mailbox_changed(m, MBN_RESORT);
+ mailbox_changed(m, MBN_RESORT);
}
return rc;
#include "color.h"
#include "commands.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "mutt/mutt.h"
#include "monitor.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "mx.h"
}
else
{
- if (mutt_mailbox_find(Context->mailbox->realpath))
+ if (mailbox_find(Context->mailbox->realpath))
{
rc = 1;
goto cleanup;
#include "mutt_attach.h"
#include "context.h"
#include "copy.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "filter.h"
#include "globals.h"
#include "handler.h"
-#include "mailbox.h"
#include "muttlib.h"
#include "mx.h"
#include "ncrypt/ncrypt.h"
#include "mutt.h"
#include "alias.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "index.h"
-#include "mailbox.h"
#include "muttlib.h"
#include "ncrypt/ncrypt.h"
#include "options.h"
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
+#include <utime.h>
#include "mutt/mutt.h"
#include "mutt_mailbox.h"
+#include "core/lib.h"
#include "globals.h"
-#include "mailbox.h"
#include "mutt_menu.h"
#include "mutt_window.h"
#include "muttlib.h"
#include "mx.h"
-#include "neomutt.h"
#include "protos.h"
static time_t MailboxTime = 0; /**< last time we started checking for mail */
mutt_buffer_pool_release(&s_buf);
}
+
+/**
+ * mutt_mailbox_cleanup - Restore the timestamp of a mailbox
+ * @param path Path to the mailbox
+ * @param st Timestamp info from stat()
+ *
+ * Fix up the atime and mtime after mbox/mmdf mailbox was modified according to
+ * stat() info taken before a modification.
+ */
+void mutt_mailbox_cleanup(const char *path, struct stat *st)
+{
+#ifdef HAVE_UTIMENSAT
+ struct timespec ts[2];
+#else
+ struct utimbuf ut;
+#endif
+
+ if (C_CheckMboxSize)
+ {
+ struct Mailbox *m = mailbox_find(path);
+ if (m && !m->has_new)
+ mailbox_update(m);
+ }
+ else
+ {
+ /* fix up the times so mailbox won't get confused */
+ if (st->st_mtime > st->st_atime)
+ {
+#ifdef HAVE_UTIMENSAT
+ ts[0].tv_sec = 0;
+ ts[0].tv_nsec = UTIME_OMIT;
+ ts[1].tv_sec = 0;
+ ts[1].tv_nsec = UTIME_NOW;
+ utimensat(0, buf, ts, 0);
+#else
+ ut.actime = st->st_atime;
+ ut.modtime = time(NULL);
+ utime(path, &ut);
+#endif
+ }
+ else
+ {
+#ifdef HAVE_UTIMENSAT
+ ts[0].tv_sec = 0;
+ ts[0].tv_nsec = UTIME_NOW;
+ ts[1].tv_sec = 0;
+ ts[1].tv_nsec = UTIME_NOW;
+ utimensat(0, buf, ts, 0);
+#else
+ utime(path, NULL);
+#endif
+ }
+ }
+}
struct Buffer;
struct Mailbox;
+struct stat;
/* These Config Variables are only used in mutt_mailbox.c */
extern short C_MailCheck;
#define MUTT_MAILBOX_CHECK_FORCE_STATS (1 << 1)
int mutt_mailbox_check (struct Mailbox *m_cur, int force);
+void mutt_mailbox_cleanup (const char *path, struct stat *st);
bool mutt_mailbox_list (void);
void mutt_mailbox_next (struct Mailbox *m_cur, char *s, size_t slen);
void mutt_mailbox_next_buffer (struct Mailbox *m_cur, struct Buffer *s);
#include "mutt.h"
#include "mutt_thread.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
-#include "mailbox.h"
#include "mutt_menu.h"
#include "mx.h"
#include "protos.h"
#include "email/lib.h"
#include "mutt.h"
#include "mx.h"
-#include "account.h"
#include "alias.h"
#include "context.h"
#include "copy.h"
+#include "core/lib.h"
#include "globals.h"
#include "hook.h"
#include "keymap.h"
-#include "mailbox.h"
#include "maildir/lib.h"
#include "mbox/mbox.h"
#include "mutt_header.h"
#include "mutt_thread.h"
#include "muttlib.h"
#include "ncrypt/ncrypt.h"
-#include "neomutt.h"
#include "opcodes.h"
#include "options.h"
#include "pattern.h"
if (m->mx_ops)
m->mx_ops->mbox_close(m);
- mutt_mailbox_changed(m, MBN_CLOSED);
+ mailbox_changed(m, MBN_CLOSED);
mutt_hash_free(&m->subj_hash);
mutt_hash_free(&m->id_hash);
m->msg_deleted = 0;
}
}
- mutt_mailbox_changed(m, MBN_UNTAG);
+ mailbox_changed(m, MBN_UNTAG);
}
/* really only for IMAP - imap_sync_mailbox results in a call to
/* IMAP does this automatically after handling EXPUNGE */
if (m->magic != MUTT_IMAP)
{
- mutt_mailbox_changed(m, MBN_UPDATE);
- mutt_mailbox_changed(m, MBN_RESORT);
+ mailbox_changed(m, MBN_UPDATE);
+ mailbox_changed(m, MBN_RESORT);
}
}
}
int rc = m->mx_ops->mbox_check(m, index_hint);
if ((rc == MUTT_NEW_MAIL) || (rc == MUTT_REOPENED))
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
return rc;
}
#include <time.h>
#include "config/lib.h"
#include "hcache/hcache.h"
-#include "mailbox.h"
+#include "core/lib.h"
struct Email;
struct Context;
#include "email/lib.h"
#include "browser.h"
#include "context.h"
+#include "core/lib.h"
#include "format_flags.h"
#include "globals.h"
-#include "mailbox.h"
#include "muttlib.h"
#include "nntp.h"
#include "conn/conn.h"
#include "mutt.h"
#include "bcache.h"
+#include "core/lib.h"
#include "format_flags.h"
#include "globals.h"
#include "hcache/hcache.h"
-#include "mailbox.h"
#include "mutt_account.h"
#include "mutt_logging.h"
#include "mutt_socket.h"
{
save_sort = C_Sort;
C_Sort = SORT_ORDER;
- mutt_mailbox_changed(m, MBN_RESORT);
+ mailbox_changed(m, MBN_RESORT);
}
entries = mdata->newsrc_len;
if (save_sort != C_Sort)
{
C_Sort = save_sort;
- mutt_mailbox_changed(m, MBN_RESORT);
+ mailbox_changed(m, MBN_RESORT);
}
}
#include "conn/conn.h"
#include "mutt.h"
#include "nntp.h"
-#include "account.h"
#include "bcache.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "hcache/hcache.h"
#include "hook.h"
-#include "mailbox.h"
#include "mutt_account.h"
#include "mutt_logging.h"
#include "mutt_parse.h"
/* some headers were removed, context must be updated */
if (rc == MUTT_REOPENED)
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
/* fetch headers of new articles */
if (mdata->last_message > mdata->last_loaded)
if (rc2 == 0)
{
if (m->msg_count > old_msg_count)
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
mdata->last_loaded = mdata->last_message;
}
if ((rc == 0) && (m->msg_count > oldmsgcount))
#include "email/lib.h"
#include "mutt.h"
#include "mutt_notmuch.h"
-#include "account.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "globals.h"
#include "hcache/hcache.h"
#include "index.h"
-#include "mailbox.h"
#include "maildir/lib.h"
#include "mutt_thread.h"
#include "mx.h"
e->active = true;
e->index = m->msg_count;
- mutt_mailbox_size_add(m, e);
+ mailbox_size_add(m, e);
m->emails[m->msg_count] = e;
m->msg_count++;
rc = 0;
if (m->msg_count > mdata->oldmsgcount)
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
done:
if (q)
notmuch_query_destroy(q);
}
if (m->msg_count > mdata->oldmsgcount)
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
done:
if (q)
notmuch_query_destroy(q);
#include <time.h>
#include "config/lib.h"
#include "progress.h"
-#include "mailbox.h"
+#include "core/lib.h"
#ifndef MUTT_NOTMUCH_NOTMUCH_PRIVATE_H
#define MUTT_NOTMUCH_NOTMUCH_PRIVATE_H
#include "color.h"
#include "commands.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "format_flags.h"
#include "globals.h"
#include "hook.h"
#include "index.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_attach.h"
#include "mutt_curses.h"
#include "mutt_header.h"
#include "alias.h"
#include "context.h"
#include "copy.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "filter.h"
#include "globals.h"
#include "handler.h"
#include "hdrline.h"
-#include "mailbox.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "mutt_parse.h"
#include "conn/conn.h"
#include "mutt.h"
#include "pop.h"
-#include "account.h"
#include "bcache.h"
#include "context.h"
+#include "core/lib.h"
#include "globals.h"
#include "hcache/hcache.h"
#include "hook.h"
-#include "mailbox.h"
#include "mutt_account.h"
#include "mutt_header.h"
#include "mutt_logging.h"
int rc = pop_fetch_headers(m);
pop_clear_cache(adata);
if (m->msg_count > old_msg_count)
- mutt_mailbox_changed(m, MBN_INVALID);
+ mailbox_changed(m, MBN_INVALID);
if (rc < 0)
return -1;
#include "email/lib.h"
#include "conn/conn.h"
#include "mutt.h"
-#include "account.h"
+#include "core/lib.h"
#include "globals.h"
-#include "mailbox.h"
#include "mutt_account.h"
#include "mutt_logging.h"
#include "mutt_socket.h"
#include "conn/conn.h"
#include "mutt.h"
#include "context.h"
+#include "core/lib.h"
#include "format_flags.h"
#include "globals.h"
#include "handler.h"
#include "hdrline.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "mutt_thread.h"
#include "recvattach.h"
#include "commands.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "filter.h"
#include "format_flags.h"
#include "hdrline.h"
#include "hook.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_attach.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "mutt.h"
#include "score.h"
#include "context.h"
+#include "core/lib.h"
#include "globals.h"
#include "keymap.h"
-#include "mailbox.h"
#include "mutt_commands.h"
#include "mutt_menu.h"
#include "options.h"
#include "compose.h"
#include "context.h"
#include "copy.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "edit.h"
#include "filter.h"
#include "handler.h"
#include "hdrline.h"
#include "hook.h"
-#include "mailbox.h"
#include "mutt_attach.h"
#include "mutt_body.h"
#include "mutt_header.h"
#include "sendlib.h"
#include "context.h"
#include "copy.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "filter.h"
#include "globals.h"
#include "handler.h"
#include "hook.h"
-#include "mailbox.h"
+#include "mutt_mailbox.h"
#include "mutt_parse.h"
#include "mutt_window.h"
#include "muttlib.h"
#include "config/lib.h"
#include "sidebar.h"
#include "context.h"
+#include "core/lib.h"
#include "curs_lib.h"
#include "format_flags.h"
#include "globals.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mutt_window.h"
#include "muttlib.h"
#include "mx.h"
-#include "neomutt.h"
#include "opcodes.h"
#include "sort.h"
#include "sort.h"
#include "alias.h"
#include "context.h"
+#include "core/lib.h"
#include "globals.h"
-#include "mailbox.h"
#include "mutt_logging.h"
#include "mutt_thread.h"
#include "options.h"
#include <stdio.h>
#include "mutt/mutt.h"
#include "context.h"
+#include "core/lib.h"
#include "format_flags.h"
#include "globals.h"
-#include "mailbox.h"
#include "mutt_mailbox.h"
#include "mutt_menu.h"
#include "mutt_window.h"
test/config/slist.o \
test/config/sort.o \
test/config/string.o \
- test/config/synonym.o \
- account.o \
- mailbox.o \
- neomutt.o
+ test/config/synonym.o
DATE_OBJS = test/date/mutt_date_add_timeout.o \
test/date/mutt_date_check_month.o \
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static short VarApple;
static short VarBanana;
#include "address/lib.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static struct Address *VarApple;
static struct Address *VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static bool VarApple;
static bool VarBanana;
#include "mutt/mutt.h"
#include "config/lib.h"
#include "common.h"
-#include "account.h"
+#include "core/lib.h"
const char *line = "----------------------------------------"
"----------------------------------------";
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static bool VarApple;
static bool VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static unsigned char VarApple;
static unsigned char VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static char *VarApple;
static char *VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static long VarApple;
static long VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static struct MbTable *VarApple;
static struct MbTable *VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static short VarApple;
static short VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static char VarApple;
static char VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static struct Regex *VarApple;
static struct Regex *VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static short VarApple;
static bool VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static struct Slist *VarApple;
static struct Slist *VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static short VarApple;
static short VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static char *VarApple;
static char *VarBanana;
#include "mutt/mutt.h"
#include "config/common.h"
#include "config/lib.h"
-#include "account.h"
+#include "core/lib.h"
static char *VarApple;
static char *VarCherry;
{
struct Email e = { 0 };
- TEST_CHECK(mutt_rfc822_parse_line(NULL, &e, "apple", "banana", false,
- false, false) == 0);
+ TEST_CHECK(mutt_rfc822_parse_line(NULL, &e, "apple", "banana", false, false, false) == 0);
}
{
struct Envelope envelope;
memset(&envelope, 0, sizeof(struct Envelope));
struct Email e = { 0 };
- TEST_CHECK(mutt_rfc822_parse_line(&envelope, &e, "apple", NULL, false,
- false, false) == 0);
+ TEST_CHECK(mutt_rfc822_parse_line(&envelope, &e, "apple", NULL, false, false, false) == 0);
}
}