php_imap.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Rex Logan <veebert@dimensional.com> |
  16. | Mark Musone <musone@afterfive.com> |
  17. | Brian Wang <brian@vividnet.com> |
  18. | Kaj-Michael Lang <milang@tal.org> |
  19. | Antoni Pamies Olive <toni@readysoft.net> |
  20. | Rasmus Lerdorf <rasmus@php.net> |
  21. | Chuck Hagenbuch <chuck@horde.org> |
  22. | Andrew Skalski <askalski@chekinc.com> |
  23. | Hartmut Holzgraefe <hholzgra@php.net> |
  24. | Jani Taskinen <sniper@iki.fi> |
  25. | Daniel R. Kalowsky <kalowsky@php.net> |
  26. | PHP 4.0 updates: Zeev Suraski <zeev@php.net> |
  27. +----------------------------------------------------------------------+
  28. */
  29. #ifndef PHP_IMAP_H
  30. #define PHP_IMAP_H
  31. #if HAVE_IMAP
  32. #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
  33. /* For now these appear on Windows, remove this check if it appears outside */
  34. # ifdef PHP_WIN32
  35. /* Undefine these LOG defines to avoid warnings */
  36. # undef LOG_EMERG
  37. # undef LOG_CRIT
  38. # undef LOG_ERR
  39. # undef LOG_WARNING
  40. # undef LOG_NOTICE
  41. # undef LOG_DEBUG
  42. /* c-client also redefines its own ftruncate */
  43. # undef ftruncate
  44. # endif
  45. /* these are used for quota support */
  46. # include "c-client.h" /* includes mail.h and rfc822.h */
  47. # include "imap4r1.h" /* location of c-client quota functions */
  48. #else
  49. # include "mail.h"
  50. # include "rfc822.h"
  51. #endif
  52. extern zend_module_entry imap_module_entry;
  53. #define imap_module_ptr &imap_module_entry
  54. #include "php_version.h"
  55. #define PHP_IMAP_VERSION PHP_VERSION
  56. /* Data types */
  57. #ifdef IMAP41
  58. #define LSIZE text.size
  59. #define LTEXT text.data
  60. #define DTYPE int
  61. #define CONTENT_PART nested.part
  62. #define CONTENT_MSG_BODY nested.msg->body
  63. #define IMAPVER "Imap 4R1"
  64. #else
  65. #define LSIZE size
  66. #define LTEXT text
  67. #define DTYPE char
  68. #define CONTENT_PART contents.part
  69. #define CONTENT_MSG_BODY contents.msg.body
  70. #define IMAPVER "Imap 4"
  71. #endif
  72. /* Determines how mm_list() and mm_lsub() are to return their results. */
  73. typedef enum {
  74. FLIST_ARRAY,
  75. FLIST_OBJECT
  76. } folderlist_style_t;
  77. typedef struct php_imap_le_struct {
  78. MAILSTREAM *imap_stream;
  79. long flags;
  80. } pils;
  81. typedef struct php_imap_mailbox_struct {
  82. SIZEDTEXT text;
  83. DTYPE delimiter;
  84. long attributes;
  85. struct php_imap_mailbox_struct *next;
  86. } FOBJECTLIST;
  87. typedef struct php_imap_error_struct {
  88. SIZEDTEXT text;
  89. long errflg;
  90. struct php_imap_error_struct *next;
  91. } ERRORLIST;
  92. typedef struct _php_imap_message_struct {
  93. unsigned long msgid;
  94. struct _php_imap_message_struct *next;
  95. } MESSAGELIST;
  96. /* Functions */
  97. PHP_MINIT_FUNCTION(imap);
  98. PHP_RINIT_FUNCTION(imap);
  99. PHP_RSHUTDOWN_FUNCTION(imap);
  100. PHP_MINFO_FUNCTION(imap);
  101. PHP_FUNCTION(imap_open);
  102. PHP_FUNCTION(imap_popen);
  103. PHP_FUNCTION(imap_reopen);
  104. PHP_FUNCTION(imap_num_msg);
  105. PHP_FUNCTION(imap_num_recent);
  106. PHP_FUNCTION(imap_headers);
  107. PHP_FUNCTION(imap_headerinfo);
  108. PHP_FUNCTION(imap_rfc822_parse_headers);
  109. PHP_FUNCTION(imap_body);
  110. PHP_FUNCTION(imap_fetchstructure);
  111. PHP_FUNCTION(imap_fetchbody);
  112. PHP_FUNCTION(imap_fetchmime);
  113. PHP_FUNCTION(imap_savebody);
  114. PHP_FUNCTION(imap_gc);
  115. PHP_FUNCTION(imap_expunge);
  116. PHP_FUNCTION(imap_delete);
  117. PHP_FUNCTION(imap_undelete);
  118. PHP_FUNCTION(imap_check);
  119. PHP_FUNCTION(imap_close);
  120. PHP_FUNCTION(imap_mail_copy);
  121. PHP_FUNCTION(imap_mail_move);
  122. PHP_FUNCTION(imap_createmailbox);
  123. PHP_FUNCTION(imap_renamemailbox);
  124. PHP_FUNCTION(imap_deletemailbox);
  125. PHP_FUNCTION(imap_listmailbox);
  126. PHP_FUNCTION(imap_scanmailbox);
  127. PHP_FUNCTION(imap_subscribe);
  128. PHP_FUNCTION(imap_unsubscribe);
  129. PHP_FUNCTION(imap_append);
  130. PHP_FUNCTION(imap_ping);
  131. PHP_FUNCTION(imap_base64);
  132. PHP_FUNCTION(imap_qprint);
  133. PHP_FUNCTION(imap_8bit);
  134. PHP_FUNCTION(imap_binary);
  135. PHP_FUNCTION(imap_mailboxmsginfo);
  136. PHP_FUNCTION(imap_rfc822_write_address);
  137. PHP_FUNCTION(imap_rfc822_parse_adrlist);
  138. PHP_FUNCTION(imap_setflag_full);
  139. PHP_FUNCTION(imap_clearflag_full);
  140. PHP_FUNCTION(imap_sort);
  141. PHP_FUNCTION(imap_fetchheader);
  142. PHP_FUNCTION(imap_fetchtext);
  143. PHP_FUNCTION(imap_uid);
  144. PHP_FUNCTION(imap_msgno);
  145. PHP_FUNCTION(imap_list);
  146. PHP_FUNCTION(imap_list_full);
  147. PHP_FUNCTION(imap_listscan);
  148. PHP_FUNCTION(imap_lsub);
  149. PHP_FUNCTION(imap_lsub_full);
  150. PHP_FUNCTION(imap_create);
  151. PHP_FUNCTION(imap_rename);
  152. PHP_FUNCTION(imap_status);
  153. PHP_FUNCTION(imap_bodystruct);
  154. PHP_FUNCTION(imap_fetch_overview);
  155. PHP_FUNCTION(imap_mail_compose);
  156. PHP_FUNCTION(imap_alerts);
  157. PHP_FUNCTION(imap_errors);
  158. PHP_FUNCTION(imap_last_error);
  159. PHP_FUNCTION(imap_mail);
  160. PHP_FUNCTION(imap_search);
  161. PHP_FUNCTION(imap_utf8);
  162. PHP_FUNCTION(imap_utf7_decode);
  163. PHP_FUNCTION(imap_utf7_encode);
  164. #ifdef HAVE_IMAP_MUTF7
  165. PHP_FUNCTION(imap_utf8_to_mutf7);
  166. PHP_FUNCTION(imap_mutf7_to_utf8);
  167. #endif
  168. PHP_FUNCTION(imap_mime_header_decode);
  169. PHP_FUNCTION(imap_thread);
  170. PHP_FUNCTION(imap_timeout);
  171. #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
  172. PHP_FUNCTION(imap_get_quota);
  173. PHP_FUNCTION(imap_get_quotaroot);
  174. PHP_FUNCTION(imap_set_quota);
  175. PHP_FUNCTION(imap_setacl);
  176. PHP_FUNCTION(imap_getacl);
  177. #endif
  178. ZEND_BEGIN_MODULE_GLOBALS(imap)
  179. char *imap_user;
  180. char *imap_password;
  181. STRINGLIST *imap_alertstack;
  182. ERRORLIST *imap_errorstack;
  183. STRINGLIST *imap_folders;
  184. STRINGLIST *imap_folders_tail;
  185. STRINGLIST *imap_sfolders;
  186. STRINGLIST *imap_sfolders_tail;
  187. MESSAGELIST *imap_messages;
  188. MESSAGELIST *imap_messages_tail;
  189. FOBJECTLIST *imap_folder_objects;
  190. FOBJECTLIST *imap_folder_objects_tail;
  191. FOBJECTLIST *imap_sfolder_objects;
  192. FOBJECTLIST *imap_sfolder_objects_tail;
  193. folderlist_style_t folderlist_style;
  194. long status_flags;
  195. unsigned long status_messages;
  196. unsigned long status_recent;
  197. unsigned long status_unseen;
  198. unsigned long status_uidnext;
  199. unsigned long status_uidvalidity;
  200. #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
  201. zval **quota_return;
  202. zval *imap_acl_list;
  203. #endif
  204. /* php_stream for php_mail_gets() */
  205. php_stream *gets_stream;
  206. zend_bool enable_rsh;
  207. ZEND_END_MODULE_GLOBALS(imap)
  208. #ifdef ZTS
  209. # define IMAPG(v) TSRMG(imap_globals_id, zend_imap_globals *, v)
  210. #else
  211. # define IMAPG(v) (imap_globals.v)
  212. #endif
  213. #else
  214. #define imap_module_ptr NULL
  215. #endif
  216. #define phpext_imap_ptr imap_module_ptr
  217. #endif /* PHP_IMAP_H */