2 * This file is part of mutt-ng, see http://www.muttng.org/.
3 * It's licensed under the GNU General Public License,
4 * please see the file GPL in the top level source directory.
7 #include <lib-lib/lib-lib.h>
10 #include "imap_private.h"
15 int imap_is_magic (const char* path, struct stat* st __attribute__ ((unused))) {
19 s = url_check_scheme (NONULL (path));
20 return ((s == U_IMAP || s == U_IMAPS) ? M_IMAP : -1);
23 static int acl_check_imap (CONTEXT* ctx, int bit) {
24 return (!mutt_bit_isset (((IMAP_DATA*) ctx->data)->capabilities, ACL) ||
25 mutt_bit_isset (((IMAP_DATA*) ctx->data)->rights, bit));
28 static int imap_open_new_message (MESSAGE * msg,
29 CONTEXT * dest __attribute__ ((unused)),
30 HEADER * hdr __attribute__ ((unused)))
32 char tmp[_POSIX_PATH_MAX];
35 if ((msg->fp = safe_fopen (tmp, "w")) == NULL) {
39 msg->path = m_strdup(tmp);
43 /* this ugly kludge is required since the last int to
44 * imap_check_mailbox() doesn't mean 'lock' but 'force'... */
45 static int _imap_check_mailbox (CONTEXT* ctx,
47 int lock __attribute__ ((unused))) {
48 return (imap_check_mailbox (ctx, index_hint, 0));
51 static int imap_commit_message (MESSAGE* msg, CONTEXT* ctx) {
54 if ((r = safe_fclose (&msg->fp)) == 0)
55 r = imap_append_message (ctx, msg);
59 mx_t const imap_mx = {
66 imap_open_new_message,