php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #32268 IMAP: [PATCH] Show user flags in imap_headerinfo
Submitted: 2005-03-10 22:36 UTC Modified: 2016-12-30 22:46 UTC
Votes:11
Avg. Score:4.3 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:4 (80.0%)
From: jigermano at gmail dot com Assigned:
Status: Open Package: IMAP related
PHP Version: 4.3.9 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jigermano at gmail dot com
New email:
PHP Version: OS:

 

 [2005-03-10 22:36 UTC] 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);



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-26 16:14 UTC] slim at inbox dot lv
please implement custom flags (KEYWORDS) as described in RFC3501 for imap_headerinfo() function
 [2016-12-30 22:46 UTC] cmb@php.net
-Package: Feature/Change Request +Package: IMAP related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 18:01:31 2024 UTC