1 /* 2 +----------------------------------------------------------------------+ 3 | Copyright (c) The PHP Group | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | https://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Authors: Rex Logan <veebert@dimensional.com> | 14 | Mark Musone <musone@afterfive.com> | 15 | Brian Wang <brian@vividnet.com> | 16 | Kaj-Michael Lang <milang@tal.org> | 17 | Antoni Pamies Olive <toni@readysoft.net> | 18 | Rasmus Lerdorf <rasmus@php.net> | 19 | Chuck Hagenbuch <chuck@horde.org> | 20 | Andrew Skalski <askalski@chekinc.com> | 21 | Hartmut Holzgraefe <hholzgra@php.net> | 22 | Jani Taskinen <sniper@iki.fi> | 23 | Daniel R. Kalowsky <kalowsky@php.net> | 24 | PHP 4.0 updates: Zeev Suraski <zeev@php.net> | 25 +----------------------------------------------------------------------+ 26 */ 27 28 #ifndef PHP_IMAP_H 29 #define PHP_IMAP_H 30 31 #ifdef HAVE_IMAP 32 33 #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) 34 35 /* For now these appear on Windows, remove this check if it appears outside */ 36 # ifdef PHP_WIN32 37 /* Undefine these LOG defines to avoid warnings */ 38 # undef LOG_EMERG 39 # undef LOG_CRIT 40 # undef LOG_ERR 41 # undef LOG_WARNING 42 # undef LOG_NOTICE 43 # undef LOG_DEBUG 44 45 /* c-client also redefines its own ftruncate */ 46 # undef ftruncate 47 # endif 48 49 /* these are used for quota support */ 50 ZEND_DIAGNOSTIC_IGNORED_START("-Wstrict-prototypes") 51 # include "c-client.h" /* includes mail.h and rfc822.h */ 52 ZEND_DIAGNOSTIC_IGNORED_END 53 # include "imap4r1.h" /* location of c-client quota functions */ 54 #else 55 # include "mail.h" 56 # include "rfc822.h" 57 #endif 58 59 extern zend_module_entry imap_module_entry; 60 #define imap_module_ptr &imap_module_entry 61 62 #include "php_version.h" 63 #define PHP_IMAP_VERSION PHP_VERSION 64 65 /* Data types */ 66 67 #ifdef IMAP41 68 #define LSIZE text.size 69 #define LTEXT text.data 70 #define DTYPE int 71 #define CONTENT_PART nested.part 72 #define CONTENT_MSG_BODY nested.msg->body 73 #define IMAPVER "Imap 4R1" 74 #else 75 #define LSIZE size 76 #define LTEXT text 77 #define DTYPE char 78 #define CONTENT_PART contents.part 79 #define CONTENT_MSG_BODY contents.msg.body 80 #define IMAPVER "Imap 4" 81 #endif 82 83 84 /* Determines how mm_list() and mm_lsub() are to return their results. */ 85 typedef enum { 86 FLIST_ARRAY, 87 FLIST_OBJECT 88 } folderlist_style_t; 89 90 typedef struct php_imap_mailbox_struct { 91 SIZEDTEXT text; 92 DTYPE delimiter; 93 long attributes; 94 struct php_imap_mailbox_struct *next; 95 } FOBJECTLIST; 96 97 typedef struct php_imap_error_struct { 98 SIZEDTEXT text; 99 long errflg; 100 struct php_imap_error_struct *next; 101 } ERRORLIST; 102 103 typedef struct _php_imap_message_struct { 104 unsigned long msgid; 105 struct _php_imap_message_struct *next; 106 } MESSAGELIST; 107 108 109 /* Functions */ 110 111 PHP_MINIT_FUNCTION(imap); 112 PHP_RINIT_FUNCTION(imap); 113 PHP_RSHUTDOWN_FUNCTION(imap); 114 PHP_MINFO_FUNCTION(imap); 115 116 ZEND_BEGIN_MODULE_GLOBALS(imap) 117 char *imap_user; 118 char *imap_password; 119 120 STRINGLIST *imap_alertstack; 121 ERRORLIST *imap_errorstack; 122 123 STRINGLIST *imap_folders; 124 STRINGLIST *imap_folders_tail; 125 STRINGLIST *imap_sfolders; 126 STRINGLIST *imap_sfolders_tail; 127 MESSAGELIST *imap_messages; 128 MESSAGELIST *imap_messages_tail; 129 FOBJECTLIST *imap_folder_objects; 130 FOBJECTLIST *imap_folder_objects_tail; 131 FOBJECTLIST *imap_sfolder_objects; 132 FOBJECTLIST *imap_sfolder_objects_tail; 133 134 folderlist_style_t folderlist_style; 135 long status_flags; 136 unsigned long status_messages; 137 unsigned long status_recent; 138 unsigned long status_unseen; 139 unsigned long status_uidnext; 140 unsigned long status_uidvalidity; 141 #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) 142 zval **quota_return; 143 zval *imap_acl_list; 144 #endif 145 /* php_stream for php_mail_gets() */ 146 php_stream *gets_stream; 147 bool enable_rsh; 148 ZEND_END_MODULE_GLOBALS(imap) 149 150 #if defined(ZTS) && defined(COMPILE_DL_IMAP) 151 ZEND_TSRMLS_CACHE_EXTERN() 152 #endif 153 154 ZEND_EXTERN_MODULE_GLOBALS(imap) 155 #define IMAPG(v) ZEND_MODULE_GLOBALS_ACCESSOR(imap, v) 156 157 #else 158 159 #define imap_module_ptr NULL 160 161 #endif 162 163 #define phpext_imap_ptr imap_module_ptr 164 165 #endif /* PHP_IMAP_H */ 166