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-04-02 08:19 UTC

Return to Bug #38712 | Download this patch
This patch renders other patches obsolete

Obsolete 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-04-02 09:58:23.192768860 +0200
@@ -464,6 +464,11 @@
 	ZEND_ARG_INFO(0, timeout_type)
 	ZEND_ARG_INFO(0, timeout)
 ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_capability, 0, 0, 1)
+	ZEND_ARG_INFO(0, stream_id)
+ZEND_END_ARG_INFO()
+
 /* }}} */
 
 /* {{{ imap_functions[]
@@ -550,6 +555,9 @@
 	PHP_FALIAS(imap_scan,			imap_listscan,		arginfo_imap_listscan)
 	PHP_FALIAS(imap_create,			imap_createmailbox,	arginfo_imap_createmailbox)
 	PHP_FALIAS(imap_rename,			imap_renamemailbox,	arginfo_imap_renamemailbox)
+
+    PHP_FE(imap_capability,                         arginfo_imap_capability)
+
 	{NULL, NULL, NULL}
 };
 /* }}} */
@@ -3840,6 +3848,67 @@
 }
 /* }}} */
 
+/* {{{ 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 ) ;
+    }
+
+  }
+/* }}} */
+
 /* {{{ _php_imap_mail
  */
 int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char* rpath TSRMLS_DC)
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-04-02 09:58:23.244768418 +0200
@@ -181,6 +181,8 @@
 PHP_FUNCTION(imap_getacl);
 #endif
 
+PHP_FUNCTION(imap_capability);
+
 
 ZEND_BEGIN_MODULE_GLOBALS(imap)
 	char *imap_user;
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Aug 07 22:01:24 2020 UTC