cvs: /php3/functions php3_mcal.c

From: Date: Thu, 02 Sep 1999 21:55:50 +0000
Subject: cvs: /php3/functions php3_mcal.c
Groups: php.dev 
Request: Send a blank email to php-dev+get-10474@lists.php.net to get a copy of this message
musone Thu Sep 2 17:55:50 1999 EDT Modified files: /php3/functions php3_mcal.c Log: made convenience functions Index: php3/functions/php3_mcal.c diff -u php3/functions/php3_mcal.c:1.5 php3/functions/php3_mcal.c:1.6 --- php3/functions/php3_mcal.c:1.5 Thu Sep 2 17:09:40 1999 +++ php3/functions/php3_mcal.c Thu Sep 2 17:55:50 1999 @@ -196,10 +196,8 @@ mcal_le_struct = emalloc(sizeof(pils)); mcal_le_struct->mcal_stream = mcal_stream; - mcal_le_struct->flags = 0; - mcal_le_struct->start_has_time=0; - mcal_le_struct->end_has_time=0; - + php3_event_init(mcal_le_struct); + ind = php3_list_insert(mcal_le_struct, le_mcal); RETURN_LONG(ind); } @@ -717,12 +715,13 @@ unsigned long uid; CALEVENT *myevent; myargc=ARG_COUNT(ht); - if (myargc !=2 || getParameters(ht,myargc,&streamind,&storeobject) == FAILURE) { + if (myargc <1 || getParameters(ht,myargc,&streamind,&storeobject) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long(streamind); - convert_to_array(storeobject); + + if(myargc >= 2 )convert_to_array(storeobject); ind = streamind->value.lval; @@ -738,6 +737,8 @@ RETURN_FALSE; } myevent=calevent_new(); + if(myargc >=2) + { if(_php3_hash_find(storeobject->value.ht,"uid",sizeof("uid"),(void **) &pvalue)== SUCCESS){ convert_to_long(pvalue); @@ -844,8 +845,29 @@ } myevent->end.has_date=true; } - - cal_append(mcal_le_struct->mcal_stream,"INBOX",&uid,myevent); + } + else + { + myevent->description=mcal_le_struct->description; + myevent->title=mcal_le_struct->title; + myevent->category=mcal_le_struct->category; + myevent->alarm=mcal_le_struct->alarm; + myevent->public=mcal_le_struct->class; + myevent->start.year=mcal_le_struct->start_year; + myevent->start.mon=mcal_le_struct->start_month; + myevent->start.mday=mcal_le_struct->start_mday; + myevent->start.hour=mcal_le_struct->start_hour; + myevent->start.min=mcal_le_struct->start_min; + myevent->start.sec=mcal_le_struct->start_sec; + + myevent->end.year=mcal_le_struct->end_year; + myevent->end.mon=mcal_le_struct->end_month; + myevent->end.mday=mcal_le_struct->end_mday; + myevent->end.hour=mcal_le_struct->end_hour; + myevent->end.min=mcal_le_struct->end_min; + myevent->end.sec=mcal_le_struct->start_sec; + } + cal_append(mcal_le_struct->mcal_stream,"INBOX",&uid,myevent); calevent_free(myevent); RETURN_LONG(uid); } @@ -1128,6 +1150,68 @@ } /* }}} */ +void php3_mcal_init_event(INTERNAL_FUNCTION_PARAMETERS) +{ + pval *streamind; + int ind, ind_type; + unsigned long i; + char *t; + int mcal_folders=0; + unsigned int msgno; + pils *mcal_le_struct; + pval *pvalue,*temppvalue; + cal_list_t *my_cal_list; + int myargc; + unsigned long uid; + CALEVENT *myevent; + myargc=ARG_COUNT(ht); + if (myargc !=1 || getParameters(ht,myargc,&streamind) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(streamind); + + ind = streamind->value.lval; + + mcal_le_struct = (pils *)php3_list_find(ind, &ind_type); + + if (!mcal_le_struct ) { + php3_error(E_WARNING, "Unable to find stream pointer"); + RETURN_FALSE; + } + php3_event_init(&mcal_le_struct); +} + /* }}} */ + +php3_event_init(struct php3_mcal_le_struct *mystruct) +{ + mystruct->class=1; + if(mystruct->category) efree(mystruct->category); + if(mystruct->title) efree(mystruct->title); + if(mystruct->description) efree(mystruct->description); + mystruct->alarm=0; + mystruct->start_year=0; + mystruct->start_month=0; + mystruct->start_mday=0; + mystruct->start_hour=0; + mystruct->start_min=0; + mystruct->start_sec=0; + mystruct->start_has_time=0; + + mystruct->end_year=0; + mystruct->end_month=0; + mystruct->end_mday=0; + mystruct->end_hour=0; + mystruct->end_min=0; + mystruct->end_sec=0; + mystruct->end_has_time=0; + + mystruct->category=NULL; + mystruct->title=NULL; + mystruct->description=NULL; +} + + void php3_mcal_event_add_class(INTERNAL_FUNCTION_PARAMETERS) { pval *streamind,*class; @@ -1161,6 +1245,7 @@ mcal_le_struct->class=class->value.lval; } /* }}} */ + /* Interfaces to callbacks */

« previous php.dev (#10474) next »