[PHP-DEV] CVS update: php3/functions From: rasmus (php-dev <email protected>)
Date: 08/20/98

Date: Thursday August 20, 1998 @ 23:07
Author: rasmus

Update of /repository/php3/functions
In directory asf:/export/home/rasmus/php3/functions

Modified Files:
        imap.c
Log Message:
Oops, imap_open() already has an OP_EXPUNGE option. Re-assign CL_EXPUNGE
so it can be used to mean the same thing in both imap_open() and
imap_close()

Index: php3/functions/imap.c
diff -c php3/functions/imap.c:1.17 php3/functions/imap.c:1.18
*** php3/functions/imap.c:1.17 Thu Aug 20 22:56:46 1998
--- php3/functions/imap.c Thu Aug 20 23:07:49 1998
***************
*** 31,37 ****
     | Rasmus Lerdorf <rasmus <email protected>> |
     +----------------------------------------------------------------------+
   */
! /* $Id: imap.c,v 1.17 1998/08/21 02:56:46 rasmus Exp $ */
  
  #define IMAP41
  
--- 31,37 ----
     | Rasmus Lerdorf <rasmus <email protected>> |
     +----------------------------------------------------------------------+
   */
! /* $Id: imap.c,v 1.18 1998/08/21 03:07:49 rasmus Exp $ */
  
  #define IMAP41
  
***************
*** 80,86 ****
  #define IMAPVER "Imap 4"
  #endif
  
! #define PHP_OP_EXPUNGE 32768
  
  /*
   * this array should be set up as:
--- 80,86 ----
  #define IMAPVER "Imap 4"
  #endif
  
! #define PHP_EXPUNGE 32768
  
  /*
   * this array should be set up as:
***************
*** 261,276 ****
         REGISTER_MAIN_LONG_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS);
  /* don't do non-secure authentication */
  
! /* This is a PHP-specific define added because it seems like a good idea to be able to
! indicate that the mailbox should be automatically expunged during imap_open in case the
! script get interrupted and it doesn't get to the imap_close() where this option is
! normally placed. If the c-client library adds other options and the value for this
! one conflicts, simply make this one higher at the top of this file */
! REGISTER_MAIN_LONG_CONSTANT("OP_EXPUNGE", PHP_OP_EXPUNGE, CONST_PERSISTENT | CONST_CS);
!
! /* Close options */
!
! REGISTER_MAIN_LONG_CONSTANT("CL_EXPUNGE", CL_EXPUNGE, CONST_PERSISTENT | CONST_CS);
          /* expunge silently */
  
  
--- 261,275 ----
         REGISTER_MAIN_LONG_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS);
  /* don't do non-secure authentication */
  
! /*
! PHP re-assigns CL_EXPUNGE a custom value that can be used as part of the imap_open() bitfield
! because it seems like a good idea to be able to indicate that the mailbox should be
! automatically expunged during imap_open in case the script get interrupted and it doesn't get
! to the imap_close() where this option is normally placed. If the c-client library adds other
! options and the value for this one conflicts, simply make PHP_EXPUNGE higher at the top of
! this file
! */
! REGISTER_MAIN_LONG_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS);
          /* expunge silently */
  
  
***************
*** 385,393 ****
                  if(myargc ==4) {
                          convert_to_long(options);
                          flags = options->value.lval;
! if(flags & PHP_OP_EXPUNGE) {
                                  cl_flags = CL_EXPUNGE;
! flags ^= PHP_OP_EXPUNGE;
                          }
                  }
                  strcpy(imap_user,user->value.str.val);
--- 384,392 ----
                  if(myargc ==4) {
                          convert_to_long(options);
                          flags = options->value.lval;
! if(flags & PHP_EXPUNGE) {
                                  cl_flags = CL_EXPUNGE;
! flags ^= PHP_EXPUNGE;
                          }
                  }
                  strcpy(imap_user,user->value.str.val);
***************
*** 570,575 ****
--- 569,575 ----
          int ind, ind_type;
          pils *imap_le_struct=NULL;
          int myargcount=ARG_COUNT(ht);
+ long flags = NIL;
  
          if (myargcount < 1 || myargcount > 2 || getParameters(ht, myargcount, &streamind, &options) == FAILURE) {
                  WRONG_PARAM_COUNT;
***************
*** 583,589 ****
      }
          if(myargcount==2) {
                  convert_to_long(options);
! imap_le_struct->flags = options->value.lval;
          }
          php3_list_delete(ind);
          RETURN_TRUE;
--- 583,595 ----
      }
          if(myargcount==2) {
                  convert_to_long(options);
! flags = options->value.lval;
! /* Do the translation from PHP's internal PHP_EXPUNGE define to c-client's CL_EXPUNGE */
! if(flags & PHP_EXPUNGE) {
! flags ^= PHP_EXPUNGE;
! flags |= CL_EXPUNGE;
! }
! imap_le_struct->flags = flags;
          }
          php3_list_delete(ind);
          RETURN_TRUE;

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>