#include "copy.h"
#include "keymap.h"
#include "compress.h"
+#include "dotlock.h"
#include <imap/imap.h>
-#include <imap/mx_imap.h>
-
#include <pop/pop.h>
-#include <pop/mx_pop.h>
#ifdef USE_NNTP
-#include "nntp/nntp.h"
-#include "nntp/mx_nntp.h"
-#endif
-
-#ifdef USE_DOTLOCK
-#include "dotlock.h"
+#include <nntp/nntp.h>
#endif
#include <lib-crypt/crypt.h>
#define MX_IDX(idx) (idx >= 0 && idx < countof(mxfmts))
#define mutt_is_spool(s) (m_strcmp(Spoolfile, s) == 0)
-#ifdef USE_DOTLOCK
/* parameters:
* path - file to lock
* retry - should retry if unable to lock?
*/
-
static int invoke_dotlock (const char *path, int flags, int retry)
{
char cmd[LONG_STRING + _POSIX_PATH_MAX];
DL_EX_OK ? 0 : -1);
}
-#endif /* USE_DOTLOCK */
-
/* looks up index of type for path in mxfmts */
static int mx_get_idx (const char* path) {
int i = 0, t = 0;
}
#endif /* USE_FLOCK */
-#ifdef USE_DOTLOCK
if (r == 0 && dot)
r = dotlock_file (path, time_out);
-#endif /* USE_DOTLOCK */
if (r == -1) {
/* release any other locks obtained in this routine */
flock (fd, LOCK_UN);
#endif
-#ifdef USE_DOTLOCK
if (dot)
undotlock_file (path);
-#endif
return 0;
}
{
int fd;
-#ifndef USE_DOTLOCK
- struct stat sb;
-#endif
-
if ((fd = open (path, O_RDWR)) == -1)
return;
return;
}
-#ifdef USE_DOTLOCK
- invoke_dotlock (path, DL_FL_UNLINK, 1);
-#else
- if (fstat (fd, &sb) == 0 && sb.st_size == 0)
- unlink (path);
-#endif
+ invoke_dotlock(path, DL_FL_UNLINK, 1);
mx_unlock_file (path, fd, 0);
close (fd);
p_delete(&ctx->hdrs);
p_delete(&ctx->v2r);
- if (ctx->compressinfo)
+ if (ctx->cinfo)
mutt_fast_close_compressed (ctx);
p_delete(&ctx->path);
/* the 1 is only of interest for IMAP and means EXPUNGE */
rc = mxfmts[ctx->magic-1]->mx_sync_mailbox(ctx,1,index_hint);
- if (rc == 0 && ctx->compressinfo)
+ if (rc == 0 && ctx->cinfo)
return mutt_sync_compressed (ctx);
return rc;
!mutt_is_spool (ctx->path) && !option (OPTSAVEEMPTY))
mx_unlink_empty (ctx->path);
- if (ctx->compressinfo && mutt_slow_close_compressed (ctx))
+ if (ctx->cinfo && mutt_slow_close_compressed (ctx))
return (-1);
mx_fastclose_mailbox (ctx);
/* check for new mail */
int mx_check_mailbox (CONTEXT * ctx, int *index_hint, int lock) {
- if (ctx->compressinfo)
+ if (ctx->cinfo)
return mutt_check_mailbox_compressed (ctx);
if (ctx) {