php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #38712
Patch imap_capability.patch revision 2013-04-02 08:19 UTC by michael dot radzewitz at freenet-ag dot de
revision 2013-03-28 13:26 UTC by michael dot radzewitz at freenet-ag dot de

Patch imap_capability.patch for IMAP related Bug #38712

Patch version 2013-03-28 13:26 UTC

Return to Bug #38712 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: michael.radzewitz@freenet-ag.de

diff -urN php5-5.3.3.org/ext/imap/php_imap.c php5-5.3.3/ext/imap/php_imap.c
--- php5-5.3.3.org/ext/imap/php_imap.c	2013-03-28 12:58:32.000000000 +0100
+++ php5-5.3.3/ext/imap/php_imap.c	2013-03-28 14:12:16.768737662 +0100
@@ -530,6 +530,7 @@
 	PHP_FE(imap_thread,								arginfo_imap_thread)
 	PHP_FE(imap_timeout,								arginfo_imap_timeout)
 
+    PHP_FE(imap_capability,                         arginfo_imap_open)
 #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
 	PHP_FE(imap_get_quota,							arginfo_imap_get_quota)
 	PHP_FE(imap_get_quotaroot,						arginfo_imap_get_quotaroot)
@@ -4762,6 +4763,70 @@
 }
 /* }}} */
 
+
+/* {{{ proto mixed imap_capability(stream)
+   Fetch imap capability record as requested in: https://bugs.php.net/bug.php?id=38712 */
+PHP_FUNCTION(imap_capability)
+  {
+  zval *streamind ;
+  pils *imap_le_struct ;
+
+  if ( zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &streamind) == FAILURE )
+    {
+    return ;
+    }
+
+  ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap) ;
+
+  IMAPCAP  *m = imap_cap ( imap_le_struct->imap_stream ) ;
+
+  if ( !m )
+    {
+    php_error_docref(NULL TSRMLS_CC, E_WARNING, "c-client imap_cap failed");
+    zval_dtor(return_value);
+    RETURN_FALSE ;
+    }
+  else
+    {
+    object_init(return_value);
+
+    add_property_long(return_value, "rfc1176", m->rfc1176 ) ;
+    add_property_long(return_value, "imap2bis", m->imap2bis ) ;
+    add_property_long(return_value, "imap4", m->imap4 ) ;
+    add_property_long(return_value, "imap4rev1", m->imap4rev1 ) ;
+    add_property_long(return_value, "acl", m->acl ) ;
+    add_property_long(return_value, "quota", m->quota ) ;
+    add_property_long(return_value, "litplus", m->litplus ) ;
+    add_property_long(return_value, "idle", m->idle ) ;
+    add_property_long(return_value, "mbx_ref", m->mbx_ref ) ;
+    add_property_long(return_value, "log_ref", m->log_ref ) ;
+    add_property_long(return_value, "authanon", m->authanon ) ;
+    add_property_long(return_value, "namespace", m->namespace ) ;
+    add_property_long(return_value, "uidplus", m->uidplus ) ;
+    add_property_long(return_value, "starttls", m->starttls ) ;
+    add_property_long(return_value, "logindisabled", m->logindisabled ) ;
+    add_property_long(return_value, "id", m->id ) ;
+    add_property_long(return_value, "children", m->children ) ;
+    add_property_long(return_value, "multiappend", m->multiappend ) ;
+    add_property_long(return_value, "binary", m->binary ) ;
+    add_property_long(return_value, "unselect", m->unselect ) ;
+    add_property_long(return_value, "sasl_ir", m->sasl_ir ) ;
+    add_property_long(return_value, "sort", m->sort ) ;
+    add_property_long(return_value, "scan", m->scan ) ;
+    add_property_long(return_value, "urlauth", m->urlauth ) ;
+    add_property_long(return_value, "catenate", m->catenate ) ;
+    add_property_long(return_value, "condstore", m->condstore ) ;
+    add_property_long(return_value, "esearch", m->esearch ) ;
+    add_property_long(return_value, "within", m->within ) ;
+    add_property_long(return_value, "extlevel", m->extlevel ) ;
+    add_property_long(return_value, "auth", m->auth ) ;
+    }
+
+  }
+/* }}} */
+
+
+
 #define GETS_FETCH_SIZE 8196LU
 static char *php_mail_gets(readfn_t f, void *stream, unsigned long size, GETS_DATA *md) /* {{{ */
 {
diff -urN php5-5.3.3.org/ext/imap/php_imap.h php5-5.3.3/ext/imap/php_imap.h
--- php5-5.3.3.org/ext/imap/php_imap.h	2013-03-28 12:58:32.000000000 +0100
+++ php5-5.3.3/ext/imap/php_imap.h	2013-03-28 14:12:16.825250292 +0100
@@ -173,6 +173,7 @@
 PHP_FUNCTION(imap_thread);
 PHP_FUNCTION(imap_timeout);
 
+PHP_FUNCTION(imap_capability);
 #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
 PHP_FUNCTION(imap_get_quota);
 PHP_FUNCTION(imap_get_quotaroot);
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed May 27 15:01:26 2020 UTC