remove useless things
[apps/madmutt.git] / mbox.c
diff --git a/mbox.c b/mbox.c
index d4125b0..3832eee 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -9,22 +9,9 @@
 
 /* This file contains code to parse ``mbox'' and ``mmdf'' style mailboxes */
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <sys/stat.h>
-#include <dirent.h>
-#include <string.h>
-#include <utime.h>
-#include <sys/file.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-
 #include <lib-lib/lib-lib.h>
-#include <lib-ui/curses.h>
 
+#include <lib-ui/curses.h>
 #include <lib-sys/mutt_signal.h>
 
 #include "mutt.h"
@@ -74,7 +61,7 @@ int mbox_lock_mailbox (CONTEXT * ctx, int excl, int retry)
   return (r);
 }
 
-void mbox_unlock_mailbox (CONTEXT * ctx)
+static void mbox_unlock_mailbox (CONTEXT * ctx)
 {
   if (ctx->locked) {
     fflush (ctx->fp);
@@ -503,7 +490,7 @@ static int mbox_check_mailbox (CONTEXT* ctx, int* index_hint, int lock) {
  *     0       success
  *     -1      failure
  */
-static int _mbox_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused)), int *index_hint)
+static int mbox_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused)), int *index_hint)
 {
   char tempfile[_POSIX_PATH_MAX];
   char buf[32];
@@ -819,19 +806,6 @@ bail:                          /* Come here in case of disaster */
   return rc;
 }
 
-static int mbox_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) {
-#ifdef BUFFY_SIZE
-  BUFFY* tmp = NULL;
-#endif
-  int rc = _mbox_sync_mailbox (ctx, unused, index_hint);
-
-#ifdef BUFFY_SIZE
-  if ((tmp = buffy_find_mailbox (ctx->path)) && tmp->new == 0)
-    buffy_update_mailbox (tmp);
-#endif
-  return (rc);
-}
-
 /* close a mailbox opened in write-mode */
 int mbox_close_mailbox (CONTEXT * ctx)
 {
@@ -1036,16 +1010,15 @@ int mbox_is_magic (const char* path, struct stat* st) {
       return (M_MBOX);
   }
   else if ((f = fopen (path, "r")) != NULL) {
-#ifndef BUFFY_SIZE
     struct utimbuf times;
-#endif
+
     fgets (tmp, sizeof (tmp), f);
     if (m_strncmp("From ", tmp, 5) == 0)
       magic = M_MBOX;
     else if (m_strcmp(MMDF_SEP, tmp) == 0)
       magic = M_MMDF;
     safe_fclose (&f);
-#ifndef BUFFY_SIZE
+
     /* need to restore the times here, the file was not really accessed,
      * only the type was accessed.  This is important, because detection
      * of "new mail" depends on those times set correctly.
@@ -1053,7 +1026,6 @@ int mbox_is_magic (const char* path, struct stat* st) {
     times.actime = st->st_atime;
     times.modtime = st->st_mtime;
     utime (path, &times);
-#endif
   } else {
     mutt_perror (path);
     return (-1);         /* fopen failed */
@@ -1083,28 +1055,32 @@ static int mmdf_commit_message (MESSAGE* msg, CONTEXT* ctx) {
   return (commit_message (msg, ctx, 0));
 }
 
-static mx_t* reg_mx (void) {
-  mx_t* fmt = p_new(mx_t, 1);
-  fmt->local = 1;
-  fmt->mx_check_empty = mbox_check_empty;
-  fmt->mx_is_magic = mbox_is_magic;
-  fmt->mx_access = access;
-  fmt->mx_open_mailbox = mbox_open_mailbox;
-  fmt->mx_open_new_message = mbox_open_new_message;
-  fmt->mx_sync_mailbox = mbox_sync_mailbox;
-  fmt->mx_check_mailbox = mbox_check_mailbox;
-  return (fmt);
-}
+mx_t const mbox_mx = {
+    M_MBOX,
+    1,
+    mbox_is_magic,
+    mbox_check_empty,
+    access,
+    mbox_open_mailbox,
+    mbox_open_new_message,
+    NULL,
+    mbox_check_mailbox,
+    NULL,
+    mbox_sync_mailbox,
+    mbox_commit_message,
+};
 
-mx_t* mbox_reg_mx (void) {
-  mx_t* fmt = reg_mx ();
-  fmt->type = M_MBOX;
-  fmt->mx_commit_message = mbox_commit_message;
-  return (fmt);
-}
-mx_t* mmdf_reg_mx (void) {
-  mx_t* fmt = reg_mx ();
-  fmt->type = M_MMDF;
-  fmt->mx_commit_message = mmdf_commit_message;
-  return (fmt);
-}
+mx_t const mmdf_mx = {
+    M_MMDF,
+    1,
+    mbox_is_magic,
+    mbox_check_empty,
+    access,
+    mbox_open_mailbox,
+    mbox_open_new_message,
+    NULL,
+    mbox_check_mailbox,
+    NULL,
+    mbox_sync_mailbox,
+    mmdf_commit_message,
+};