cvs: /php3/functions php3_mcal.c php3_mcal.h
| From: | Mark Musone | Date: | Thu, 02 Sep 1999 21:09:41 +0000 |
| Subject: | cvs: /php3/functions php3_mcal.c php3_mcal.h | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-10471@lists.php.net to get a copy of this message | ||
musone Thu Sep 2 17:09:41 1999 EDT
Modified files:
/php3/functions php3_mcal.c php3_mcal.h
Log:
added convenience functions to events
Index: php3/functions/php3_mcal.c
diff -u php3/functions/php3_mcal.c:1.4 php3/functions/php3_mcal.c:1.5
--- php3/functions/php3_mcal.c:1.4 Thu Sep 2 15:26:23 1999
+++ php3/functions/php3_mcal.c Thu Sep 2 17:09:40 1999
@@ -48,6 +48,7 @@
#include <ctype.h>
#include <signal.h>
#include <stdarg.h>
+#include "php3_list.h"
#include "mcal.h"
#include "php3_mcal.h"
#include "modules.h"
@@ -60,8 +61,12 @@
typedef struct php3_mcal_le_struct {
- CALSTREAM *mcal_stream;
- long flags;
+ CALSTREAM *mcal_stream;
+ long public;
+ char *category,*title,*description;
+ long alarm,start_year,start_month,start_mday,start_hour,start_min,start_sec,start_has_time;
+ long end_year,end_month,end_mday,end_hour,end_min,end_sec,end_has_time;
+ long flags,class;
} pils;
@@ -91,6 +96,12 @@
{"mcal_delete_event", php3_mcal_delete_event, NULL},
{"mcal_store_event", php3_mcal_store_event, NULL},
{"mcal_snooze", php3_mcal_snooze, NULL},
+ {"mcal_event_set_category",php3_mcal_event_add_category,NULL},
+ {"mcal_event_set_title",php3_mcal_event_add_title,NULL},
+ {"mcal_event_set_description",php3_mcal_event_add_description,NULL},
+ {"mcal_event_set_start",php3_mcal_event_add_start,NULL},
+ {"mcal_event_set_alarm",php3_mcal_event_add_alarm,NULL},
+ {"mcal_event_set_class",php3_mcal_event_add_class,NULL},
{NULL, NULL, NULL}
};
@@ -186,6 +197,9 @@
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;
+
ind = php3_list_insert(mcal_le_struct, le_mcal);
RETURN_LONG(ind);
}
@@ -878,7 +892,279 @@
/* }}} */
+/* {{{ proto string mcal_event_add_category(int stream_id, string category)
+ attach a category to an event*/
+void php3_mcal_event_add_category(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *streamind,*category;
+ 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 !=2 || getParameters(ht,myargc,&streamind,&category) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(streamind);
+ convert_to_string(category);
+
+ 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;
+ }
+ mcal_le_struct->category=estrdup(category->value.str.val);
+}
+ /* }}} */
+
+/* {{{ proto string mcal_event_add_title(int stream_id, string title)
+ attach a title to an event*/
+void php3_mcal_event_add_title(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *streamind,*title;
+ 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 !=2 || getParameters(ht,myargc,&streamind,&title) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(streamind);
+ convert_to_string(title);
+
+ 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;
+ }
+ mcal_le_struct->title=estrdup(title->value.str.val);
+}
+ /* }}} */
+
+/* {{{ proto string mcal_event_add_description(int stream_id, string description)
+ attach a description to an event*/
+void php3_mcal_event_add_description(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *streamind,*description;
+ 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 !=2 || getParameters(ht,myargc,&streamind,&description) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(streamind);
+ convert_to_string(description);
+
+ 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;
+ }
+ mcal_le_struct->description=estrdup(description->value.str.val);
+}
+ /* }}} */
+
+/* {{{ proto string mcal_event_add_start(int stream_id, int year,int month, int day, [[[int
hour],int min],int sec])
+ attach a start datetime to an event*/
+void php3_mcal_event_add_start(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *streamind,*year,*month,*date,*hour,*min,*sec;
+ 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 <4 ||
getParameters(ht,myargc,&streamind,&year,&month,&date,&hour,&min,&sec)
== FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(streamind);
+ convert_to_long(year);
+ convert_to_long(month);
+ convert_to_long(date);
+ if(myargc > 4) convert_to_long(hour);
+ if(myargc > 5) convert_to_long(min);
+ if(myargc > 6) convert_to_long(sec);
+
+ 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;
+ }
+ mcal_le_struct->start_year=year->value.lval;
+ mcal_le_struct->start_month=month->value.lval;
+ mcal_le_struct->start_mday=date->value.lval;
+ if(myargc > 4) mcal_le_struct->start_hour=hour->value.lval;
+ if(myargc > 4) mcal_le_struct->start_has_time=1;
+ if(myargc > 5) mcal_le_struct->start_min=min->value.lval;
+ if(myargc > 6) mcal_le_struct->start_sec=sec->value.lval;
+}
+ /* }}} */
+
+/* {{{ proto string mcal_event_add_end(int stream_id, int year,int month, int day, [[[int hour],int
min],int sec])
+ attach an end datetime to an event*/
+void php3_mcal_event_add_end(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *streamind,*year,*month,*date,*hour,*min,*sec;
+ 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 <4 ||
getParameters(ht,myargc,&streamind,&year,&month,&date,&hour,&min,&sec)
== FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(streamind);
+ convert_to_long(year);
+ convert_to_long(month);
+ convert_to_long(date);
+ if(myargc > 4) convert_to_long(hour);
+ if(myargc > 5) convert_to_long(min);
+ if(myargc > 6) convert_to_long(sec);
+
+ 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;
+ }
+ mcal_le_struct->end_year=year->value.lval;
+ mcal_le_struct->end_month=month->value.lval;
+ mcal_le_struct->end_mday=date->value.lval;
+ if(myargc > 4) mcal_le_struct->end_hour=hour->value.lval;
+ if(myargc > 4) mcal_le_struct->end_has_time=1;
+ if(myargc > 5) mcal_le_struct->end_min=min->value.lval;
+ if(myargc > 6) mcal_le_struct->end_sec=sec->value.lval;
+}
+ /* }}} */
+
+void php3_mcal_event_add_alarm(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *streamind,*alarm;
+ 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 !=2 || getParameters(ht,myargc,&streamind,&alarm) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(streamind);
+ convert_to_long(alarm);
+
+ 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;
+ }
+ mcal_le_struct->alarm=alarm->value.lval;
+}
+ /* }}} */
+
+void php3_mcal_event_add_class(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *streamind,*class;
+ 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 !=2 || getParameters(ht,myargc,&streamind,&class) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(streamind);
+ convert_to_long(class);
+
+ 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;
+ }
+ mcal_le_struct->class=class->value.lval;
+}
+ /* }}} */
+
+
/* Interfaces to callbacks */
+
void cc_searched (unsigned long cal_uid)
Index: php3/functions/php3_mcal.h
diff -u php3/functions/php3_mcal.h:1.2 php3/functions/php3_mcal.h:1.3
--- php3/functions/php3_mcal.h:1.2 Thu Sep 2 15:26:23 1999
+++ php3/functions/php3_mcal.h Thu Sep 2 17:09:40 1999
@@ -1,4 +1,4 @@
-/* $Id: php3_mcal.h,v 1.2 1999/09/02 19:26:23 musone Exp $ */
+/* $Id: php3_mcal.h,v 1.3 1999/09/02 21:09:40 musone Exp $ */
#ifndef _INCLUDED_MCAL_H
#define _INCLUDED_MCAL_H
@@ -42,7 +42,12 @@
void php3_mcal_delete_event(INTERNAL_FUNCTION_PARAMETERS);
void php3_mcal_snooze(INTERNAL_FUNCTION_PARAMETERS);
void php3_mcal_list_alarms(INTERNAL_FUNCTION_PARAMETERS);
-
+void php3_mcal_event_add_category(INTERNAL_FUNCTION_PARAMETERS);
+void php3_mcal_event_add_title(INTERNAL_FUNCTION_PARAMETERS);
+void php3_mcal_event_add_description(INTERNAL_FUNCTION_PARAMETERS);
+void php3_mcal_event_add_start(INTERNAL_FUNCTION_PARAMETERS);
+void php3_mcal_event_add_alarm(INTERNAL_FUNCTION_PARAMETERS);
+void php3_mcal_event_add_class(INTERNAL_FUNCTION_PARAMETERS);