Commit d4d93763 authored by Rocco Rutte's avatar Rocco Rutte

Generic ACL support.

parent 7f95a955
......@@ -90,18 +90,12 @@ static const char *No_visible = N_("No visible messages.");
break; \
}
#ifdef USE_IMAP
/* the error message returned here could be better. */
#define CHECK_IMAP_ACL(aclbit) if (Context->magic == M_IMAP) \
if (mutt_bit_isset (((IMAP_DATA *)Context->data)->capabilities, ACL) \
&& !mutt_bit_isset(((IMAP_DATA *)Context->data)->rights,aclbit)){ \
#define CHECK_ACL(aclbit,action) \
if (!mutt_bit_isset(Context->rights,aclbit)) { \
mutt_flushinp(); \
mutt_error ("Operation not permitted by the IMAP ACL for this mailbox"); \
mutt_error (_("Cannot %s: Operation not permitted by ACL"), action); \
break; \
}
#else
#define CHECK_IMAP_ACL(aclbit) /**/
#endif
#define CHECK_ATTACH if(option(OPTATTACHMSG)) \
{\
......@@ -805,7 +799,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
CHECK_ACL(M_ACL_DELETE, _("delete message(s)"));
CHECK_ATTACH;
mutt_pattern_func (M_DELETE, _("Delete messages matching: "));
......@@ -972,7 +966,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
if (mutt_pattern_func (M_UNDELETE, _("Undelete messages matching: ")) == 0)
menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
......@@ -1230,7 +1224,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
CHECK_ACL(M_ACL_DELETE, _("link threads"));
if ((Sort & SORT_MASK) != SORT_THREADS)
mutt_error _("Threading is not enabled.");
......@@ -1498,16 +1492,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_IMAP_ACL(IMAP_ACL_WRITE);
#ifdef USE_POP
if (Context->magic == M_POP)
{
mutt_flushinp ();
mutt_error _("Can't change 'important' flag on POP server.");
break;
}
#endif
CHECK_ACL(M_ACL_WRITE, _("flag message"));
if (tag)
{
......@@ -1544,7 +1529,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_IMAP_ACL(IMAP_ACL_SEEN);
CHECK_ACL(M_ACL_SEEN, _("toggle new"));
if (tag)
{
......@@ -1658,7 +1643,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
/* CHECK_IMAP_ACL(IMAP_ACL_WRITE); */
/* CHECK_ACL(M_ACL_WRITE); */
if (mutt_change_flag (tag ? NULL : CURHDR, (op == OP_MAIN_SET_FLAG)) == 0)
{
......@@ -1798,7 +1783,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
CHECK_ACL(M_ACL_DELETE, _("delete message"));
if (tag)
{
......@@ -1839,7 +1824,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
CHECK_ACL(M_ACL_DELETE, _("delete message(s)"));
rc = mutt_thread_set_flag (CURHDR, M_DELETE, 1,
op == OP_DELETE_THREAD ? 0 : 1);
......@@ -1880,16 +1865,7 @@ int mutt_index_menu (void)
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_ATTACH;
CHECK_IMAP_ACL(IMAP_ACL_INSERT);
#ifdef USE_POP
if (Context->magic == M_POP)
{
mutt_flushinp ();
mutt_error _("Can't edit message on POP server.");
break;
}
#endif
CHECK_ACL(M_ACL_INSERT, _("edit message"));
if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)))
mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
......@@ -2020,7 +1996,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_IMAP_ACL(IMAP_ACL_SEEN);
CHECK_ACL(M_ACL_SEEN, _("mark message(s) as read"));
rc = mutt_thread_set_flag (CURHDR, M_READ, 1,
op == OP_MAIN_READ_THREAD ? 0 : 1);
......@@ -2107,7 +2083,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
CHECK_ACL(M_ACL_DELETE, _("undelete message"));
if (tag)
{
......@@ -2134,7 +2110,7 @@ int mutt_index_menu (void)
CHECK_MSGCOUNT;
CHECK_VISIBLE;
CHECK_READONLY;
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0,
op == OP_UNDELETE_THREAD ? 0 : 1);
......
......@@ -43,12 +43,8 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
{
case M_DELETE:
#ifdef USE_IMAP
if (ctx && ctx->magic == M_IMAP)
if (mutt_bit_isset (((IMAP_DATA *)ctx->data)->capabilities, ACL) \
&& !mutt_bit_isset(((IMAP_DATA *)ctx->data)->rights,IMAP_ACL_DELETE))
return;
#endif
if (!mutt_bit_isset(ctx->rights,M_ACL_DELETE))
return;
if (bf)
{
......@@ -94,12 +90,8 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
case M_NEW:
#ifdef USE_IMAP
if (ctx && ctx->magic == M_IMAP)
if (mutt_bit_isset (((IMAP_DATA *)ctx->data)->capabilities, ACL) \
&& !mutt_bit_isset(((IMAP_DATA *)ctx->data)->rights,IMAP_ACL_SEEN))
return;
#endif
if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
return;
if (bf)
{
......@@ -129,12 +121,8 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
case M_OLD:
#ifdef USE_IMAP
if (ctx && ctx->magic == M_IMAP)
if (mutt_bit_isset (((IMAP_DATA *)ctx->data)->capabilities, ACL) \
&& !mutt_bit_isset(((IMAP_DATA *)ctx->data)->rights,IMAP_ACL_SEEN))
return;
#endif
if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
return;
if (bf)
{
......@@ -159,12 +147,8 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
case M_READ:
#ifdef USE_IMAP
if (ctx && ctx->magic == M_IMAP)
if (mutt_bit_isset (((IMAP_DATA *)ctx->data)->capabilities, ACL) \
&& !mutt_bit_isset(((IMAP_DATA *)ctx->data)->rights,IMAP_ACL_SEEN))
return;
#endif
if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
return;
if (bf)
{
......@@ -191,12 +175,8 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
case M_REPLIED:
#ifdef USE_IMAP
if (ctx && ctx->magic == M_IMAP)
if (mutt_bit_isset (((IMAP_DATA *)ctx->data)->capabilities, ACL) \
&& !mutt_bit_isset(((IMAP_DATA *)ctx->data)->rights,IMAP_ACL_WRITE))
return;
#endif
if (!mutt_bit_isset(ctx->rights,M_ACL_WRITE))
return;
if (bf)
{
......@@ -224,12 +204,8 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
case M_FLAG:
#ifdef USE_IMAP
if (ctx && ctx->magic == M_IMAP)
if (mutt_bit_isset (((IMAP_DATA *)ctx->data)->capabilities, ACL) \
&& !mutt_bit_isset(((IMAP_DATA *)ctx->data)->rights,IMAP_ACL_WRITE))
return;
#endif
if (!mutt_bit_isset(ctx->rights,M_ACL_WRITE))
return;
if (bf)
{
......
......@@ -722,38 +722,38 @@ static void cmd_parse_myrights (IMAP_DATA* idata, const char* s)
s = imap_next_word ((char*)s);
/* zero out current rights set */
memset (idata->rights, 0, sizeof (idata->rights));
memset (idata->ctx->rights, 0, sizeof (idata->ctx->rights));
while (*s && !isspace((unsigned char) *s))
{
switch (*s)
{
case 'l':
mutt_bit_set (idata->rights, IMAP_ACL_LOOKUP);
mutt_bit_set (idata->ctx->rights, M_ACL_LOOKUP);
break;
case 'r':
mutt_bit_set (idata->rights, IMAP_ACL_READ);
mutt_bit_set (idata->ctx->rights, M_ACL_READ);
break;
case 's':
mutt_bit_set (idata->rights, IMAP_ACL_SEEN);
mutt_bit_set (idata->ctx->rights, M_ACL_SEEN);
break;
case 'w':
mutt_bit_set (idata->rights, IMAP_ACL_WRITE);
mutt_bit_set (idata->ctx->rights, M_ACL_WRITE);
break;
case 'i':
mutt_bit_set (idata->rights, IMAP_ACL_INSERT);
mutt_bit_set (idata->ctx->rights, M_ACL_INSERT);
break;
case 'p':
mutt_bit_set (idata->rights, IMAP_ACL_POST);
mutt_bit_set (idata->ctx->rights, M_ACL_POST);
break;
case 'c':
mutt_bit_set (idata->rights, IMAP_ACL_CREATE);
mutt_bit_set (idata->ctx->rights, M_ACL_CREATE);
break;
case 'd':
mutt_bit_set (idata->rights, IMAP_ACL_DELETE);
mutt_bit_set (idata->ctx->rights, M_ACL_DELETE);
break;
case 'a':
mutt_bit_set (idata->rights, IMAP_ACL_ADMIN);
mutt_bit_set (idata->ctx->rights, M_ACL_ADMIN);
break;
}
s++;
......
......@@ -573,7 +573,7 @@ int imap_open_mailbox (CONTEXT* ctx)
/* clear mailbox status */
idata->status = 0;
memset (idata->rights, 0, (RIGHTSMAX+7)/8);
memset (idata->ctx->rights, 0, sizeof (idata->ctx->rights));
idata->newMailCount = 0;
mutt_message (_("Selecting %s..."), idata->mailbox);
......@@ -588,14 +588,14 @@ int imap_open_mailbox (CONTEXT* ctx)
/* assume we have all rights if ACL is unavailable */
else
{
mutt_bit_set (idata->rights, IMAP_ACL_LOOKUP);
mutt_bit_set (idata->rights, IMAP_ACL_READ);
mutt_bit_set (idata->rights, IMAP_ACL_SEEN);
mutt_bit_set (idata->rights, IMAP_ACL_WRITE);
mutt_bit_set (idata->rights, IMAP_ACL_INSERT);
mutt_bit_set (idata->rights, IMAP_ACL_POST);
mutt_bit_set (idata->rights, IMAP_ACL_CREATE);
mutt_bit_set (idata->rights, IMAP_ACL_DELETE);
mutt_bit_set (idata->ctx->rights, M_ACL_LOOKUP);
mutt_bit_set (idata->ctx->rights, M_ACL_READ);
mutt_bit_set (idata->ctx->rights, M_ACL_SEEN);
mutt_bit_set (idata->ctx->rights, M_ACL_WRITE);
mutt_bit_set (idata->ctx->rights, M_ACL_INSERT);
mutt_bit_set (idata->ctx->rights, M_ACL_POST);
mutt_bit_set (idata->ctx->rights, M_ACL_CREATE);
mutt_bit_set (idata->ctx->rights, M_ACL_DELETE);
}
/* pipeline the postponed count if possible */
pmx.mbox = NULL;
......@@ -724,10 +724,10 @@ int imap_open_mailbox (CONTEXT* ctx)
}
#endif
if (!(mutt_bit_isset(idata->rights, IMAP_ACL_DELETE) ||
mutt_bit_isset(idata->rights, IMAP_ACL_SEEN) ||
mutt_bit_isset(idata->rights, IMAP_ACL_WRITE) ||
mutt_bit_isset(idata->rights, IMAP_ACL_INSERT)))
if (!(mutt_bit_isset(idata->ctx->rights, M_ACL_DELETE) ||
mutt_bit_isset(idata->ctx->rights, M_ACL_SEEN) ||
mutt_bit_isset(idata->ctx->rights, M_ACL_WRITE) ||
mutt_bit_isset(idata->ctx->rights, M_ACL_INSERT)))
ctx->readonly = 1;
ctx->hdrmax = count;
......@@ -815,7 +815,7 @@ void imap_logout (IMAP_DATA* idata)
static void imap_set_flag (IMAP_DATA* idata, int aclbit, int flag,
const char *str, char *flags, size_t flsize)
{
if (mutt_bit_isset (idata->rights, aclbit))
if (mutt_bit_isset (idata->ctx->rights, aclbit))
if (flag && imap_has_flag (idata->flags, str))
safe_strcat (flags, flsize, str);
}
......@@ -985,19 +985,19 @@ int imap_sync_message (IMAP_DATA *idata, HEADER *hdr, BUFFER *cmd,
flags[0] = '\0';
imap_set_flag (idata, IMAP_ACL_SEEN, hdr->read, "\\Seen ",
imap_set_flag (idata, M_ACL_SEEN, hdr->read, "\\Seen ",
flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_WRITE, hdr->old,
imap_set_flag (idata, M_ACL_WRITE, hdr->old,
"Old ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_WRITE, hdr->flagged,
imap_set_flag (idata, M_ACL_WRITE, hdr->flagged,
"\\Flagged ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_WRITE, hdr->replied,
imap_set_flag (idata, M_ACL_WRITE, hdr->replied,
"\\Answered ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_DELETE, hdr->deleted,
imap_set_flag (idata, M_ACL_DELETE, hdr->deleted,
"\\Deleted ", flags, sizeof (flags));
/* now make sure we don't lose custom tags */
if (mutt_bit_isset (idata->rights, IMAP_ACL_WRITE))
if (mutt_bit_isset (idata->ctx->rights, M_ACL_WRITE))
imap_add_keywords (flags, hdr, idata->flags, sizeof (flags));
mutt_remove_trailing_ws (flags);
......@@ -1006,11 +1006,11 @@ int imap_sync_message (IMAP_DATA *idata, HEADER *hdr, BUFFER *cmd,
* explicitly revoke all system flags (if we have permission) */
if (!*flags)
{
imap_set_flag (idata, IMAP_ACL_SEEN, 1, "\\Seen ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_WRITE, 1, "Old ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_WRITE, 1, "\\Flagged ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_WRITE, 1, "\\Answered ", flags, sizeof (flags));
imap_set_flag (idata, IMAP_ACL_DELETE, 1, "\\Deleted ", flags, sizeof (flags));
imap_set_flag (idata, M_ACL_SEEN, 1, "\\Seen ", flags, sizeof (flags));
imap_set_flag (idata, M_ACL_WRITE, 1, "Old ", flags, sizeof (flags));
imap_set_flag (idata, M_ACL_WRITE, 1, "\\Flagged ", flags, sizeof (flags));
imap_set_flag (idata, M_ACL_WRITE, 1, "\\Answered ", flags, sizeof (flags));
imap_set_flag (idata, M_ACL_DELETE, 1, "\\Deleted ", flags, sizeof (flags));
mutt_remove_trailing_ws (flags);
......@@ -1046,10 +1046,10 @@ static int sync_helper (IMAP_DATA* idata, BUFFER* buf, int right, int flag,
{
int rc = 0;
if (!mutt_bit_isset (idata->rights, right))
if (!mutt_bit_isset (idata->ctx->rights, right))
return 0;
if (right == IMAP_ACL_WRITE && !imap_has_flag (idata->flags, name))
if (right == M_ACL_WRITE && !imap_has_flag (idata->flags, name))
return 0;
buf->dptr = buf->data;
......@@ -1111,7 +1111,7 @@ int imap_sync_mailbox (CONTEXT* ctx, int expunge, int* index_hint)
memset (&cmd, 0, sizeof (cmd));
/* if we are expunging anyway, we can do deleted messages very quickly... */
if (expunge && mutt_bit_isset (idata->rights, IMAP_ACL_DELETE))
if (expunge && mutt_bit_isset (idata->ctx->rights, M_ACL_DELETE))
{
mutt_buffer_addstr (&cmd, "UID STORE ");
deleted = imap_make_msg_set (idata, &cmd, M_DELETED, 1, 0);
......@@ -1194,11 +1194,11 @@ int imap_sync_mailbox (CONTEXT* ctx, int expunge, int* index_hint)
mutt_get_sort_func (SORT_ORDER));
}
rc += sync_helper (idata, &cmd, IMAP_ACL_DELETE, M_DELETED, "\\Deleted");
rc += sync_helper (idata, &cmd, IMAP_ACL_WRITE, M_FLAG, "\\Flagged");
rc += sync_helper (idata, &cmd, IMAP_ACL_WRITE, M_OLD, "Old");
rc += sync_helper (idata, &cmd, IMAP_ACL_SEEN, M_READ, "\\Seen");
rc += sync_helper (idata, &cmd, IMAP_ACL_WRITE, M_REPLIED, "\\Answered");
rc += sync_helper (idata, &cmd, M_ACL_DELETE, M_DELETED, "\\Deleted");
rc += sync_helper (idata, &cmd, M_ACL_WRITE, M_FLAG, "\\Flagged");
rc += sync_helper (idata, &cmd, M_ACL_WRITE, M_OLD, "Old");
rc += sync_helper (idata, &cmd, M_ACL_SEEN, M_READ, "\\Seen");
rc += sync_helper (idata, &cmd, M_ACL_WRITE, M_REPLIED, "\\Answered");
if (oldsort != Sort)
{
......@@ -1231,7 +1231,7 @@ int imap_sync_mailbox (CONTEXT* ctx, int expunge, int* index_hint)
/* We must send an EXPUNGE command if we're not closing. */
if (expunge && !(ctx->closing) &&
mutt_bit_isset(idata->rights, IMAP_ACL_DELETE))
mutt_bit_isset(idata->ctx->rights, M_ACL_DELETE))
{
mutt_message _("Expunging messages from server...");
/* Set expunge bit so we don't get spurious reopened messages */
......
......@@ -94,22 +94,6 @@ enum
IMAP_NS_SHARED
};
/* ACL Rights */
enum
{
IMAP_ACL_LOOKUP = 0,
IMAP_ACL_READ,
IMAP_ACL_SEEN,
IMAP_ACL_WRITE,
IMAP_ACL_INSERT,
IMAP_ACL_POST,
IMAP_ACL_CREATE,
IMAP_ACL_DELETE,
IMAP_ACL_ADMIN,
RIGHTSMAX
};
/* Capabilities we are interested in */
enum
{
......@@ -228,7 +212,6 @@ typedef struct
char *mailbox;
unsigned short check_status;
unsigned char reopen;
unsigned char rights[(RIGHTSMAX + 7)/8];
unsigned int newMailCount;
IMAP_CACHE cache[IMAP_CACHE_LEN];
unsigned int uid_validity;
......
......@@ -831,6 +831,22 @@ typedef struct pattern_t
} p;
} pattern_t;
/* ACL Rights */
enum
{
M_ACL_LOOKUP = 0,
M_ACL_READ,
M_ACL_SEEN,
M_ACL_WRITE,
M_ACL_INSERT,
M_ACL_POST,
M_ACL_CREATE,
M_ACL_DELETE,
M_ACL_ADMIN,
RIGHTSMAX
};
typedef struct
{
char *path;
......@@ -863,6 +879,8 @@ typedef struct
short magic; /* mailbox type */
unsigned char rights[(RIGHTSMAX + 7)/8]; /* ACL bits */
unsigned int locked : 1; /* is the mailbox locked? */
unsigned int changed : 1; /* mailbox has been modified */
unsigned int readonly : 1; /* don't allow changes to the mailbox */
......
......@@ -634,7 +634,10 @@ CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx)
ctx->msgnotreadyet = -1;
ctx->collapsed = 0;
for (rc=0; rc < RIGHTSMAX; rc++)
mutt_bit_set(ctx->rights,rc);
if (flags & M_QUIET)
ctx->quiet = 1;
if (flags & M_READONLY)
......
......@@ -83,16 +83,12 @@ static HEADER *OldHdr = NULL;
break; \
}
#ifdef USE_IMAP
/* the error message returned here could be better. */
#define CHECK_IMAP_ACL(aclbit) if (Context->magic == M_IMAP) \
if (mutt_bit_isset (((IMAP_DATA *)Context->data)->capabilities, ACL) \
&& !mutt_bit_isset(((IMAP_DATA *)Context->data)->rights,aclbit)){ \
#define CHECK_ACL(aclbit,action) \
if (!mutt_bit_isset(Context->rights,aclbit)) { \
mutt_flushinp(); \
mutt_error ("Operation not permitted by the IMAP ACL for this mailbox"); \
mutt_error (_("Cannot %s: Operation not permitted by ACL"), action); \
break; \
}
#endif
struct q_class_t
{
......@@ -2261,10 +2257,7 @@ search_next:
case OP_DELETE:
CHECK_MODE(IsHeader (extra));
CHECK_READONLY;
#ifdef USE_IMAP
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
#endif
CHECK_ACL(M_ACL_DELETE, _("delete message"));
mutt_set_flag (Context, extra->hdr, M_DELETE, 1);
if (option (OPTDELETEUNTAG))
......@@ -2281,10 +2274,7 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE);
case OP_DELETE_SUBTHREAD:
CHECK_MODE(IsHeader (extra));
CHECK_READONLY;
#ifdef USE_IMAP
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
#endif
CHECK_ACL(M_ACL_DELETE, _("delete message(s)"));
r = mutt_thread_set_flag (extra->hdr, M_DELETE, 1,
ch == OP_DELETE_THREAD ? 0 : 1);
......@@ -2404,19 +2394,7 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE);
case OP_FLAG_MESSAGE:
CHECK_MODE(IsHeader (extra));
CHECK_READONLY;
#ifdef USE_POP
if (Context->magic == M_POP)
{
mutt_flushinp ();
mutt_error _("Can't change 'important' flag on POP server.");
break;
}
#endif
#ifdef USE_IMAP
CHECK_IMAP_ACL(IMAP_ACL_WRITE);
#endif
CHECK_ACL(M_ACL_WRITE, "flag message");
mutt_set_flag (Context, extra->hdr, M_FLAG, !extra->hdr->flagged);
redraw = REDRAW_STATUS | REDRAW_INDEX;
......@@ -2572,10 +2550,7 @@ CHECK_IMAP_ACL(IMAP_ACL_WRITE);
case OP_TOGGLE_NEW:
CHECK_MODE(IsHeader (extra));
CHECK_READONLY;
#ifdef USE_IMAP
CHECK_IMAP_ACL(IMAP_ACL_SEEN);
#endif
CHECK_ACL(M_ACL_SEEN, _("toggle new"));
if (extra->hdr->read || extra->hdr->old)
mutt_set_flag (Context, extra->hdr, M_NEW, 1);
......@@ -2594,10 +2569,7 @@ CHECK_IMAP_ACL(IMAP_ACL_SEEN);
case OP_UNDELETE:
CHECK_MODE(IsHeader (extra));
CHECK_READONLY;
#ifdef USE_IMAP
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
#endif
CHECK_ACL(M_ACL_DELETE, _("undelete message"));
mutt_set_flag (Context, extra->hdr, M_DELETE, 0);
redraw = REDRAW_STATUS | REDRAW_INDEX;
......@@ -2612,10 +2584,7 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE);
case OP_UNDELETE_SUBTHREAD:
CHECK_MODE(IsHeader (extra));
CHECK_READONLY;
#ifdef USE_IMAP
CHECK_IMAP_ACL(IMAP_ACL_DELETE);
#endif
CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
r = mutt_thread_set_flag (extra->hdr, M_DELETE, 0,
ch == OP_UNDELETE_THREAD ? 0 : 1);
......
......@@ -376,6 +376,11 @@ int pop_open_mailbox (CONTEXT *ctx)
conn->data = pop_data;
pop_data->bcache = mutt_bcache_open (&acct, NULL);
/* init (hard-coded) ACL rights */
memset (ctx->rights, 0, sizeof (ctx->rights));
mutt_bit_set (ctx->rights, M_ACL_SEEN);
mutt_bit_set (ctx->rights, M_ACL_DELETE);
FOREVER
{
if (pop_reconnect (ctx) < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment