]> granicus.if.org Git - neomutt/commitdiff
merge mailbox.h and mx.h
authorRichard Russon <rich@flatcap.org>
Fri, 3 Aug 2018 13:41:45 +0000 (14:41 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 3 Aug 2018 19:42:33 +0000 (20:42 +0100)
34 files changed:
browser.c
buffy.c
commands.c
complete.c
compose.c
compress.c
copy.c
curs_main.c
editmsg.c
hook.c
imap/command.c
imap/imap.c
imap/message.c
imap/util.c
init.c
mailbox.h [deleted file]
maildir/mh.c
main.c
mbox/mbox.c
mutt_attach.c
mutt_lua.c
mutt_parse.c
muttlib.c
mx.c
mx.h
nntp/nntp.c
notmuch/mutt_notmuch.c
pager.c
pattern.c
pop/pop.c
postpone.c
recvattach.c
send.c
sendlib.c

index eafc0b47141b615ee3d2301393f343233e3bbf17..520d6b33524272a7f3ed74f7a838ff6c67dcc28c 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -47,7 +47,6 @@
 #include "format_flags.h"
 #include "globals.h"
 #include "keymap.h"
-#include "mailbox.h"
 #include "maildir/maildir.h"
 #include "menu.h"
 #include "mutt_attach.h"
diff --git a/buffy.c b/buffy.c
index 8423b7432f4a264ef334bc15c41912499098e58a..e09edf20966445431cdf35f7af0fcca8ac3abd0c 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -37,7 +37,6 @@
 #include "buffy.h"
 #include "context.h"
 #include "globals.h"
-#include "mailbox.h"
 #include "maildir/maildir.h"
 #include "menu.h"
 #include "mutt_window.h"
index d33ac933048f2d99354280690afecef7e814f8e0..a1cf850641f335b0c0eea0313fa4a6abba1a8538 100644 (file)
@@ -45,7 +45,6 @@
 #include "hdrline.h"
 #include "hook.h"
 #include "keymap.h"
-#include "mailbox.h"
 #include "menu.h"
 #include "mutt_curses.h"
 #include "mutt_logging.h"
index 5b1f04159f0f1fe55fef9fbe4dfc0dc0a0abd526..484056e73067cce911977b8ba8feb76881d701ca 100644 (file)
@@ -38,7 +38,7 @@
 #include "options.h"
 #ifdef USE_IMAP
 #include "imap/imap.h"
-#include "mailbox.h"
+#include "mx.h"
 #endif
 #ifdef USE_NNTP
 #include "nntp/nntp.h"
index 4a842738a9fa16d7885453dba95ad00ff00daeb4..46c7b9cad383b908f501d5a2fbde8d0656003dc4 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -46,7 +46,6 @@
 #include "globals.h"
 #include "hook.h"
 #include "keymap.h"
-#include "mailbox.h"
 #include "menu.h"
 #include "mutt_attach.h"
 #include "mutt_curses.h"
index c9095724260b12495fa6a47d53dffdcb390025a1..b78c006463422bee9d64ffb117c1ed979cbbe2b0 100644 (file)
@@ -42,7 +42,6 @@
 #include "format_flags.h"
 #include "globals.h"
 #include "hook.h"
-#include "mailbox.h"
 #include "mutt_curses.h"
 #include "muttlib.h"
 #include "mx.h"
diff --git a/copy.c b/copy.c
index d967210c3b73d734fa93382e93f6344859f1994a..18c22195ed58852f9f186ba779a98263e2b88b96 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -40,7 +40,6 @@
 #include "globals.h"
 #include "handler.h"
 #include "hdrline.h"
-#include "mailbox.h"
 #include "mutt_window.h"
 #include "muttlib.h"
 #include "mx.h"
index a5986e72dc3debb647d0d1f911fa6c71c90eb06b..93f40f8557d814951fd54ffaaba85d0b2acd54bb 100644 (file)
@@ -45,7 +45,6 @@
 #include "hdrline.h"
 #include "hook.h"
 #include "keymap.h"
-#include "mailbox.h"
 #include "menu.h"
 #include "mutt_curses.h"
 #include "mutt_header.h"
index f3c852a9e15eec5c75b6106f10c1dde6264165a0..c18cb672eda5405d3ecb50895515de7eaa3a7b06 100644 (file)
--- a/editmsg.c
+++ b/editmsg.c
@@ -43,7 +43,6 @@
 #include "copy.h"
 #include "curs_lib.h"
 #include "globals.h"
-#include "mailbox.h"
 #include "muttlib.h"
 #include "mx.h"
 #include "protos.h"
diff --git a/hook.c b/hook.c
index acb1327a50ba7e25f963f6706b63d8d32068a595..9d686062818ffe0147ceaf60c2c39f3ab1ea58e8 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -40,8 +40,8 @@
 #include "alias.h"
 #include "globals.h"
 #include "hdrline.h"
-#include "mailbox.h"
 #include "muttlib.h"
+#include "mx.h"
 #include "ncrypt/ncrypt.h"
 #include "pattern.h"
 #ifdef USE_COMPRESSED
index 71a1b90ffe547cf324508083a74452a407aff24d..895a1ea915a3def37bd2ff980b9745c70de326d8 100644 (file)
@@ -47,7 +47,6 @@
 #include "context.h"
 #include "globals.h"
 #include "imap/imap.h"
-#include "mailbox.h"
 #include "menu.h"
 #include "message.h"
 #include "mutt_account.h"
index 6fe1484d8b0ce7375d5e62ee64e603c353dc5a41..2fe3cd2a071be601a6ccb01c9cba28f16aae70e3 100644 (file)
@@ -49,7 +49,6 @@
 #include "context.h"
 #include "curs_lib.h"
 #include "globals.h"
-#include "mailbox.h"
 #include "message.h"
 #include "mutt_account.h"
 #include "mutt_logging.h"
index a6dfc61a4ca0b43c70e719b8d5d83567a9c7fdb4..62d235e8356bbf1b442b045b694a059adfe482e4 100644 (file)
@@ -46,7 +46,6 @@
 #include "curs_lib.h"
 #include "globals.h"
 #include "imap/imap.h"
-#include "mailbox.h"
 #include "mutt_account.h"
 #include "mutt_curses.h"
 #include "mutt_logging.h"
index 34147a532b5fe27245e3746d8c5e4be479fe1a33..0b0aa606d2a65cd331991d57f10910c2c682a3e2 100644 (file)
@@ -51,7 +51,6 @@
 #include "curs_lib.h"
 #include "globals.h"
 #include "imap/imap.h"
-#include "mailbox.h"
 #include "message.h"
 #include "mutt_account.h"
 #include "mx.h"
diff --git a/init.c b/init.c
index acf359bee0d089dadca946ef0dcbce079db13479..1460f4df2ecc3c1397757347042d926f0737f703 100644 (file)
--- a/init.c
+++ b/init.c
@@ -45,7 +45,6 @@
 #include "group.h"
 #include "hcache/hcache.h"
 #include "keymap.h"
-#include "mailbox.h"
 #include "menu.h"
 #include "mutt_curses.h"
 #include "mutt_window.h"
diff --git a/mailbox.h b/mailbox.h
deleted file mode 100644 (file)
index f1a19cd..0000000
--- a/mailbox.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * @file
- * Constants/structs for handling mailboxes
- *
- * @authors
- * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.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 <stdio.h>
-#include <time.h>
-
-struct Header;
-struct Context;
-
-/* flags for mutt_open_mailbox() */
-#define MUTT_NOSORT    (1 << 0) /**< do not sort the mailbox after opening it */
-#define MUTT_APPEND    (1 << 1) /**< open mailbox for appending messages */
-#define MUTT_READONLY  (1 << 2) /**< open in read-only mode */
-#define MUTT_QUIET     (1 << 3) /**< do not print any messages */
-#define MUTT_NEWFOLDER (1 << 4) /**< create a new folder - same as MUTT_APPEND, but uses
-                                 * mutt_file_fopen() with mode "w" for mbox-style folders.
-                                 * This will truncate an existing file. */
-#define MUTT_PEEK      (1 << 5) /**< revert atime back after taking a look (if applicable) */
-#define MUTT_APPENDNEW (1 << 6) /**< set in mx_open_mailbox_append if the mailbox doesn't
-                                 * exist. used by maildir/mh to create the mailbox. */
-
-/* mx_msg_open_new() */
-#define MUTT_ADD_FROM  (1 << 0) /**< add a From_ line */
-#define MUTT_SET_DRAFT (1 << 1) /**< set the message draft flag */
-
-/**
- * enum MxCheckReturns - Return values from mx_mbox_check()
- */
-enum MxCheckReturns
-{
-  MUTT_NEW_MAIL = 1, /**< new mail received in mailbox */
-  MUTT_LOCKED,       /**< couldn't lock the mailbox */
-  MUTT_REOPENED,     /**< mailbox was reopened */
-  MUTT_FLAGS         /**< nondestructive flags change (IMAP) */
-};
-
-/**
- * struct Message - A local copy of an email
- */
-struct Message
-{
-  FILE *fp;             /**< pointer to the message data */
-  char *path;           /**< path to temp file */
-  char *committed_path; /**< the final path generated by mx_msg_commit() */
-  bool write;           /**< nonzero if message is open for writing */
-  struct
-  {
-    bool read : 1;
-    bool flagged : 1;
-    bool replied : 1;
-    bool draft : 1;
-  } flags;
-  time_t received; /**< the time at which this message was received */
-};
-
-/* The Mailbox API, see MxOps */
-struct Context *mx_mbox_open   (const char *path, int flags, struct Context *pctx);
-int             mx_mbox_check  (struct Context *ctx, int *index_hint);
-int             mx_mbox_sync   (struct Context *ctx, int *index_hint);
-int             mx_mbox_close  (struct Context *ctx, int *index_hint);
-struct Message *mx_msg_open    (struct Context *ctx, int msgno);
-struct Message *mx_msg_open_new(struct Context *ctx, struct Header *hdr, int flags);
-int             mx_msg_commit  (struct Context *ctx, struct Message *msg);
-int             mx_msg_close   (struct Context *ctx, struct Message **msg);
-int             mx_tags_edit   (struct Context *ctx, const char *tags, char *buf, size_t buflen);
-int             mx_tags_commit (struct Context *ctx, struct Header *hdr, char *tags);
-
-void mx_fastclose_mailbox(struct Context *ctx);
-
-int mx_get_magic(const char *path);
-int mx_check_mailbox(struct Context *ctx, int *index_hint);
-#ifdef USE_IMAP
-bool mx_is_imap(const char *p);
-#endif
-#ifdef USE_POP
-bool mx_is_pop(const char *p);
-#endif
-#ifdef USE_NNTP
-bool mx_is_nntp(const char *p);
-#endif
-
-int mx_access(const char *path, int flags);
-int mx_check_empty(const char *path);
-
-#endif /* _MUTT_MAILBOX_H */
index d41129dd133ad680eb5630d23a5de14200d3d66c..451182f85a91579858f9acbf598b1305173c7158 100644 (file)
@@ -51,7 +51,6 @@
 #include "context.h"
 #include "copy.h"
 #include "globals.h"
-#include "mailbox.h"
 #include "maildir.h"
 #include "mutt_thread.h"
 #include "muttlib.h"
diff --git a/main.c b/main.c
index ac5621b173550d80f86be780d5a7a5b836fdb21e..b3140a83c217e576dfe1d12ac65e76bd1f2a9708 100644 (file)
--- a/main.c
+++ b/main.c
@@ -55,7 +55,6 @@
 #include "globals.h"
 #include "hook.h"
 #include "keymap.h"
-#include "mailbox.h"
 #include "menu.h"
 #include "mutt_curses.h"
 #include "mutt_history.h"
index 030ea0be993dc51fee3985afd68acb1f80304197..2222426abbd8264768fd89223baeac3b4d96d2d7 100644 (file)
@@ -45,7 +45,6 @@
 #include "context.h"
 #include "copy.h"
 #include "globals.h"
-#include "mailbox.h"
 #include "mutt_header.h"
 #include "mutt_thread.h"
 #include "muttlib.h"
index 64c0cd36f12d484ca57ab049ea09688566b6e64d..d3dbc24d2ce0fa49cc2592f52ae64d490152da29 100644 (file)
@@ -41,7 +41,6 @@
 #include "filter.h"
 #include "globals.h"
 #include "handler.h"
-#include "mailbox.h"
 #include "muttlib.h"
 #include "mx.h"
 #include "ncrypt/ncrypt.h"
index 170cf3bc2535f3b6a24d17e2cab7e448e1c65574..0740ac627f7966476657f887358588b1dd3ac9d2 100644 (file)
 #include "mutt.h"
 #include "mutt_lua.h"
 #include "globals.h"
-#include "mailbox.h"
 #include "mutt_commands.h"
 #include "mutt_options.h"
 #include "muttlib.h"
+#include "mx.h"
 #include "myvar.h"
 
 /**
index 186a04103a3a63dd33fda28159409c05703816c7..d0f678e1240f18081190e1de79101c1a0c2d9160 100644 (file)
@@ -29,7 +29,7 @@
 #include "mutt.h"
 #include "mutt_parse.h"
 #include "globals.h"
-#include "mailbox.h"
+#include "mx.h"
 #include "ncrypt/ncrypt.h"
 
 struct Context;
index 04165fbec612ce6780b93c995193d524c5b510a6..520c386605486c46e9991a57e581231e3848a3b2 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -47,7 +47,6 @@
 #include "format_flags.h"
 #include "globals.h"
 #include "hook.h"
-#include "mailbox.h"
 #include "mutt_window.h"
 #include "mx.h"
 #include "ncrypt/ncrypt.h"
diff --git a/mx.c b/mx.c
index 0cb77c4b54b8951178d7f0c5200e9b15639ce482..3fb05e97860e42f22484e66c4f154cadc968c9c8 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -47,7 +47,6 @@
 #include "globals.h"
 #include "hook.h"
 #include "keymap.h"
-#include "mailbox.h"
 #include "maildir/maildir.h"
 #include "mbox/mbox.h"
 #include "mutt_header.h"
diff --git a/mx.h b/mx.h
index 3add32c6f667533bc6c81be03ed99f8efce37eb0..d65f05414bd74dc78a7d16ba9f8103f394ff9893 100644 (file)
--- a/mx.h
+++ b/mx.h
@@ -26,6 +26,7 @@
 
 #include <stdbool.h>
 #include <stdio.h>
+#include <time.h>
 #include "where.h"
 #ifdef USE_HCACHE
 #include "hcache/hcache.h"
@@ -163,4 +164,79 @@ struct MxOps *mx_get_ops(int magic);
 /* This variable is backing for a config item */
 WHERE short MboxType;  ///< Config: Default type for creating new mailboxes
 
+/* flags for mutt_open_mailbox() */
+#define MUTT_NOSORT    (1 << 0) /**< do not sort the mailbox after opening it */
+#define MUTT_APPEND    (1 << 1) /**< open mailbox for appending messages */
+#define MUTT_READONLY  (1 << 2) /**< open in read-only mode */
+#define MUTT_QUIET     (1 << 3) /**< do not print any messages */
+#define MUTT_NEWFOLDER (1 << 4) /**< create a new folder - same as MUTT_APPEND, but uses
+                                 * mutt_file_fopen() with mode "w" for mbox-style folders.
+                                 * This will truncate an existing file. */
+#define MUTT_PEEK      (1 << 5) /**< revert atime back after taking a look (if applicable) */
+#define MUTT_APPENDNEW (1 << 6) /**< set in mx_open_mailbox_append if the mailbox doesn't
+                                 * exist. used by maildir/mh to create the mailbox. */
+
+/* mx_msg_open_new() */
+#define MUTT_ADD_FROM  (1 << 0) /**< add a From_ line */
+#define MUTT_SET_DRAFT (1 << 1) /**< set the message draft flag */
+
+/**
+ * enum MxCheckReturns - Return values from mx_mbox_check()
+ */
+enum MxCheckReturns
+{
+  MUTT_NEW_MAIL = 1, /**< new mail received in mailbox */
+  MUTT_LOCKED,       /**< couldn't lock the mailbox */
+  MUTT_REOPENED,     /**< mailbox was reopened */
+  MUTT_FLAGS         /**< nondestructive flags change (IMAP) */
+};
+
+/**
+ * struct Message - A local copy of an email
+ */
+struct Message
+{
+  FILE *fp;             /**< pointer to the message data */
+  char *path;           /**< path to temp file */
+  char *committed_path; /**< the final path generated by mx_msg_commit() */
+  bool write;           /**< nonzero if message is open for writing */
+  struct
+  {
+    bool read : 1;
+    bool flagged : 1;
+    bool replied : 1;
+    bool draft : 1;
+  } flags;
+  time_t received; /**< the time at which this message was received */
+};
+
+/* The Mailbox API, see MxOps */
+struct Context *mx_mbox_open   (const char *path, int flags, struct Context *pctx);
+int             mx_mbox_check  (struct Context *ctx, int *index_hint);
+int             mx_mbox_sync   (struct Context *ctx, int *index_hint);
+int             mx_mbox_close  (struct Context *ctx, int *index_hint);
+struct Message *mx_msg_open    (struct Context *ctx, int msgno);
+struct Message *mx_msg_open_new(struct Context *ctx, struct Header *hdr, int flags);
+int             mx_msg_commit  (struct Context *ctx, struct Message *msg);
+int             mx_msg_close   (struct Context *ctx, struct Message **msg);
+int             mx_tags_edit   (struct Context *ctx, const char *tags, char *buf, size_t buflen);
+int             mx_tags_commit (struct Context *ctx, struct Header *hdr, char *tags);
+
+void mx_fastclose_mailbox(struct Context *ctx);
+
+int mx_get_magic(const char *path);
+int mx_check_mailbox(struct Context *ctx, int *index_hint);
+#ifdef USE_IMAP
+bool mx_is_imap(const char *p);
+#endif
+#ifdef USE_POP
+bool mx_is_pop(const char *p);
+#endif
+#ifdef USE_NNTP
+bool mx_is_nntp(const char *p);
+#endif
+
+int mx_access(const char *path, int flags);
+int mx_check_empty(const char *path);
+
 #endif /* _MUTT_MX_H */
index 1208ef27971636aa7cce02e82512c40113ae75b1..d52f90015e3c1b40dd0cd789475c0b8b0a9c4b3c 100644 (file)
@@ -45,7 +45,6 @@
 #include "context.h"
 #include "curs_lib.h"
 #include "globals.h"
-#include "mailbox.h"
 #include "mutt_account.h"
 #include "mutt_logging.h"
 #include "mutt_parse.h"
index ed5076c0117b71db6a5264ac187805afc286934c..2cb8a9bc4647d9b91778bf08909491875949d796 100644 (file)
@@ -63,7 +63,6 @@
 #include "curs_lib.h"
 #include "curs_main.h"
 #include "globals.h"
-#include "mailbox.h"
 #include "maildir/maildir.h"
 #include "mutt_logging.h"
 #include "mutt_thread.h"
diff --git a/pager.c b/pager.c
index 9fb8f2719948585f6e1ac6519877f4a529c77ddb..68d02b186f536e2736066d30da7a6b5470bcce7d 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -48,7 +48,6 @@
 #include "hdrline.h"
 #include "hook.h"
 #include "keymap.h"
-#include "mailbox.h"
 #include "menu.h"
 #include "mutt_attach.h"
 #include "mutt_curses.h"
index c2e698df4d3e25bd0965cfa5877925c8e4ce08f6..90ac3a584ec17143991803d78341898cd17e2c86 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -45,7 +45,6 @@
 #include "group.h"
 #include "handler.h"
 #include "hdrline.h"
-#include "mailbox.h"
 #include "menu.h"
 #include "mutt_logging.h"
 #include "mutt_parse.h"
index f943823d19c33497ab6fbc17e2e96355d1e62299..496c3cb0b4cfe6c1260e2d4244b16ceb6fdd1365 100644 (file)
--- a/pop/pop.c
+++ b/pop/pop.c
@@ -46,7 +46,6 @@
 #include "bcache.h"
 #include "context.h"
 #include "globals.h"
-#include "mailbox.h"
 #include "mutt_account.h"
 #include "mutt_header.h"
 #include "mutt_logging.h"
index b7cb326073b42848e250ca5e858b9794f70e8d2f..9420373ab3490ddfcee29caa9add02a0f38d40ff 100644 (file)
@@ -46,7 +46,6 @@
 #include "handler.h"
 #include "hdrline.h"
 #include "keymap.h"
-#include "mailbox.h"
 #include "menu.h"
 #include "mutt_logging.h"
 #include "mutt_thread.h"
index 4681fbe8b1ff0073934472d50b09adc7be4b594c..e2b5258b5c5a7e9da76bbb2428295f3651685346 100644 (file)
@@ -43,7 +43,6 @@
 #include "hdrline.h"
 #include "hook.h"
 #include "keymap.h"
-#include "mailbox.h"
 #include "menu.h"
 #include "mutt_attach.h"
 #include "mutt_logging.h"
diff --git a/send.c b/send.c
index 5984f230293024be496bdff0257542a6191f0b58..9dfdfbd80f89fd0e65502898c55a0570f4ed2f95 100644 (file)
--- a/send.c
+++ b/send.c
@@ -46,7 +46,6 @@
 #include "globals.h"
 #include "hdrline.h"
 #include "hook.h"
-#include "mailbox.h"
 #include "mutt_attach.h"
 #include "mutt_header.h"
 #include "mutt_logging.h"
index 12956f581065e9d9bea0b0886e701c9d08a3c160..cd2242860cb38ea7638159fb40e1da44f3b80d97 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -47,7 +47,6 @@
 #include "filter.h"
 #include "globals.h"
 #include "handler.h"
-#include "mailbox.h"
 #include "mutt_parse.h"
 #include "mutt_window.h"
 #include "muttlib.h"