Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > by-pkgid > d27673e6001a0f733a6f96b690c748b4 > files > 22

php4-4.4.6-3mdv2007.1.src.rpm

diff -Naur php-4.4.0/ext/imap/php_imap.c php-4.4.0.oden/ext/imap/php_imap.c
--- php-4.4.0/ext/imap/php_imap.c	2005-04-08 17:04:52.000000000 +0200
+++ php-4.4.0.oden/ext/imap/php_imap.c	2005-07-12 00:43:02.574727114 +0200
@@ -115,6 +115,7 @@
 	PHP_FE(imap_binary,								NULL)
 	PHP_FE(imap_utf8,								NULL)
 	PHP_FE(imap_status,								NULL)
+	PHP_FE(imap_status_current,							NULL)
 	PHP_FE(imap_mailboxmsginfo,						NULL)
 	PHP_FE(imap_setflag_full,						NULL)
 	PHP_FE(imap_clearflag_full,						NULL)
@@ -2551,6 +2552,42 @@
 }
 /* }}} */
 
+/* {{{ proto object imap_status_current(resource stream_id, int options)
+   Get (cached) status info from current mailbox */
+PHP_FUNCTION(imap_status_current)
+{
+ 	zval **streamind, **pflags;
+	pils *imap_le_struct;
+	long flags = 0L;
+
+ 	if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &pflags) == FAILURE) {
+ 		ZEND_WRONG_PARAM_COUNT();
+ 	}
+
+	ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
+
+	convert_to_long_ex(pflags);
+	flags = Z_LVAL_PP(pflags);
+
+	if (object_init(return_value) == FAILURE) {
+		RETURN_FALSE;
+	}
+
+	if (flags & SA_MESSAGES) {
+		add_property_long(return_value, "messages", imap_le_struct->imap_stream->nmsgs);
+	}
+	if (flags & SA_RECENT) {
+		add_property_long(return_value, "recent", imap_le_struct->imap_stream->recent);
+	}
+	if (flags & SA_UIDNEXT) {
+		add_property_long(return_value, "uidnext", imap_le_struct->imap_stream->uid_last+1);
+	}
+	if (flags & SA_UIDVALIDITY) {
+		add_property_long(return_value, "uidvalidity", imap_le_struct->imap_stream->uid_validity);
+	}
+}
+/* }}} */
+
 /* {{{ proto object imap_status(resource stream_id, string mailbox, int options)
    Get status info from a mailbox */
 PHP_FUNCTION(imap_status)
diff -Naur php-4.4.0/ext/imap/php_imap.h php-4.4.0.oden/ext/imap/php_imap.h
--- php-4.4.0/ext/imap/php_imap.h	2003-06-13 16:45:36.000000000 +0200
+++ php-4.4.0.oden/ext/imap/php_imap.h	2005-07-12 00:43:02.575727139 +0200
@@ -151,6 +151,7 @@
 PHP_FUNCTION(imap_lsub_full);
 PHP_FUNCTION(imap_create);
 PHP_FUNCTION(imap_rename);
+PHP_FUNCTION(imap_status_current);
 PHP_FUNCTION(imap_status);
 PHP_FUNCTION(imap_bodystruct);
 PHP_FUNCTION(imap_fetch_overview);