ID: 32268
Comment by: slim at inbox dot lv
Reported By: jigermano at gmail dot com
Status: Open
Bug Type: Feature/Change Request
PHP Version: 4.3.9
New Comment:
please implement custom flags (KEYWORDS) as described in RFC3501 for
imap_headerinfo() function
Previous Comments:
------------------------------------------------------------------------
[2005-03-10 22:36:22] jigermano at gmail dot com
Description:
------------
Although imap_headers returns information regarding user flags for all
the mail in a folder, imap_headerinfo does not return such information
for just one message. I added this functionality:
--- tmp/php-4.3.9/ext/imap/php_imap.c Thu Aug 12 16:32:59 2004
+++ php-4.3.9/ext/imap/php_imap.c Thu Mar 10 21:22:31 2005
@@ -1463,12 +1463,13 @@
Read the headers of the message */
PHP_FUNCTION(imap_headerinfo)
{
- zval **streamind, **msgno, **fromlength, **subjectlength,
**defaulthost;
+ zval **streamind, **msgno, **fromlength, **subjectlength,
**defaulthost, *user_flags;
pils *imap_le_struct;
MESSAGECACHE *cache;
ENVELOPE *en;
char dummy[2000], fulladdress[MAILTMPLEN];
int myargc = ZEND_NUM_ARGS();
+ unsigned long i;
if (myargc < 2 || myargc > 5 || zend_get_parameters_ex(myargc,
&streamind, &msgno, &fromlength, &subjectlength, &defaulthost) ==
FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1513,6 +1514,19 @@
add_property_string(return_value, "Answered", cache->answered ?
"A" : " ", 1);
add_property_string(return_value, "Deleted", cache->deleted ?
"D" : " ", 1);
add_property_string(return_value, "Draft", cache->draft ? "X" :
" ", 1);
+
+ if ((i = cache->user_flags)) {
+ add_property_bool(return_value, "HasUserFlag", 1);
+ MAKE_STD_ZVAL(user_flags);
+ array_init(user_flags);
+ while (i) {
+ add_next_index_string(user_flags,
imap_le_struct->imap_stream->user_flags[find_rightmost_bit (&i)] ,1);
+ }
+ add_property_zval(return_value,
"UserFlags",user_flags);
+
+ }else{
+ add_property_bool(return_value, "HasUserFlag", 0);
+ }
sprintf(dummy, "%4ld", cache->msgno);
add_property_string(return_value, "Msgno", dummy, 1);
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32268&edit=1