]> granicus.if.org Git - neomutt/commitdiff
create libmaildir
authorRichard Russon <rich@flatcap.org>
Sat, 7 Jul 2018 11:06:31 +0000 (12:06 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 16 Jul 2018 22:13:05 +0000 (23:13 +0100)
Makefile.autosetup
browser.c
buffy.c
buffy.h
mailbox.h
maildir/maildir.h [new file with mode: 0644]
maildir/mh.c [moved from mh.c with 99% similarity]
mx.c
mx.h
notmuch/mutt_notmuch.c
po/POTFILES.in

index 8dce07a1f0ca8bbc2c0de67c0923c1689df66c5f..469963b3a82fcd51d5d9ffcb4d9c6bd20425d5a4 100644 (file)
@@ -66,7 +66,7 @@ NEOMUTTOBJS=  addrbook.o alias.o bcache.o browser.o buffy.o \
                conststrings.o copy.o curs_lib.o curs_main.o edit.o editmsg.o \
                enriched.o enter.o filter.o flags.o from.o group.o handler.o \
                hdrline.o help.o history.o hook.o init.o keymap.o \
-               main.o menu.o mh.o muttlib.o mutt_account.o mutt_attach.o mutt_body.o mutt_header.o \
+               main.o menu.o muttlib.o mutt_account.o mutt_attach.o mutt_body.o mutt_header.o \
                mutt_logging.o mutt_signal.o mutt_socket.o mutt_thread.o mutt_window.o mx.o \
                pager.o parse.o pattern.o \
                postpone.o progress.o query.o recvattach.o recvcmd.o resize.o rfc1524.o \
@@ -129,6 +129,14 @@ MUTTLIBS+= $(LIBNOTMUCH)
 ALLOBJS+=      $(LIBNOTMUCHOBJS)
 @endif
 
+###############################################################################
+# libmaildir
+LIBMAILDIR=    libmaildir.a
+LIBMAILDIROBJS=        maildir/mh.o
+CLEANFILES+=   $(LIBMAILDIR) $(LIBMAILDIROBJS)
+MUTTLIBS+=     $(LIBMAILDIR)
+ALLOBJS+=      $(LIBMAILDIROBJS)
+
 ###############################################################################
 # libmutt
 LIBMUTT=       libmutt.a
@@ -294,6 +302,13 @@ $(LIBNOTMUCH): $(PWD)/notmuch $(LIBNOTMUCHOBJS)
 $(PWD)/notmuch:
        $(MKDIR_P) $(PWD)/notmuch
 
+# libmaildir
+$(LIBMAILDIR): $(PWD)/maildir $(LIBMAILDIROBJS)
+       $(AR) cr $@ $(LIBMAILDIROBJS)
+       $(RANLIB) $@
+$(PWD)/maildir:
+       $(MKDIR_P) $(PWD)/maildir
+
 # libncrypt
 $(LIBNCRYPT): $(PWD)/ncrypt $(LIBNCRYPTOBJS)
        $(AR) cr $@ $(LIBNCRYPTOBJS)
index e22e2743ed3aaa80db7866f66ec3f4f45beb60cf..ce2e73ef8ff33b27ac804d630ccfcc461e3d7dac 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -45,6 +45,7 @@
 #include "globals.h"
 #include "keymap.h"
 #include "mailbox.h"
+#include "maildir/maildir.h"
 #include "mutt_attach.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
diff --git a/buffy.c b/buffy.c
index c04e0504d574232b7662ca15d29215a7aff57650..b8c2851eb3b5b451ce0bbadff87f1a01ef92f2ff 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -35,6 +35,7 @@
 #include "context.h"
 #include "globals.h"
 #include "mailbox.h"
+#include "maildir/maildir.h"
 #include "mutt_menu.h"
 #include "mutt_window.h"
 #include "mx.h"
diff --git a/buffy.h b/buffy.h
index 8368989d1dfa5f0d256b7fecf5c732183a53912b..55d2468c255e62f1150d9cb4fa099d5cd1d5a4e1 100644 (file)
--- a/buffy.h
+++ b/buffy.h
@@ -76,8 +76,6 @@ void mutt_buffy_cleanup(const char *path, struct stat *st);
 /** mark mailbox just left as already notified */
 void mutt_buffy_setnotified(const char *path);
 
-bool mh_buffy(struct Buffy *mailbox, bool check_stats);
-
 /* force flags passed to mutt_buffy_check() */
 #define MUTT_BUFFY_CHECK_FORCE       (1 << 0)
 #define MUTT_BUFFY_CHECK_FORCE_STATS (1 << 1)
index ffe51fa0093a7fd32910430e5012cf0b5851e6db..2b765a1bc2426293dbbee184dc888b7ebbdfc866 100644 (file)
--- a/mailbox.h
+++ b/mailbox.h
@@ -105,7 +105,4 @@ bool mx_is_nntp(const char *p);
 int mx_access(const char *path, int flags);
 int mx_check_empty(const char *path);
 
-bool mx_is_maildir(const char *path);
-bool mx_is_mh(const char *path);
-
 #endif /* _MUTT_MAILBOX_H */
diff --git a/maildir/maildir.h b/maildir/maildir.h
new file mode 100644 (file)
index 0000000..3447933
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * @file
+ * Maildir local mailbox type
+ *
+ * @authors
+ * 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 _MAILDIR_MAILDIR_H
+#define _MAILDIR_MAILDIR_H
+
+#include <stdbool.h>
+#include <stdio.h>
+#include "mx.h"
+#ifdef USE_HCACHE
+#include "hcache/hcache.h"
+#endif
+
+struct Buffy;
+struct Context;
+struct Header;
+
+extern struct MxOps mx_maildir_ops;
+extern struct MxOps mx_mh_ops;
+
+int            maildir_check_empty(const char *path);
+void           maildir_flags(char *dest, size_t destlen, struct Header *hdr);
+FILE *         maildir_open_find_message(const char *folder, const char *msg, char **newname);
+void           maildir_parse_flags(struct Header *h, const char *path);
+struct Header *maildir_parse_message(int magic, const char *fname, bool is_old, struct Header *h);
+struct Header *maildir_parse_stream(int magic, FILE *f, const char *fname, bool is_old, struct Header *h);
+bool           maildir_update_flags(struct Context *ctx, struct Header *o, struct Header *n);
+
+bool           mh_buffy(struct Buffy *mailbox, bool check_stats);
+int            mh_check_empty(const char *path);
+
+bool           mx_is_maildir(const char *path);
+bool           mx_is_mh(const char *path);
+
+#ifdef USE_HCACHE
+int            mh_sync_mailbox_message(struct Context *ctx, int msgno, header_cache_t *hc);
+#else
+int            mh_sync_mailbox_message(struct Context *ctx, int msgno);
+#endif
+
+#endif /* _MAILDIR_MAILDIR_H */
similarity index 99%
rename from mh.c
rename to maildir/mh.c
index 5c05eb7a50c13ab7e52b9ce15e4c59c2ff8fdc42..7409f4a469a9c01a8037e1d008e9e744dcb9b3eb 100644 (file)
--- a/mh.c
@@ -46,6 +46,7 @@
 #include "copy.h"
 #include "globals.h"
 #include "mailbox.h"
+#include "maildir.h"
 #include "mutt_thread.h"
 #include "mx.h"
 #include "options.h"
diff --git a/mx.c b/mx.c
index f6900daca08c9623cb667fd710306b17aa208b61..e1cb8ce8a04456a1c26510d977ed12f8cf431b62 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -47,6 +47,7 @@
 #include "globals.h"
 #include "keymap.h"
 #include "mailbox.h"
+#include "maildir/maildir.h"
 #include "mbox/mbox.h"
 #include "mutt_header.h"
 #include "mutt_thread.h"
diff --git a/mx.h b/mx.h
index c137f99d52b22a13327054cf755f6f2705069fc2..1d0ff7559b54852da7170f73209a5ce827462553 100644 (file)
--- a/mx.h
+++ b/mx.h
@@ -158,37 +158,17 @@ enum MailboxFormat
 
 void mbox_reset_atime(struct Context *ctx, struct stat *st);
 
-int mh_check_empty(const char *path);
-
-int maildir_check_empty(const char *path);
-
-struct Header *maildir_parse_message(int magic, const char *fname, bool is_old, struct Header *h);
-struct Header *maildir_parse_stream(int magic, FILE *f, const char *fname, bool is_old, struct Header *h);
-void maildir_parse_flags(struct Header *h, const char *path);
-bool maildir_update_flags(struct Context *ctx, struct Header *o, struct Header *n);
-void maildir_flags(char *dest, size_t destlen, struct Header *hdr);
-
-#ifdef USE_HCACHE
-int mh_sync_mailbox_message(struct Context *ctx, int msgno, header_cache_t *hc);
-#else
-int mh_sync_mailbox_message(struct Context *ctx, int msgno);
-#endif
-
 #ifdef USE_NOTMUCH
 bool mx_is_notmuch(const char *p);
 #endif
 
 bool mx_tags_is_supported(struct Context *ctx);
 
-FILE *maildir_open_find_message(const char *folder, const char *msg, char **newname);
-
 void mx_alloc_memory(struct Context *ctx);
 void mx_update_context(struct Context *ctx, int new_messages);
 void mx_update_tables(struct Context *ctx, bool committing);
 
 struct MxOps *mx_get_ops(int magic);
-extern struct MxOps mx_maildir_ops;
-extern struct MxOps mx_mh_ops;
 
 /* This variable is backing for a config item */
 WHERE short MboxType;
index 2e31493fb316db1dc6b0d8b7956b28cc89499c20..906c3f1e51de058281e3ddafcfa7b987f5a7596e 100644 (file)
@@ -54,6 +54,7 @@
 #include "context.h"
 #include "globals.h"
 #include "mailbox.h"
+#include "maildir/maildir.h"
 #include "mutt_thread.h"
 #include "mx.h"
 #include "progress.h"
index f85b721ca2200431d26abc106b11ed019cae5542..f00d7a11ad16da22adc9b180b1a9d80afce9e2ec 100644 (file)
@@ -63,10 +63,10 @@ imap/utf7.c
 imap/util.c
 init.c
 keymap.c
+maildir/mh.c
 main.c
 mbox/mbox.c
 menu.c
-mh.c
 mutt/base64.c
 mutt/buffer.c
 mutt/charset.c