cvs: /php3/functions php3_icap.h php3_icap.c
| From: | Mark Musone | Date: | Mon, 09 Aug 1999 14:27:50 +0000 |
| Subject: | cvs: /php3/functions php3_icap.h php3_icap.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-9677@lists.php.net to get a copy of this message | ||
musone Mon Aug 9 10:27:50 1999 EDT
Modified files:
/php3/functions php3_icap.h php3_icap.c
Log:
added alarms and trigger support
Index: php3/functions/php3_icap.h
diff -u php3/functions/php3_icap.h:1.1 php3/functions/php3_icap.h:1.2
--- php3/functions/php3_icap.h:1.1 Mon Aug 2 13:48:26 1999
+++ php3/functions/php3_icap.h Mon Aug 9 10:27:49 1999
@@ -1,4 +1,4 @@
-/* $Id: php3_icap.h,v 1.1 1999/08/02 17:48:26 musone Exp $ */
+/* $Id: php3_icap.h,v 1.2 1999/08/09 14:27:49 musone Exp $ */
#ifndef _INCLUDED_ICAP_H
#define _INCLUDED_ICAP_H
@@ -40,9 +40,8 @@
void php3_icap_delete_calendar(INTERNAL_FUNCTION_PARAMETERS);
void php3_icap_store_event(INTERNAL_FUNCTION_PARAMETERS);
void php3_icap_delete_event(INTERNAL_FUNCTION_PARAMETERS);
-
-
-
+void php3_icap_snooze(INTERNAL_FUNCTION_PARAMETERS);
+void php3_icap_list_alarms(INTERNAL_FUNCTION_PARAMETERS);
Index: php3/functions/php3_icap.c
diff -u php3/functions/php3_icap.c:1.3 php3/functions/php3_icap.c:1.4
--- php3/functions/php3_icap.c:1.3 Mon Aug 2 17:59:23 1999
+++ php3/functions/php3_icap.c Mon Aug 9 10:27:49 1999
@@ -91,11 +91,13 @@
{"icap_reopen", php3_icap_reopen, NULL},
{"icap_fetch_event", php3_icap_fetch_event, NULL},
{"icap_list_events", php3_icap_list_events, NULL},
+ {"icap_list_alarms", php3_icap_list_alarms, NULL},
{"icap_create_calendar", php3_icap_create_calendar, NULL},
{"icap_rename_calendar", php3_icap_rename_calendar, NULL},
{"icap_delete_calendar", php3_icap_delete_calendar, NULL},
{"icap_delete_event", php3_icap_delete_event, NULL},
{"icap_store_event", php3_icap_store_event, NULL},
+ {"icap_snooze", php3_icap_snooze, NULL},
{NULL, NULL, NULL}
};
@@ -145,6 +147,10 @@
{
le_icap = register_list_destructors(cal_close_it,NULL);
+ REGISTER_MAIN_LONG_CONSTANT("CLASS_PRIVATE", CLASS_PRIVATE, CONST_PERSISTENT |
CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("CLASS_PUBLIC", CLASS_PUBLIC, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_LONG_CONSTANT("CLASS_CONFIDENTIAL", CLASS_CONFIDENTIAL, CONST_PERSISTENT |
CONST_CS);
+
event_init(&global_event);
return SUCCESS;
}
@@ -341,7 +347,7 @@
add_property_long(return_value,"uid",global_event.uid);
add_property_long(return_value,"year",global_event.date.year);
add_property_long(return_value,"month",global_event.date.month);
- add_property_long(return_value,"day",global_event.date.date);
+ add_property_long(return_value,"day",global_event.date.mday);
add_property_long(return_value,"starthour",global_event.start.hour);
add_property_long(return_value,"startminute",global_event.start.minute);
add_property_long(return_value,"endhour",global_event.end.hour);
@@ -349,7 +355,11 @@
add_property_string(return_value,"category",global_event.category,1);
add_property_string(return_value,"title",global_event.title,1);
add_property_string(return_value,"description",global_event.description,1);
-
+ add_property_long(return_value,"class",global_event.ical_class);
+ add_property_long(return_value,"alarm_year",global_event.alarm_last.year);
+ add_property_long(return_value,"alarm_month",global_event.alarm_last.month);
+ add_property_long(return_value,"alarm_day",global_event.alarm_last.mday);
+ add_property_long(return_value,"alarm",global_event.alarm);
}
/* }}} */
@@ -400,7 +410,7 @@
}
if(_php3_hash_find(begindate->value.ht,"day",sizeof("day"),(void **)
&pvalue)== SUCCESS){
convert_to_long(pvalue);
- begincal.date=pvalue->value.lval;
+ begincal.mday=pvalue->value.lval;
}
if(myargc == 3)
{
@@ -414,7 +424,7 @@
}
if(_php3_hash_find(enddate->value.ht,"day",sizeof("day"),(void **)
&pvalue)== SUCCESS){
convert_to_long(pvalue);
- endcal.date=pvalue->value.lval;
+ endcal.mday=pvalue->value.lval;
}
}
@@ -498,6 +508,62 @@
+void php3_icap_list_alarms(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *streamind, *date,*time;
+ pval *pvalue;
+ caldate_t mydate;
+ caltime_t mytime;
+ int ind, ind_type;
+ pils *icap_le_struct;
+ int myargc=ARG_COUNT(ht);
+ if (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;
+
+ icap_le_struct = (pils *)php3_list_find(ind, &ind_type);
+ if (!icap_le_struct ) {
+ php3_error(E_WARNING, "Unable to find stream pointer");
+ RETURN_FALSE;
+ }
+
+ 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.month=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);
+ mytime.hour=pvalue->value.lval;
+ }
+ if(_php3_hash_find(time->value.ht,"minute",sizeof("minute"),(void **)
&pvalue)== SUCCESS){
+ convert_to_long(pvalue);
+ mytime.minute=pvalue->value.lval;
+ }
+
+ if(cal_search_alarming(icap_le_struct->icap_stream,&mydate,&mytime))
+ {
+
+ RETURN_TRUE;
+ }
+ else
+ {
+ RETURN_FALSE;
+ }
+}
/* Interfaces to C-client */
@@ -664,7 +730,7 @@
}
if(_php3_hash_find(storeobject->value.ht,"day",sizeof("day"),(void **)
&pvalue)== SUCCESS){
convert_to_long(pvalue);
- myevent.date.date=pvalue->value.lval;
+ myevent.date.mday=pvalue->value.lval;
}
if(_php3_hash_find(storeobject->value.ht,"starthour",sizeof("starthour"),(void
**) &pvalue)== SUCCESS){
convert_to_long(pvalue);
@@ -694,11 +760,68 @@
convert_to_string(pvalue);
myevent.description=strdup(pvalue->value.str.val);
}
+
+ if(_php3_hash_find(storeobject->value.ht,"alarm",sizeof("alarm"),(void **)
&pvalue)== SUCCESS){
+ convert_to_long(pvalue);
+ myevent.alarm=pvalue->value.lval;
+ }
+ if(_php3_hash_find(storeobject->value.ht,"alarm_year",sizeof("alarm_year"),(void
**) &pvalue)== SUCCESS){
+ convert_to_long(pvalue);
+ myevent.alarm_last.year=pvalue->value.lval;
+ }
+ if(_php3_hash_find(storeobject->value.ht,"alarm_month",sizeof("alarm_month"),(void
**) &pvalue)== SUCCESS){
+ convert_to_string(pvalue);
+ myevent.alarm_last.month=pvalue->value.lval;
+ }
+ if(_php3_hash_find(storeobject->value.ht,"alarm_mday",sizeof("alarm_day"),(void
**) &pvalue)== SUCCESS){
+ convert_to_string(pvalue);
+ myevent.alarm_last.mday=pvalue->value.lval;
+ }
+
+
cal_append(icap_le_struct->icap_stream,"INBOX",&myevent);
event_destroy(&myevent);
RETURN_LONG(guid);
}
/* }}} */
+
+
+void php3_icap_snooze(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *streamind,*uid;
+ int ind, ind_type;
+ pils *icap_le_struct;
+ pval *pvalue;
+ int myargc;
+ myargc=ARG_COUNT(ht);
+ if (myargc !=2 || getParameters(ht,myargc,&streamind,&uid) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(streamind);
+ convert_to_long(uid);
+
+ ind = streamind->value.lval;
+
+ icap_le_struct = (pils *)php3_list_find(ind, &ind_type);
+
+ if (!icap_le_struct ) {
+ php3_error(E_WARNING, "Unable to find stream pointer");
+ RETURN_FALSE;
+ }
+
+ if(cal_snooze(icap_le_struct->icap_stream,uid->value.lval))
+ {
+ RETURN_TRUE;
+ }
+ else
+ {
+ RETURN_FALSE;
+ }
+
+
+}
+
void cc_appended(u_int32_t uid)
{