CVS update: php3/functions
| From: | musone | Date: | Fri, 04 Sep 1998 04:28:33 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-793@lists.php.net to get a copy of this message | ||
Date: Friday September 4, 1998 @ 0:28
Author: musone
Update of /repository/php3/functions
In directory asf:/u2/tmp/cvs-serv1016
Modified Files:
imap.c imap.h
Log Message:
fixed imap_sort and added a beta imap_bodystruct
Index: php3/functions/imap.c
diff -c php3/functions/imap.c:1.30 php3/functions/imap.c:1.31
*** php3/functions/imap.c:1.30 Tue Sep 1 09:28:58 1998
--- php3/functions/imap.c Fri Sep 4 00:28:32 1998
***************
*** 31,37 ****
| Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: imap.c,v 1.30 1998/09/01 13:28:58 rasmus Exp $ */
#define IMAP41
--- 31,37 ----
| Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: imap.c,v 1.31 1998/09/04 04:28:32 musone Exp $ */
#define IMAP41
***************
*** 154,159 ****
--- 154,160 ----
{"imap_create", php3_imap_createmailbox, NULL},
{"imap_rename", php3_imap_renamemailbox, NULL},
{"imap_status", php3_imap_status, NULL},
+ {"imap_bodystruct", php3_imap_bodystruct, NULL},
{NULL, NULL, NULL}
};
***************
*** 221,226 ****
--- 222,228 ----
#if WIN32|WINNT
mail_link (&mbxdriver); /* link in the mbox driver */
#else
+ mail_link(&unixdriver); /* link in the unix driver */
mail_link (&mboxdriver); /* link in the mbox driver */
#endif
mail_link (&imapdriver); /* link in the imap driver */
***************
*** 1718,1724 ****
int ind,ind_type;
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) {
--- 1720,1727 ----
int ind,ind_type;
unsigned long *slst,*sl;
char mystring[100];
! SORTPGM *mypgm=NIL;
! SEARCHPGM *spg=NIL;
pils *imap_le_struct;
int myargc=ARG_COUNT(ht);
if (myargc < 3 || myargc > 4 || getParameters(ht, myargc,
&streamind,&pgm,&rev,&flags) ==FAILURE) {
***************
*** 1735,1752 ****
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);
}
--- 1738,1758 ----
php3_error(E_WARNING, "Unable to find stream pointer");
RETURN_FALSE;
}
+ spg = mail_newsearchpgm();
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,spg,mypgm,myargc == 4 ?
flags->value.lval:NIL);
!
!
for (sl = slst; *sl; sl++) {
! add_next_index_long(return_value,*sl);
}
! fs_give ((void **) &slst);
!
}
***************
*** 1865,1870 ****
--- 1871,1973 ----
}
+ void php3_imap_bodystruct(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ pval *streamind, *msg, *section;
+ int ind, ind_type;
+ pils *imap_le_struct;
+ pval parametres, param, dparametres, dparam;
+ PARAMETER *par, *dpar;
+ PART *part;
+ BODY *body;
+ int myargc=ARG_COUNT(ht);
+ if (myargc != 3 || getParameters(ht,myargc,&streamind,&msg,§ion) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(streamind);
+ convert_to_long(msg);
+ convert_to_string(section);
+ 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(object_init(return_value) == FAILURE){
+ RETURN_FALSE;
+ }
+
+ body=mail_body(imap_le_struct->imap_stream, msg->value.lval, section->value.str.val);
+ if(body->type) add_property_long( return_value, "type", body->type );
+ if(body->encoding) add_property_long( return_value, "encoding", body->encoding );
+
+ if ( body->subtype ){
+ add_property_long( return_value, "ifsubtype", 1 );
+ add_property_string( return_value, "subtype", body->subtype, 1 );
+ } else {
+ add_property_long( return_value, "ifsubtype", 0 );
+ }
+
+ if ( body->description ){
+ add_property_long( return_value, "ifdescription", 1 );
+ add_property_string( return_value, "description", body->description, 1 );
+ } else {
+ add_property_long( return_value, "ifdescription", 0 );
+ }
+ if ( body->id ){
+ add_property_long( return_value, "ifid", 1 );
+ if(body->description) add_property_string( return_value, "id",
body->description, 1 );
+ } else {
+ add_property_long( return_value, "ifid", 0 );
+ }
+
+ if(body->size.lines) add_property_long( return_value, "lines", body->size.lines
);
+ if(body->size.bytes) add_property_long( return_value, "bytes", body->size.bytes
);
+ #ifdef IMAP41
+ if ( body->disposition.type ){
+ add_property_long( return_value, "ifdisposition", 1);
+ add_property_string( return_value, "disposition", body->disposition.type, 1);
+ } else {
+ add_property_long( return_value, "ifdisposition", 0);
+ }
+
+ if ( body->disposition.parameter ) {
+ dpar = body->disposition.parameter;
+ add_property_long( return_value, "ifdparameters", 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( return_value, "dparameters", dparametres );
+ } else {
+ add_property_long( return_value, "ifdparameters", 0);
+ }
+ #endif
+
+ if ( (par = body->parameter) ) {
+ add_property_long( return_value, "ifparameters", 1 );
+
+ array_init( ¶metres );
+ do {
+ object_init( ¶m );
+ if(par->attribute) add_property_string( ¶m, "attribute",
par->attribute, 1 );
+ if(par->value) add_property_string( ¶m, "value", par->value, 1 );
+
+ add_next_index_object( ¶metres, param );
+ } while ( (par = par->next) );
+ } else {
+ object_init(¶metres);
+ add_property_long( return_value, "ifparameters", 0 );
+ }
+ add_assoc_object( return_value, "parameters", parametres );
+ }
/* Interfaces to C-client */
Index: php3/functions/imap.h
diff -c php3/functions/imap.h:1.5 php3/functions/imap.h:1.6
*** php3/functions/imap.h:1.5 Fri Aug 21 15:12:45 1998
--- php3/functions/imap.h Fri Sep 4 00:28:32 1998
***************
*** 63,68 ****
--- 63,69 ----
void php3_imap_msgno(INTERNAL_FUNCTION_PARAMETERS);
void php3_imap_fetchtext_full(INTERNAL_FUNCTION_PARAMETERS);
void php3_imap_status(INTERNAL_FUNCTION_PARAMETERS);
+ void php3_imap_bodystruct(INTERNAL_FUNCTION_PARAMETERS);
#else
#define php3_imap_module_ptr NULL
--
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