cvs: php4 /ext/imap php_imap.c

From: Date: Thu, 15 Jun 2000 03:02:36 +0000
Subject: cvs: php4 /ext/imap php_imap.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-282@lists.php.net to get a copy of this message
chagenbu Wed Jun 14 20:02:36 2000 EDT Modified files: /php4/ext/imap php_imap.c Log: patch from jtaskine@hit.fi - add deleted info to imap_mailboxmsginfo() and fix some prototype info. Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.28 php4/ext/imap/php_imap.c:1.29 --- php4/ext/imap/php_imap.c:1.28 Wed Jun 14 05:28:20 2000 +++ php4/ext/imap/php_imap.c Wed Jun 14 20:02:36 2000 @@ -23,7 +23,7 @@ | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.28 2000/06/14 12:28:20 thies Exp $ */ +/* $Id: php_imap.c,v 1.29 2000/06/15 03:02:36 chagenbu Exp $ */ #define IMAP41 @@ -2044,8 +2044,8 @@ /* }}} */ -/* {{{ proto array imap_mailboxmsginfo(int stream_id) - Returns info about the current mailbox in an associative array */ +/* {{{ proto object imap_mailboxmsginfo(int stream_id) + Returns info about the current mailbox */ PHP_FUNCTION(imap_mailboxmsginfo) { zval **streamind; @@ -2053,7 +2053,7 @@ int ind, ind_type; unsigned int msgno; pils *imap_le_struct; - unsigned unreadmsg, msize; + unsigned unreadmsg, deletedmsg, msize; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); @@ -2070,21 +2070,23 @@ RETURN_FALSE; } - /* Initialize return array */ + /* Initialize return object */ if (object_init(return_value) == FAILURE) { RETURN_FALSE; } unreadmsg = 0; + deletedmsg = 0; msize = 0; for (msgno = 1; msgno <= imap_le_struct->imap_stream->nmsgs; msgno++) { MESSAGECACHE * cache = mail_elt (imap_le_struct->imap_stream,msgno); mail_fetchstructure (imap_le_struct->imap_stream,msgno,NIL); - unreadmsg = cache->recent ? (cache->seen ? unreadmsg : unreadmsg++) : unreadmsg; - unreadmsg = (cache->recent | cache->seen) ? unreadmsg : unreadmsg++; + if (!cache->seen || cache->recent) unreadmsg++; + if (cache->deleted) deletedmsg++; msize = msize + cache->rfc822_size; } add_property_long(return_value, "Unread", unreadmsg); + add_property_long(return_value, "Deleted", deletedmsg); add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); add_property_long(return_value, "Size", msize); rfc822_date(date);

« previous php.cvs (#282) next »