cvs: /php3/functions php3_mcal.c
| From: | Mark Musone | Date: | Wed, 08 Sep 1999 18:14:26 +0000 |
| Subject: | cvs: /php3/functions php3_mcal.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-10732@lists.php.net to get a copy of this message | ||
musone Wed Sep 8 14:14:26 1999 EDT
Modified files:
/php3/functions php3_mcal.c
Log:
using the global event structure more
Index: php3/functions/php3_mcal.c
diff -u php3/functions/php3_mcal.c:1.21 php3/functions/php3_mcal.c:1.22
--- php3/functions/php3_mcal.c:1.21 Wed Sep 8 13:53:04 1999
+++ php3/functions/php3_mcal.c Wed Sep 8 14:14:25 1999
@@ -640,7 +640,7 @@
{
pval *streamind, *date,*time;
pval *pvalue;
- datetime_t mydate;
+ datetime_t mydate=DT_INIT;
int ind, ind_type;
pils *mcal_le_struct;
int mcal_folders=0;
@@ -648,13 +648,11 @@
cal_list_t *my_cal_list;
int myargc=ARG_COUNT(ht);
- if (myargc != 3 || getParameters(ht,myargc,&streamind,&date,&time) == FAILURE) {
+ if (myargc < 1 || myargc !=3 || getParameters(ht,myargc,&streamind,&date,&time) ==
FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(streamind);
- convert_to_array(date);
- convert_to_array(time);
ind = streamind->value.lval;
mcal_le_struct = (pils *)php3_list_find(ind, &ind_type);
@@ -666,39 +664,49 @@
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
- mydate.has_date=1;
- mydate.has_time=1;
- if(_php3_hash_find(date->value.ht,"year",sizeof("year"),(void **)
&pvalue)== SUCCESS){
- convert_to_long(pvalue);
- mydate.year=(pvalue)->value.lval;
- }
- if(_php3_hash_find(date->value.ht,"month",sizeof("month"),(void **)
&pvalue)== SUCCESS){
-
- convert_to_long(pvalue);
- mydate.mon=(pvalue)->value.lval;
- }
- if(_php3_hash_find(date->value.ht,"day",sizeof("day"),(void **)
&pvalue)== SUCCESS){
-
- convert_to_long(pvalue);
- mydate.mday=(pvalue)->value.lval;
- }
-
- if(_php3_hash_find(time->value.ht,"hour",sizeof("hour"),(void **)
&pvalue)== SUCCESS){
-
- convert_to_long(pvalue);
- mydate.hour=(pvalue)->value.lval;
- }
- if(_php3_hash_find(time->value.ht,"minute",sizeof("minute"),(void **)
&pvalue)== SUCCESS){
-
- convert_to_long(pvalue);
- mydate.min=(pvalue)->value.lval;
- }
- mydate.sec=0;
- g_cal_list=NULL;
- cal_search_alarm(mcal_le_struct->mcal_stream,&mydate);
- my_cal_list=g_cal_list;
- while(my_cal_list != NULL)
+ if(myargc ==3)
+ {
+ convert_to_array(date);
+ convert_to_array(time);
+ mydate.has_date=1;
+ mydate.has_time=1;
+ if(_php3_hash_find(date->value.ht,"year",sizeof("year"),(void **)
&pvalue)== SUCCESS){
+
+ convert_to_long(pvalue);
+ mydate.year=(pvalue)->value.lval;
+ }
+ if(_php3_hash_find(date->value.ht,"month",sizeof("month"),(void **)
&pvalue)== SUCCESS){
+
+ convert_to_long(pvalue);
+ mydate.mon=(pvalue)->value.lval;
+ }
+ if(_php3_hash_find(date->value.ht,"day",sizeof("day"),(void **)
&pvalue)== SUCCESS){
+
+ convert_to_long(pvalue);
+ mydate.mday=(pvalue)->value.lval;
+ }
+
+ if(_php3_hash_find(time->value.ht,"hour",sizeof("hour"),(void **)
&pvalue)== SUCCESS){
+
+ convert_to_long(pvalue);
+ mydate.hour=(pvalue)->value.lval;
+ }
+ if(_php3_hash_find(time->value.ht,"minute",sizeof("minute"),(void **)
&pvalue)== SUCCESS){
+
+ convert_to_long(pvalue);
+ mydate.min=(pvalue)->value.lval;
+ }
+ mydate.sec=0;
+ }
+ else
+ {
+ mydate=mcal_le_struct->event->start;
+ }
+ g_cal_list=NULL;
+ cal_search_alarm(mcal_le_struct->mcal_stream,&mydate);
+ my_cal_list=g_cal_list;
+ while(my_cal_list != NULL)
{
add_next_index_long(return_value,my_cal_list->uid);
my_cal_list=my_cal_list->next;