php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #53043
Patch imap_flags_patch revision 2010-10-11 16:46 UTC by maris at co dot inbox dot lv

Patch imap_flags_patch for IMAP related Bug #53043

Patch version 2010-10-11 16:46 UTC

Return to Bug #53043 | Download this patch
Patch Revisions:

Developer: maris@co.inbox.lv

diff -ur php-5.3.3/ext/imap/php_imap.c php-5.3.3.patched/ext/imap/php_imap.c
--- php-5.3.3/ext/imap/php_imap.c	2010-04-14 12:45:37.000000000 +0300
+++ php-5.3.3.patched/ext/imap/php_imap.c	2010-10-11 16:24:23.000000000 +0300
@@ -650,6 +650,27 @@
 }
 /* }}} */
 
+/* {{{ add_user_flags 
+ */
+void add_user_flags(zval* arg, pils* imap_le_struct, MESSAGECACHE* cache) 
+{
+    unsigned long i;
+
+    if ((i = cache->user_flags)) {
+        zval *dflags;
+        char *p;
+
+        MAKE_STD_ZVAL(dflags);
+        array_init(dflags);
+        while (i) {
+            p = imap_le_struct->imap_stream->user_flags[find_rightmost_bit (&i)];
+            add_assoc_long(dflags, p, 1);
+        }
+        add_assoc_object(arg, "user_flags", dflags);
+    }
+}
+
+/* }}} */ 
 /* {{{ mail_newfolderobjectlist
  *
  * Mail instantiate FOBJECTLIST
@@ -2093,6 +2114,10 @@
 	add_property_string(return_value, "Deleted", cache->deleted ? "D" : " ", 1);
 	add_property_string(return_value, "Draft", cache->draft ? "X" : " ", 1);
 
+    if (cache->user_flags) {
+        add_user_flags(return_value, imap_le_struct, cache);
+    }
+
 	snprintf(dummy, sizeof(dummy), "%4ld", cache->msgno);
 	add_property_string(return_value, "Msgno", dummy, 1);
 
@@ -3421,6 +3446,9 @@
 				add_property_long(myoverview, "seen", elt->seen);
 				add_property_long(myoverview, "draft", elt->draft);
 				add_property_long(myoverview, "udate", mail_longdate(elt));
+                if (elt->user_flags) {
+                    add_user_flags(myoverview, imap_le_struct, elt);
+                }
 				add_next_index_object(return_value, myoverview TSRMLS_CC);
 			}
 		}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 02:01:30 2024 UTC