]> granicus.if.org Git - php/commitdiff
Correctly checks for the proper header files, and excludes the QUOTA functions
authorDan Kalowsky <kalowsky@php.net>
Mon, 26 Feb 2001 15:17:12 +0000 (15:17 +0000)
committerDan Kalowsky <kalowsky@php.net>
Mon, 26 Feb 2001 15:17:12 +0000 (15:17 +0000)
from non-imap2000 systems (unavailable for testing at this time).
# anyone willing to test this out on non-imap2000?
PR:
Submitted by:
Reviewed by: Sascha Schumann
Obtained from:

ext/imap/config.m4
ext/imap/php_imap.c
ext/imap/php_imap.h

index ff7a0a7ce146020124a31206080de329fc0e7ebf..84f46ca38cde7c533799bc75834bd2cf9f6b0f58 100644 (file)
@@ -1,6 +1,14 @@
 dnl $Id$
 
-AC_DEFUN(IMAP_INC_CHK,[if test -r $i$1/rfc822.h; then IMAP_DIR=$i; IMAP_INC_DIR=$i$1])
+AC_DEFUN(IMAP_INC_CHK,[if test -r "$i$1/c-client.h"; then
+               AC_DEFINE(HAVE_IMAP2000, 1, [ ])
+               IMAP_DIR=$i
+               IMAP_INC_DIR=$i$1
+       elif test -r "$i$1/rfc822.h"; then 
+               IMAP_DIR=$i; 
+               IMAP_INC_DIR=$i$1
+       
+])
 
 AC_DEFUN(IMAP_LIB_CHK,[
                str="$IMAP_DIR/$1/lib$lib.*"
index a52e6fe3184a7a483c6e5300df9b21877823d386..8e4a3b91f72fab86b983c4a4b37a80ce4c892d3e 100644 (file)
@@ -101,8 +101,10 @@ function_entry imap_functions[] = {
        PHP_FE(imap_createmailbox,      NULL)
        PHP_FE(imap_renamemailbox,      NULL)
        PHP_FE(imap_deletemailbox,      NULL)
+#ifdef HAVE_IMAP2000
        PHP_FE(imap_get_quota,          NULL)
        PHP_FE(imap_set_quota,          NULL)
+#endif
        PHP_FALIAS(imap_listmailbox, imap_list, NULL)
        PHP_FALIAS(imap_getmailboxes, imap_list_full,   NULL)
        PHP_FALIAS(imap_scanmailbox, imap_listscan,     NULL)
@@ -357,6 +359,7 @@ MESSAGELIST *mail_newmessagelist(void)
                                                                  sizeof(MESSAGELIST));
 }
 
+#ifdef HAVE_IMAP2000
 /* Mail GET_QUOTA callback
  * Called via the mail_parameter function in c-client:src/c-client/mail.c
  * Author DRK
@@ -370,6 +373,7 @@ void mail_getquota(MAILSTREAM *stream, char *qroot,QUOTALIST *qlist)
                IMAPG(quota_limit) = qlist->limit;
        }
 }
+#endif
 
 /* Mail garbage collect MESSAGELIST
  * Accepts: pointer to MESSAGELIST pointer
@@ -547,12 +551,13 @@ PHP_MINIT_FUNCTION(imap)
        /* next UID to be assigned */
        REGISTER_MAIN_LONG_CONSTANT("SA_UIDVALIDITY",SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS);
        /* UID validity value */
-
+#ifdef HAVE_IMAP2000
        sa_all |= GET_QUOTA;
         REGISTER_MAIN_LONG_CONSTANT("GET_QUOTA",GET_QUOTA , CONST_PERSISTENT | CONST_CS);
      /* Disk space taken up by mailbox. */
        sa_all |= GET_QUOTAROOT;
         REGISTER_MAIN_LONG_CONSTANT("GET_QUOTAROOT",GET_QUOTAROOT , CONST_PERSISTENT | CONST_CS);
+#endif
      /* Disk space taken up by all mailboxes owned by user. */
        REGISTER_MAIN_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS);
      /* get all status information */
@@ -1011,7 +1016,7 @@ PHP_FUNCTION(imap_num_recent)
 }
 /* }}} */
 
-
+#ifdef HAVE_IMAP2000
 /* {{{ proto array imap_get_quota(int stream_id, string qroot)
        Returns the quota set to the mailbox account qroot */
 PHP_FUNCTION(imap_get_quota)
@@ -1053,7 +1058,6 @@ PHP_FUNCTION(imap_get_quota)
 }
 /* }}} */
 
-
 /* {{{ proto int imap_set_quota(int stream_id, string qroot, int mailbox_size)
    Will set the quota for qroot mailbox */
 PHP_FUNCTION(imap_set_quota)
@@ -1084,6 +1088,7 @@ PHP_FUNCTION(imap_set_quota)
        RETURN_LONG(imap_setquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot), &limits));
 }
 /* }}} */
+#endif
 
 
 /* {{{ proto int imap_expunge(int stream_id)
index 2d91299376a87a22019966239134a52823ff2c51..cbdd491a9f7e38b5ecd6c90d41cf51993ce5199a 100644 (file)
@@ -6,12 +6,15 @@
 #include "build-defs.h"
 #endif
 
-/*
+#ifdef HAVE_IMAP2000
+ /* these are used for quota support */
+ #include "c-client.h" /* includes mail.h and rfc822.h */
+ #include "imap4r1.h"  /* location of c-client quota functions */
+#else
  #include "mail.h"
  #include "rfc822.h" 
-*/
-#include "c-client.h"
-#include "imap4r1.h"   /* used for the imap_setquota function */
+#endif
+
 #include "modules.h"
 
 extern zend_module_entry imap_module_entry;
@@ -104,8 +107,10 @@ PHP_FUNCTION(imap_renamemailbox);
 PHP_FUNCTION(imap_deletemailbox);
 PHP_FUNCTION(imap_listmailbox);
 PHP_FUNCTION(imap_scanmailbox);
+#ifdef HAVE_IMAP2000
 PHP_FUNCTION(imap_get_quota);
 PHP_FUNCTION(imap_set_quota);
+#endif
 PHP_FUNCTION(imap_subscribe);
 PHP_FUNCTION(imap_unsubscribe);
 PHP_FUNCTION(imap_append);
@@ -162,8 +167,10 @@ ZEND_BEGIN_MODULE_GLOBALS(imap)
        unsigned long status_unseen;
        unsigned long status_uidnext;
        unsigned long status_uidvalidity;
+#ifdef HAVE_IMAP2000
        unsigned long quota_usage;
        unsigned long quota_limit;
+#endif
 ZEND_END_MODULE_GLOBALS(imap)