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.
13 #include "imap_private.h"
23 int imap_is_magic (const char* path, struct stat* st) {
27 if (*path == '{') /* pain
\17pine compatibility */
29 s = url_check_scheme (NONULL (path));
30 return ((s == U_IMAP || s == U_IMAPS) ? M_IMAP : -1);
33 static int acl_check_imap (CONTEXT* ctx, int bit) {
34 return (!mutt_bit_isset (((IMAP_DATA*) ctx->data)->capabilities, ACL) ||
35 mutt_bit_isset (((IMAP_DATA*) ctx->data)->rights, bit));
38 static int imap_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr)
40 char tmp[_POSIX_PATH_MAX];
43 if ((msg->fp = safe_fopen (tmp, "w")) == NULL)
45 msg->path = safe_strdup (tmp);
49 /* this ugly kludge is required since the last int to
50 * imap_check_mailbox() doesn't mean 'lock' but 'force'... */
51 static int _imap_check_mailbox (CONTEXT* ctx, int* index_hint, int lock) {
52 return (imap_check_mailbox (ctx, index_hint, 0));
55 mx_t* imap_reg_mx (void) {
56 mx_t* fmt = safe_calloc (1, sizeof (mx_t));
58 /* make up mx_t record... */
60 fmt->mx_is_magic = imap_is_magic;
61 fmt->mx_access = imap_access;
62 fmt->mx_open_mailbox = imap_open_mailbox;
63 fmt->mx_open_new_message = imap_open_new_message;
64 fmt->mx_acl_check = acl_check_imap;
65 fmt->mx_fastclose_mailbox = imap_close_mailbox;
66 fmt->mx_sync_mailbox = imap_sync_mailbox;
67 fmt->mx_check_mailbox = _imap_check_mailbox;