php_imap.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. #ifndef PHP_IMAP_H
  28. #define PHP_IMAP_H
  29. #ifdef HAVE_IMAP
  30. #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
  31. /* For now these appear on Windows, remove this check if it appears outside */
  32. # ifdef PHP_WIN32
  33. /* Undefine these LOG defines to avoid warnings */
  34. # undef LOG_EMERG
  35. # undef LOG_CRIT
  36. # undef LOG_ERR
  37. # undef LOG_WARNING
  38. # undef LOG_NOTICE
  39. # undef LOG_DEBUG
  40. /* c-client also redefines its own ftruncate */
  41. # undef ftruncate
  42. # endif
  43. /* these are used for quota support */
  44. # include "c-client.h" /* includes mail.h and rfc822.h */
  45. # include "imap4r1.h" /* location of c-client quota functions */
  46. #else
  47. # include "mail.h"
  48. # include "rfc822.h"
  49. #endif
  50. extern zend_module_entry imap_module_entry;
  51. #define imap_module_ptr &imap_module_entry
  52. #include "php_version.h"
  53. #define PHP_IMAP_VERSION PHP_VERSION
  54. /* Data types */
  55. #ifdef IMAP41
  56. #define LSIZE text.size
  57. #define LTEXT text.data
  58. #define DTYPE int
  59. #define CONTENT_PART nested.part
  60. #define CONTENT_MSG_BODY nested.msg->body
  61. #define IMAPVER "Imap 4R1"
  62. #else
  63. #define LSIZE size
  64. #define LTEXT text
  65. #define DTYPE char
  66. #define CONTENT_PART contents.part
  67. #define CONTENT_MSG_BODY contents.msg.body
  68. #define IMAPVER "Imap 4"
  69. #endif
  70. /* Determines how mm_list() and mm_lsub() are to return their results. */
  71. typedef enum {
  72. FLIST_ARRAY,
  73. FLIST_OBJECT
  74. } folderlist_style_t;
  75. typedef struct php_imap_mailbox_struct {
  76. SIZEDTEXT text;
  77. DTYPE delimiter;
  78. long attributes;
  79. struct php_imap_mailbox_struct *next;
  80. } FOBJECTLIST;
  81. typedef struct php_imap_error_struct {
  82. SIZEDTEXT text;
  83. long errflg;
  84. struct php_imap_error_struct *next;
  85. } ERRORLIST;
  86. typedef struct _php_imap_message_struct {
  87. unsigned long msgid;
  88. struct _php_imap_message_struct *next;
  89. } MESSAGELIST;
  90. /* Functions */
  91. PHP_MINIT_FUNCTION(imap);
  92. PHP_RINIT_FUNCTION(imap);
  93. PHP_RSHUTDOWN_FUNCTION(imap);
  94. PHP_MINFO_FUNCTION(imap);
  95. ZEND_BEGIN_MODULE_GLOBALS(imap)
  96. char *imap_user;
  97. char *imap_password;
  98. STRINGLIST *imap_alertstack;
  99. ERRORLIST *imap_errorstack;
  100. STRINGLIST *imap_folders;
  101. STRINGLIST *imap_folders_tail;
  102. STRINGLIST *imap_sfolders;
  103. STRINGLIST *imap_sfolders_tail;
  104. MESSAGELIST *imap_messages;
  105. MESSAGELIST *imap_messages_tail;
  106. FOBJECTLIST *imap_folder_objects;
  107. FOBJECTLIST *imap_folder_objects_tail;
  108. FOBJECTLIST *imap_sfolder_objects;
  109. FOBJECTLIST *imap_sfolder_objects_tail;
  110. folderlist_style_t folderlist_style;
  111. long status_flags;
  112. unsigned long status_messages;
  113. unsigned long status_recent;
  114. unsigned long status_unseen;
  115. unsigned long status_uidnext;
  116. unsigned long status_uidvalidity;
  117. #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
  118. zval **quota_return;
  119. zval *imap_acl_list;
  120. #endif
  121. /* php_stream for php_mail_gets() */
  122. php_stream *gets_stream;
  123. bool enable_rsh;
  124. ZEND_END_MODULE_GLOBALS(imap)
  125. #if defined(ZTS) && defined(COMPILE_DL_IMAP)
  126. ZEND_TSRMLS_CACHE_EXTERN()
  127. #endif
  128. ZEND_EXTERN_MODULE_GLOBALS(imap)
  129. #define IMAPG(v) ZEND_MODULE_GLOBALS_ACCESSOR(imap, v)
  130. #else
  131. #define imap_module_ptr NULL
  132. #endif
  133. #define phpext_imap_ptr imap_module_ptr
  134. #endif /* PHP_IMAP_H */