/**
* comp_open_new_message - Delegated to mbox handler
- * @param msg Message to commit
* @param ctx Mailbox
+ * @param msg Message to commit
* @param hdr Email header
* @retval 0 Success
* @retval -1 Failure
*/
-static int comp_open_new_message(struct Message *msg, struct Context *ctx, struct Header *hdr)
+static int comp_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr)
{
if (!ctx)
return -1;
return -1;
/* Delegate */
- return ops->open_new_msg(msg, ctx, hdr);
+ return ops->open_new_msg(ctx, msg, hdr);
}
/**
/**
* imap_open_new_message - Open an IMAP message
+ * @param ctx Context (UNUSED)
* @param msg Message to open
- * @param dest Context (UNUSED)
* @param hdr Header (UNUSED)
* @retval 0 Success
* @retval -1 Failure
*/
-static int imap_open_new_message(struct Message *msg, struct Context *dest, struct Header *hdr)
+static int imap_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr)
{
char tmp[_POSIX_PATH_MAX];
/**
* imap_commit_message_tags - Add/Change/Remove flags from headers
- * @param ctx Context
- * @param h Header
- * @param tags List of tags
+ * @param ctx Context
+ * @param hdr Header
+ * @param buf List of tags
* @retval 0 Success
* @retval -1 Error
*
* Also this method check that each flags is support by the server
* first and remove unsupported one.
*/
-static int imap_commit_message_tags(struct Context *ctx, struct Header *h, char *tags)
+static int imap_commit_message_tags(struct Context *ctx, struct Header *hdr, char *buf)
{
struct Buffer *cmd = NULL;
char uid[11];
struct ImapData *idata = ctx->data;
- if (*tags == '\0')
- tags = NULL;
+ if (*buf == '\0')
+ buf = NULL;
if (!mutt_bit_isset(idata->ctx->rights, MUTT_ACL_WRITE))
return 0;
- snprintf(uid, sizeof(uid), "%u", HEADER_DATA(h)->uid);
+ snprintf(uid, sizeof(uid), "%u", HEADER_DATA(hdr)->uid);
/* Remove old custom flags */
- if (HEADER_DATA(h)->flags_remote)
+ if (HEADER_DATA(hdr)->flags_remote)
{
cmd = mutt_buffer_new();
if (!cmd)
mutt_buffer_addstr(cmd, "UID STORE ");
mutt_buffer_addstr(cmd, uid);
mutt_buffer_addstr(cmd, " -FLAGS.SILENT (");
- mutt_buffer_addstr(cmd, HEADER_DATA(h)->flags_remote);
+ mutt_buffer_addstr(cmd, HEADER_DATA(hdr)->flags_remote);
mutt_buffer_addstr(cmd, ")");
/* Should we return here, or we are fine and we could
}
/* Add new custom flags */
- if (tags)
+ if (buf)
{
cmd = mutt_buffer_new();
if (!cmd)
mutt_buffer_addstr(cmd, "UID STORE ");
mutt_buffer_addstr(cmd, uid);
mutt_buffer_addstr(cmd, " +FLAGS.SILENT (");
- mutt_buffer_addstr(cmd, tags);
+ mutt_buffer_addstr(cmd, buf);
mutt_buffer_addstr(cmd, ")");
if (imap_exec(idata, cmd->data, 0) != 0)
}
/* We are good sync them */
- mutt_debug(1, "NEW TAGS: %d\n", tags);
- driver_tags_replace(&h->tags, tags);
- FREE(&HEADER_DATA(h)->flags_remote);
- HEADER_DATA(h)->flags_remote = driver_tags_get_with_hidden(&h->tags);
+ mutt_debug(1, "NEW TAGS: %d\n", buf);
+ driver_tags_replace(&hdr->tags, buf);
+ FREE(&HEADER_DATA(hdr)->flags_remote);
+ HEADER_DATA(hdr)->flags_remote = driver_tags_get_with_hidden(&hdr->tags);
return 0;
}
return 0;
}
-static int mbox_open_new_message(struct Message *msg, struct Context *dest, struct Header *hdr)
+static int mbox_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr)
{
- msg->fp = dest->fp;
+ msg->fp = ctx->fp;
return 0;
}
* Open a new (temporary) message in an MH folder.
*/
-static int mh_open_new_message(struct Message *msg, struct Context *dest, struct Header *hdr)
+static int mh_open_new_message(struct Context *ctx, struct Message *msg, struct Header *hdr)
{
- return mh_mkstemp(dest, &msg->fp, &msg->path);
+ return mh_mkstemp(ctx, &msg->fp, &msg->path);
}
static int ch_compar(const void *a, const void *b)
* Note that this uses _almost_ the maildir file name format,
* but with a {cur,new} prefix.
*/
-static int maildir_open_new_message(struct Message *msg, struct Context *dest,
+static int maildir_open_new_message(struct Context *ctx, struct Message *msg,
struct Header *hdr)
{
int fd;
else
mutt_str_strfcpy(subdir, "new", sizeof(subdir));
- omask = umask(mh_umask(dest));
+ omask = umask(mh_umask(ctx));
while (true)
{
- snprintf(path, _POSIX_PATH_MAX, "%s/tmp/%s.%lld.R%" PRIu64 ".%s%s", dest->path, subdir,
+ snprintf(path, _POSIX_PATH_MAX, "%s/tmp/%s.%lld.R%" PRIu64 ".%s%s", ctx->path, subdir,
(long long) time(NULL), mutt_rand64(), NONULL(ShortHostname), suffix);
mutt_debug(2, "Trying %s.\n", path);
if (msg->received == 0)
time(&msg->received);
- if (dest->mx_ops->open_new_msg(msg, dest, hdr) == 0)
+ if (dest->mx_ops->open_new_msg(dest, msg, hdr) == 0)
{
if (dest->magic == MUTT_MMDF)
fputs(MMDF_SEP, msg->fp);
int (*open_msg)(struct Context *ctx, struct Message *msg, int msgno);
int (*close_msg)(struct Context *ctx, struct Message *msg);
int (*commit_msg)(struct Context *ctx, struct Message *msg);
- int (*open_new_msg)(struct Message *msg, struct Context *ctx, struct Header *hdr);
+ int (*open_new_msg)(struct Context *ctx, struct Message *msg, struct Header *hdr);
int (*edit_msg_tags)(struct Context *ctx, const char *tags, char *buf, size_t buflen);
- int (*commit_msg_tags)(struct Context *msg, struct Header *hdr, char *buf);
+ int (*commit_msg_tags)(struct Context *ctx, struct Header *hdr, char *buf);
};
/**