.open = imap_open_mailbox,
.close = imap_close_mailbox,
.open_msg = imap_fetch_message,
+ .close_msg = imap_close_message,
.open_new_msg = imap_open_new_message,
.check = imap_check_mailbox_reopen,
};
int imap_cache_clean (IMAP_DATA* idata);
int imap_fetch_message (CONTEXT *ctx, MESSAGE *msg, int msgno);
+int imap_close_message (CONTEXT *ctx, MESSAGE *msg);
/* util.c */
#ifdef USE_HCACHE
return -1;
}
+int imap_close_message (CONTEXT *ctx, MESSAGE *msg)
+{
+ return safe_fclose (&msg->fp);
+}
+
int imap_append_message (CONTEXT *ctx, MESSAGE *msg)
{
IMAP_DATA* idata;
return 0;
}
+static int mbox_close_message (CONTEXT *ctx, MESSAGE *msg)
+{
+ msg->fp = NULL;
+
+ return 0;
+}
+
static int mbox_open_new_message (MESSAGE *msg, CONTEXT *dest, HEADER *hdr)
{
msg->fp = dest->fp;
.open = mbox_open_mailbox,
.close = mbox_close_mailbox,
.open_msg = mbox_open_message,
+ .close_msg = mbox_close_message,
.open_new_msg = mbox_open_new_message,
.check = mbox_check_mailbox,
};
.open = mbox_open_mailbox,
.close = mbox_close_mailbox,
.open_msg = mbox_open_message,
+ .close_msg = mbox_close_message,
.open_new_msg = mbox_open_new_message,
.check = mbox_check_mailbox,
};
return maildir_mh_open_message (ctx, msg, msgno, 0);
}
+static int mh_close_message (CONTEXT *ctx, MESSAGE *msg)
+{
+ return safe_fclose (&msg->fp);
+}
+
/*
* Open a new (temporary) message in a maildir folder.
*
.open = maildir_open_mailbox,
.close = mh_close_mailbox,
.open_msg = maildir_open_message,
+ .close_msg = mh_close_message,
.open_new_msg = maildir_open_new_message,
.check = maildir_check_mailbox,
};
.open = mh_open_mailbox,
.close = mh_close_mailbox,
.open_msg = mh_open_message,
+ .close_msg = mh_close_message,
.open_new_msg = mh_open_new_message,
.check = mh_check_mailbox,
};
int (*close)(struct _context *);
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 (*open_new_msg) (struct _message *, struct _context *, HEADER *);
};
/* close a pointer to a message */
int mx_close_message (CONTEXT *ctx, MESSAGE **msg)
{
+ struct mx_ops *ops = mx_get_ops (ctx->magic);
int r = 0;
- if (ctx->magic == MUTT_MH || ctx->magic == MUTT_MAILDIR
- || ctx->magic == MUTT_IMAP || ctx->magic == MUTT_POP)
- {
- r = safe_fclose (&(*msg)->fp);
- }
- else
- (*msg)->fp = NULL;
+ if (ops && ops->close_msg)
+ r = ops->close_msg (ctx, *msg);
if ((*msg)->path)
{
dprint (1, (debugfile, "mx_close_message (): unlinking %s\n",
- (*msg)->path));
+ (*msg)->path));
unlink ((*msg)->path);
FREE (&(*msg)->path);
}
return 0;
}
+static int pop_close_message (CONTEXT *ctx, MESSAGE *msg)
+{
+ return safe_fclose (&msg->fp);
+}
+
/* update POP mailbox - delete messages from server */
int pop_sync_mailbox (CONTEXT *ctx, int *index_hint)
{
.open = pop_open_mailbox,
.close = pop_close_mailbox,
.open_msg = pop_fetch_message,
+ .close_msg = pop_close_message,
.check = pop_check_mailbox,
};