.close = imap_close_mailbox,
.open_msg = imap_fetch_message,
.close_msg = imap_close_message,
+ .commit_msg = imap_commit_message,
.open_new_msg = imap_open_new_message,
.check = imap_check_mailbox_reopen,
};
/* message.c */
int imap_append_message (CONTEXT* ctx, MESSAGE* msg);
int imap_copy_messages (CONTEXT* ctx, HEADER* h, char* dest, int delete);
-int imap_commit_message (CONTEXT *ctx, MESSAGE *msg);
/* socket.c */
void imap_logout_all (void);
int imap_fetch_message (CONTEXT *ctx, MESSAGE *msg, int msgno);
int imap_close_message (CONTEXT *ctx, MESSAGE *msg);
+int imap_commit_message (CONTEXT *ctx, MESSAGE *msg);
/* util.c */
#ifdef USE_HCACHE
return 0;
}
-int mbox_commit_message (CONTEXT *ctx, MESSAGE *msg)
+static int mbox_commit_message (CONTEXT *ctx, MESSAGE *msg)
{
int r = fputc ('\n', msg->fp);
return 0;
}
-int mmdf_commit_message (CONTEXT *ctx, MESSAGE *msg)
+static int mmdf_commit_message (CONTEXT *ctx, MESSAGE *msg)
{
int r = fputs (MMDF_SEP, msg->fp);
.close = mbox_close_mailbox,
.open_msg = mbox_open_message,
.close_msg = mbox_close_message,
+ .commit_msg = mbox_commit_message,
.open_new_msg = mbox_open_new_message,
.check = mbox_check_mailbox,
};
.close = mbox_close_mailbox,
.open_msg = mbox_open_message,
.close_msg = mbox_close_message,
+ .commit_msg = mmdf_commit_message,
.open_new_msg = mbox_open_new_message,
.check = mbox_check_mailbox,
};
}
}
-int maildir_commit_message (CONTEXT * ctx, MESSAGE * msg)
+static int maildir_commit_message (CONTEXT * ctx, MESSAGE * msg)
{
return _maildir_commit_message (ctx, msg, NULL);
}
return 0;
}
-int mh_commit_message (CONTEXT * ctx, MESSAGE * msg)
+static int mh_commit_message (CONTEXT * ctx, MESSAGE * msg)
{
return _mh_commit_message (ctx, msg, NULL, 1);
}
.close = mh_close_mailbox,
.open_msg = maildir_open_message,
.close_msg = mh_close_message,
+ .commit_msg = maildir_commit_message,
.open_new_msg = maildir_open_new_message,
.check = maildir_check_mailbox,
};
.close = mh_close_mailbox,
.open_msg = mh_open_message,
.close_msg = mh_close_message,
+ .commit_msg = mh_commit_message,
.open_new_msg = mh_open_new_message,
.check = mh_check_mailbox,
};
int (*check) (struct _context *ctx, int *index_hint);
int (*open_msg) (struct _context *, struct _message *, int msgno);
int (*close_msg) (struct _context *, struct _message *);
+ int (*commit_msg) (struct _context *, struct _message *);
int (*open_new_msg) (struct _message *, struct _context *, HEADER *);
};
int mx_commit_message (MESSAGE *msg, CONTEXT *ctx)
{
+ struct mx_ops *ops = mx_get_ops (ctx->magic);
int r = 0;
+ if (!ops || !ops->commit_msg)
+ return -1;
+
if (!(msg->write && ctx->append))
{
dprint (1, (debugfile, "mx_commit_message(): msg->write = %d, ctx->append = %d\n",
return -1;
}
- switch (ctx->magic)
- {
- case MUTT_MMDF:
- {
- r = mmdf_commit_message (ctx, msg);
- break;
- }
-
- case MUTT_MBOX:
- {
- r = mbox_commit_message (ctx, msg);
- break;
- }
-
-#ifdef USE_IMAP
- case MUTT_IMAP:
- {
- r = imap_commit_message (ctx, msg);
- break;
- }
-#endif
-
- case MUTT_MAILDIR:
- {
- r = maildir_commit_message (ctx, msg);
- break;
- }
-
- case MUTT_MH:
- {
- r = mh_commit_message (ctx, msg);
- break;
- }
- }
+ r = ops->commit_msg (ctx, msg);
if (r == 0 && (ctx->magic == MUTT_MBOX || ctx->magic == MUTT_MMDF)
&& (fflush (msg->fp) == EOF || fsync (fileno (msg->fp)) == -1))
void mbox_unlock_mailbox (CONTEXT *);
int mbox_check_empty (const char *);
void mbox_reset_atime (CONTEXT *, struct stat *);
-int mbox_commit_message (CONTEXT *ctx, MESSAGE *msg);
-int mmdf_commit_message (CONTEXT *ctx, MESSAGE *msg);
int mh_sync_mailbox (CONTEXT *, int *);
int mh_check_empty (const char *);
int maildir_check_empty (const char *);
-int maildir_commit_message (CONTEXT *, MESSAGE *);
-int mh_commit_message (CONTEXT *, MESSAGE *);
-
FILE *maildir_open_find_message (const char *, const char *);
int mbox_strict_cmp_headers (const HEADER *, const HEADER *);