#32268 [Fbk->Opn]: Show user flags in imap_headerinfo
| From: | sniper@php.net | Date: | Fri, 25 Mar 2005 01:02:27 +0000 |
| Subject: | #32268 [Fbk->Opn]: Show user flags in imap_headerinfo | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76838@lists.php.net to get a copy of this message | ||
ID: 32268
Updated by: sniper@php.net
Reported By: jigermano at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: IMAP related
PHP Version: 4.3.9
New Comment:
Nevermind with the snapshot.
Previous Comments:
------------------------------------------------------------------------
[2005-03-25 02:02:06] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[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