always build imap as well.
[apps/madmutt.git] / mx.c
diff --git a/mx.c b/mx.c
index e38f696..28ba348 100644 (file)
--- a/mx.c
+++ b/mx.c
 #include "sidebar.h"
 #include "compress.h"
 
-#ifdef USE_IMAP
-#include "imap/imap.h"
-#include "imap/mx_imap.h"
-#endif
+#include <imap/imap.h>
+#include <imap/mx_imap.h>
 
 #include <pop/pop.h>
 #include <pop/mx_pop.h>
@@ -387,13 +385,9 @@ static int mx_open_mailbox_append (CONTEXT * ctx, int flags)
 
   ctx->append = 1;
 
-#ifdef USE_IMAP
-
   if (mx_get_magic (ctx->path) == M_IMAP)
     return imap_open_mailbox_append (ctx);
 
-#endif
-
   if (stat (ctx->path, &sb) == 0) {
     ctx->magic = mx_get_magic (ctx->path);
 
@@ -758,10 +752,8 @@ static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
     }
   }
 
-#ifdef USE_IMAP
   /* IMAP servers manage the OLD flag themselves */
   if (ctx->magic != M_IMAP)
-#endif
     if (option (OPTMARKOLD)) {
       for (i = 0; i < ctx->msgcount; i++) {
         if (!ctx->hdrs[i]->deleted && !ctx->hdrs[i]->old)
@@ -772,7 +764,6 @@ static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
   if (move_messages) {
     mutt_message (_("Moving read messages to %s..."), mbox);
 
-#ifdef USE_IMAP
     /* try to use server-side copy first */
     i = 1;
 
@@ -795,7 +786,6 @@ static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
       return -1;
     }
     else                        /* use regular append-copy mode */
-#endif
     {
       if (mx_open_mailbox (mbox, M_APPEND, &f) == NULL) {
         ctx->closing = 0;
@@ -836,7 +826,6 @@ static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
       return -1;
     }
 
-#ifdef USE_IMAP
   /* allow IMAP to preserve the deleted flag across sessions */
   if (ctx->magic == M_IMAP) {
     if ((check = imap_sync_mailbox (ctx, purge, index_hint)) != 0) {
@@ -845,7 +834,6 @@ static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
     }
   }
   else
-#endif
   {
     if (!purge) {
       for (i = 0; i < ctx->msgcount; i++)
@@ -1017,10 +1005,8 @@ static int _mx_sync_mailbox (CONTEXT * ctx, int *index_hint)
     else if (purge == M_NO) {
       if (!ctx->changed)
         return 0;               /* nothing to do! */
-#ifdef USE_IMAP
       /* let IMAP servers hold on to D flags */
       if (ctx->magic != M_IMAP)
-#endif
       {
         for (i = 0; i < ctx->msgcount; i++)
           ctx->hdrs[i]->deleted = 0;
@@ -1041,19 +1027,15 @@ static int _mx_sync_mailbox (CONTEXT * ctx, int *index_hint)
       return -1;
   }
 
-#ifdef USE_IMAP
   if (ctx->magic == M_IMAP)
     rc = imap_sync_mailbox (ctx, purge, index_hint);
   else
-#endif
     rc = sync_mailbox (ctx, index_hint);
   if (rc == 0) {
-#ifdef USE_IMAP
     if (ctx->magic == M_IMAP && !purge)
       mutt_message (_("Mailbox checkpointed."));
 
     else
-#endif
       mutt_message (_("%d kept, %d deleted."), msgcount - deleted, deleted);
 
     mutt_sleep (0);
@@ -1074,10 +1056,8 @@ static int _mx_sync_mailbox (CONTEXT * ctx, int *index_hint)
      * at least with the new threading code.
      */
     if (purge || (ctx->magic != M_MAILDIR && ctx->magic != M_MH)) {
-#ifdef USE_IMAP
       /* IMAP does this automatically after handling EXPUNGE */
       if (ctx->magic != M_IMAP)
-#endif
       {
         mx_update_tables (ctx, 1);
         mutt_sort_headers (ctx, 1);     /* rethread from scratch */
@@ -1196,14 +1176,12 @@ MESSAGE *mx_open_message (CONTEXT * ctx, int msgno)
     }
     break;
 
-#ifdef USE_IMAP
   case M_IMAP:
     {
       if (imap_fetch_message (msg, ctx, msgno) != 0)
         p_delete(&msg);
       break;
     }
-#endif /* USE_IMAP */
 
   case M_POP:
     {
@@ -1247,9 +1225,7 @@ int mx_close_message (MESSAGE ** msg)
   int r = 0;
 
   if ((*msg)->magic == M_MH || (*msg)->magic == M_MAILDIR
-#ifdef USE_IMAP
       || (*msg)->magic == M_IMAP
-#endif
       || (*msg)->magic == M_POP
 #ifdef USE_NNTP
       || (*msg)->magic == M_NNTP
@@ -1393,9 +1369,7 @@ void mx_init (void) {
   list_push_back (&MailboxFormats, (void*) mmdf_reg_mx ());
   list_push_back (&MailboxFormats, (void*) mh_reg_mx ());
   list_push_back (&MailboxFormats, (void*) maildir_reg_mx ());
-#ifdef USE_IMAP
   list_push_back (&MailboxFormats, (void*) imap_reg_mx ());
-#endif
   list_push_back (&MailboxFormats, (void*) pop_reg_mx ());
 #ifdef USE_NNTP
   list_push_back (&MailboxFormats, (void*) nntp_reg_mx ());
@@ -1431,11 +1405,7 @@ int mx_rebuild_cache (void) {
   for (i = 0; i < Incoming->length; i++) {
     b = (BUFFY*) Incoming->data[i];
     magic = mx_get_magic (b->path);
-    if (magic != M_MAILDIR && magic != M_MH
-#ifdef USE_IMAP
-        && magic != M_IMAP
-#endif
-    )
+    if (magic != M_MAILDIR && magic != M_MH && magic != M_IMAP)
       continue;
     sidebar_set_current (b->path);
     sidebar_draw (CurrentMenu);