diff options
author | JP Rosevear <jpr@src.gnome.org> | 2001-04-18 01:23:26 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-04-18 01:23:26 +0800 |
commit | 3a49d3e43d8e752162e5c4a098e1c0991a7611db (patch) | |
tree | d6955b35899631b5eb216b16c1d90b254f626822 /libical/src | |
parent | 0d90c71a6a7960e6220958883885b8486eb2d43a (diff) | |
download | gsoc2013-evolution-3a49d3e43d8e752162e5c4a098e1c0991a7611db.tar gsoc2013-evolution-3a49d3e43d8e752162e5c4a098e1c0991a7611db.tar.gz gsoc2013-evolution-3a49d3e43d8e752162e5c4a098e1c0991a7611db.tar.bz2 gsoc2013-evolution-3a49d3e43d8e752162e5c4a098e1c0991a7611db.tar.lz gsoc2013-evolution-3a49d3e43d8e752162e5c4a098e1c0991a7611db.tar.xz gsoc2013-evolution-3a49d3e43d8e752162e5c4a098e1c0991a7611db.tar.zst gsoc2013-evolution-3a49d3e43d8e752162e5c4a098e1c0991a7611db.zip |
This commit was generated by cvs2svn to compensate for changes in r9415,
which included commits to RCS files with non-trunk default branches.
svn path=/trunk/; revision=9416
Diffstat (limited to 'libical/src')
-rw-r--r-- | libical/src/libical/icallangbind.h | 17 | ||||
-rw-r--r-- | libical/src/libical/icalmime.c | 2 | ||||
-rw-r--r-- | libical/src/libical/icalrecur.h | 57 | ||||
-rw-r--r-- | libical/src/libical/sspm.c | 4 | ||||
-rw-r--r-- | libical/src/libicalss/icalclassify.c | 43 | ||||
-rw-r--r-- | libical/src/libicalss/icalcstp.c | 378 | ||||
-rw-r--r-- | libical/src/libicalss/icaldirset.c | 18 | ||||
-rw-r--r-- | libical/src/libicalss/icalfileset.c | 14 | ||||
-rw-r--r-- | libical/src/libicalss/icalfileset.h | 1 | ||||
-rw-r--r-- | libical/src/libicalss/icalset.c | 2 | ||||
-rw-r--r-- | libical/src/libicalss/icalset.h | 10 | ||||
-rw-r--r-- | libical/src/libicalvcal/icalvcal.c | 2 | ||||
-rw-r--r-- | libical/src/test/recur.c | 18 | ||||
-rw-r--r-- | libical/src/test/testclassify.c | 1 | ||||
-rw-r--r-- | libical/src/test/testvcal.c | 10 |
15 files changed, 168 insertions, 409 deletions
diff --git a/libical/src/libical/icallangbind.h b/libical/src/libical/icallangbind.h index 184233147f..2ed50038eb 100644 --- a/libical/src/libical/icallangbind.h +++ b/libical/src/libical/icallangbind.h @@ -29,4 +29,21 @@ const char* icallangbind_get_property_val(icalproperty* p); const char* icallangbind_get_parameter(icalproperty *p, const char* parameter); icalcomponent* icallangbind_get_component(icalcomponent *c, const char* comp); +icalproperty* icallangbind_get_first_property(icalcomponent *c, + const char* prop); + +icalproperty* icallangbind_get_next_property(icalcomponent *c, + const char* prop); + +icalcomponent* icallangbind_get_first_component(icalcomponent *c, + const char* comp); + +icalcomponent* icallangbind_get_next_component(icalcomponent *c, + const char* comp); + + +const char* icallangbind_property_eval_string(icalproperty* prop, char* sep); + + +int icallangbind_string_to_open_flag(const char* str); #endif /*__ICALLANGBIND_H__*/ diff --git a/libical/src/libical/icalmime.c b/libical/src/libical/icalmime.c index 17db8cdee1..6e11e9e326 100644 --- a/libical/src/libical/icalmime.c +++ b/libical/src/libical/icalmime.c @@ -370,7 +370,7 @@ int icalmime_test(char* (*get_string)(char *s, size_t size, void *d), for(i = 0; i <NUM_PARTS && parts[i].header.major != SSPM_NO_MAJOR_TYPE ; i++){ if(parts[i].header.minor == SSPM_CALENDAR_MINOR_TYPE){ - parts[i].data = strdup( + parts[i].data = icalmemory_strdup( icalcomponent_as_ical_string((icalcomponent*)parts[i].data)); } } diff --git a/libical/src/libical/icalrecur.h b/libical/src/libical/icalrecur.h index a4880d7de1..5fcdc15a8c 100644 --- a/libical/src/libical/icalrecur.h +++ b/libical/src/libical/icalrecur.h @@ -17,6 +17,34 @@ The Mozilla Public License Version 1.0. You may obtain a copy of the License at http://www.mozilla.org/MPL/ +How to use: + +1) Get a rule and a start time from a component + icalproperty rrule; + struct icalrecurrencetype recur; + struct icaltimetype dtstart; + + rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY); + recur = icalproperty_get_rrule(rrule); + start = icalproperty_get_dtstart(dtstart); + +Or, just make them up: + recur = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=SU,WE"); + dtstart = icaltime_from_string("19970101T123000") + +2) Create an iterator + icalrecur_iterator* ritr; + ritr = icalrecur_iterator_new(recur,start); + +3) Iterator over the occurrences + struct icaltimetype next; + while (next = icalrecur_iterator_next(ritr) + && !icaltime_is_null_time(next){ + Do something with next + } + +Note that that the time returned by icalrecur_iterator_next is in +whatever timezone that dtstart is in. ======================================================================*/ @@ -62,11 +90,7 @@ enum { ICAL_RECURRENCE_ARRAY_MAX = 0x7f7f, ICAL_RECURRENCE_ARRAY_MAX_BYTE = 0x7f }; - -const char* icalrecur_recurrence_to_string(icalrecurrencetype_frequency kind); -icalrecurrencetype_frequency icalrecur_string_to_recurrence(const char* str); -const char* icalrecur_weekday_to_string(icalrecurrencetype_weekday kind); -icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str); + /********************** Recurrence type routines **************/ @@ -84,6 +108,7 @@ icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str); #define ICAL_BY_MONTH_SIZE 13 #define ICAL_BY_SETPOS_SIZE 367 +/* Main struct for holding digested recurrence rules */ struct icalrecurrencetype { icalrecurrencetype_frequency freq; @@ -131,32 +156,28 @@ enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day); /* 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */ short icalrecurrencetype_day_position(short day); -/* Return the next occurance of 'r' after the time specified by 'after' */ -struct icaltimetype icalrecurrencetype_next_occurance( - struct icalrecurrencetype *r, - struct icaltimetype *after); - - - -typedef void icalrecur_iterator; -void icalrecurrencetype_test(); /*********************************************************************** * Recurrance rule parser **********************************************************************/ +/* Convert between strings ans recurrencetype structures. */ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str); char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur); -/********** recurrence routines ********************/ +/********** recurrence iteration routines ********************/ -icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, struct icaltimetype dtstart); +typedef void icalrecur_iterator; -struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*); +/* Create a new recurrence rule iterator */ +icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule, + struct icaltimetype dtstart); -int icalrecur_iterator_count(icalrecur_iterator*); +/* Get the next occurrence from an iterator */ +struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*); +/* Free the iterator */ void icalrecur_iterator_free(icalrecur_iterator*); /* Fills array up with at most 'count' time_t values, each diff --git a/libical/src/libical/sspm.c b/libical/src/libical/sspm.c index faaacb5592..311747c8f5 100644 --- a/libical/src/libical/sspm.c +++ b/libical/src/libical/sspm.c @@ -39,7 +39,7 @@ #include <assert.h> #include <ctype.h> /* for tolower */ #include <stdlib.h> /* for malloc, free */ - +#include <string.h> /* for strcasecmp */ #ifdef DMALLOC #include "dmalloc.h" @@ -489,7 +489,7 @@ char* sspm_major_type_string(enum sspm_major_type type) return major_content_type_map[i].str; /* Should return SSPM_UNKNOWN_MINOR_TYPE */ } -char* sspm_minor_type_string(enum sspm_major_type type) +char* sspm_minor_type_string(enum sspm_minor_type type) { int i; for (i=0; minor_content_type_map[i].type != SSPM_UNKNOWN_MINOR_TYPE; diff --git a/libical/src/libicalss/icalclassify.c b/libical/src/libicalss/icalclassify.c index 89761d8120..ad2d6d6fd8 100644 --- a/libical/src/libicalss/icalclassify.c +++ b/libical/src/libicalss/icalclassify.c @@ -117,7 +117,7 @@ icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp) -icalparameter_partstat icalclassify_find_attendee(icalcomponent *c, +icalproperty* icalclassify_find_attendee(icalcomponent *c, const char* attendee) { icalproperty *p; @@ -133,22 +133,17 @@ icalparameter_partstat icalclassify_find_attendee(icalcomponent *c, = icalclassify_lowercase(icalproperty_get_attendee(p)); char* this_upn = strchr(this_attendee,':'); - if(strcmp(this_upn,upn)==0){ - - icalparameter *param = icalproperty_get_first_parameter(p, - ICAL_PARTSTAT_PARAMETER); - if (param != 0){ - free(lattendee); - free((void*)this_attendee); - return icalparameter_get_partstat(param); - } + if(this_upn == 0){ + continue; + } + if(strcmp(this_upn,upn)==0){ + return p; } } - free(lattendee); - return ICAL_PARTSTAT_NONE; + return 0; } @@ -453,12 +448,12 @@ int icalclassify_reply_accept( struct icalclassify_parts *match, const char* user) { - icalparameter_partstat partstat; + icalproperty* attendee; icalclassify_pre; - partstat = icalclassify_find_attendee(match->c,comp->reply_attendee); + attendee = icalclassify_find_attendee(match->c,comp->reply_attendee); - if(partstat != ICAL_PARTSTAT_NONE && + if(attendee != 0&& comp->reply_partstat == ICAL_PARTSTAT_ACCEPTED){ rtrn = 1; } @@ -470,13 +465,13 @@ int icalclassify_reply_decline( struct icalclassify_parts *match, const char* user) { - icalparameter_partstat partstat; + icalproperty* attendee; icalclassify_pre; + attendee = icalclassify_find_attendee(match->c,comp->reply_attendee); - partstat = icalclassify_find_attendee(match->c,comp->reply_attendee); - if(partstat != ICAL_PARTSTAT_NONE && + if( attendee != 0 && comp->reply_partstat == ICAL_PARTSTAT_DECLINED){ rtrn = 1; } @@ -487,13 +482,12 @@ int icalclassify_reply_crasher_accept( struct icalclassify_parts *match, const char* user) { - icalparameter_partstat partstat; + icalproperty* attendee; icalclassify_pre; + attendee= icalclassify_find_attendee(match->c,comp->reply_attendee); - partstat = icalclassify_find_attendee(match->c,comp->reply_attendee); - - if(partstat == ICAL_PARTSTAT_NONE && + if(attendee == 0 && comp->reply_partstat == ICAL_PARTSTAT_ACCEPTED){ rtrn = 1; } @@ -505,12 +499,13 @@ int icalclassify_reply_crasher_decline( const char* user) { icalparameter_partstat partstat; + icalproperty* attendee; icalclassify_pre; - partstat = icalclassify_find_attendee(match->c,comp->reply_attendee); + attendee = icalclassify_find_attendee(match->c,comp->reply_attendee); - if(partstat == ICAL_PARTSTAT_NONE && + if(attendee == 0 && comp->reply_partstat == ICAL_PARTSTAT_DECLINED){ rtrn = 1; } diff --git a/libical/src/libicalss/icalcstp.c b/libical/src/libicalss/icalcstp.c index 53ee7bdeef..3b212b424a 100644 --- a/libical/src/libicalss/icalcstp.c +++ b/libical/src/libicalss/icalcstp.c @@ -37,380 +37,80 @@ #include <stdlib.h> /* for malloc */ #include <string.h> -enum cstps_state { - NO_STATE, - CONNECTED, - AUTHENTICATED, - IDENTIFIED, - DISCONNECTED, - RECEIVE, -}; - -struct icalcstps_impl { - int timeout; - icalparser *parser; - enum cstps_state major_state; - struct icalcstps_stubs stubs; -}; - - -enum cstp_command { - ABORT, - AUTHENTICATE, - CAPABILITY, - CONTINUE, - EXPANDCALID, - IDENTIFY, - DISCONNECT, - SENDDATA, - STARTTLS, - EXPANDUPN, - COMMAND_COMPLETE, - UNKNOWN -}; struct command_map { - enum cstp_command command; + enum icalcstp_command command; char *str; } command_map[] = { - {ABORT,"ABORT"}, - {AUTHENTICATE,"AUTHENTICATE"}, - {CAPABILITY,"CAPABILITY"}, - {CONTINUE,"CONTINUE"}, - {EXPANDCALID,"EXPANDCALID"}, - {IDENTIFY,"IDENTIFY"}, - {DISCONNECT,"DISCONNECT"}, - {SENDDATA,"SENDDATA"}, - {STARTTLS,"STARTTLS"}, - {EXPANDUPN,"EXPANDUPN"}, - {UNKNOWN,"UNKNOWN"} + {ICAL_ABORT_COMMAND,"ABORT"}, + {ICAL_AUTHENTICATE_COMMAND,"AUTHENTICATE"}, + {ICAL_CAPABILITY_COMMAND,"CAPABILITY"}, + {ICAL_CONTINUE_COMMAND,"CONTINUE"}, + {ICAL_CALIDEXPAND_COMMAND,"CALIDEXPAND"}, + {ICAL_IDENTIFY_COMMAND,"IDENTIFY"}, + {ICAL_DISCONNECT_COMMAND,"DISCONNECT"}, + {ICAL_SENDDATA_COMMAND,"SENDDATA"}, + {ICAL_STARTTLS_COMMAND,"STARTTLS"}, + {ICAL_UPNEXPAND_COMMAND,"UPNEXPAND"}, + {ICAL_UNKNOWN_COMMAND,"UNKNOWN"} }; - -/* This state machine is a Mealy-type: actions occur on the - transitions, not in the states. - - Here is the state machine diagram from the CAP draft: - - - STARTTLS / - CAPABILITY - +-------+ - | | +---------------+ - | +-----------+ AUTHENTICATE | | - +-->| Connected |-------------->| Authenticated | - +-----------+ | | - | +---------------+ - | | - | | - | | - | | +-----+ STARTTLS / - | V | | CAPABILITY / - | +---------------+ | IDENTIFY - | | |<-+ - | | Identified |<----+ - | +--------| | | - | | +---------------+ | command - | | | | completes - V |DISCONNECT | | - +--------------+ | |SENDDATA | - | Disconnected |<--+ | | - +--------------+ | | ABORT - A | | - | V | - | DISCONNECT +---------------+ | - +--------------------| Receive |--+ - | |<--+ - +---------------+ | - | | CONTINUTE - +----+ - - In this implmenetation, the transition from CONNECTED to IDENTIFIED - is non-standard. The spec specifies that on the ATHENTICATE - command, the machine transitions from CONNECTED to AUTHENTICATED, - and then immediately goes to IDENTIFIED. This makes AUTHENTICATED a - useless state, so I removed it */ - -struct state_table { - enum cstps_state major_state; - enum cstp_command command; - void (*action)(); - enum cstps_state next_state; - -} server_state_table[] = +icalcstp_command icalcstp_line_command(char* line) { - { CONNECTED, CAPABILITY , 0, CONNECTED}, - { CONNECTED, AUTHENTICATE , 0, IDENTIFIED}, /* Non-standard */ - { IDENTIFIED, STARTTLS, 0, IDENTIFIED}, - { IDENTIFIED, IDENTIFY, 0, IDENTIFIED}, - { IDENTIFIED, CAPABILITY, 0, IDENTIFIED}, - { IDENTIFIED, SENDDATA, 0, RECEIVE}, - { IDENTIFIED, DISCONNECT, 0, DISCONNECTED}, - { DISCONNECTED, 0, 0, 0}, - { RECEIVE, DISCONNECT, 0, DISCONNECTED}, - { RECEIVE, CONTINUE, 0, RECEIVE}, - { RECEIVE, ABORT , 0, IDENTIFIED}, - { RECEIVE, COMMAND_COMPLETE , 0, IDENTIFIED} -}; + int i; + for(i = 0; command_map[i].command != ICAL_UNKNOWN_COMMAND; i++){ + size_t l = strlen(command_map[i].str); -/**********************************************************************/ - - - -icalcstps* icalcstps_new(struct icalcstps_stubs stubs) -{ - struct icalcstps_impl* impl; - - if ( ( impl = (struct icalcstps_impl*) - malloc(sizeof(struct icalcstps_impl))) == 0) { - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return 0; + if(strncmp(line, command_map[i].str, l) == 0){ + return command_map[i].command; + } + } - impl->stubs = stubs; - impl->timeout = 10; - - return (icalcstps*)impl; - + return ICAL_UNKNOWN_COMMAND; } -void icalcstps_free(icalcstps* cstp); - -int icalcstps_set_timeout(icalcstps* cstp, int sec) +icalrequeststatus icalcstp_line_response_code(char* line) { - struct icalcstps_impl *impl = (struct icalcstps_impl *) cstp; + struct icalreqstattype rs; - icalerror_check_arg_rz( (cstp!=0), "cstp"); + rs = icalreqstattype_from_string(line); - impl->timeout = sec; - - return sec; + return rs.code; } -typedef struct icalcstps_response { - icalrequeststatus code; - char caluid[1024]; - void* result; -} icalcstps_response; - -int line_is_command(char* line); -int line_is_response(char* line); -int line_is_endofdata(char* line); -int line_is_mime(char* line); - -icalerrorenum prep_abort(struct icalcstps_impl* impl, char* data) +int icalcstp_line_is_endofdata(char* line) { - return ICAL_NO_ERROR; -} -icalerrorenum prep_authenticate(struct icalcstps_impl* impl, char* data) -{ return ICAL_NO_ERROR; -} -icalerrorenum prep_capability(struct icalcstps_impl* impl, char* data) -{ return ICAL_NO_ERROR; -} -icalerrorenum prep_calidexpand(struct icalcstps_impl* impl, char* data) -{ - return ICAL_NO_ERROR; -} -icalerrorenum prep_continue(struct icalcstps_impl* impl, char* data) -{ - return ICAL_NO_ERROR; -} -icalerrorenum prep_disconnect(struct icalcstps_impl* impl, char* data) -{ - return ICAL_NO_ERROR; -} -icalerrorenum prep_identify(struct icalcstps_impl* impl, char* data) -{ - return ICAL_NO_ERROR; -} -icalerrorenum prep_starttls(struct icalcstps_impl* impl, char* data) -{ - return ICAL_NO_ERROR; -} -icalerrorenum prep_upnexpand(struct icalcstps_impl* impl, char* data) -{ - return ICAL_NO_ERROR; -} -icalerrorenum prep_sendata(struct icalcstps_impl* impl, char* data) -{ return ICAL_NO_ERROR; -} - -char* icalcstps_process_incoming(icalcstps* cstp, char* input) -{ - struct icalcstps_impl *impl = (struct icalcstps_impl *) cstp; - char *i; - char *cmd_or_resp; - char *data; - char *input_cpy; - icalerrorenum error; - - icalerror_check_arg_rz(cstp !=0,"cstp"); - icalerror_check_arg_rz(input !=0,"input"); - - if ((input_cpy = (char*)strdup(input)) == 0){ - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return 0; - } - - i = (char*)strstr(" ",input_cpy); - - cmd_or_resp = input_cpy; - - if (i != 0){ - *i = '\0'; - data = ++i; - } else { - data = 0; + if(line[0] == '.' && line[1] == '\n'){ + return 1; } - printf("cmd: %s\n",cmd_or_resp); - printf("data: %s\n",data); - - /* extract the command, look up in the state table, and dispatch - to the proper handler */ - - if(strcmp(cmd_or_resp,"ABORT") == 0){ - error = prep_abort(impl,data); - } else if(strcmp(cmd_or_resp,"AUTHENTICATE") == 0){ - error = prep_authenticate(impl,data); - } else if(strcmp(cmd_or_resp,"CAPABILITY") == 0){ - error = prep_capability(impl,data); - } else if(strcmp(cmd_or_resp,"CALIDEXPAND") == 0){ - error = prep_calidexpand(impl,data); - } else if(strcmp(cmd_or_resp,"CONTINUE") == 0){ - error = prep_continue(impl,data); - } else if(strcmp(cmd_or_resp,"DISCONNECT") == 0){ - error = prep_disconnect(impl,data); - } else if(strcmp(cmd_or_resp,"IDENTIFY") == 0){ - error = prep_identify(impl,data); - } else if(strcmp(cmd_or_resp,"STARTTLS") == 0){ - error = prep_starttls(impl,data); - } else if(strcmp(cmd_or_resp,"UPNEXPAND") == 0){ - error = prep_upnexpand(impl,data); - } else if(strcmp(cmd_or_resp,"SENDDATA") == 0){ - error = prep_sendata(impl,data); - } - return 0; -} - - /* Read data until we get a end of data marker */ - - - -struct icalcstps_server_stubs { - icalerrorenum (*abort)(icalcstps* cstp); - icalerrorenum (*authenticate)(icalcstps* cstp, char* mechanism, - char* data); - icalerrorenum (*calidexpand)(icalcstps* cstp, char* calid); - icalerrorenum (*capability)(icalcstps* cstp); - icalerrorenum (*cont)(icalcstps* cstp, unsigned int time); - icalerrorenum (*identify)(icalcstps* cstp, char* id); - icalerrorenum (*disconnect)(icalcstps* cstp); - icalerrorenum (*sendata)(icalcstps* cstp, unsigned int time, - icalcomponent *comp); - icalerrorenum (*starttls)(icalcstps* cstp, char* command, - char* data); - icalerrorenum (*upnexpand)(icalcstps* cstp, char* upn); - icalerrorenum (*unknown)(icalcstps* cstp, char* command, char* data); -}; - - -/********************** Client (Sender) Interfaces **************************/ - -struct icalcstpc_impl { - int timeout; - icalparser *parser; - enum cstp_command command; - char* next_output; - char* next_input; -}; -icalcstps* icalcstpc_new(); - -void* icalcstpc_free(icalcstpc* cstpc); - -/* Get the next string to send to the server */ -char* icalcstpc_next_output(icalcstpc* cstp) -{ - return 0; } -/* process the next string to send to the server */ -int icalcstpc_next_input(icalcstpc* cstp) +int icalcstp_line_is_mime(char* line) { - return 0; } -/* After icalcstpc_next_input returns a 0, there are responses - ready. use these to get them */ -icalcstpc_response icalcstpc_first_response(icalcstpc* cstp); -icalcstpc_response icalcstpc_next_response(icalcstpc* cstp); - -int icalcstpc_set_timeout(icalcstpc* cstp, int sec); -icalerrorenum icalcstpc_abort(icalcstpc* cstp) -{ - struct icalcstpc_impl* impl = (struct icalcstpc_impl*)cstp; - - icalerror_check_arg_re(cstp!=0,"cstp",ICAL_BADARG_ERROR); - - impl->next_output = "ABORT"; +const char* icalcstp_command_to_string(icalcstp_command command){ - return ICAL_NO_ERROR; -} + int i; -icalerrorenum icalcstpc_authenticate(icalcstpc* cstp, char* mechanism, - char* data, char* f(char*)) -{ - return ICAL_NO_ERROR; -} + for(i = 0; command_map[i].command != ICAL_UNKNOWN_COMMAND; i++){ + size_t l = strlen(command_map[i].str); -icalerrorenum icalcstpc_capability(icalcstpc* cstp) -{ - return ICAL_NO_ERROR;} - -icalerrorenum icalcstpc_calidexpand(icalcstpc* cstp,char* calid) -{ - return ICAL_NO_ERROR; -} - -icalerrorenum icalcstpc_continue(icalcstpc* cstp, unsigned int time) -{ - return ICAL_NO_ERROR; -} - -icalerrorenum icalcstpc_disconnect(icalcstpc* cstp) -{ - return ICAL_NO_ERROR; -} - -icalerrorenum icalcstpc_identify(icalcstpc* cstp, char* id) -{ - return ICAL_NO_ERROR; -} - -icalerrorenum icalcstpc_starttls(icalcstpc* cstp, char* command, - char* data, char * f(char*)) -{ - return ICAL_NO_ERROR; -} + if(command_map[i].command == command){ + return command_map[i].str; + } + + } -icalerrorenum icalcstpc_upnexpand(icalcstpc* cstp,char* calid) -{ - return ICAL_NO_ERROR; -} + return command_map[i].str; -icalerrorenum icalcstpc_sendata(icalcstpc* cstp, unsigned int time, - icalcomponent *comp) -{ - return ICAL_NO_ERROR; } - - - diff --git a/libical/src/libicalss/icaldirset.c b/libical/src/libicalss/icaldirset.c index 78b2373219..3a7b9cfdd9 100644 --- a/libical/src/libicalss/icaldirset.c +++ b/libical/src/libicalss/icaldirset.c @@ -65,7 +65,7 @@ #include "icalfilesetimpl.h" #include "icalgauge.h" -#include <limits.h> +#include <limits.h> /* For PATH_MAX */ #include <dirent.h> /* for opendir() */ #include <errno.h> #include <sys/types.h> /* for opendir() */ @@ -191,7 +191,7 @@ icaldirset* icaldirset_new(const char* dir) impl = icaldirset_new_impl(); if (impl ==0){ - icalerror_set_errno(ICAL_ALLOCATION_ERROR); + icalerror_set_errno(ICAL_NEWFAILED_ERROR); return 0; } @@ -252,7 +252,7 @@ int icaldirset_next_uid_number(icaldirset* store) struct icaldirset_impl *impl = (struct icaldirset_impl*)store; char sequence = 0; char temp[128]; - char filename[PATH_MAX]; + char filename[ICAL_PATH_MAX]; char *r; FILE *f; struct stat sbuf; @@ -304,7 +304,7 @@ int icaldirset_next_uid_number(icaldirset* store) icalerrorenum icaldirset_next_cluster(icaldirset* store) { struct icaldirset_impl *impl = (struct icaldirset_impl*)store; - char path[PATH_MAX]; + char path[ICAL_PATH_MAX]; if (impl->directory_iterator == 0){ icalerror_set_errno(ICAL_INTERNAL_ERROR); @@ -332,7 +332,7 @@ icalerrorenum icaldirset_next_cluster(icaldirset* store) void icaldirset_add_uid(icaldirset* store, icaldirset* comp) { - char uidstring[PATH_MAX]; + char uidstring[ICAL_PATH_MAX]; icalproperty *uid; struct utsname unamebuf; @@ -363,7 +363,7 @@ void icaldirset_add_uid(icaldirset* store, icaldirset* comp) icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp) { struct icaldirset_impl *impl; - char clustername[PATH_MAX]; + char clustername[ICAL_PATH_MAX]; icalproperty *dt; icalvalue *v; struct icaltimetype tm; @@ -418,7 +418,7 @@ icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp) tm = icalvalue_get_datetime(v); - snprintf(clustername,PATH_MAX,"%s/%04d%02d",impl->dir,tm.year,tm.month); + snprintf(clustername,ICAL_PATH_MAX,"%s/%04d%02d",impl->dir,tm.year,tm.month); /* Load the cluster and insert the object */ @@ -633,7 +633,7 @@ icalcomponent* icaldirset_get_first_component(icaldirset* store) { struct icaldirset_impl *impl = (struct icaldirset_impl*)store; icalerrorenum error; - char path[PATH_MAX]; + char path[ICAL_PATH_MAX]; error = icaldirset_read_directory(impl); @@ -649,7 +649,7 @@ icalcomponent* icaldirset_get_first_component(icaldirset* store) return 0; } - snprintf(path,PATH_MAX,"%s/%s",impl->dir,(char*)pvl_data(impl->directory_iterator)); + snprintf(path,ICAL_PATH_MAX,"%s/%s",impl->dir,(char*)pvl_data(impl->directory_iterator)); /* If the next cluster we need is different than the current cluster, delete the current one and get a new one */ diff --git a/libical/src/libicalss/icalfileset.c b/libical/src/libicalss/icalfileset.c index 2ef38ff876..b6e3430f7d 100644 --- a/libical/src/libicalss/icalfileset.c +++ b/libical/src/libicalss/icalfileset.c @@ -33,7 +33,6 @@ #include "icalfileset.h" #include "icalgauge.h" #include <errno.h> -#include <limits.h> /* For PATH_MAX */ #include <sys/stat.h> /* for stat */ #include <unistd.h> /* for stat, getpid */ #include <stdlib.h> @@ -155,7 +154,6 @@ icalerrorenum icalfileset_read_file(icalfileset* cluster,mode_t mode) { icalparser *parser; - int fd; struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster; @@ -292,7 +290,7 @@ int icalfileset_safe_saves=0; icalerrorenum icalfileset_commit(icalfileset* cluster) { - char tmp[PATH_MAX]; + char tmp[ICAL_PATH_MAX]; char *str; icalcomponent *c; off_t write_size=0; @@ -309,7 +307,7 @@ icalerrorenum icalfileset_commit(icalfileset* cluster) } if(icalfileset_safe_saves == 1){ - snprintf(tmp,PATH_MAX,"cp %s %s.bak",impl->path,impl->path); + snprintf(tmp,ICAL_PATH_MAX,"cp %s %s.bak",impl->path,impl->path); if(system(tmp) < 0){ icalerror_set_errno(ICAL_FILE_ERROR); @@ -376,8 +374,8 @@ icalerrorenum icalfileset_add_component(icalfileset *cluster, { struct icalfileset_impl* impl = (struct icalfileset_impl*)cluster; - icalerror_check_arg_rv((cluster!=0),"cluster"); - icalerror_check_arg_rv((child!=0),"child"); + icalerror_check_arg_re((cluster!=0),"cluster", ICAL_BADARG_ERROR); + icalerror_check_arg_re((child!=0),"child",ICAL_BADARG_ERROR); icalcomponent_add_component(impl->cluster,child); @@ -392,8 +390,8 @@ icalerrorenum icalfileset_remove_component(icalfileset *cluster, { struct icalfileset_impl* impl = (struct icalfileset_impl*)cluster; - icalerror_check_arg_rv((cluster!=0),"cluster"); - icalerror_check_arg_rv((child!=0),"child"); + icalerror_check_arg_re((cluster!=0),"cluster",ICAL_BADARG_ERROR); + icalerror_check_arg_re((child!=0),"child",ICAL_BADARG_ERROR); icalcomponent_remove_component(impl->cluster,child); diff --git a/libical/src/libicalss/icalfileset.h b/libical/src/libicalss/icalfileset.h index 3b4b87c34d..c785921463 100644 --- a/libical/src/libicalss/icalfileset.h +++ b/libical/src/libicalss/icalfileset.h @@ -30,6 +30,7 @@ #define ICALFILESET_H #include "ical.h" +#include "icalset.h" #include "icalgauge.h" #include <sys/types.h> /* For open() flags and mode */ #include <sys/stat.h> /* For open() flags and mode */ diff --git a/libical/src/libicalss/icalset.c b/libical/src/libicalss/icalset.c index 3edbe503c4..2120609928 100644 --- a/libical/src/libicalss/icalset.c +++ b/libical/src/libicalss/icalset.c @@ -123,7 +123,7 @@ struct icalset_impl icalset_get_impl(icalset* set) struct icalset_impl impl; memset(&impl,0,sizeof(impl)); - icalerror_check_arg_rv( (set!=0),"set"); + icalerror_check_arg_re( (set!=0),"set",impl); if(strcmp((char*)set,ICALSET_ID)==0) { /* It is actually a set, so just sent the reference back out. */ diff --git a/libical/src/libicalss/icalset.h b/libical/src/libicalss/icalset.h index d4678e3bed..7b083dae24 100644 --- a/libical/src/libicalss/icalset.h +++ b/libical/src/libicalss/icalset.h @@ -37,9 +37,19 @@ #ifndef ICALSET_H #define ICALSET_H +#include <limits.h> /* For PATH_MAX */ #include "ical.h" #include "icalerror.h" +#ifdef PATH_MAX +#define ICAL_PATH_MAX PATH_MAX +#else +#define ICAL_PATH_MAX 1024 +#endif + + + + typedef void icalset; typedef enum icalset_kind { diff --git a/libical/src/libicalvcal/icalvcal.c b/libical/src/libicalvcal/icalvcal.c index 9ae00a7d90..24c3155178 100644 --- a/libical/src/libicalvcal/icalvcal.c +++ b/libical/src/libicalvcal/icalvcal.c @@ -153,7 +153,7 @@ static void icalvcal_traverse_objects(VObject *object,icalcomponent* last_comp, snprintf(temp,1024,"%s: %s",message,name); error_param = icalparameter_new_xlicerrortype( - ICAL_XLICERRORTYPE_UNKVCALPROP + ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR ); error_prop = icalproperty_new_xlicerror(temp); diff --git a/libical/src/test/recur.c b/libical/src/test/recur.c index 95dd3b08a3..f4d9a38647 100644 --- a/libical/src/test/recur.c +++ b/libical/src/test/recur.c @@ -31,10 +31,17 @@ #include <stdlib.h> /* for malloc */ #include <stdio.h> /* for printf */ #include <time.h> /* for time() */ +#include <signal.h> /* for signal */ +#include <unistd.h> /* for alarm */ #include "icalmemory.h" #include "icaldirset.h" #include "icalfileset.h" +static void sig_alrm(int i){ + fprintf(stderr,"Could not get lock on file\n"); + exit(1); +} + int main(int argc, char *argv[]) { icalfileset *cin; @@ -46,9 +53,10 @@ int main(int argc, char *argv[]) time_t tt; char* file; - icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR, ICAL_ERROR_NONFATAL); icalerror_set_error_state(ICAL_PARSE_ERROR, ICAL_ERROR_NONFATAL); + signal(SIGALRM,sig_alrm); + if (argc <= 1){ file = "../../test-data/recur.txt"; @@ -59,8 +67,10 @@ int main(int argc, char *argv[]) exit(1); } + alarm(300); /* to get file lock */ cin = icalfileset_new(file); - + alarm(0); + if(cin == 0){ fprintf(stderr,"recur: can't open file %s\n",file); exit(1); @@ -82,6 +92,8 @@ int main(int argc, char *argv[]) continue; } + printf("\n\n#### %s\n",icalproperty_get_description(desc)); + printf("#### %s\n",icalvalue_as_ical_string(icalproperty_get_value(rrule))); recur = icalproperty_get_rrule(rrule); start = icalproperty_get_dtstart(dtstart); @@ -89,8 +101,6 @@ int main(int argc, char *argv[]) tt = icaltime_as_timet(start); - printf("\n\n#### %s\n",icalproperty_get_description(desc)); - printf("#### %s\n",icalvalue_as_ical_string(icalproperty_get_value(rrule))); printf("#### %s\n",ctime(&tt )); for(ritr = icalrecur_iterator_new(recur,start), diff --git a/libical/src/test/testclassify.c b/libical/src/test/testclassify.c index 821baac251..2c6c785dfa 100644 --- a/libical/src/test/testclassify.c +++ b/libical/src/test/testclassify.c @@ -31,7 +31,6 @@ #include <string.h> /* For strerror */ #include "icalset.h" #include "icalclassify.h" -#include "icalssutil.h" struct class_map { diff --git a/libical/src/test/testvcal.c b/libical/src/test/testvcal.c index 4777162623..f82adffcc8 100644 --- a/libical/src/test/testvcal.c +++ b/libical/src/test/testvcal.c @@ -41,8 +41,16 @@ int main(int argc, char* argv[]) { VObject *vcal = 0; icalcomponent *comp; + char* file; - vcal = Parse_MIME_FromFileName(argv[1]); + if (argc != 2){ + file = "../../test-data/user-cal.vcf"; + } else { + file = argv[1]; + } + + + vcal = Parse_MIME_FromFileName(file); assert(vcal != 0); |