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: 2013-04-02 08:19 UTC | 2013-03-28 13:26 UTC

Developer: michael.radzewitz@freenet-ag.de

Line 1 (now 1), was 33 lines, now 20 lines

  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 @@
 +++ 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)
  +  {


  +
  +  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) ;
 +  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) ;
 +    php_error_docref(NULL TSRMLS_CC, E_WARNING, "c-client imap_cap failed");
 +    zval_dtor(return_value);
  +    RETURN_FALSE ;
  +    }
  +  else
  +    {
 +    object_init(return_value) ;
 +    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 ) ;


  +
  +  }
  +/* }}} */
  +
  /* {{{ _php_imap_mail
   */
  int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char* rpath TSRMLS_DC)
 +
 +
  #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-04-02 09:58:23.244768418 +0200
 @@ -181,6 +181,8 @@
  PHP_FUNCTION(imap_getacl);
  #endif
 +++ 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);
 +
  
  ZEND_BEGIN_MODULE_GLOBALS(imap)
  	char *imap_user;
  #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
  PHP_FUNCTION(imap_get_quota);
  PHP_FUNCTION(imap_get_quotaroot);
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Nov 30 13:03:49 2021 UTC