CVS update: php3/functions

From: Date: Fri, 21 Aug 1998 02:35:13 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-385@lists.php.net to get a copy of this message
Date: Thursday August 20, 1998 @ 22:35 Author: rasmus Update of /repository/php3/functions In directory asf:/export/home/rasmus/php3/functions Modified Files: imap.c Log Message: Add optional argument to imap_close and try to get some formatting consistency throughout this module. Index: php3/functions/imap.c diff -c php3/functions/imap.c:1.15 php3/functions/imap.c:1.16 *** php3/functions/imap.c:1.15 Thu Aug 20 15:15:45 1998 --- php3/functions/imap.c Thu Aug 20 22:35:13 1998 *************** *** 1,3 **** --- 1,38 ---- + /* + +----------------------------------------------------------------------+ + | PHP HTML Embedded Scripting Language Version 3.0 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997,1998 PHP Development Team (See Credits file) | + +----------------------------------------------------------------------+ + | This program is free software; you can redistribute it and/or modify | + | it under the terms of one of the following licenses: | + | | + | A) the GNU General Public License as published by the Free Software | + | Foundation; either version 2 of the License, or (at your option) | + | any later version. | + | | + | B) the PHP License as published by the PHP Development Team and | + | included in the distribution in the file: LICENSE | + | | + | This program is distributed in the hope that it will be useful, | + | but WITHOUT ANY WARRANTY; without even the implied warranty of | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | + | GNU General Public License for more details. | + | | + | You should have received a copy of both licenses referred to here. | + | If you did not, or have any questions about PHP licensing, please | + | contact core@php.net. | + +----------------------------------------------------------------------+ + | Authors: Rex Logan <veebert@dimensional.com> | + | Mark Musone <musone@afterfive.com> | + | Brian Wang <brian@vividnet.com> | + | Kaj-Michael Lang <milang@tal.org> | + | Antoni Pamies Olive <toni@readysoft.net> | + | Rasmus Lerdorf <rasmus@lerdorf.on.ca> | + +----------------------------------------------------------------------+ + */ + /* $Id: imap.c,v 1.16 1998/08/21 02:35:13 rasmus Exp $ */ + #define IMAP41 #ifdef ERROR *************** *** 25,31 **** #include "mail.h" #include "rfc822.h" #include "modules.h" - MAILSTREAM *mail_close_it (MAILSTREAM *stream); #if (WIN32|WINNT) #include "winsock.h" #endif --- 60,65 ---- *************** *** 61,66 **** --- 95,107 ---- int add_next_index_object(pval *arg, pval tmp); void imap_add_body( pval *arg, BODY *body ); + typedef struct php3_imap_le_struct { + MAILSTREAM *imap_stream; + long flags; + } pils; + + MAILSTREAM *mail_close_it (pils *imap_le_struct); + function_entry imap_functions[] = { {"imap_open", php3_imap_open, NULL}, *************** *** 128,136 **** STRINGLIST *imap_folders=NIL; STRINGLIST *imap_sfolders=NIL; ! MAILSTREAM *mail_close_it (MAILSTREAM *stream) { ! return mail_close_full ( stream,NIL); } inline int add_assoc_object(pval *arg, char *key, pval tmp) --- 169,180 ---- STRINGLIST *imap_folders=NIL; STRINGLIST *imap_sfolders=NIL; ! MAILSTREAM *mail_close_it (pils *imap_le_struct) { ! MAILSTREAM *ret; ! ret = mail_close_full (imap_le_struct->imap_stream,imap_le_struct->flags); ! efree(imap_le_struct); ! return ret; } inline int add_assoc_object(pval *arg, char *key, pval tmp) *************** *** 315,320 **** --- 359,366 ---- pval *passwd; pval *options; MAILSTREAM *imap_stream; + pils *imap_le_struct; + int ind; int myargc=ARG_COUNT(ht); *************** *** 334,340 **** php3_error(E_WARNING,"Couldn't open stream %s\n",mailbox->value.str.val); RETURN_FALSE; } ! ind = php3_list_insert(imap_stream, le_imap); RETURN_LONG(ind); } --- 380,391 ---- php3_error(E_WARNING,"Couldn't open stream %s\n",mailbox->value.str.val); RETURN_FALSE; } ! /* Note that if we ever come up with a persistent imap stream, the persistent version of this ! struct needs to be malloc'ed and not emalloc'ed */ ! imap_le_struct = emalloc(sizeof(pils)); ! imap_le_struct->imap_stream = imap_stream; ! imap_le_struct->flags = NIL; ! ind = php3_list_insert(imap_le_struct, le_imap); RETURN_LONG(ind); } *************** *** 348,353 **** --- 399,405 ---- pval *mailbox; pval *options; MAILSTREAM *imap_stream; + pils *imap_le_struct; int ind, ind_type; int myargc=ARG_COUNT(ht); if (myargc<2 || myargc>3 || getParameters(ht,myargc,&streamind, &mailbox, &options) == FAILURE) { *************** *** 356,363 **** convert_to_long(streamind); ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } --- 408,415 ---- convert_to_long(streamind); ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } *************** *** 365,372 **** convert_to_string(mailbox); if(myargc == 3) convert_to_long(options); ! imap_stream = mail_open(imap_stream,mailbox->value.str.val,myargc == 3 ? options->value.lval : NIL ); ! if (imap_stream == NIL){ php3_error(E_WARNING,"Couldn't re-open stream\n"); RETURN_FALSE; } --- 417,424 ---- convert_to_string(mailbox); if(myargc == 3) convert_to_long(options); ! imap_stream = mail_open(imap_le_struct->imap_stream,mailbox->value.str.val,myargc == 3 ? options->value.lval : NIL ); ! if (imap_stream == NIL) { php3_error(E_WARNING,"Couldn't re-open stream\n"); RETURN_FALSE; } *************** *** 377,383 **** { pval *streamind,*folder, *message,*flags; int ind, ind_type; ! MAILSTREAM *imap_stream; STRING st; int myargc=ARG_COUNT(ht); --- 429,435 ---- { pval *streamind,*folder, *message,*flags; int ind, ind_type; ! pils *imap_le_struct; STRING st; int myargc=ARG_COUNT(ht); *************** *** 391,404 **** if (myargc == 4) convert_to_long(flags); ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find( ind, &ind_type ); ! if ( !imap_stream || ind_type != le_imap ) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } INIT (&st,mail_string,(void *) message->value.str.val,message->value.str.len); ! mail_append_full( imap_stream, folder->value.str.val,myargc==4?flags->value.str.val:NIL,NIL,&st); RETURN_TRUE; } --- 443,456 ---- if (myargc == 4) convert_to_long(flags); ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find( ind, &ind_type ); ! if ( !imap_le_struct || ind_type != le_imap ) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } INIT (&st,mail_string,(void *) message->value.str.val,message->value.str.len); ! mail_append_full(imap_le_struct->imap_stream, folder->value.str.val,myargc==4?flags->value.str.val:NIL,NIL,&st); RETURN_TRUE; } *************** *** 406,412 **** { pval *streamind; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { WRONG_PARAM_COUNT; --- 458,464 ---- { pval *streamind; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 416,436 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! RETURN_LONG(imap_stream->nmsgs); } void php3_imap_ping(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { WRONG_PARAM_COUNT; --- 468,488 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! RETURN_LONG(imap_le_struct->imap_stream->nmsgs); } void php3_imap_ping(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 439,450 **** convert_to_long( streamind ); ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find( ind, &ind_type ); ! if ( !imap_stream || ind_type != le_imap ) { php3_error( E_WARNING, "Unable to find stream pointer" ); RETURN_FALSE; } ! RETURN_LONG( mail_ping( imap_stream ) ); } --- 491,502 ---- convert_to_long( streamind ); ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find( ind, &ind_type ); ! if ( !imap_le_struct || ind_type != le_imap ) { php3_error( E_WARNING, "Unable to find stream pointer" ); RETURN_FALSE; } ! RETURN_LONG( mail_ping( imap_le_struct->imap_stream ) ); } *************** *** 452,476 **** { pval *streamind; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long(streamind); ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! RETURN_LONG(imap_stream->recent); } void php3_imap_expunge(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { WRONG_PARAM_COUNT; --- 504,528 ---- { pval *streamind; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long(streamind); ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! RETURN_LONG(imap_le_struct->imap_stream->recent); } void php3_imap_expunge(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 480,493 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! mail_expunge (imap_stream); RETURN_TRUE; } --- 532,545 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! mail_expunge (imap_le_struct->imap_stream); RETURN_TRUE; } *************** *** 495,508 **** void php3_imap_close(INTERNAL_FUNCTION_PARAMETERS) { ! pval *ind; int myargcount=ARG_COUNT(ht); ! if (myargcount != 1 || getParameters(ht, myargcount, &ind) == FAILURE) { WRONG_PARAM_COUNT; } ! convert_to_long(ind); ! php3_list_delete(ind->value.lval); RETURN_TRUE; } --- 547,572 ---- void php3_imap_close(INTERNAL_FUNCTION_PARAMETERS) { ! pval *options, *streamind; ! int ind, ind_type; ! pils *imap_le_struct=NULL; int myargcount=ARG_COUNT(ht); ! if (myargcount < 1 || myargcount > 2 || getParameters(ht, myargcount, &streamind, &options) == FAILURE) { WRONG_PARAM_COUNT; } ! convert_to_long(streamind); ! ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct->imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! if(myargcount==2) { ! convert_to_long(options); ! imap_le_struct->flags = options->value.lval; ! } ! php3_list_delete(ind); RETURN_TRUE; } *************** *** 514,520 **** unsigned long i; char *t; unsigned int msgno; ! MAILSTREAM *imap_stream; char tmp[MAILTMPLEN]; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { --- 578,584 ---- unsigned long i; char *t; unsigned int msgno; ! pils *imap_le_struct; char tmp[MAILTMPLEN]; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { *************** *** 525,533 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } --- 589,597 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct->imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } *************** *** 537,545 **** RETURN_FALSE; } ! for (msgno = 1; msgno <= imap_stream->nmsgs; msgno++) { ! MESSAGECACHE * cache = mail_elt (imap_stream,msgno); ! mail_fetchstructure (imap_stream,msgno,NIL); tmp[0] = cache->recent ? (cache->seen ? 'R': 'N') : ' '; tmp[1] = (cache->recent | cache->seen) ? ' ' : 'U'; tmp[2] = cache->flagged ? 'F' : ' '; --- 601,609 ---- RETURN_FALSE; } ! for (msgno = 1; msgno <= imap_le_struct->imap_stream->nmsgs; msgno++) { ! MESSAGECACHE * cache = mail_elt (imap_le_struct->imap_stream,msgno); ! mail_fetchstructure (imap_le_struct->imap_stream,msgno,NIL); tmp[0] = cache->recent ? (cache->seen ? 'R': 'N') : ' '; tmp[1] = (cache->recent | cache->seen) ? ' ' : 'U'; tmp[2] = cache->flagged ? 'F' : ' '; *************** *** 549,565 **** mail_date (tmp+11,cache); tmp[17] = ' '; tmp[18] = '\0'; ! mail_fetchfrom (tmp+18,imap_stream,msgno,(long) 20); strcat (tmp," "); if ((i = cache->user_flags)) { strcat (tmp,"{"); while (i) { ! strcat (tmp,imap_stream->user_flags[find_rightmost_bit (&i)]); if (i) strcat (tmp," "); } strcat (tmp,"} "); } ! mail_fetchsubject(t=tmp+strlen(tmp),imap_stream,msgno,(long)25); sprintf (t+=strlen(t)," (%ld chars)",cache->rfc822_size); add_next_index_string(return_value,tmp,1); } --- 613,629 ---- mail_date (tmp+11,cache); tmp[17] = ' '; tmp[18] = '\0'; ! mail_fetchfrom (tmp+18,imap_le_struct->imap_stream,msgno,(long) 20); strcat (tmp," "); if ((i = cache->user_flags)) { strcat (tmp,"{"); while (i) { ! strcat (tmp,imap_le_struct->imap_stream->user_flags[find_rightmost_bit (&i)]); if (i) strcat (tmp," "); } strcat (tmp,"} "); } ! mail_fetchsubject(t=tmp+strlen(tmp),imap_le_struct->imap_stream,msgno,(long)25); sprintf (t+=strlen(t)," (%ld chars)",cache->rfc822_size); add_next_index_string(return_value,tmp,1); } *************** *** 570,576 **** { pval *streamind, * msgno, *flags; int ind, ind_type; ! MAILSTREAM *imap_stream; int myargc=ARG_COUNT(ht); if (myargc <2 || myargc > 3 || getParameters(ht,myargc,&streamind,&msgno,&flags) == FAILURE) { WRONG_PARAM_COUNT; --- 634,640 ---- { pval *streamind, * msgno, *flags; int ind, ind_type; ! pils *imap_le_struct; int myargc=ARG_COUNT(ht); if (myargc <2 || myargc > 3 || getParameters(ht,myargc,&streamind,&msgno,&flags) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 581,592 **** if(myargc == 3) convert_to_long(flags); ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! RETVAL_STRING(mail_fetchtext_full (imap_stream,msgno->value.lval,NIL,myargc == 3 ? flags->value.lval : NIL),1); } --- 645,656 ---- if(myargc == 3) convert_to_long(flags); ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! RETVAL_STRING(mail_fetchtext_full (imap_le_struct->imap_stream,msgno->value.lval,NIL,myargc == 3 ? flags->value.lval : NIL),1); } *************** *** 594,600 **** { pval *streamind, * msgno, *flags; int ind, ind_type; ! MAILSTREAM *imap_stream; int myargcount = ARG_COUNT(ht); if (myargcount >3 || myargcount <2 || getParameters(ht,myargcount,&streamind,&msgno,&flags) == FAILURE) { WRONG_PARAM_COUNT; --- 658,664 ---- { pval *streamind, * msgno, *flags; int ind, ind_type; ! pils *imap_le_struct; int myargcount = ARG_COUNT(ht); if (myargcount >3 || myargcount <2 || getParameters(ht,myargcount,&streamind,&msgno,&flags) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 605,624 **** if (myargcount == 3) convert_to_long(flags); ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! RETVAL_STRING(mail_fetchtext_full (imap_stream,msgno->value.lval,NIL,myargcount==3?flags->value.lval:NIL),1); ! } void php3_imap_mail_copy(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind,*seq, *folder, *options; int ind, ind_type; ! MAILSTREAM *imap_stream; int myargcount = ARG_COUNT(ht); if (myargcount > 4 || myargcount < 3 || getParameters(ht,myargcount,&streamind,&seq,&folder,&options) == FAILURE) { --- 669,687 ---- if (myargcount == 3) convert_to_long(flags); ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! RETVAL_STRING(mail_fetchtext_full (imap_le_struct->imap_stream,msgno->value.lval,NIL,myargcount==3?flags->value.lval:NIL),1); } void php3_imap_mail_copy(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind,*seq, *folder, *options; int ind, ind_type; ! pils *imap_le_struct; int myargcount = ARG_COUNT(ht); if (myargcount > 4 || myargcount < 3 || getParameters(ht,myargcount,&streamind,&seq,&folder,&options) == FAILURE) { *************** *** 631,642 **** if(myargcount == 4) convert_to_long(options); ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if ( mail_copy_full(imap_stream,seq->value.str.val,folder->value.str.val,myargcount == 4 ? options->value.lval : NIL)==T ) { RETURN_TRUE; } else { RETURN_FALSE; --- 694,705 ---- if(myargcount == 4) convert_to_long(options); ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if ( mail_copy_full(imap_le_struct->imap_stream,seq->value.str.val,folder->value.str.val,myargcount == 4 ? options->value.lval : NIL)==T ) { RETURN_TRUE; } else { RETURN_FALSE; *************** *** 647,653 **** { pval *streamind,*seq, *folder; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht)!=3 || getParameters(ht,3,&streamind,&seq,&folder) == FAILURE) { --- 710,716 ---- { pval *streamind,*seq, *folder; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht)!=3 || getParameters(ht,3,&streamind,&seq,&folder) == FAILURE) { *************** *** 660,671 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if ( mail_move(imap_stream,seq->value.str.val,folder->value.str.val)==T ) { RETURN_TRUE; } else { RETURN_FALSE; --- 723,734 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if ( mail_move(imap_le_struct->imap_stream,seq->value.str.val,folder->value.str.val)==T ) { RETURN_TRUE; } else { RETURN_FALSE; *************** *** 676,682 **** { pval *streamind, *folder; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&folder) == FAILURE) { WRONG_PARAM_COUNT; --- 739,745 ---- { pval *streamind, *folder; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&folder) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 687,698 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if ( mail_create(imap_stream,folder->value.str.val)==T ) { RETURN_TRUE; } else { RETURN_FALSE; --- 750,761 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if ( mail_create(imap_le_struct->imap_stream,folder->value.str.val)==T ) { RETURN_TRUE; } else { RETURN_FALSE; *************** *** 703,709 **** { pval *streamind, *old, *new; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht)!=3 || getParameters(ht,3,&streamind,&old,&new)==FAILURE){ WRONG_PARAM_COUNT; --- 766,772 ---- { pval *streamind, *old, *new; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht)!=3 || getParameters(ht,3,&streamind,&old,&new)==FAILURE){ WRONG_PARAM_COUNT; *************** *** 715,726 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if ( mail_rename(imap_stream,old->value.str.val,new->value.str.val)==T ) { RETURN_TRUE; } else { RETURN_FALSE; --- 778,789 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if ( mail_rename(imap_le_struct->imap_stream,old->value.str.val,new->value.str.val)==T ) { RETURN_TRUE; } else { RETURN_FALSE; *************** *** 731,737 **** { pval *streamind, *folder; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&folder) == FAILURE) { WRONG_PARAM_COUNT; --- 794,800 ---- { pval *streamind, *folder; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&folder) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 742,753 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if ( mail_delete(imap_stream,folder->value.str.val)==T ) { RETURN_TRUE; } else { RETURN_FALSE; --- 805,816 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if ( mail_delete(imap_le_struct->imap_stream,folder->value.str.val)==T ) { RETURN_TRUE; } else { RETURN_FALSE; *************** *** 758,764 **** { pval *streamind, *ref, *pat; int ind, ind_type; ! MAILSTREAM *imap_stream; STRINGLIST *cur=NIL; if (ARG_COUNT(ht)!=3 --- 821,827 ---- { pval *streamind, *ref, *pat; int ind, ind_type; ! pils *imap_le_struct; STRINGLIST *cur=NIL; if (ARG_COUNT(ht)!=3 *************** *** 772,784 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } imap_folders = NIL; ! mail_list(imap_stream,ref->value.str.val,pat->value.str.val); if (imap_folders == NIL) { RETURN_FALSE; } --- 835,847 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } imap_folders = NIL; ! mail_list(imap_le_struct->imap_stream,ref->value.str.val,pat->value.str.val); if (imap_folders == NIL) { RETURN_FALSE; } *************** *** 790,838 **** } mail_free_stringlist (&imap_folders); } void php3_imap_listscan(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *ref, *pat, *content; ! int ind, ind_type; ! MAILSTREAM *imap_stream; ! STRINGLIST *cur=NIL; ! ! if (ARG_COUNT(ht)!=3 ! || getParameters(ht,4,&streamind,&ref,&pat,&content) == FAILURE) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long(streamind); ! convert_to_string(ref); ! convert_to_string(pat); ! convert_to_string(content); ! ! ind = streamind->value.lval; ! ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! imap_folders = NIL; ! mail_scan(imap_stream,ref->value.str.val,pat->value.str.val,content->value.str.val); ! if (imap_folders == NIL) { ! RETURN_FALSE; ! } ! array_init(return_value); ! cur=imap_folders; ! while (cur != NIL ) { ! add_next_index_string(return_value,cur->LTEXT,1); ! cur=cur->next; ! } ! mail_free_stringlist (&imap_folders); } void php3_imap_check(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind; int ind, ind_type; ! MAILSTREAM *imap_stream; char date[50]; if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&streamind) == FAILURE) { --- 853,901 ---- } mail_free_stringlist (&imap_folders); } + void php3_imap_listscan(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *ref, *pat, *content; ! int ind, ind_type; ! pils *imap_le_struct; ! STRINGLIST *cur=NIL; ! ! if (ARG_COUNT(ht)!=3 || getParameters(ht,4,&streamind,&ref,&pat,&content) == FAILURE) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long(streamind); ! convert_to_string(ref); ! convert_to_string(pat); ! convert_to_string(content); ! ! ind = streamind->value.lval; ! ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! imap_folders = NIL; ! mail_scan(imap_le_struct->imap_stream,ref->value.str.val,pat->value.str.val,content->value.str.val); ! if (imap_folders == NIL) { ! RETURN_FALSE; ! } ! array_init(return_value); ! cur=imap_folders; ! while (cur != NIL ) { ! add_next_index_string(return_value,cur->LTEXT,1); ! cur=cur->next; ! } ! mail_free_stringlist (&imap_folders); } void php3_imap_check(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind; int ind, ind_type; ! pils *imap_le_struct; char date[50]; if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&streamind) == FAILURE) { *************** *** 843,865 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if (mail_ping (imap_stream) == NIL ) { RETURN_FALSE; } ! if (imap_stream && imap_stream->mailbox) { rfc822_date (date); object_init(return_value); add_property_string(return_value,"Date",date,1); ! add_property_string(return_value,"Driver",imap_stream->dtb->name,1); ! add_property_string(return_value,"Mailbox",imap_stream->mailbox,1); ! add_property_long(return_value,"Nmsgs",imap_stream->nmsgs); ! add_property_long(return_value,"Recent",imap_stream->recent); } else { RETURN_FALSE; } --- 906,928 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if (mail_ping (imap_le_struct->imap_stream) == NIL ) { RETURN_FALSE; } ! if (imap_le_struct->imap_stream && imap_le_struct->imap_stream->mailbox) { rfc822_date (date); object_init(return_value); add_property_string(return_value,"Date",date,1); ! add_property_string(return_value,"Driver",imap_le_struct->imap_stream->dtb->name,1); ! add_property_string(return_value,"Mailbox",imap_le_struct->imap_stream->mailbox,1); ! add_property_long(return_value,"Nmsgs",imap_le_struct->imap_stream->nmsgs); ! add_property_long(return_value,"Recent",imap_le_struct->imap_stream->recent); } else { RETURN_FALSE; } *************** *** 870,876 **** { pval *streamind, * msgno; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&msgno) == FAILURE) { WRONG_PARAM_COUNT; --- 933,939 ---- { pval *streamind, * msgno; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&msgno) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 881,902 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! mail_setflag(imap_stream,msgno->value.str.val,"\\DELETED"); RETVAL_TRUE; - } void php3_imap_undelete(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind, * msgno; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&msgno) == FAILURE) { WRONG_PARAM_COUNT; --- 944,964 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! mail_setflag(imap_le_struct->imap_stream,msgno->value.str.val,"\\DELETED"); RETVAL_TRUE; } void php3_imap_undelete(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind, * msgno; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&msgno) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 907,941 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! mail_clearflag (imap_stream,msgno->value.str.val,"\\DELETED"); RETVAL_TRUE; - } void php3_imap_headerinfo(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, * msgno,to,tovals,from,fromvals,reply_to,reply_tovals,sender; ! pval *fromlength; ! pval *subjectlength; ! pval sendervals,return_path,return_pathvals; ! pval cc,ccvals,bcc,bccvals; ! pval *defaulthost; ! int ind, ind_type; ! unsigned long length; ! MAILSTREAM *imap_stream; MESSAGECACHE * cache; char *mystring; char dummy[2000]; char fulladdress[MAILTMPLEN]; ENVELOPE *en; - /* BODY *body; */ ADDRESS *addresstmp; int myargc; STRINGLIST *lines=mail_newstringlist (); --- 969,1001 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! mail_clearflag (imap_le_struct->imap_stream,msgno->value.str.val,"\\DELETED"); RETVAL_TRUE; } void php3_imap_headerinfo(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, * msgno,to,tovals,from,fromvals,reply_to,reply_tovals,sender; ! pval *fromlength; ! pval *subjectlength; ! pval sendervals,return_path,return_pathvals; ! pval cc,ccvals,bcc,bccvals; ! pval *defaulthost; ! int ind, ind_type; ! unsigned long length; ! pils *imap_le_struct; MESSAGECACHE * cache; char *mystring; char dummy[2000]; char fulladdress[MAILTMPLEN]; ENVELOPE *en; ADDRESS *addresstmp; int myargc; STRINGLIST *lines=mail_newstringlist (); *************** *** 946,966 **** } convert_to_long(streamind); convert_to_long(msgno); ! if(myargc >= 3) convert_to_long(fromlength); else fromlength=0x00;; ! if(myargc >= 4) convert_to_long(subjectlength); else subjectlength=0x00; ! if(myargc == 5) convert_to_string(defaulthost); ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if(msgno->value.lval <= imap_stream->nmsgs && mail_fetchstructure (imap_stream,msgno->value.lval,NIL)) ! cache = mail_elt (imap_stream,msgno->value.lval); else ! RETURN_FALSE; object_init(return_value); cur->LSIZE = strlen (cur->LTEXT = (char *)cpystr ("From")); --- 1006,1026 ---- } convert_to_long(streamind); convert_to_long(msgno); ! if(myargc >= 3) convert_to_long(fromlength); else fromlength=0x00;; ! if(myargc >= 4) convert_to_long(subjectlength); else subjectlength=0x00; ! if(myargc == 5) convert_to_string(defaulthost); ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! if(msgno->value.lval <= imap_le_struct->imap_stream->nmsgs && mail_fetchstructure (imap_le_struct->imap_stream,msgno->value.lval,NIL)) ! cache = mail_elt (imap_le_struct->imap_stream,msgno->value.lval); else ! RETURN_FALSE; object_init(return_value); cur->LSIZE = strlen (cur->LTEXT = (char *)cpystr ("From")); *************** *** 974,980 **** cur->LSIZE = strlen (cur->LTEXT = (char *)cpystr ("cc")); cur = cur->next = mail_newstringlist (); cur->LSIZE = strlen (cur->LTEXT = (char *)cpystr ("Reply-To")); ! mystring=mail_fetchheader_full(imap_stream,msgno->value.lval,lines,&length,NIL); mail_free_stringlist (&lines); if(myargc ==5) rfc822_parse_msg (&en,NULL,mystring,length,NULL,defaulthost->value.str.val,NIL); --- 1034,1040 ---- cur->LSIZE = strlen (cur->LTEXT = (char *)cpystr ("cc")); cur = cur->next = mail_newstringlist (); cur->LSIZE = strlen (cur->LTEXT = (char *)cpystr ("Reply-To")); ! mystring=mail_fetchheader_full(imap_le_struct->imap_stream,msgno->value.lval,lines,&length,NIL); mail_free_stringlist (&lines); if(myargc ==5) rfc822_parse_msg (&en,NULL,mystring,length,NULL,defaulthost->value.str.val,NIL); *************** *** 1133,1145 **** if(en->from && fromlength) { fulladdress[0]=0x00; ! mail_fetchfrom(fulladdress,imap_stream,msgno->value.lval,fromlength->value.lval); add_property_string(return_value,"fetchfrom",fulladdress,1); } if(en->subject && subjectlength) { fulladdress[0]=0x00; ! mail_fetchsubject(fulladdress,imap_stream,msgno->value.lval,subjectlength->value.lval); add_property_string(return_value,"fetchsubject",fulladdress,1); } } --- 1193,1205 ---- if(en->from && fromlength) { fulladdress[0]=0x00; ! mail_fetchfrom(fulladdress,imap_le_struct->imap_stream,msgno->value.lval,fromlength->value.lval); add_property_string(return_value,"fetchfrom",fulladdress,1); } if(en->subject && subjectlength) { fulladdress[0]=0x00; ! mail_fetchsubject(fulladdress,imap_le_struct->imap_stream,msgno->value.lval,subjectlength->value.lval); add_property_string(return_value,"fetchsubject",fulladdress,1); } } *************** *** 1147,1463 **** /* KMLANG */ void php3_imap_lsub(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *ref, *pat; ! int ind, ind_type; ! MAILSTREAM *imap_stream; ! STRINGLIST *cur=NIL; ! ! if (ARG_COUNT(ht)!=3 ! || getParameters(ht,3,&streamind,&ref,&pat) == FAILURE) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long(streamind); ! convert_to_string(ref); ! convert_to_string(pat); ! ! ind = streamind->value.lval; ! ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! imap_sfolders = NIL; ! mail_lsub(imap_stream,ref->value.str.val,pat->value.str.val); ! if (imap_sfolders == NIL) { ! RETURN_FALSE; ! } ! array_init(return_value); ! cur=imap_sfolders; ! while (cur != NIL ) { ! add_next_index_string(return_value,cur->LTEXT,1); ! cur=cur->next; ! } ! mail_free_stringlist (&imap_sfolders); } void php3_imap_subscribe(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *folder; ! int ind, ind_type; ! MAILSTREAM *imap_stream; ! ! if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&folder) == FAILURE) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long(streamind); ! convert_to_string(folder); ! ! ind = streamind->value.lval; ! ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! if ( mail_subscribe(imap_stream,folder->value.str.val)==T ) { ! RETURN_TRUE; ! } else { ! RETURN_FALSE; ! } } void php3_imap_unsubscribe(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *folder; ! int ind, ind_type; ! MAILSTREAM *imap_stream; ! ! if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&folder) == FAILURE) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long(streamind); ! convert_to_string(folder); ! ! ind = streamind->value.lval; ! ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! if ( mail_unsubscribe(imap_stream,folder->value.str.val)==T ) { ! RETURN_TRUE; ! } else { ! RETURN_FALSE; ! } ! } void imap_add_body( pval *arg, BODY *body ) { ! pval parametres, param, dparametres, dparam; ! PARAMETER *par, *dpar; ! PART *part; ! ! if(body->type) add_property_long( arg, "type", body->type ); ! if(body->encoding) add_property_long( arg, "encoding", body->encoding ); ! ! if ( body->subtype ){ ! add_property_long( arg, "ifsubtype", 1 ); ! add_property_string( arg, "subtype", body->subtype, 1 ); ! } else { ! add_property_long( arg, "ifsubtype", 0 ); ! } ! ! if ( body->description ){ ! add_property_long( arg, "ifdescription", 1 ); ! add_property_string( arg, "description", body->description, 1 ); ! } else { ! add_property_long( arg, "ifdescription", 0 ); ! } ! if ( body->id ){ ! add_property_long( arg, "ifid", 1 ); ! if(body->description) add_property_string( arg, "id", body->description, 1 ); ! } else { ! add_property_long( arg, "ifid", 0 ); ! } ! if(body->size.lines) add_property_long( arg, "lines", body->size.lines ); ! if(body->size.bytes) add_property_long( arg, "bytes", body->size.bytes ); #ifdef IMAP41 ! if ( body->disposition.type ){ ! add_property_long( arg, "ifdisposition", 1); ! add_property_string( arg, "disposition", body->disposition.type, 1); ! } else { ! add_property_long( arg, "ifdisposition", 0); ! } ! ! if ( body->disposition.parameter ) ! { ! dpar = body->disposition.parameter; ! add_property_long( arg, "ifdparametres", 1); ! array_init( &dparametres ); ! do { ! object_init( &dparam ); ! add_property_string( &dparam, "attribute", dpar->attribute, 1); ! add_property_string( &dparam, "value", dpar->value, 1); ! add_next_index_object( &dparametres, dparam ); } while ( (dpar = dpar->next) ); ! add_assoc_object( arg, "dparametres", dparametres ); ! } ! else ! { ! add_property_long( arg, "ifdparametres", 0); ! } #endif ! if ( (par = body->parameter) ) { ! add_property_long( arg, "ifparametres", 1 ); ! array_init( &parametres ); ! do{ ! object_init( &param ); ! if(par->attribute) add_property_string( &param, "attribute", par->attribute, 1 ); ! if(par->value) add_property_string( &param, "value", par->value, 1 ); ! ! add_next_index_object( &parametres, param ); ! } while ( (par = par->next) ); ! } else { ! object_init(&parametres); ! add_property_long( arg, "ifparametres", 0 ); ! } ! add_assoc_object( arg, "parametres", parametres ); ! ! /* multipart message ? */ ! ! if ( body->type == TYPEMULTIPART ){ ! array_init( &parametres ); ! for ( part = body->CONTENT_PART; part; part = part->next ){ ! object_init( &param ); ! imap_add_body( &param, &part->body ); ! add_next_index_object( &parametres, param ); ! } ! add_assoc_object( arg, "parts", parametres ); ! } ! /* encapsulated message ? */ ! if ( ( body->type == TYPEMESSAGE ) && (!strncasecmp(body->subtype, "rfc822", 6))){ ! body=body->CONTENT_MSG_BODY; ! array_init(&parametres); ! object_init( &param ); ! imap_add_body( &param, body ); ! add_next_index_object(&parametres, param ); ! add_assoc_object( arg, "parts", parametres ); ! } } void php3_imap_fetchstructure(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *msgno; ! int ind, ind_type; ! MAILSTREAM *imap_stream; ! BODY *body; ! ! if ( ARG_COUNT(ht) != 2 || getParameters( ht, 2, &streamind, &msgno ) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! convert_to_long( streamind ); ! convert_to_long( msgno ); ! object_init(return_value); ! ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find( ind, &ind_type ); ! if ( !imap_stream || ind_type != le_imap ) { ! php3_error( E_WARNING, "Unable to find stream pointer" ); ! RETURN_FALSE; ! } ! mail_fetchstructure( imap_stream, msgno->value.lval, &body ); ! if ( !body ) { ! php3_error( E_WARNING, "No body information available" ); ! RETURN_FALSE; ! } ! imap_add_body( return_value, body ); } void php3_imap_fetchbody(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *msgno, *sec,*flags; ! int ind, ind_type; ! MAILSTREAM *imap_stream; ! char *body; ! unsigned long len; ! int myargc=ARG_COUNT(ht); ! if(myargc < 3 || myargc >4 || getParameters( ht, myargc, &streamind, &msgno, &sec,&flags ) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long( streamind ); ! convert_to_long( msgno ); ! convert_to_string( sec ); ! if(myargc == 4) convert_to_long(flags); ! ind = streamind->value.lval; ! ! imap_stream = ( MAILSTREAM *)php3_list_find( ind, &ind_type ); ! ! if ( !imap_stream || ind_type != le_imap ) { ! php3_error( E_WARNING, "Unable to find stream pointer" ); ! RETURN_FALSE; ! } ! body = mail_fetchbody_full( imap_stream, msgno->value.lval, sec->value.str.val, &len,myargc == 4 ? flags->value.lval : NIL ); ! if ( !body ) { ! php3_error( E_WARNING, "No body information available" ); ! RETURN_FALSE; ! } ! RETVAL_STRING( body ,1); } void php3_imap_base64(INTERNAL_FUNCTION_PARAMETERS) { ! pval *text; ! char *decode; ! unsigned long newlength; ! if ( ARG_COUNT(ht) != 1 || getParameters( ht, 1, &text) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_string( text ); ! object_init(return_value); ! ! decode = (char *) rfc822_base64((unsigned char *) text->value.str.val, ! text->value.str.len,&newlength); ! RETVAL_STRINGL(decode,newlength,1); } void php3_imap_qprint(INTERNAL_FUNCTION_PARAMETERS) { ! pval *text; ! char *decode; ! unsigned long newlength; ! if ( ARG_COUNT(ht) != 1 || getParameters( ht, 1, &text) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_string( text ); ! object_init(return_value); ! ! decode = (char *) rfc822_qprint((unsigned char *) text->value.str.val, ! text->value.str.len,&newlength); ! RETVAL_STRINGL(decode,newlength,1); } void php3_imap_8bit(INTERNAL_FUNCTION_PARAMETERS) { ! pval *text; ! char *decode; ! unsigned long newlength; ! if ( ARG_COUNT(ht) != 1 || getParameters( ht, 1, &text) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_string( text ); ! object_init(return_value); ! ! decode = (char *) rfc822_8bit((unsigned char *) text->value.str.val, ! text->value.str.len,&newlength); ! RETVAL_STRINGL(decode,newlength,1); } void php3_imap_binary(INTERNAL_FUNCTION_PARAMETERS) { ! pval *text,*length; #if 0 char *decode; FILE *fp; --- 1207,1515 ---- /* KMLANG */ void php3_imap_lsub(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *ref, *pat; ! int ind, ind_type; ! pils *imap_le_struct; ! STRINGLIST *cur=NIL; ! ! if (ARG_COUNT(ht)!=3 || getParameters(ht,3,&streamind,&ref,&pat) == FAILURE) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long(streamind); ! convert_to_string(ref); ! convert_to_string(pat); ! ! ind = streamind->value.lval; ! ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! imap_sfolders = NIL; ! mail_lsub(imap_le_struct->imap_stream,ref->value.str.val,pat->value.str.val); ! if (imap_sfolders == NIL) { ! RETURN_FALSE; ! } ! array_init(return_value); ! cur=imap_sfolders; ! while (cur != NIL ) { ! add_next_index_string(return_value,cur->LTEXT,1); ! cur=cur->next; ! } ! mail_free_stringlist (&imap_sfolders); } void php3_imap_subscribe(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *folder; ! int ind, ind_type; ! pils *imap_le_struct; ! ! if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&folder) == FAILURE) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long(streamind); ! convert_to_string(folder); ! ! ind = streamind->value.lval; ! ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! if ( mail_subscribe(imap_le_struct->imap_stream,folder->value.str.val)==T ) { ! RETURN_TRUE; ! } else { ! RETURN_FALSE; ! } } + void php3_imap_unsubscribe(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *folder; ! int ind, ind_type; ! pils *imap_le_struct; ! ! if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&folder) == FAILURE) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long(streamind); ! convert_to_string(folder); ! ! ind = streamind->value.lval; + imap_le_struct = (pils *)php3_list_find(ind, &ind_type); + if (!imap_le_struct || ind_type != le_imap) { + php3_error(E_WARNING, "Unable to find stream pointer"); + RETURN_FALSE; + } + if ( mail_unsubscribe(imap_le_struct->imap_stream,folder->value.str.val)==T ) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } + } void imap_add_body( pval *arg, BODY *body ) { ! pval parametres, param, dparametres, dparam; ! PARAMETER *par, *dpar; ! PART *part; ! ! if(body->type) add_property_long( arg, "type", body->type ); ! if(body->encoding) add_property_long( arg, "encoding", body->encoding ); ! ! if ( body->subtype ){ ! add_property_long( arg, "ifsubtype", 1 ); ! add_property_string( arg, "subtype", body->subtype, 1 ); ! } else { ! add_property_long( arg, "ifsubtype", 0 ); ! } ! if ( body->description ){ ! add_property_long( arg, "ifdescription", 1 ); ! add_property_string( arg, "description", body->description, 1 ); ! } else { ! add_property_long( arg, "ifdescription", 0 ); ! } ! if ( body->id ){ ! add_property_long( arg, "ifid", 1 ); ! if(body->description) add_property_string( arg, "id", body->description, 1 ); ! } else { ! add_property_long( arg, "ifid", 0 ); ! } ! ! if(body->size.lines) add_property_long( arg, "lines", body->size.lines ); ! if(body->size.bytes) add_property_long( arg, "bytes", body->size.bytes ); #ifdef IMAP41 ! if ( body->disposition.type ){ ! add_property_long( arg, "ifdisposition", 1); ! add_property_string( arg, "disposition", body->disposition.type, 1); ! } else { ! add_property_long( arg, "ifdisposition", 0); ! } ! ! if ( body->disposition.parameter ) { ! dpar = body->disposition.parameter; ! add_property_long( arg, "ifdparametres", 1); ! array_init( &dparametres ); ! do { ! object_init( &dparam ); ! add_property_string( &dparam, "attribute", dpar->attribute, 1); ! add_property_string( &dparam, "value", dpar->value, 1); ! add_next_index_object( &dparametres, dparam ); } while ( (dpar = dpar->next) ); ! add_assoc_object( arg, "dparametres", dparametres ); ! } else { ! add_property_long( arg, "ifdparametres", 0); ! } #endif ! if ( (par = body->parameter) ) { ! add_property_long( arg, "ifparametres", 1 ); ! array_init( &parametres ); ! do { ! object_init( &param ); ! if(par->attribute) add_property_string( &param, "attribute", par->attribute, 1 ); ! if(par->value) add_property_string( &param, "value", par->value, 1 ); ! add_next_index_object( &parametres, param ); ! } while ( (par = par->next) ); ! } else { ! object_init(&parametres); ! add_property_long( arg, "ifparametres", 0 ); ! } ! add_assoc_object( arg, "parametres", parametres ); ! ! /* multipart message ? */ ! ! if ( body->type == TYPEMULTIPART ) { ! array_init( &parametres ); ! for ( part = body->CONTENT_PART; part; part = part->next ) { ! object_init( &param ); ! imap_add_body( &param, &part->body ); ! add_next_index_object( &parametres, param ); ! } ! add_assoc_object( arg, "parts", parametres ); ! } ! ! /* encapsulated message ? */ ! if ( ( body->type == TYPEMESSAGE ) && (!strncasecmp(body->subtype, "rfc822", 6))) { ! body=body->CONTENT_MSG_BODY; ! array_init(&parametres); ! object_init( &param ); ! imap_add_body( &param, body ); ! add_next_index_object(&parametres, param ); ! add_assoc_object( arg, "parts", parametres ); ! } } void php3_imap_fetchstructure(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *msgno; ! int ind, ind_type; ! pils *imap_le_struct; ! BODY *body; ! if ( ARG_COUNT(ht) != 2 || getParameters( ht, 2, &streamind, &msgno ) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! convert_to_long( streamind ); ! convert_to_long( msgno ); ! object_init(return_value); ! ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find( ind, &ind_type ); ! if ( !imap_le_struct || ind_type != le_imap ) { ! php3_error( E_WARNING, "Unable to find stream pointer" ); ! RETURN_FALSE; ! } ! mail_fetchstructure( imap_le_struct->imap_stream, msgno->value.lval, &body ); ! if ( !body ) { ! php3_error( E_WARNING, "No body information available" ); ! RETURN_FALSE; ! } + imap_add_body( return_value, body ); } void php3_imap_fetchbody(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind, *msgno, *sec,*flags; ! int ind, ind_type; ! pils *imap_le_struct; ! char *body; ! unsigned long len; ! int myargc=ARG_COUNT(ht); ! if(myargc < 3 || myargc >4 || getParameters( ht, myargc, &streamind, &msgno, &sec,&flags ) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long( streamind ); ! convert_to_long( msgno ); ! convert_to_string( sec ); ! if(myargc == 4) convert_to_long(flags); ! ind = streamind->value.lval; ! ! imap_le_struct = (pils *)php3_list_find( ind, &ind_type ); ! ! if ( !imap_le_struct || ind_type != le_imap ) { ! php3_error( E_WARNING, "Unable to find stream pointer" ); ! RETURN_FALSE; ! } ! body = mail_fetchbody_full( imap_le_struct->imap_stream, msgno->value.lval, sec->value.str.val, &len,myargc == 4 ? flags->value.lval : NIL ); ! if ( !body ) { ! php3_error( E_WARNING, "No body information available" ); ! RETURN_FALSE; ! } ! RETVAL_STRING( body ,1); } void php3_imap_base64(INTERNAL_FUNCTION_PARAMETERS) { ! pval *text; ! char *decode; ! unsigned long newlength; ! if ( ARG_COUNT(ht) != 1 || getParameters( ht, 1, &text) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_string( text ); ! object_init(return_value); ! ! decode = (char *) rfc822_base64((unsigned char *) text->value.str.val, text->value.str.len,&newlength); ! RETVAL_STRINGL(decode,newlength,1); } void php3_imap_qprint(INTERNAL_FUNCTION_PARAMETERS) { ! pval *text; ! char *decode; ! unsigned long newlength; ! if ( ARG_COUNT(ht) != 1 || getParameters( ht, 1, &text) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_string( text ); ! object_init(return_value); ! ! decode = (char *) rfc822_qprint((unsigned char *) text->value.str.val, text->value.str.len,&newlength); ! RETVAL_STRINGL(decode,newlength,1); } void php3_imap_8bit(INTERNAL_FUNCTION_PARAMETERS) { ! pval *text; ! char *decode; ! unsigned long newlength; ! if ( ARG_COUNT(ht) != 1 || getParameters( ht, 1, &text) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_string( text ); ! object_init(return_value); ! ! decode = (char *) rfc822_8bit((unsigned char *) text->value.str.val, text->value.str.len,&newlength); ! RETVAL_STRINGL(decode,newlength,1); } void php3_imap_binary(INTERNAL_FUNCTION_PARAMETERS) { ! pval *text,*length; #if 0 char *decode; FILE *fp; *************** *** 1466,1552 **** unsigned long newlength; #endif ! if ( ARG_COUNT(ht) != 2 || getParameters( ht, 2, &text,&length) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } } void php3_imap_mailboxmsginfo(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind; char date[50]; ! int ind, ind_type; ! unsigned int msgno; ! MAILSTREAM *imap_stream; ! unsigned unreadmsg,msize; ! ! if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == ! FAILURE) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long(streamind); ! ! ind = streamind->value.lval; ! ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! ! if(!imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! ! /* Initialize return array */ ! if(object_init(return_value) == FAILURE) { ! RETURN_FALSE; ! } ! ! unreadmsg = 0; ! msize = 0; ! for (msgno = 1; msgno <= imap_stream->nmsgs; msgno++) { ! MESSAGECACHE * cache = mail_elt (imap_stream,msgno); ! mail_fetchstructure (imap_stream,msgno,NIL); ! unreadmsg = cache->recent ? (cache->seen ? unreadmsg : ! unreadmsg++) : unreadmsg; ! unreadmsg = (cache->recent | cache->seen) ? unreadmsg : ! unreadmsg++; ! msize = msize + cache->rfc822_size; ! } ! add_property_long(return_value,"Unread",unreadmsg); ! add_property_long(return_value,"Nmsgs",imap_stream->nmsgs); ! add_property_long(return_value,"Size",msize); rfc822_date (date); add_property_string(return_value,"Date",date,1); ! add_property_string(return_value,"Driver",imap_stream->dtb->name,1); ! add_property_string(return_value,"Mailbox",imap_stream->mailbox,1); ! add_property_long(return_value,"Recent",imap_stream->recent); } void php3_imap_rfc822_write_address(INTERNAL_FUNCTION_PARAMETERS) { ! pval *mailbox,*host,*personal; ! ADDRESS *addr; ! char string[MAILTMPLEN]; ! int argc; ! argc=ARG_COUNT(ht); ! if ( argc <2 || argc>3 || getParameters( ht, argc, &mailbox,&host,&personal) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! convert_to_string(mailbox); ! convert_to_string(host); ! convert_to_string(personal); ! addr=mail_newaddr(); ! if(mailbox) addr->mailbox=cpystr(mailbox->value.str.val); ! if(host) addr->host=cpystr(host->value.str.val); ! if(personal) addr->personal=cpystr(personal->value.str.val); ! addr->next=NIL; ! addr->error=NIL; ! addr->adl=NIL; ! string[0]=0x00; ! rfc822_write_address(string,addr); ! RETVAL_STRING(string,1); } void php3_imap_rfc822_parse_adrlist(INTERNAL_FUNCTION_PARAMETERS) --- 1518,1601 ---- unsigned long newlength; #endif ! if ( ARG_COUNT(ht) != 2 || getParameters( ht, 2, &text,&length) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } } void php3_imap_mailboxmsginfo(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind; char date[50]; ! int ind, ind_type; ! unsigned int msgno; ! pils *imap_le_struct; ! unsigned unreadmsg,msize; ! ! if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &streamind) == FAILURE) { ! WRONG_PARAM_COUNT; ! } ! ! convert_to_long(streamind); ! ! ind = streamind->value.lval; ! ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! ! if(!imap_le_struct || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! ! /* Initialize return array */ ! if(object_init(return_value) == FAILURE) { ! RETURN_FALSE; ! } ! ! unreadmsg = 0; ! msize = 0; ! for (msgno = 1; msgno <= imap_le_struct->imap_stream->nmsgs; msgno++) { ! MESSAGECACHE * cache = mail_elt (imap_le_struct->imap_stream,msgno); ! mail_fetchstructure (imap_le_struct->imap_stream,msgno,NIL); ! unreadmsg = cache->recent ? (cache->seen ? unreadmsg : unreadmsg++) : unreadmsg; ! unreadmsg = (cache->recent | cache->seen) ? unreadmsg : unreadmsg++; ! msize = msize + cache->rfc822_size; ! } ! add_property_long(return_value,"Unread",unreadmsg); ! add_property_long(return_value,"Nmsgs",imap_le_struct->imap_stream->nmsgs); ! add_property_long(return_value,"Size",msize); rfc822_date (date); add_property_string(return_value,"Date",date,1); ! add_property_string(return_value,"Driver",imap_le_struct->imap_stream->dtb->name,1); ! add_property_string(return_value,"Mailbox",imap_le_struct->imap_stream->mailbox,1); ! add_property_long(return_value,"Recent",imap_le_struct->imap_stream->recent); } void php3_imap_rfc822_write_address(INTERNAL_FUNCTION_PARAMETERS) { ! pval *mailbox,*host,*personal; ! ADDRESS *addr; ! char string[MAILTMPLEN]; ! int argc; ! argc=ARG_COUNT(ht); ! if ( argc <2 || argc>3 || getParameters( ht, argc, &mailbox,&host,&personal) == FAILURE ) { ! WRONG_PARAM_COUNT; ! } ! convert_to_string(mailbox); ! convert_to_string(host); ! convert_to_string(personal); ! addr=mail_newaddr(); ! if(mailbox) addr->mailbox = cpystr(mailbox->value.str.val); ! if(host) addr->host = cpystr(host->value.str.val); ! if(personal) addr->personal = cpystr(personal->value.str.val); ! addr->next=NIL; ! addr->error=NIL; ! addr->adl=NIL; ! string[0]=0x00; ! rfc822_write_address(string,addr); ! RETVAL_STRING(string,1); } void php3_imap_rfc822_parse_adrlist(INTERNAL_FUNCTION_PARAMETERS) *************** *** 1574,1633 **** void php3_imap_setflag_full(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind; pval *sequence; pval *flag; pval *flags; int ind,ind_type; ! MAILSTREAM *imap_stream; int myargc=ARG_COUNT(ht); ! if (myargc < 3 || myargc > 4 || getParameters(ht, myargc, &streamind,&sequence,&flag,&flags) ==FAILURE) { ! WRONG_PARAM_COUNT; ! } ! convert_to_long(streamind); convert_to_string(sequence); convert_to_string(flag); if(myargc==4) convert_to_long(flags); ! ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if(!imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! mail_setflag_full(imap_stream,sequence->value.str.val,flag->value.str.val,myargc == 4 ? flags->value.lval : NIL); ! } void php3_imap_clearflag_full(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind; pval *sequence; pval *flag; pval *flags; int ind,ind_type; ! MAILSTREAM *imap_stream; int myargc=ARG_COUNT(ht); ! if (myargc < 3 || myargc > 4 || getParameters(ht, myargc, &streamind,&sequence,&flag,&flags) ==FAILURE) { ! WRONG_PARAM_COUNT; ! } ! convert_to_long(streamind); convert_to_string(sequence); convert_to_string(flag); if(myargc==4) convert_to_long(flags); ! ! ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if(!imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! mail_clearflag_full(imap_stream,sequence->value.str.val,flag->value.str.val,myargc == 4 ? flags->value.lval : NIL); } void php3_imap_sort(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind; pval *pgm; pval *rev; pval *flags; --- 1623,1681 ---- void php3_imap_setflag_full(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind; pval *sequence; pval *flag; pval *flags; int ind,ind_type; ! pils *imap_le_struct; int myargc=ARG_COUNT(ht); ! ! if (myargc < 3 || myargc > 4 || getParameters(ht, myargc, &streamind,&sequence,&flag,&flags) ==FAILURE) { ! WRONG_PARAM_COUNT; ! } ! convert_to_long(streamind); convert_to_string(sequence); convert_to_string(flag); if(myargc==4) convert_to_long(flags); ! ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if(!imap_le_struct || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! mail_setflag_full(imap_le_struct->imap_stream,sequence->value.str.val,flag->value.str.val,myargc == 4 ? flags->value.lval : NIL); } void php3_imap_clearflag_full(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind; pval *sequence; pval *flag; pval *flags; int ind,ind_type; ! pils *imap_le_struct; int myargc=ARG_COUNT(ht); ! if (myargc < 3 || myargc > 4 || getParameters(ht, myargc, &streamind,&sequence,&flag,&flags) ==FAILURE) { ! WRONG_PARAM_COUNT; ! } ! convert_to_long(streamind); convert_to_string(sequence); convert_to_string(flag); if(myargc==4) convert_to_long(flags); ! ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if(!imap_le_struct || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! mail_clearflag_full(imap_le_struct->imap_stream,sequence->value.str.val,flag->value.str.val,myargc == 4 ? flags->value.lval : NIL); } void php3_imap_sort(INTERNAL_FUNCTION_PARAMETERS) { ! pval *streamind; pval *pgm; pval *rev; pval *flags; *************** *** 1635,1668 **** unsigned long *slst,*sl; char mystring[100]; SORTPGM *mypgm; ! MAILSTREAM *imap_stream; int myargc=ARG_COUNT(ht); ! if (myargc < 3 || myargc > 4 || getParameters(ht, myargc, &streamind,&pgm,&rev,&flags) ==FAILURE) { ! WRONG_PARAM_COUNT; ! } ! convert_to_long(streamind); ! convert_to_long(rev); convert_to_long(pgm); if(myargc==4) convert_to_long(flags); ! ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if(!imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } mypgm=mail_newsortpgm(); mypgm->reverse=rev->value.lval; mypgm->function=pgm->value.lval; mypgm->next=NIL; ! array_init(return_value); ! slst=mail_sort(imap_stream,NIL,NIL,mypgm,myargc == 4 ? flags->value.lval:NIL); ! for (sl = slst; *sl; sl++) ! { ! sprintf (mystring,"%lu",*sl); ! add_next_index_string(return_value,mystring,1); ! } fs_give ((void **) &slst); } --- 1683,1715 ---- unsigned long *slst,*sl; char mystring[100]; SORTPGM *mypgm; ! pils *imap_le_struct; int myargc=ARG_COUNT(ht); ! if (myargc < 3 || myargc > 4 || getParameters(ht, myargc, &streamind,&pgm,&rev,&flags) ==FAILURE) { ! WRONG_PARAM_COUNT; ! } ! convert_to_long(streamind); ! convert_to_long(rev); convert_to_long(pgm); if(myargc==4) convert_to_long(flags); ! ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if(!imap_le_struct || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } mypgm=mail_newsortpgm(); mypgm->reverse=rev->value.lval; mypgm->function=pgm->value.lval; mypgm->next=NIL; ! array_init(return_value); ! slst=mail_sort(imap_le_struct->imap_stream,NIL,NIL,mypgm,myargc == 4 ? flags->value.lval:NIL); ! for (sl = slst; *sl; sl++) { ! sprintf (mystring,"%lu",*sl); ! add_next_index_string(return_value,mystring,1); ! } fs_give ((void **) &slst); } *************** *** 1671,1677 **** { pval *streamind, * msgno, * flags; int ind, ind_type; ! MAILSTREAM *imap_stream; int myargc = ARG_COUNT(ht); if (myargc < 2 || myargc > 3 || getParameters(ht,myargc,&streamind,&msgno,&flags) == FAILURE) { WRONG_PARAM_COUNT; --- 1718,1724 ---- { pval *streamind, * msgno, * flags; int ind, ind_type; ! pils *imap_le_struct; int myargc = ARG_COUNT(ht); if (myargc < 2 || myargc > 3 || getParameters(ht,myargc,&streamind,&msgno,&flags) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 1682,1701 **** if(myargc == 3) convert_to_long(flags); ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! RETVAL_STRING(mail_fetchheader_full (imap_stream,msgno->value.lval,NIL,NIL,myargc == 3 ? flags->value.lval : NIL),1); } ! void php3_imap_uid(INTERNAL_FUNCTION_PARAMETERS) ! { pval *streamind, *msgno; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&streamind,&msgno) == FAILURE) { WRONG_PARAM_COUNT; --- 1729,1748 ---- if(myargc == 3) convert_to_long(flags); ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { php3_error(E_WARNING, "Unable to find stream pointer"); RETURN_FALSE; } ! RETVAL_STRING(mail_fetchheader_full (imap_le_struct->imap_stream,msgno->value.lval,NIL,NIL,myargc == 3 ? flags->value.lval : NIL),1); } ! void php3_imap_uid(INTERNAL_FUNCTION_PARAMETERS) ! { pval *streamind, *msgno; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&streamind,&msgno) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 1706,1728 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! RETURN_LONG(mail_uid(imap_stream, msgno->value.lval)); ! } ! ! ! void php3_imap_msgno(INTERNAL_FUNCTION_PARAMETERS) ! { pval *streamind, *msgno; int ind, ind_type; ! MAILSTREAM *imap_stream; if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&streamind,&msgno) == FAILURE) { WRONG_PARAM_COUNT; --- 1753,1773 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! RETURN_LONG(mail_uid(imap_le_struct->imap_stream, msgno->value.lval)); ! } ! void php3_imap_msgno(INTERNAL_FUNCTION_PARAMETERS) ! { pval *streamind, *msgno; int ind, ind_type; ! pils *imap_le_struct; if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&streamind,&msgno) == FAILURE) { WRONG_PARAM_COUNT; *************** *** 1733,1747 **** ind = streamind->value.lval; ! imap_stream = ( MAILSTREAM *)php3_list_find(ind, &ind_type); ! if (!imap_stream || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! RETURN_LONG(mail_msgno(imap_stream, msgno->value.lval)); ! } /* Interfaces to C-client */ --- 1778,1792 ---- ind = streamind->value.lval; ! imap_le_struct = (pils *)php3_list_find(ind, &ind_type); ! if (!imap_le_struct || ind_type != le_imap) { ! php3_error(E_WARNING, "Unable to find stream pointer"); ! RETURN_FALSE; ! } ! RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, msgno->value.lval)); ! } /* Interfaces to C-client */ *************** *** 1774,1787 **** void mm_list (MAILSTREAM *stream,DTYPE delimiter,char *mailbox,long attributes) { STRINGLIST *cur=NIL; ! if(!(attributes & LATT_NOSELECT)) { ! if (imap_folders == NIL) { ! imap_folders=mail_newstringlist(); ! imap_folders->LSIZE=strlen(imap_folders->LTEXT=cpystr(mailbox)); ! imap_folders->next=NIL; } else { ! cur=imap_folders; while (cur->next != NIL ) { cur=cur->next; } --- 1819,1851 ---- void mm_list (MAILSTREAM *stream,DTYPE delimiter,char *mailbox,long attributes) { STRINGLIST *cur=NIL; ! if(!(attributes & LATT_NOSELECT)) { ! if (imap_folders == NIL) { ! imap_folders=mail_newstringlist(); ! imap_folders->LSIZE=strlen(imap_folders->LTEXT=cpystr(mailbox)); ! imap_folders->next=NIL; ! } else { ! cur=imap_folders; ! while (cur->next != NIL ) { ! cur=cur->next; ! } ! cur->next=mail_newstringlist (); ! cur=cur->next; ! cur->LSIZE = strlen (cur->LTEXT = cpystr (mailbox)); ! cur->next = NIL; ! } ! } ! } ! ! void mm_lsub (MAILSTREAM *stream,DTYPE delimiter,char *mailbox,long attributes) { ! STRINGLIST *cur=NIL; ! if (imap_sfolders == NIL) { ! imap_sfolders=mail_newstringlist(); ! imap_sfolders->LSIZE=strlen(imap_sfolders->LTEXT=cpystr(mailbox)); ! imap_sfolders->next=NIL; } else { ! cur=imap_sfolders; while (cur->next != NIL ) { cur=cur->next; } *************** *** 1791,1843 **** cur->next = NIL; } } - } - - void mm_lsub (MAILSTREAM *stream,DTYPE delimiter,char *mailbox,long attributes) - { - STRINGLIST *cur=NIL; - if (imap_sfolders == NIL) { - imap_sfolders=mail_newstringlist(); - imap_sfolders->LSIZE=strlen(imap_sfolders->LTEXT=cpystr(mailbox)); - imap_sfolders->next=NIL; - } else { - cur=imap_sfolders; - while (cur->next != NIL ) { - cur=cur->next; - } - cur->next=mail_newstringlist (); - cur=cur->next; - cur->LSIZE = strlen (cur->LTEXT = cpystr (mailbox)); - cur->next = NIL; - } - } - void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status) { } - void mm_log (char *string,long errflg) { ! switch ((short) errflg) { ! case NIL: ! php3_error(E_NOTICE,string); /* messages */ ! break; ! case PARSE: ! case WARN: ! php3_error(E_WARNING,string); /* warnings */ ! break; ! case ERROR: ! php3_error(E_NOTICE,string); /* errors */ ! break; ! } } - void mm_dlog (char *string) { ! php3_error(E_NOTICE,string); } void mm_login (NETMBX *mb,char *user,char *pwd,long trial) --- 1855,1884 ---- cur->next = NIL; } } void mm_status (MAILSTREAM *stream,char *mailbox,MAILSTATUS *status) { } void mm_log (char *string,long errflg) { ! switch ((short) errflg) { ! case NIL: ! php3_error(E_NOTICE,string); /* messages */ ! break; ! case PARSE: ! case WARN: ! php3_error(E_WARNING,string); /* warnings */ ! break; ! case ERROR: ! php3_error(E_NOTICE,string); /* errors */ ! break; ! } } void mm_dlog (char *string) { ! php3_error(E_NOTICE,string); } void mm_login (NETMBX *mb,char *user,char *pwd,long trial) -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#385) next »