Nico Golde:
[apps/madmutt.git] / flags.c
diff --git a/flags.c b/flags.c
index bc57bb9..b206ae3 100644 (file)
--- a/flags.c
+++ b/flags.c
@@ -36,13 +36,8 @@ void _mutt_set_flag (CONTEXT * ctx, HEADER * h, int flag, int bf, int upd_ctx)
   switch (flag) {
   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 (!mx_acl_check (ctx, ACL_DELETE))
+      return;
 
     if (bf) {
       if (!h->deleted && !ctx->readonly) {
@@ -110,13 +105,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 (!mx_acl_check (ctx, ACL_SEEN))
+      return;
 
     if (bf) {
       if (h->read || h->old) {
@@ -148,13 +138,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 (!mx_acl_check (ctx, ACL_SEEN))
+      return;
 
     if (bf) {
       if (!h->old) {
@@ -180,13 +165,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 (!mx_acl_check (ctx, ACL_SEEN))
+      return;
 
     if (bf) {
       if (!h->read) {
@@ -216,13 +196,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 (!mx_acl_check (ctx, ACL_WRITE))
+      return;
 
     if (bf) {
       if (!h->replied) {
@@ -250,13 +225,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 (!mx_acl_check (ctx, ACL_WRITE))
+      return;
 
     if (bf) {
       if (!h->flagged) {