compress.h \
attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \
globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
- mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
+ mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \
- mx.h pager.h pgp.h protos.h reldate.h rfc1524.h rfc2047.h \
+ mbox.h mh.h mx.h pager.h pgp.h protos.h reldate.h rfc1524.h rfc2047.h \
rfc2231.h rfc822.h sha1.h sort.h mime.types VERSION prepare \
_regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \
mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h Muttngrc.head Muttngrc \
- Stop making up names of global functions with mutt_*; give meaningful
names and declare them in the right headers to eventually obsolote
- protos.h
+ protos.h. This counts for data typedef's, too! Write one header and
+ one source file per datatype, do proper information hiding and thus
+ provide sane internal abstraction to get "future ready." For example,
+ for all the mailbox handling, the mbox_*/mmdf_* and mh_*/maildir_*
+ functions should only be called directly in the right abstraction
+ layer's implementation. And so forth.
- Convert all the names in manual.sgml.head/tail
#include "rfc1524.h"
#include "mime.h"
#include "pager.h"
-#include "mailbox.h"
#include "copy.h"
#include "mx.h"
#include "mutt_crypt.h"
#include "buffy.h"
#include "mapping.h"
#include "sort.h"
-#include "mailbox.h"
#include "browser.h"
#ifdef USE_IMAP
#include "imap.h"
#include "mutt.h"
#include "buffy.h"
-#include "mailbox.h"
#include "mx.h"
+#include "mh.h"
#include "sidebar.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mime.h"
#include "sort.h"
-#include "mailbox.h"
#include "copy.h"
#include "mx.h"
#include "pager.h"
#include "mutt.h"
#ifdef USE_IMAP
-#include "mailbox.h"
+#include "mx.h"
#include "imap.h"
#endif
#ifdef USE_NNTP
#include "mime.h"
#include "attach.h"
#include "mapping.h"
-#include "mailbox.h"
#include "sort.h"
#include "charset.h"
#include "mx.h"
#ifdef USE_COMPRESSED
#include "mx.h"
-#include "mailbox.h"
#include "mutt_curses.h"
#include "lib/mem.h"
#endif
#include "mutt.h"
-#include "mailbox.h"
#include "mx.h"
#include "copy.h"
#include "rfc2047.h"
#include "mutt_curses.h"
#include "mx.h"
#include "mutt_menu.h"
-#include "mailbox.h"
#include "mapping.h"
#include "sort.h"
#include "buffy.h"
#include "mutt.h"
#include "copy.h"
-#include "mailbox.h"
#include "mx.h"
#include "lib/intl.h"
#endif
#include "mutt.h"
-#include "mailbox.h"
+#include "mx.h"
#include "mutt_crypt.h"
#ifdef USE_COMPRESSED
#include "mutt.h"
#include "mutt_curses.h"
#include "mx.h"
-#include "mailbox.h"
#include "globals.h"
#include "sort.h"
#include "browser.h"
#include "account.h"
#include "browser.h"
-#include "mailbox.h"
+#include "mx.h"
/* -- data structures -- */
typedef struct {
#include "mx.h"
#include "init.h"
-#include "mailbox.h"
#include "lib/mem.h"
#include "lib/intl.h"
+++ /dev/null
-/*
- * Copyright notice from original mutt:
- * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-
-#ifndef _MAILBOX_H
-#define _MAILBOX_H
-
-/* flags for mutt_open_mailbox() */
-#define M_NOSORT (1<<0) /* do not sort the mailbox after opening it */
-#define M_APPEND (1<<1) /* open mailbox for appending messages */
-#define M_READONLY (1<<2) /* open in read-only mode */
-#define M_QUIET (1<<3) /* do not print any messages */
-#define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses
- * safe_fopen() for mbox-style folders.
- */
-
-/* mx_open_new_message() */
-#define M_ADD_FROM 1 /* add a From_ line */
-
-/* return values from mx_check_mailbox() */
-enum {
- M_NEW_MAIL = 1, /* new mail received in mailbox */
- M_LOCKED, /* couldn't lock the mailbox */
- M_REOPENED, /* mailbox was reopened */
- M_FLAGS /* nondestructive flags change (IMAP) */
-};
-
-typedef struct {
- FILE *fp; /* pointer to the message data */
- char *path; /* path to temp file */
- short magic; /* type of mailbox this message belongs to */
- short write; /* nonzero if message is open for writing */
- struct {
- unsigned read:1;
- unsigned flagged:1;
- unsigned replied:1;
- } flags;
- time_t received; /* the time at which this message was received */
-} MESSAGE;
-
-CONTEXT *mx_open_mailbox (const char *, int, CONTEXT *);
-
-MESSAGE *mx_open_message (CONTEXT *, int);
-MESSAGE *mx_open_new_message (CONTEXT *, HEADER *, int);
-
-void mx_fastclose_mailbox (CONTEXT *);
-
-int mx_close_mailbox (CONTEXT *, int *);
-int mx_sync_mailbox (CONTEXT *, int *);
-int mx_commit_message (MESSAGE *, CONTEXT *);
-int mx_close_message (MESSAGE **);
-int mx_get_magic (const char *);
-int mx_set_magic (const char *);
-int mx_check_mailbox (CONTEXT *, int *, int);
-
-#ifdef USE_IMAP
-int mx_is_imap (const char *);
-#endif
-#ifdef USE_POP
-int mx_is_pop (const char *);
-#endif
-#ifdef USE_NNTP
-int mx_is_nntp (const char *);
-#endif
-
-int mx_access (const char *, int);
-int mx_check_empty (const char *);
-
-#endif
#include "mutt.h"
#include "mutt_curses.h"
#include "keymap.h"
-#include "mailbox.h"
#include "url.h"
#include "mutt_crypt.h"
#include "mutt_idna.h"
#endif
#include "mutt.h"
-#include "mailbox.h"
#include "mx.h"
+#include "mbox.h"
#include "sort.h"
#include "copy.h"
long length;
};
+
+int mbox_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr)
+{
+ msg->fp = dest->fp;
+ return 0;
+}
+
/* parameters:
* ctx - context to lock
* excl - exclusive lock?
}
if (modified) {
- if (mutt_reopen_mailbox (ctx, index_hint) != -1) {
+ if (mbox_reopen_mailbox (ctx, index_hint) != -1) {
if (unlock) {
mbox_unlock_mailbox (ctx);
mutt_unblock_signals ();
return 0;
}
-int mutt_reopen_mailbox (CONTEXT * ctx, int *index_hint)
+int mbox_reopen_mailbox (CONTEXT * ctx, int *index_hint)
{
int (*cmp_headers) (const HEADER *, const HEADER *) = NULL;
HEADER **old_hdrs;
case M_MBOX:
case M_MMDF:
if (fseek (ctx->fp, 0, SEEK_SET) != 0) {
- dprint (1, (debugfile, "mutt_reopen_mailbox: fseek() failed\n"));
+ dprint (1, (debugfile, "mbox_reopen_mailbox: fseek() failed\n"));
rc = -1;
}
else {
--- /dev/null
+/*
+ * Copyright notice from original mutt:
+ * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
+ * Copyright (C) 1999-2002 Thomas Roessler <roessler@does-not-exist.org>
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
+ */
+
+/*
+ * functions for dealing with mbox/mmdf style mailboxes
+ */
+
+#ifndef _MBOX_H
+#define _MBOX_H
+
+#include "mx.h"
+
+#define MMDF_SEP "\001\001\001\001\n"
+
+int mbox_sync_mailbox (CONTEXT *, int *);
+int mbox_open_mailbox (CONTEXT *);
+int mbox_check_mailbox (CONTEXT *, int *);
+int mbox_close_mailbox (CONTEXT *);
+int mbox_lock_mailbox (CONTEXT *, int, int);
+int mbox_parse_mailbox (CONTEXT *);
+int mmdf_parse_mailbox (CONTEXT *);
+void mbox_unlock_mailbox (CONTEXT *);
+int mbox_check_empty (const char *);
+
+int mbox_strict_cmp_headers (const HEADER *, const HEADER *);
+int mbox_reopen_mailbox (CONTEXT *, int *);
+
+int mbox_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr);
+
+#endif
#endif
#include "mutt.h"
-#include "mailbox.h"
#include "mx.h"
+#include "mh.h"
+#include "mbox.h"
#include "copy.h"
#include "buffy.h"
#include "sort.h"
--- /dev/null
+/*
+ * Copyright notice from original mutt:
+ * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
+ * Copyright (C) 1999-2002 Thomas Roessler <roessler@does-not-exist.org>
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
+ */
+
+/*
+ * functions for dealing with Maildir/MH style mailboxes
+ */
+
+#ifndef _MH_H
+#define _MH_H
+
+#include "mx.h"
+
+int mh_read_dir (CONTEXT *, const char *);
+int mh_sync_mailbox (CONTEXT *, int *);
+int mh_check_mailbox (CONTEXT *, int *);
+int mh_buffy (const char *);
+int mh_check_empty (const char *);
+
+int maildir_read_dir (CONTEXT *);
+int maildir_check_mailbox (CONTEXT *, int *);
+int maildir_check_empty (const char *);
+
+int maildir_commit_message (CONTEXT *, MESSAGE *, HEADER *);
+int mh_commit_message (CONTEXT *, MESSAGE *, HEADER *);
+
+int maildir_open_new_message (MESSAGE *, CONTEXT *, HEADER *);
+int mh_open_new_message (MESSAGE *, CONTEXT *, HEADER *);
+
+FILE *maildir_open_find_message (const char *, const char *);
+
+#endif /* !_MH_H */
#include "mutt.h"
#include "mutt_curses.h"
#include "mime.h"
-#include "mailbox.h"
#include "mx.h"
#include "url.h"
#include "mutt.h"
#include "mx.h"
+#include "mbox.h"
+#include "mh.h"
#include "rfc2047.h"
#include "sort.h"
-#include "mailbox.h"
#include "copy.h"
#include "keymap.h"
#include "url.h"
*/
#ifdef USE_IMAP
-
int mx_is_imap (const char *p)
{
url_scheme_t scheme;
return 0;
}
-
#endif
#ifdef USE_POP
return (rc);
}
-
-/* {maildir,mh}_open_new_message are in mh.c. */
-
-int mbox_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr)
-{
- msg->fp = dest->fp;
- return 0;
-}
-
#ifdef USE_IMAP
int imap_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr)
{
*/
/*
- * This header file contains prototypes for internal functions used by the
- * generic mailbox api. None of these functions should be called directly.
+ * mailbox abstraction
+ * when adding code dealing with folders or whatever,
+ * please use these only
*/
#ifndef _MX_H
#define _MX_H
-#include "mailbox.h"
-
/* supported mailbox formats */
enum {
M_MBOX = 1,
#endif
};
-WHERE short DefaultMagic INITVAL (M_MBOX);
+/* flags for mx_open_mailbox() */
+#define M_NOSORT (1<<0) /* do not sort the mailbox after opening it */
+#define M_APPEND (1<<1) /* open mailbox for appending messages */
+#define M_READONLY (1<<2) /* open in read-only mode */
+#define M_QUIET (1<<3) /* do not print any messages */
+#define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses
+ * safe_fopen() for mbox-style folders.
+ */
+
+/* mx_open_new_message() */
+#define M_ADD_FROM 1 /* add a From_ line */
-#define MMDF_SEP "\001\001\001\001\n"
#define MAXLOCKATTEMPT 5
-int mbox_sync_mailbox (CONTEXT *, int *);
-int mbox_open_mailbox (CONTEXT *);
-int mbox_check_mailbox (CONTEXT *, int *);
-int mbox_close_mailbox (CONTEXT *);
-int mbox_lock_mailbox (CONTEXT *, int, int);
-int mbox_parse_mailbox (CONTEXT *);
-int mmdf_parse_mailbox (CONTEXT *);
-void mbox_unlock_mailbox (CONTEXT *);
-int mbox_check_empty (const char *);
+/* return values from mx_check_mailbox() */
+enum {
+ M_NEW_MAIL = 1, /* new mail received in mailbox */
+ M_LOCKED, /* couldn't lock the mailbox */
+ M_REOPENED, /* mailbox was reopened */
+ M_FLAGS /* nondestructive flags change (IMAP) */
+};
-int mh_read_dir (CONTEXT *, const char *);
-int mh_sync_mailbox (CONTEXT *, int *);
-int mh_check_mailbox (CONTEXT *, int *);
-int mh_buffy (const char *);
-int mh_check_empty (const char *);
+typedef struct {
+ FILE *fp; /* pointer to the message data */
+ char *path; /* path to temp file */
+ short magic; /* type of mailbox this message belongs to */
+ short write; /* nonzero if message is open for writing */
+ struct {
+ unsigned read:1;
+ unsigned flagged:1;
+ unsigned replied:1;
+ } flags;
+ time_t received; /* the time at which this message was received */
+} MESSAGE;
-int maildir_read_dir (CONTEXT *);
-int maildir_check_mailbox (CONTEXT *, int *);
-int maildir_check_empty (const char *);
+WHERE short DefaultMagic INITVAL (M_MBOX);
-int maildir_commit_message (CONTEXT *, MESSAGE *, HEADER *);
-int mh_commit_message (CONTEXT *, MESSAGE *, HEADER *);
+CONTEXT *mx_open_mailbox (const char *, int, CONTEXT *);
-int maildir_open_new_message (MESSAGE *, CONTEXT *, HEADER *);
-int mh_open_new_message (MESSAGE *, CONTEXT *, HEADER *);
+MESSAGE *mx_open_message (CONTEXT *, int);
+MESSAGE *mx_open_new_message (CONTEXT *, HEADER *, int);
-FILE *maildir_open_find_message (const char *, const char *);
+void mx_fastclose_mailbox (CONTEXT *);
-int mbox_strict_cmp_headers (const HEADER *, const HEADER *);
-int mutt_reopen_mailbox (CONTEXT *, int *);
+int mx_close_mailbox (CONTEXT *, int *);
+int mx_sync_mailbox (CONTEXT *, int *);
+int mx_commit_message (MESSAGE *, CONTEXT *);
+int mx_close_message (MESSAGE **);
+int mx_get_magic (const char *);
+int mx_set_magic (const char *);
+int mx_check_mailbox (CONTEXT *, int *, int);
+
+#ifdef USE_IMAP
+int mx_is_imap (const char *);
+#endif
+#ifdef USE_POP
+int mx_is_pop (const char *);
+#endif
+#ifdef USE_NNTP
+int mx_is_nntp (const char *);
+#endif
+
+int mx_access (const char *, int);
+int mx_check_empty (const char *);
void mx_alloc_memory (CONTEXT *);
void mx_update_context (CONTEXT *, int);
void mx_update_tables (CONTEXT *, int);
-
int mx_lock_file (const char *, int, int, int, int);
int mx_unlock_file (const char *path, int fd, int dot);
-
-#endif
+#endif /* !_MX_H */
#include "sort.h"
#include "mx.h"
#include "mime.h"
-#include "mailbox.h"
#include "nntp.h"
#include "rfc822.h"
#include "rfc1524.h"
#include "mime.h"
#include "rfc1524.h"
#include "rfc2047.h"
-#include "mailbox.h"
#include "nntp.h"
#ifdef HAVE_PGP
#define _NNTP_H_ 1
#include "mutt_socket.h"
-#include "mailbox.h"
+#include "mx.h"
#include <time.h>
#endif
#include "mutt.h"
-#include "mailbox.h"
+#include "mx.h"
#include "mime.h"
#include "rfc2047.h"
#include "rfc2231.h"
#endif
#include "mutt.h"
+#include "mx.h"
#include "mapping.h"
#include "keymap.h"
-#include "mailbox.h"
#include "copy.h"
#include "lib/mem.h"
#ifndef _POP_H
#define _POP_H 1
-#include "mailbox.h"
+#include "mx.h"
#include "mutt_socket.h"
#define POP_PORT 110
#include "mutt_menu.h"
#include "rfc1524.h"
#include "mime.h"
-#include "mailbox.h"
#include "mapping.h"
#include "sort.h"
#ifdef USE_IMAP
#include "mutt_menu.h"
#include "rfc1524.h"
#include "mime.h"
-#include "mailbox.h"
#include "attach.h"
#include "mapping.h"
#include "mx.h"
#include "mutt_menu.h"
#include "rfc1524.h"
#include "mime.h"
-#include "mailbox.h"
#include "attach.h"
#include "mapping.h"
#include "mx.h"
#include "rfc2047.h"
#include "keymap.h"
#include "mime.h"
-#include "mailbox.h"
#include "copy.h"
#include "mx.h"
#include "mutt_crypt.h"
#include "rfc2231.h"
#include "mx.h"
#include "mime.h"
-#include "mailbox.h"
#include "copy.h"
#include "pager.h"
#include "charset.h"