#include <lib-lib/ascii.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
+#include <lib-lib/file.h>
+
+#include <lib-mime/mime.h>
#include "mutt.h"
#include "buffy.h"
#include "mx.h"
#include "mbox.h"
#include "mh.h"
-#include "rfc2047.h"
#include "sort.h"
#include "thread.h"
#include "copy.h"
#include "keymap.h"
#include "url.h"
#include "sidebar.h"
-
-#ifdef USE_COMPRESSED
#include "compress.h"
-#endif
#ifdef USE_IMAP
#include "imap/imap.h"
#include "imap/mx_imap.h"
#endif
-#ifdef USE_POP
-#include "pop/pop.h"
-#include "pop/mx_pop.h"
-#endif
+#include <pop/pop.h>
+#include <pop/mx_pop.h>
#ifdef USE_NNTP
#include "nntp/nntp.h"
#define MX_COMMAND(idx,cmd) ((mx_t*) MailboxFormats->data[idx])->cmd
#define MX_IDX(idx) (idx >= 0 && idx < MailboxFormats->length)
-#define mutt_is_spool(s) (str_cmp (Spoolfile, s) == 0)
+#define mutt_is_spool(s) (m_strcmp(Spoolfile, s) == 0)
#ifdef USE_DOTLOCK
/* parameters:
* retry - should retry if unable to lock?
*/
-#ifdef DL_STANDALONE
-
static int invoke_dotlock (const char *path, int dummy, int flags, int retry)
{
char cmd[LONG_STRING + _POSIX_PATH_MAX];
return mutt_system (cmd);
}
-#else
-
-#define invoke_dotlock dotlock_invoke
-
-#endif
-
static int dotlock_file (const char *path, int fd, int retry)
{
int r;
struct flock lck;
- memset (&lck, 0, sizeof (struct flock));
+ p_clear(&lck, 1);
lck.l_type = excl ? F_WRLCK : F_RDLCK;
lck.l_whence = SEEK_SET;
#ifdef USE_FCNTL
struct flock unlockit;
- memset (&unlockit, 0, sizeof (struct flock));
+ p_clear(&unlockit, 1);
unlockit.l_type = F_UNLCK;
unlockit.l_whence = SEEK_SET;
fcntl (fd, F_SETLK, &unlockit);
{
struct stat sb;
-#ifdef USE_COMPRESSED
/* special case for appending to compressed folders -
* even if we can not open them for reading */
if (mutt_can_append_compressed (ctx->path))
mutt_open_append_compressed (ctx);
-#endif
ctx->append = 1;
if (!MX_IDX(ctx->magic-1))
ctx->magic = mx_get_magic (path);
-#ifdef USE_COMPRESSED
if (ctx->magic == M_COMPRESSED)
mutt_open_read_compressed (ctx);
-#endif
if (ctx->magic == 0)
mutt_error (_("%s is not a mailbox."), path);
mutt_free_header (&ctx->hdrs[i]);
p_delete(&ctx->hdrs);
p_delete(&ctx->v2r);
-#ifdef USE_COMPRESSED
+
if (ctx->compressinfo)
mutt_fast_close_compressed (ctx);
-#endif
+
p_delete(&ctx->path);
p_delete(&ctx->pattern);
if (ctx->limit_pattern)
mutt_pattern_free (&ctx->limit_pattern);
safe_fclose (&ctx->fp);
- memset (ctx, 0, sizeof (CONTEXT));
+ p_clear(ctx, 1);
}
/* save changes to disk */
/* the 1 is only of interest for IMAP and means EXPUNGE */
rc = MX_COMMAND(ctx->magic-1,mx_sync_mailbox(ctx,1,index_hint));
-#ifdef USE_COMPRESSED
if (rc == 0 && ctx->compressinfo)
return mutt_sync_compressed (ctx);
-#endif
return rc;
}
if ((p = mutt_find_hook (M_MBOXHOOK, ctx->path))) {
isSpool = 1;
- strfcpy (mbox, p, sizeof (mbox));
+ m_strcpy(mbox, sizeof(mbox), p);
}
else {
- strfcpy (mbox, NONULL (Inbox), sizeof (mbox));
+ m_strcpy(mbox, sizeof(mbox), NONULL(Inbox));
isSpool = mutt_is_spool (ctx->path) && !mutt_is_spool (mbox);
}
mutt_expand_path (mbox, sizeof (mbox));
!mutt_is_spool (ctx->path) && !option (OPTSAVEEMPTY))
mx_unlink_empty (ctx->path);
-#ifdef USE_COMPRESSED
if (ctx->compressinfo && mutt_slow_close_compressed (ctx))
return (-1);
-#endif
mx_fastclose_mailbox (ctx);
km_find_func (MENU_MAIN, OP_TOGGLE_WRITE)))
snprintf (tmp, sizeof (tmp), _(" Press '%s' to toggle write"), buf);
else
- strfcpy (tmp, _("Use 'toggle-write' to re-enable write!"),
- sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), _("Use 'toggle-write' to re-enable write!"));
mutt_error (_("Mailbox is marked unwritable. %s"), tmp);
return -1;
MESSAGE *mx_open_new_message (CONTEXT * dest, HEADER * hdr, int flags)
{
MESSAGE *msg;
- ADDRESS *p = NULL;
+ address_t *p = NULL;
if (!MX_IDX(dest->magic-1)) {
debug_print (1, ("function unimplemented for mailbox type %d.\n", dest->magic));
/* check for new mail */
int mx_check_mailbox (CONTEXT * ctx, int *index_hint, int lock) {
-#ifdef USE_COMPRESSED
if (ctx->compressinfo)
return mutt_check_mailbox_compressed (ctx);
-#endif
if (ctx) {
if (ctx->locked)
}
#endif /* USE_IMAP */
-#ifdef USE_POP
case M_POP:
{
if (pop_fetch_message (msg, ctx, msgno) != 0)
p_delete(&msg);
break;
}
-#endif /* USE_POP */
#ifdef USE_NNTP
case M_NNTP:
#ifdef USE_IMAP
|| (*msg)->magic == M_IMAP
#endif
-#ifdef USE_POP
|| (*msg)->magic == M_POP
-#endif
#ifdef USE_NNTP
|| (*msg)->magic == M_NNTP
#endif
for (msgno = ctx->msgcount - new_messages; msgno < ctx->msgcount; msgno++) {
h = ctx->hdrs[msgno];
- if (WithCrypto) {
- /* NOTE: this _must_ be done before the check for mailcap! */
- h->security = crypt_query (h->content);
- }
+ /* NOTE: this _must_ be done before the check for mailcap! */
+ h->security = crypt_query (h->content);
if (!ctx->pattern) {
ctx->v2r[ctx->vcount] = msgno;
#ifdef USE_IMAP
list_push_back (&MailboxFormats, (void*) imap_reg_mx ());
#endif
-#ifdef USE_POP
list_push_back (&MailboxFormats, (void*) pop_reg_mx ());
-#endif
#ifdef USE_NNTP
list_push_back (&MailboxFormats, (void*) nntp_reg_mx ());
#endif
-#ifdef USE_COMPRESSED
list_push_back (&MailboxFormats, (void*) compress_reg_mx ());
-#endif
#ifdef DEBUG
/* check module registration for completeness with debug versions */
#define EXITWITHERR(m) do { fprintf(stderr, "error: incomplete mx module: %s is missing for type %i\n",m,i);exit(1); } while (0)