From 73a6d43a66a828b09e2c1b5a483405e6e0b5fa6a Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Thu, 24 Aug 2000 20:12:06 +0000 Subject: Fix minor conflicts. svn path=/trunk/; revision=5017 --- libical/ChangeLog | 63 +- libical/Makefile.am | 4 +- libical/NEWS | 48 +- libical/README | 9 +- libical/THANKS | 16 +- libical/TODO | 4 + libical/configure.in | 30 +- libical/design-data/components.txt | 1 + libical/design-data/prop-to-value.txt | 11 +- libical/doc/Makefile.am | 2 +- libical/doc/UsingLibical.lyx | 1957 ++++++++++--------------------- libical/doc/UsingLibical.ps | 2027 +++++++++++++++++++-------------- libical/doc/UsingLibical.txt | 647 +++++++++-- libical/scripts/mkderivedvalues.pl | 8 + libical/src/Makefile.am | 2 +- libical/src/libical/Makefile.am | 18 +- libical/src/libical/ical.h | 35 +- libical/src/libical/icalcomponent.c | 285 +++-- libical/src/libical/icalcomponent.h | 61 +- libical/src/libical/icalenums.c | 29 +- libical/src/libical/icalenums.h | 60 +- libical/src/libical/icalerror.c | 24 +- libical/src/libical/icalerror.h | 28 +- libical/src/libical/icalmemory.c | 109 +- libical/src/libical/icalmemory.h | 34 +- libical/src/libical/icalparameter.c | 178 ++- libical/src/libical/icalparameter.h | 27 +- libical/src/libical/icalparser.c | 34 +- libical/src/libical/icalparser.h | 72 +- libical/src/libical/icalproperty.c | 488 +++++++- libical/src/libical/icalproperty.h | 82 +- libical/src/libical/icalrestriction.c | 19 +- libical/src/libical/icalrestriction.h | 27 +- libical/src/libical/icaltypes.c | 81 +- libical/src/libical/icaltypes.h | 58 +- libical/src/libical/icalvalue.c | 72 +- libical/src/libical/icalvalue.h | 27 +- libical/src/libical/icalyacc.c | 431 +++---- libical/src/libical/icalyacc.y | 31 +- libical/src/libical/pvl.c | 17 +- libical/src/libical/pvl.h | 28 +- libical/src/libicalss/Makefile.am | 25 +- libical/src/libicalss/icalcalendar.c | 61 +- libical/src/libicalss/icalcalendar.h | 39 +- libical/src/test/Makefile.am | 12 +- libical/src/test/Makefile.in | 385 ------- libical/src/test/copycluster.c | 20 +- libical/src/test/findobj.c | 5 +- libical/src/test/icaltestparser.c | 5 +- libical/src/test/regression.c | 324 +++++- libical/src/test/storage.c | 117 +- libical/src/test/stow.c | 708 ++++++++---- libical/test-data/Makefile.am | 9 +- 53 files changed, 5089 insertions(+), 3805 deletions(-) delete mode 100644 libical/src/test/Makefile.in diff --git a/libical/ChangeLog b/libical/ChangeLog index baf8b5a41c..40dd839d62 100644 --- a/libical/ChangeLog +++ b/libical/ChangeLog @@ -1,3 +1,50 @@ +2000-08-04 + + * stow.c Changed stow to write data to a file ( icalfileset) not a + calendar. Also added MIME parsing capability + + * sspm.c Core of the mime processor. Now handles quoted-printable + and base64 encodings + + * icalmime.h New file that parses mime data and returns an + icalcomponent that includes all of the parts. + + +2000-07-26 + + * icaldirset.h misc bug fixes to get deleting components to work + + * icalcomponent.h Eliminated internal use of _get_first_component + and _get_next_component, since these will reset the interal + iterators. + +2000-07-23 + + * icalcomponent.h Added external iterators to icalcomponent for + subcomponents: icalcompiter. These are still experimental, but they + seem to work OK and have a nice syntax + +2000-07-18 + + * icalset This is a new "superclass" for icalstore, icalcluster, + and others. It merges the interfaces of the old icalstore and + icalcluster + + * icalstore.{c,h} CHanged name to icaldirset + + * icalcluster.{c,h} Changed name to icalfileset + + +2000-06-12 Eric Busboom + + * icalstow.c misc improvements and bug fixes to make it useful. + +2000-06-09 Eric Busboom + + * icalrecur.c More extensive code changes for recurrence rule. + + * icalyacc.y Added support for integers in by day lists + 2000-06-08 Ettore Perazzoli * src/test/Makefile.am (INCLUDES): Likewise. @@ -5,11 +52,23 @@ * src/libicalss/Makefile.am (INCLUDES): Use $(srcdir) to allow builddir != srcdir. -2000-03-17 Eric Busboom +2000-06-01 Eric Busboom + + * icalrecur.c moved recur code into new files + +2000-05-30 Eric Busboom + + * icaltypes.c Extensive work on code to expand recurences + + * icaltypes.h Changed signature icaltimetype_from_timet to include + is_utc flag. + + +2000-03-17 Eric Busboom * icalstore.c Vastly improved icalstore_test. -2000-03-16 Eric Busboom +2000-03-16 Eric Busboom * icalcluster.c Added compile flag (ICAL_SAFESAVES) to switch how icalcluster saves files during commits. When the flag is define, diff --git a/libical/Makefile.am b/libical/Makefile.am index 66b37da052..8dcd95a438 100644 --- a/libical/Makefile.am +++ b/libical/Makefile.am @@ -1,11 +1,9 @@ - EXTRA_DIST = \ ChangeLog \ README \ TEST \ TODO -SUBDIRS = design-data doc scripts test-data src - +SUBDIRS = design-data doc scripts test-data src examples diff --git a/libical/NEWS b/libical/NEWS index 71f18ff45b..fb945eb9a2 100644 --- a/libical/NEWS +++ b/libical/NEWS @@ -1,3 +1,49 @@ +Version 0.19 6 August 00 (cvs tag libical-0-19) +----------------------------------------------- + +Created a MIME parser in icalmime.c. This will take any complex MIME +encapsulated message and return an icalcomponent with the same +structure. Each MIME part is represented by a component of type +X-LIC-MIMEPART. + +Added MIME partsing to stow.c + +Added external iterators to icalcomponent. See test_iterators() in +test/regression.c + +Refactored icalcluster and icalstore into icalset, icalfileset and +icaldirset, which have a pseudo inheritance relationship between them. + +Fixed more memory leaks. + +Version 0.18a 10 June 00 ( cvs tag libical-0-18a ) +----------------------------------------------- + +Did the final tweaks to stow.c, a program to recieve and store iMIP +messages. + + +Version 0.18 10 June 00 ( cvs tag libical-0-18 ) +----------------------------------------------- + +Added libicalvcal, which includes the Versit code for parsing vCal +files and a routine (icalvcal_convert() ) that converts a vCal object +to an iCal object. The test program is src/test/testvcal. + +Added marginally functional recurrence code. The curent code does not +handle all of the examples in rfc2445 ( which are extracted in +test-data/recur.txt ) but it can do all of the obvious cases. See the +test program in src/test/recur.c for an example. In particular, the +code cannot handle the integer values in BYDAY, nor negative integers +in BYMONTH or BYMONTHDAY. It also cannot handle BYSETPOS. + +Moved some code to the examples directory and improved the comments. + +Did a little more work on the documentation in the doc directory. The +documentation is in LyX source, but there is a text version in +UsingLibical.txt + + Version 0.17 15 May 00 (cvs tag libical-0-17 ) --------------------------------------------- @@ -5,7 +51,7 @@ Fixed two bugs that added extraneous '/' to test values Fixed type in internal string for the COUNTER method -Eliminated a mempry leak in icalparser.c +Eliminated a memory leak in icalparser.c Version 0.16a 29 April 00 diff --git a/libical/README b/libical/README index e0f7641e1e..ce27e309c0 100644 --- a/libical/README +++ b/libical/README @@ -17,6 +17,11 @@ The code in this distribution implements the iCal protocols as described in RFC2445 and RFC2446. The code is in very early stages of development. +Portions of this distribution are (C) Copyright 1996 Apple Computer, +Inc., AT&T Corp., International Business Machines Corporation and +Siemens Rolm Communications Inc. See src/libicalvcal/README.TXT for +details. + This code is under active development. If you would like to contribute to the project, you can contact me, Eric Busboom, at eric@softwarestudio.org. The project has a webpage at @@ -36,8 +41,8 @@ Building the library This distribution is developed on Red Hat Linux 6.0 and usually compiles on SunOS 5.6 and FreeBSD 2.27. I have reports of success of -previous version on MacOS ( with CodeWarrior ) but I don't know about -any other systems. +previous version on MacOS ( with CodeWarrior ) and on UnixWare, but I +don't know about any other systems. The library is configured with automake. From the root directory, run diff --git a/libical/THANKS b/libical/THANKS index 6a51d866fa..6e867ffe27 100644 --- a/libical/THANKS +++ b/libical/THANKS @@ -1,5 +1,7 @@ Thanks to: +Allan Clark for testing libical against +UnixWare. Graham Davison for MacOS support and miscelaneous code bits @@ -7,4 +9,16 @@ miscelaneous code bits Seth Alves for the first cut at the Makefile.am files and various utility functions. -Russ Steinthal for several utility functions and comments. \ No newline at end of file +Russ Steinthal for several utility functions and +comments. + +Ola Lundqvist for the vCal test data file. + +Colin DuPlantis for new functions in icalparser.c + +Holger Schmidt for all of icalcstp.c, The +CSTP protocol implementation, and modifications to icalcstp.h + +Gisle Hannemyr The decode*() functions in sspm.c +are based on the decode() routine in the mimelite program, Copyright +(c) 1994 Gisle Hannemyr. diff --git a/libical/TODO b/libical/TODO index b27e505b35..98d0c2d2b1 100644 --- a/libical/TODO +++ b/libical/TODO @@ -30,3 +30,7 @@ For some value types, if there illegal characters in the value ( like 4.56 in an integer value), the parser will output the characters to stdout. +Check all uses of strcpy and sprinf for buffer overflows + +Make the mime parsing code in sspm grow the list of parts as needed, +rather than having a hard limit. diff --git a/libical/configure.in b/libical/configure.in index c722c0fee1..238429c187 100644 --- a/libical/configure.in +++ b/libical/configure.in @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/libical/ical.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libical,0.17) +AM_INIT_AUTOMAKE(libical,0.19) dnl Checks for programs. AC_PROG_YACC @@ -37,16 +37,18 @@ AC_STRUCT_TM dnl Checks for library functions. AC_CHECK_FUNCS(strdup) -AC_OUTPUT([ -Makefile -config.h -design-data/Makefile -doc/Makefile -scripts/Makefile -src/Makefile -src/libical/Makefile -src/libical/icalversion.h -src/libicalss/Makefile -src/test/Makefile -test-data/Makefile -] ) +AC_OUTPUT(\ +src/libical/icalversion.h \ +config.h \ +src/libical/Makefile \ +src/libicalss/Makefile \ +src/libicalvcal/Makefile \ +src/test/Makefile \ +examples/Makefile \ +src/Makefile \ +design-data/Makefile \ +doc/Makefile \ +scripts/Makefile \ +test-data/Makefile \ +src/Makefile \ +Makefile ) diff --git a/libical/design-data/components.txt b/libical/design-data/components.txt index 15417eaf2f..ae5cc976ad 100644 --- a/libical/design-data/components.txt +++ b/libical/design-data/components.txt @@ -17,5 +17,6 @@ VQUERY VCAR VCOMMAND XLICINVALID +XMIMEPART ANY diff --git a/libical/design-data/prop-to-value.txt b/libical/design-data/prop-to-value.txt index a06bdc31f1..4f4bf196ff 100644 --- a/libical/design-data/prop-to-value.txt +++ b/libical/design-data/prop-to-value.txt @@ -34,8 +34,7 @@ CREATED DATE-TIME DTSTAMP DATE-TIME LAST-MODIFIED DATE-TIME SEQUENCE INTEGER -X-LIC-ERROR TEXT -X-LIC-CLUSTERCOUNT INTEGER +X TEXT REQUEST-STATUS STRING ATTACH ATTACH # Non-std: URI or BINARY GEO GEO # Non-std: Two FLOATS @@ -48,3 +47,11 @@ RDATE DATE-TIME-PERIOD # Non-std: DATE-TIME or DATE or PERIOD TRIGGER TRIGGER # Non-std: DURATION or DATE-TIME DURATION DURATION QUERY QUERY +X-LIC-ERROR TEXT +X-LIC-CLUSTERCOUNT INTEGER +X-LIC-MIMECONTENTTYPE STRING +X-LIC-MIMECHARSET STRING +X-LIC-MIMEENCODING STRING +X-LIC-MIMEOPTINFO STRING +X-LIC-MIMECID STRING +X-LIC-MIMEFILENAME STRING diff --git a/libical/doc/Makefile.am b/libical/doc/Makefile.am index 0df4f3f42d..70b008a369 100644 --- a/libical/doc/Makefile.am +++ b/libical/doc/Makefile.am @@ -1 +1 @@ -EXTRA_DIST = UsingLibical.lyx UsingLibical.ps +EXTRA_DIST = UsingLibical.lyx UsingLibical.ps UsingLibical.txt diff --git a/libical/doc/UsingLibical.lyx b/libical/doc/UsingLibical.lyx index 1742e3af00..868eac93b7 100644 --- a/libical/doc/UsingLibical.lyx +++ b/libical/doc/UsingLibical.lyx @@ -1,6 +1,5 @@ -#This file was created by Sat Feb 19 10:33:21 2000 -#LyX 1.0 (C) 1995-1999 Matthias Ettrich and the LyX Team -\lyxformat 2.15 +#LyX 1.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 2.16 \textclass linuxdoc \language default \inputencoding default @@ -31,7 +30,15 @@ Using Libical Eric Busboom (eric@softwarestudio.org) \layout Date -January 2000 +May 2000 +\layout Standard + + +\begin_inset LatexCommand \tableofcontents{} + +\end_inset + + \layout Section Introduction @@ -45,52 +52,9 @@ Libical is an Open Source implementation of the iCalendar protocols and \layout Standard -Libical implements the following specifications and protocols -\layout Standard -\added_space_top 0.3cm \added_space_bottom 0.3cm \LyXTable -multicol5 -5 2 0 0 -1 -1 -1 -1 -1 0 0 0 -1 0 0 0 -1 0 0 0 -1 0 0 0 -1 1 0 0 -8 1 0 "" "" -8 1 1 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" - -iCal Core -\newline -2445 -\newline -iTIP -\newline -2446 -\newline -iMIP -\newline -2447 -\newline -iRIP -\newline -draft -\newline -CAP -\newline -draft -\layout Standard - -(The current version, 0.15, does not implement iRip or CAP. - ) +Libical implements RFC2445 and RFC2446. + Eventually, it will also implement iRIP and CAP. + \layout Standard This documentation assumes that you are familiar with the iCalendar standards @@ -140,13 +104,29 @@ This dual license ensures that the library can be incorporated into both dual-licensed. \layout Subsection -Purpose & Goals -\layout Subsection +Example Code +\layout Standard -Document version -\layout Verbatim +A lot of the documentation for this library is in the form of example code. + These examples are in the +\begin_inset Quotes eld +\end_inset + +examples +\begin_inset Quotes erd +\end_inset + + directory of the distribution. + Also look in +\begin_inset Quotes eld +\end_inset + +src/test +\begin_inset Quotes erd +\end_inset -$Id: UsingLibical.lyx,v 1.5 2000/06/06 22:48:07 alves Exp $ + for more annotated examples. + \layout Section Building the Library @@ -214,65 +194,51 @@ n of Components, Properties, Parameters an Values, and to allow the user to manipulate the data in various ways \layout Standard \added_space_bottom 0.3cm -\begin_float fig -\layout Standard - - -\begin_inset Figure size 180 147 -file icaluml.eps -flags 13 - -\end_inset - - -\end_float -When a component is send across a network, if it is un-encrypted, it will +When a component is sent across a network, if it is un-encrypted, it will look something like: -\layout Code +\layout Verbatim BEGIN:VEVENT -\layout Code +\layout Verbatim DTSTAMP:19980309T231000Z -\layout Code +\layout Verbatim UID:guid-1.host1.com -\layout Code +\layout Verbatim ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com -\layout Code +\layout Verbatim ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP: -\layout Code - +\layout Verbatim -\protected_separator - MAILTO:employee-A@host.com -\layout Code + MAILTO:employee-A@host.com +\layout Verbatim DESCRIPTION:Project XYZ Review Meeting -\layout Code +\layout Verbatim CATEGORIES:MEETING -\layout Code +\layout Verbatim CLASS:PUBLIC -\layout Code +\layout Verbatim CREATED:19980309T130000Z -\layout Code +\layout Verbatim SUMMARY:XYZ Project Review -\layout Code +\layout Verbatim DTSTART;TZID=US-Eastern:19980312T083000 -\layout Code +\layout Verbatim DTEND;TZID=US-Eastern:19980312T093000 -\layout Code +\layout Verbatim LOCATION:1CP Conference Room 4350 -\layout Code +\layout Verbatim END:VEVENT \layout Subsection @@ -556,7 +522,7 @@ new Strings, of course, are passed in by reference, but libical will take ownership of the memory, so you had beter strdup() the data unless you want a core dump when the memory is freed for the second time. - Libical has some complex bu very regular memory handling rules. + Libical has some complex but very regular memory handling rules. These are detailed in section \begin_inset LatexCommand \ref{sec:memory} @@ -578,1189 +544,366 @@ vaargs Constructors \layout Standard There is another way to create complex components, which is arguable more - elegant, if you are not horrified by vaargs. - The vaargs constructor interface all you to create intricate components + elegant, if you are not horrified by varargs. + The varargs constructor interface all you to create intricate components in a single block of text. -\layout Code +\layout Verbatim + calendar = +\layout Verbatim -\protected_separator + icalcomponent_vanew( +\layout Verbatim -\protected_separator + ICAL_VCALENDAR_COMPONENT, +\layout Verbatim -\protected_separator - calendar = -\layout Code + icalproperty_new_version(strdup("2.0")), +\layout Verbatim + icalproperty_new_prodid(strdup( +\layout Verbatim -\protected_separator + "-//RDU Software//NONSGML HandCal//EN")), +\layout Verbatim -\protected_separator + icalcomponent_vanew( +\layout Verbatim -\protected_separator + ICAL_VEVENT_COMPONENT, +\layout Verbatim -\protected_separator + icalproperty_new_dtstamp(atime), +\layout Verbatim -\protected_separator + icalproperty_new_uid(strdup("guid-1.host1.com")), +\layout Verbatim -\protected_separator + icalproperty_vanew_organizer( +\layout Verbatim -\protected_separator + strdup("mrbig@host.com"), +\layout Verbatim -\protected_separator -icalcomponent_vanew( -\layout Code + icalparameter_new_role(ICAL_ROLE_CHAIR), +\layout Verbatim + 0 +\layout Verbatim -\protected_separator + ), +\layout Verbatim -\protected_separator + icalproperty_vanew_attendee( +\layout Verbatim -\protected_separator + strdup("employee-A@host.com"), +\layout Verbatim -\protected_separator + icalparameter_new_role( +\layout Verbatim -\protected_separator + ICAL_ROLE_REQPARTICIPANT), +\layout Verbatim -\protected_separator + icalparameter_new_rsvp(1), +\layout Verbatim -\protected_separator + icalparameter_new_cutype(ICAL_CUTYPE_GROUP), +\layout Verbatim -\protected_separator + 0 +\layout Verbatim -\protected_separator + ), +\layout Verbatim -\protected_separator + icalproperty_new_location(strdup( +\layout Verbatim -\protected_separator - ICAL_VCALENDAR_COMPONENT, -\layout Code + "1CP Conference Room 4350")), +\layout Verbatim + 0 +\layout Verbatim -\protected_separator + ), +\layout Verbatim -\protected_separator + 0 +\layout Verbatim -\protected_separator + ); +\layout Standard -\protected_separator +This form is similar to the regular constructor, except that they have +\begin_inset Quotes eld +\end_inset -\protected_separator +vanew +\begin_inset Quotes erd +\end_inset -\protected_separator + instead of +\begin_inset Quotes eld +\end_inset -\protected_separator +new +\begin_inset Quotes erd +\end_inset -\protected_separator + in the name. + The arguments are similar too, except that the component contstructor can + have a list of properties, and the property constructor can have a list + or parameters. + Be sure to terminate every list with a '0', or your code will crash, if + you are lucky. + +\layout Subsubsection -\protected_separator +Parsing Text Files +\layout Standard -\protected_separator +The final way to create components will probably be the most common; you + can create components from RFC2445 compliant text. + If you have the string in memory, use +\layout Verbatim -\protected_separator - icalproperty_new_version(strdup("2.0")), -\layout Code +icalcomponent* icalparser_parse_string(char* str); +\layout Standard +This may seem wasteful if you want to pull a large component off of the + network; you may prefer to parse the component line by line. + This is possible too by using: +\layout Verbatim -\protected_separator +icalparser* icalparser_new(); +\layout Verbatim -\protected_separator +void icalparser_free(icalparser* parser); +\layout Verbatim -\protected_separator +icalparser_get_line(parser,read_stream); +\layout Verbatim -\protected_separator +icalparser_add_line(parser,line); +\layout Verbatim -\protected_separator +icalparser_set_gen_data(parser,stream) +\layout Standard -\protected_separator +These routines will construct a parser object to which you can add lines + of input and retrieve any components that the parser creates from the input. + For an example: +\layout Verbatim -\protected_separator +char* read_stream(char *s, size_t size, void *d) +\layout Verbatim -\protected_separator +{ +\layout Verbatim -\protected_separator + char *c = fgets(s,size, (FILE*)d); +\layout Verbatim -\protected_separator + return c; +\layout Verbatim -\protected_separator - icalproperty_new_prodid(strdup("-//RDU Software//NONSGML HandCal//EN")), -\layout Code +} +\layout Verbatim +main() { +\layout Verbatim -\protected_separator + char* line; +\layout Verbatim -\protected_separator + icalcomponent *c; +\layout Verbatim -\protected_separator + icalparser *parser = icalparser_new(); +\layout Verbatim -\protected_separator + FILE* stream = fopen(argv[1],"r"); +\layout Verbatim -\protected_separator + icalparser_set_gen_data(parser,stream); +\layout Verbatim -\protected_separator + do{ +\layout Verbatim -\protected_separator + line = icalparser_get_line(parser,read_stream); +\layout Verbatim -\protected_separator + c = icalparser_add_line(parser,line); +\layout Verbatim -\protected_separator + if (c != 0){ +\layout Verbatim -\protected_separator + printf("%s",icalcomponent_as_ical_string(c)); +\layout Verbatim -\protected_separator - icalcomponent_vanew( -\layout Code + icalparser_claim(parser); +\layout Verbatim + printf(" +\backslash +n--------------- +\backslash +n"); +\layout Verbatim -\protected_separator + icalcomponent_free(c); +\layout Verbatim -\protected_separator + } +\layout Verbatim -\protected_separator + } while ( line != 0); +\layout Verbatim -\protected_separator +} +\layout Standard -\protected_separator +The parser object parameterizes the routine used to get input lines with + icalparser_set_gen_data() and +\emph on + +\emph default +icalparser_get_line(). + In this example, the routine read_stream() will fetch the next line from + a stream, with the stream passed in as the void* parameter d. + The parser calls read_stream() from icalparser_get_line(), but it also + needs to know what stream to use. + This is set by the call to icalparser_set_gen_data(). + +\layout Standard -\protected_separator +Using the same mechanism, other implmentations could read from memory buffers, + sockets or other interfaces. + +\layout Standard -\protected_separator +Since the example code is a very common way to use the parser, there is + a convienience routine; +\layout Verbatim -\protected_separator +icalcomponent* icalparser_parse(icalparser *parser, +\layout Verbatim -\protected_separator + char* (*line_gen_func)(char *s, size_t sise, void* d)) +\layout Standard -\protected_separator +To use this routine, you still must construct the parser object and pass + in a reference to a line reading routine. + If the parser can create a single component from the input, it will return + a pointer to the newly constructed component. + If the parser can construct multiple cmponents from the input, it will + return a reference to an XROOT component ( of type ICAL_XROOT_COMPONENT.) + This XROOT component will hold all of the components constructed from the + input as children. + See section 6.2.2 for how to iterate through the child components. + +\layout Subsection -\protected_separator +Accessing Components +\layout Standard -\protected_separator +Given a reference to a component, you probably will want to access the propertie +s, parameters and values inside. + Libical interface let you find sub-component, add and remove sub-components, + and do the same three operations on properties. + +\layout Subsubsection -\protected_separator +Finding Components +\layout Standard -\protected_separator +To find a sub-component of a component, use: +\layout Verbatim -\protected_separator +icalcomponent* icalcomponent_get_first_component( +\layout Verbatim -\protected_separator -ICAL_VEVENT_COMPONENT, -\layout Code + icalcomponent* component, +\layout Verbatim + icalcomponent_kind kind); +\layout Standard -\protected_separator +This routine will return a reference to the first component of the type + 'kind.' The key kind values, listed in icalenums.h are: +\layout Verbatim -\protected_separator +ICAL_ANY_COMPONENT +\layout Verbatim -\protected_separator +ICAL_VEVENT_COMPONENT +\layout Verbatim -\protected_separator +ICAL_VTODO_COMPONENT +\layout Verbatim -\protected_separator +ICAL_VJOURNAL_COMPONENT +\layout Verbatim -\protected_separator +ICAL_VCALENDAR_COMPONENT +\layout Verbatim -\protected_separator +ICAL_VFREEBUSY_COMPONENT +\layout Verbatim -\protected_separator +ICAL_VALARM_COMPONENT +\layout Standard -\protected_separator +These are only the most common components; there are many more listed in + icalenums.h. +\layout Standard -\protected_separator +As you might guess, if there is more than one subcomponent of the type you + have chosen, this routine will return only the first. + to get at the others, you need to iterate through the component. + +\layout Subsubsection -\protected_separator +Interating Through Components +\layout Standard -\protected_separator +Iteration requires a second routine to get the next subcomponent after the + first: +\layout Verbatim -\protected_separator +icalcomponent* icalcomponent_get_next_component( +\layout Verbatim -\protected_separator + icalcomponent* component, +\layout Verbatim -\protected_separator + icalcomponent_kind kind); +\layout Standard -\protected_separator -icalproperty_new_dtstamp(atime), -\layout Code +With the 'first' and 'next' routines, you can create a for loop to iterate + through all of a components subcomponents +\layout Verbatim + for(c = icalcomponent_get_first_component(comp,ICAL_ANY_COMPONENT); +\layout Verbatim -\protected_separator + c != 0; +\layout Verbatim -\protected_separator + c = icalcomponent_get_next_component(comp,ICAL_ANY_COMPONENT)) +\layout Verbatim -\protected_separator +{ +\layout Verbatim -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty_new_uid(strdup("guid-1.host1.com")), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty_vanew_organizer( -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - strdup("mrbig@host.com"), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - icalparameter_new_role(ICAL_ROLE_CHAIR), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - 0 -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty_vanew_attendee( -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - strdup("employee-A@host.com"), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - icalparameter_new_rsvp(1), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - icalparameter_new_cutype(ICAL_CUTYPE_GROUP), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - 0 -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - ), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty_new_location(strdup("1CP Conference Room 4350")), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -0 -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -), -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - 0 -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - ); -\layout Standard - -This form is similar to the regular constructor, except that they have -\begin_inset Quotes eld -\end_inset - -vanew -\begin_inset Quotes erd -\end_inset - - instead of -\begin_inset Quotes eld -\end_inset - -new -\begin_inset Quotes erd -\end_inset - - in the name. - The arguments are similar too, except that the component contstructor can - have a list of properties, and the property constructor can have a list - or parameters. - Be sure to terminate every list with a '0', or your code will crash, if - you are lucky. - -\layout Subsubsection - -Parsing Text Files -\layout Standard - -The final way to create components will probably be the most common; you - can create components from RFC2445 compliant text. - If you have the string in memory, use -\layout Verbatim - -icalcomponent* icalparser_parse_string(char* str); -\layout Standard - -This may seem wasteful if you want to pull a large component off of the - network; you may prefer to parse the component line by line. - This is possible too, with -\layout Verbatim - -icalcomponent* icalparser_parse(char*(*line_gen_func)(char *s, size_t size, - void *d)); -\layout Standard - -This routine takes a pointer to a function that copies 'size' characters - to 's'. - The routine returns 's', similar to fgets(). - See string_line_generator in icalparser.c for an example. - -\layout Subsection - -Accessing Components -\layout Standard - -Given a reference to a component, you probably will want to access the propertie -s, parameters and values inside. - -\layout Subsubsection - -Finding Components -\layout Standard - -To find a sub-component of a component, use: -\layout Verbatim - -icalproperty* icalcomponent_get_first_component( -\layout Verbatim - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -icalcomponent* component, -\layout Verbatim - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -icalcomponent_kind kind); -\layout Standard - -This routine will return a reference to the first component of the type - 'kind.' The key kind values, listed in icalenums.h are: -\layout Code - -ICAL_ANY_COMPONENT -\layout Code - -ICAL_VEVENT_COMPONENT -\layout Code - -ICAL_VTODO_COMPONENT -\layout Code - -ICAL_VJOURNAL_COMPONENT -\layout Code - -ICAL_VCALENDAR_COMPONENT -\layout Code - -ICAL_VFREEBUSY_COMPONENT -\layout Code - -ICAL_VALARM_COMPONENT -\layout Standard - -These are only the most common components; there are many more listed in - icalenums.h. -\layout Standard - -As you might guess, if there is more than one subcomponent of the type you - have chosen, this routine will return only the first. - to get at the others, you need to iterate through the component. - -\layout Subsubsection - -Interating Through Components -\layout Standard - -Iteration requires a second routine to get the next subcomponent after the - first: -\layout Verbatim - -icalcomponent* icalcomponent_get_next_component(icalcomponent* component, - + do_something(c); \layout Verbatim -icalcomponent_kind kind); -\layout Standard - -With the 'first' and 'next' routines, you can create a for loop to iterate - through all of a components subcomponents -\layout Code - - -\protected_separator - for(c = icalcomponent_get_first_component(comp,ICAL_ANY_COMPONENT); -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -c != 0; -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -c = icalcomponent_get_next_component(comp,ICAL_ANY_COMPONENT)) -\layout Code - -{ -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - do_something(c); -\layout Code - } \layout Standard @@ -1777,62 +920,63 @@ Libical component have internal iterators, so you can only have one iteration Removing an element from a list while iterating through the list can cause problems, since you will probably be removing the element that the internal iterator points to. - This will result in the iteration loop terminating immediately after removing - the element. - To avoid the problem, you will need to step the iterator ahead of the element - you are going to remove, like this: -\layout Code + The _remove() routine will keep the iterator valid by moving it to the + next component, but in a normal loop, this will result in two advances + per iteration, and you will remove only every other component. + To avoid the problem, you will need to step the iterator ahead of the + element you are going to remove, like this: +\layout Verbatim for(c = icalcomponent_get_first_component(parent_comp,ICAL_ANY_COMPONENT); -\layout Code - - -\protected_separator +\layout Verbatim -\protected_separator + c != 0; +\layout Verbatim -\protected_separator + c = next +\layout Verbatim -\protected_separator +{ +\layout Verbatim -\protected_separator + next = icalcomponent_get_next_component(parent_comp,ICAL_ANY_COMPONENT); +\layout Verbatim -\protected_separator + icalcomponent_remove_component(parent_comp,c); +\layout Verbatim -\protected_separator -c != 0; -\layout Code +} +\layout Standard +Another way to remove components is to rely on the side effect of icalcomponent_ +remove_component: if component iterator in the parent component is pointing + to the child that will be removed, it will move the iterator to the component + after the child. + The following code will exploit this behavior: +\layout Verbatim -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -c = next -\layout Code +icalcomponent_get_first_component(parent_comp,ICAL_VEVENT_COMPONENT); +\layout Verbatim -{ -\protected_separator - -\protected_separator - -\layout Code +while((c=icalcomponent_get_current_component(c)) != 0 ){ +\layout Verbatim + if(icalcomponent_isa(c) == ICAL_VEVENT_COMPONENT){ +\layout Verbatim -\protected_separator -next = icalcomponent_get_next_component(parent_comp,ICAL_ANY_COMPONENT); -\layout Code + icalcomponent_remove_component(parent_comp,inner); +\layout Verbatim + } else { +\layout Verbatim -\protected_separator + icalcomponent_get_next_component(parent_comp,ICAL_VEVENT_COMPONENT); -\protected_separator - icalcomponent_remove_component(parent_comp,c); -\layout Code +\layout Verbatim + + } +\layout Verbatim } \layout Subsubsection @@ -1848,169 +992,73 @@ Finding, iterating and removing properties works the same as it does for icalproperty* icalcomponent_get_first_property( \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalcomponent* component, + icalcomponent* component, \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty_kind kind); + icalproperty_kind kind); \layout Verbatim icalproperty* icalcomponent_get_next_property( \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalcomponent* component, + icalcomponent* component, \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty_kind kind); + icalproperty_kind kind); \layout Verbatim void icalcomponent_add_property( \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalcomponent* component, + icalcomponent* component, \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty* property); + icalproperty* property); \layout Verbatim void icalcomponent_remove_property( \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalcomponent* component, + icalcomponent* component, \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty* property); + icalproperty* property); \layout Verbatim icalparameter* icalproperty_get_first_parameter( \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty* prop, + icalproperty* prop, \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalparameter_kind kind); + icalparameter_kind kind); \layout Verbatim icalparameter* icalproperty_get_next_parameter( \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty* prop, + icalproperty* prop, \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalparameter_kind kind); + icalparameter_kind kind); \layout Verbatim void icalproperty_add_parameter( \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty* prop, + icalproperty* prop, \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalparameter* parameter); + icalparameter* parameter); \layout Verbatim void icalproperty_remove_parameter( \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalproperty* prop, + icalproperty* prop, \layout Verbatim - -\protected_separator - -\protected_separator - -\protected_separator -icalparameter_kind kind); + icalparameter_kind kind); \layout Subsubsection Getting Values @@ -2029,6 +1077,97 @@ Removing Parameters \layout Subsubsection Checking Component Validity +\layout Standard + +RFC 2446 defines rules for what properties must exist in a component to + be used for transfering scheduling data. + Most of these rules relate to the existence of properties relative to the + METHOD property, which declares what operation a remote reciever should + use to process a component. + For instance, if the METHOD is REQUEST and the component is a VEVENT, the + sender is probably asking the reciever to join in a meeting. + I this case, RFC2446 says that the component must specify a start time + (DTSTART) and list the reciever as an attendee (ATTENDEE). + +\layout Standard + +Libical can check these restrictions with the routine: +\layout Verbatim + +int icalrestriction_check(icalcomponent* comp); +\layout Standard + +This routine returns 0 if the component does not pass RFC2446 restrictions, + or if the component is malformed. + The component you pass in +\emph on +must +\emph default + be a VCALENDAR, with one or more children, like the examples in RFC2446. + +\layout Standard + +When this routine runs, it will insert new properties into the component + to indicate any errors it finds. + See section 6.5.3, X-LIC-ERROR for more information about these error properties. + +\layout Subsubsection + +Converting Components to Text +\layout Standard + +To create an RFC2445 compliant text representtion of an object, use one + of the *_as_ical_string() routines: +\layout Verbatim + +char* icalcomponent_as_ical_string (icalcomponent* component) +\layout Verbatim + +char* icalproperty_as_ical_string (icalproperty* property) +\layout Verbatim + +char* icalparameter_as_ical_string (icalparameter* parameter) +\layout Verbatim + +char* icalvalue_as_ical_string (icalvalue* value) +\layout Standard + +In most cases, you will only use icalcomponent_as_ical_string (), since + it will cascade and convert all of the parameters, properties and values + that are attached to the root component. +\layout Standard + +Icalproperty_as_ical_string() will terminate each line with the RFC2445 + specified line terminator +\begin_inset Quotes eld +\end_inset + + +\backslash +r +\backslash +n +\begin_inset Quotes erd +\end_inset + + However, if you compile with the symbol ICAL_UNIX_NEWLINE defined, it will + terminate lines with +\begin_inset Quotes eld +\end_inset + + +\backslash +n +\begin_inset Quotes erd +\end_inset + + +\layout Standard + +Remember that the string returned by these routines is owned by the library, + and will eventually be re-written. + You should copy it if you want to preserve it. + \layout Subsection Storing Objects @@ -2037,7 +1176,8 @@ Storing Objects The libical distribution inclues a seperate library, libicalss, that allows you to store iCal component data to disk in a variety of ways. This library is documented seperately. - + ( & currently, not at all. + ) \layout Subsection @@ -2089,26 +1229,172 @@ Libical relies heavily on dynamic allocation for both the core objects and Error Handling \layout Standard -icalerror_errno. - Return values. - #defines. - icalerror_stop_here. - X-LIC-ERROR +Libical has several error handling mechanisms for the varioustypes of programmin +g, semantic and syntactic errors you may encounter. \layout Subsubsection Return values +\layout Standard + +Many library routines signal errors through their return values. + All routines that return a pointer, such as icalcomponent_new(), will return + 0 ( zero ) on a fatal error. + Some routines will return a value of enum icalerrorenum. + \layout Subsubsection icalerrno -\layout Subsubsection +\layout Standard -Component errors +Most routines will set the global error value icalerrno on errors. + This variable is an enumeration; permissable values can be found in libical/ica +lerror.h. + If the routine returns an enum icalerrorenum, then the return value will + be the same as icalerrno. + You can use icalerror_strerror() to get a string that describes the error \layout Subsubsection -icalerror_stop_here -\layout Subsubsection +X-LIC-ERROR and X-LIC-INVALID-COMPONENT +\layout Standard + +The library handles semantic and syntactic errors in components by inserting + errors properties into the components. + If the parser cannot parse incoming text ( a syntactic error ) or if the + icalrestriction_check() routine indicates that the component does not meet + the requirments of RFC2446 ( a semantic error) the library will insert + properties of the type X-LIC-ERROR to describe the error. + Here is an example of the error property: +\layout Verbatim + +X-LIC-ERROR;X-LIC-ERRORTYPE=INVALID_ITIP :Failed iTIP restrictions for property + DTSTART. + Expected 1 instances of the property and got 0 +\layout Standard + +This error resulted from a call to icalrestriction_check(), which discovered + that the component does not have a DTSTART property, as required by RFC2445. + +\layout Standard -X-LIC-ERROR +There are a few routines to manipulate error properties: +\layout Standard +\LyXTable +multicol5 +10 2 0 0 -1 -1 -1 -1 +1 1 0 0 +1 0 0 0 +0 1 1 0 +1 0 0 0 +0 1 1 0 +1 1 0 0 +0 1 1 0 +1 1 0 0 +0 1 1 0 +0 1 1 0 +2 1 0 "" "" +2 1 1 "3in" "" +0 2 1 1 0 0 0 "" "" +0 8 1 0 0 0 0 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 0 1 0 1 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 0 0 0 1 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 0 1 0 0 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 0 1 0 0 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 1 1 0 1 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 1 1 0 1 "" "" +0 2 1 0 0 0 0 "" "" +0 2 1 1 0 0 1 "" "" + +Routine +\newline +Purpose +\newline +void icalrestriction_check() +\newline +Check a component against RFC2446 and insert +\newline + +\newline +error properties to indicate non compliance +\newline +int icalcomponent_count_errors() +\newline +Return the number of error properties +\newline + +\newline +in a component +\newline +void icalcomponent_strip_errors() +\newline +Remove all error properties in as +\newline + +\newline +component +\newline +void icalcomponent_convert_errors() +\newline +Convert some error properties into +\newline + +\newline +REQUESTS-STATUS to indicate the inability to +\newline + +\newline +process the component as an iTIP request. + +\layout Standard + +The types of errors are listed in icalerror.h. + They are: +\layout Verbatim + +ICAL_XLICERRORTYPE_COMPONENTPARSEERROR +\layout Verbatim + +ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR +\layout Verbatim + +ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR +\layout Verbatim + +ICAL_XLICERRORTYPE_PROPERTYPARSEERROR +\layout Verbatim + +ICAL_XLICERRORTYPE_VALUEPARSEERROR +\layout Verbatim + +ICAL_XLICERRORTYPE_UNKVCALPROP +\layout Verbatim + +ICAL_XLICERRORTYPE_INVALIDITIP +\layout Standard + +The libical parser will generate the error that end in PARSEERROR when it + encounters garbage in the input steam. + ICAL_XLICERRORTYPE_INVALIDITIP is inserted by icalrestriction_check(), + and ICAL_XLICERRORTYPE_UNKVCALPROP is generated by icalvcal_convert() when + it encounters a vCal property that it cannot convert or does not know about. + +\layout Standard + +Icalcomponent_convert_errors() converts some of the error properties ina + component into REQUEST-STATUS properties that indicate a failure. + As of libical version0.18, this routine only convert *PARSEERROR errors + and it always generates a 3.x ( failure ) code. + This makes it more of a good idea than a really useful bit of code. + \layout Subsection Naming Standard @@ -2249,8 +1535,21 @@ Finding compliance errors Performance \layout Standard -Checking restrictions is computationally expensive +Checking restrictions is computationally expensive. \layout Section Hacks and Bugs +\layout Standard + +There are a lot of hacks in the library -- bits of code that I am not proud + of and should propbably be changed. + These are marked with the comment string +\begin_inset Quotes eld +\end_inset + +HACK. +\begin_inset Quotes erd +\end_inset + + \the_end diff --git a/libical/doc/UsingLibical.ps b/libical/doc/UsingLibical.ps index 0417ded6a5..83c8f6203f 100644 --- a/libical/doc/UsingLibical.ps +++ b/libical/doc/UsingLibical.ps @@ -1,7 +1,7 @@ %!PS-Adobe-2.0 %%Creator: dvips(k) 5.85 Copyright 1999 Radical Eye Software %%Title: UsingLibical.dvi -%%Pages: 6 +%%Pages: 10 %%PageOrder: Ascend %%BoundingBox: 0 0 612 792 %%EndComments @@ -10,7 +10,7 @@ %+ /usr/local/home/eric/proj/FreeAssociation/libical/doc/UsingLibical.ps %+ UsingLibical.dvi %DVIPSParameters: dpi=600, compressed -%DVIPSSource: TeX output 2000.02.18:1517 +%DVIPSSource: TeX output 2000.06.10:1815 %%BeginProcSet: texc.pro %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S @@ -71,89 +71,115 @@ rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet TeXDict begin 40258431 52099146 1000 600 600 (UsingLibical.dvi) @start -%DVIPSBitmapFont: Fa ecbx1000 10 47 -/Fa 47 122 df<913A03FF8007FE027F9039F07FFF800103B500FDB512E0010F903A00FF +%DVIPSBitmapFont: Fa ecrm0600 6 1 +/Fa 1 50 df<13E01201120712FF12F91201B3A7487EB512C0A212217AA01E>49 +D E +%EndDVIPSBitmapFont +%DVIPSBitmapFont: Fb ecbx1000 10 55 +/Fb 55 122 df<913A03FF8007FE027F9039F07FFF800103B500FDB512E0010F903A00FF FE0FF0D93FF8ECF81F90267FE0019038F03FF849485A4816E014804816C00200ED1FF081 F007C06F91C7FCA8B912E0A4000390C701C0C7FCB3ABB5D8FC3FEBFF80A43D3A7EB938> 27 D<12E07E127C7E7E7F6C7E6C7E12037F6C7E7F12007F137E137FA2EB3F80A214C013 1F14E0A2130F14F0A4EB07F8A514FCB114F8A5EB0FF0A414E0131FA214C0133F1480A2EB 7F00A2137E13FE5B12015B485A5B1207485A485A90C7FC123E5A12F05A16537BBD25>41 -D46 -D<49B4FC011F13F0017F13FC9038FF83FE4848C67E4848EB7F804848EB3FC04848EB1FE0 -A2001F15F0A24848EB0FF8A3007F15FCA400FF15FEB3007F15FCA5003F15F86D131FA200 -1F15F0A26C6CEB3FE0000715C06C6CEB7F806C6CEBFF003900FF83FE6DB45A011F13F001 -0190C7FC27377CB530>48 D<141E143E14FE1307137FB5FCA3138FEA000FB3B3A5007FB6 -1280A4213679B530>IIII<001C15C0D81F80 -130701F8137F90B61280A216005D5D15F05D15804AC7FC14F090C9FCA7EB03FE90381FFF -E0017F13F89038FE07FC9038F003FFD9C0011380496C13C090C7FC000E15E0C8127F16F0 -A216F8A3121FEA3FC0487E12FF7FA316F05B15FFD87F8014E0007EC713C0003E5B003F49 -13806C6C481300390FF01FFE6CB512F8000114E06C6C1380D90FF8C7FC25377BB530>I< -EC0FF8ECFFFE0103EBFF8090390FF80FC090393FE003E090397F8001F09038FF000F48EC -1FF84848133F485A120F5B121FA2003FEC1FF0ED0FE0484890C7FCA31408EC7FF039FFF1 -FFFC01F313FFD9F78013809039FF007FC049EB3FE04914F0ED1FF85B16FCA34914FEA412 -7FA5123F16FCA26C7E16F8000F143F6D14F0000715E06C6CEB7FC03A01FF81FF806C90B5 -1200013F13FC010F13F00101138027377CB530>I<123C123EEA3FE090B71280A4170048 -5D5E5E5E5EA2007CC7EA0FC000784A5A4BC7FC00F8147E485C5D14014A5AC7485A4A5AA2 -4A5A143F4AC8FCA214FEA213015C1303A21307A2130F5CA2131FA5133FA96D5A6D5A6D5A -29397BB730>I<49B47E010F13F0013F13FC9038FE01FF3A01F8007F804848EB3FC04848 -EB1FE0150F484814F01507121FA27F7F7F6D130F01FF14E014C09138E01FC06CEBF83F91 -38FE7F806C9038FFFE005D6C14F06C14FC6C14FF6D14806D14C090B612E0D803FD14F026 -07F07F13F848487E261FC00F13FC383F8003007F010013FE90C7127F151F00FE14071503 -1501A21500A216FC7E6C14016D14F86C6C13036DEB07F06C6CEB0FE0D80FFEEB7FC00003 -B61200C614FC013F13F00103138027377CB530>II67 DI70 -D45 DI<49B4FC011F13F0017F13FC9038FF83FE4848C67E4848EB7F804848EB +3FC04848EB1FE0A2001F15F0A24848EB0FF8A3007F15FCA400FF15FEB3007F15FCA5003F +15F86D131FA2001F15F0A26C6CEB3FE0000715C06C6CEB7F806C6CEBFF003900FF83FE6D +B45A011F13F0010190C7FC27377CB530>48 D<141E143E14FE1307137FB5FCA3138FEA00 +0FB3B3A5007FB61280A4213679B530>IIII< +001C15C0D81F80130701F8137F90B61280A216005D5D15F05D15804AC7FC14F090C9FCA7 +EB03FE90381FFFE0017F13F89038FE07FC9038F003FFD9C0011380496C13C090C7FC000E +15E0C8127F16F0A216F8A3121FEA3FC0487E12FF7FA316F05B15FFD87F8014E0007EC713 +C0003E5B003F4913806C6C481300390FF01FFE6CB512F8000114E06C6C1380D90FF8C7FC +25377BB530>II<123C123EEA3FE090 +B71280A41700485D5E5E5E5EA2007CC7EA0FC000784A5A4BC7FC00F8147E485C5D14014A +5AC7485A4A5AA24A5A143F4AC8FCA214FEA213015C1303A21307A2130F5CA2131FA5133F +A96D5A6D5A6D5A29397BB730>I<49B47E010F13F0013F13FC9038FE01FF3A01F8007F80 +4848EB3FC04848EB1FE0150F484814F01507121FA27F7F7F6D130F01FF14E014C09138E0 +1FC06CEBF83F9138FE7F806C9038FFFE005D6C14F06C14FC6C14FF6D14806D14C090B612 +E0D803FD14F02607F07F13F848487E261FC00F13FC383F8003007F010013FE90C7127F15 +1F00FE140715031501A21500A216FC7E6C14016D14F86C6C13036DEB07F06C6CEB0FE0D8 +0FFEEB7FC00003B61200C614FC013F13F00103138027377CB530>I +II73 D76 D80 -D82 DI<003FB91280A4D9F800EBF003D87FC09238007FC049 -161F007EC7150FA2007C1707A200781703A400F818E0481701A4C892C7FCB3AE010FB7FC -A43B387DB742>III97 +123F5B1807127FA24993C7FC12FFAD127F7FF003C0123FA27F001F1707A26C6C1780180F +6C6D16006C6D5D6C173E6C6D157ED97FF85D6D6C4A5A6DB44A5A010701C0EB0FE06D01FC +EBFF80010090B548C7FC021F14F8020314E09126003FFEC8FC3A3B7BB945>67 +DIIII73 D76 DI79 DI82 DI<003FB91280A4D9F800EBF003D87FC09238007FC049161F007EC7150FA2007C17 +07A200781703A400F818E0481701A4C892C7FCB3AE010FB7FCA43B387DB742>IIII<007FB5D8F803B512F8A4C66C48C7D80FF0C7FC6D6C5D6D5E6F495A6D6D49C8FC +7F6D6D137E6F5B6DEBF8016D5D6F485A6E6C485A023F130FDA1FFF5BEE9F806E01FFC9FC +805E6E5B6E5B80826F7E153F826F7F5D4B7F92B57EA2DA01F97FDA03F17F03F07F913807 +E07FDA0FC07F021F6D7E4B7E4A486C7F027E8102FE6D7F4A7F49488149486D7F0107804A +6E7E49488149486E7E013F81017F83B60107B61280A441397DB848>I97 D<13FFB5FCA412077EAF4AB47E020F13F0023F13FC9138FE03FFDAF00013804AEB7FC002 80EB3FE091C713F0EE1FF8A217FC160FA217FEAA17FCA3EE1FF8A217F06E133F6EEB7FE0 6E14C0903AFDF001FF80903AF8FC07FE009039F03FFFF8D9E00F13E0D9C00390C7FC2F3A @@ -175,212 +201,186 @@ EBFFC090387FFFE348B6EAEFE02607FE07138F260FF801131F48486C138F003F15CF4990 07FCD807FEEB3FF00001B612C06C6C91C7FC010713F02B377DA530>I<13FFB5FCA41207 7EAFED7FC0913803FFF8020F13FE91381F03FFDA3C01138014784A7E4A14C05CA25CA291 C7FCB3A3B5D8FC3F13FFA4303A7DB935>II<13FFB5FCA412077EAF92 -380FFFE0A4923803FC0016F0ED0FE0ED1F804BC7FC157E5DEC03F8EC07E04A5A141FEC7F -E04A7E8181A2ECCFFEEC0FFF496C7F806E7F6E7F82157F6F7E6F7E82150F82B5D8F83F13 -F8A42D3A7EB932>107 D<13FFB5FCA412077EB3B3ACB512FCA4163A7DB91B>I<01FED97F -E0EB0FFC00FF902601FFFC90383FFF80020701FF90B512E0DA1F81903983F03FF0DA3C00 -903887801F000749DACF007F00034914DE6D48D97FFC6D7E4A5CA24A5CA291C75BB3A3B5 -D8FC1FB50083B512F0A44C257DA451>I<01FEEB7FC000FF903803FFF8020F13FE91381F -03FFDA3C011380000713780003497E6D4814C05CA25CA291C7FCB3A3B5D8FC3F13FFA430 -257DA435>I<903801FFC0010F13F8017F13FFD9FF807F3A03FE003FE048486D7E48486D -7E48486D7EA2003F81491303007F81A300FF1680A9007F1600A3003F5D6D1307001F5DA2 -6C6C495A6C6C495A6C6C495A6C6C6CB45A6C6CB5C7FC011F13FC010113C029257DA430> -I<9039FF01FF80B5000F13F0023F13FC9138FE07FFDAF00113800003496C13C00280EB7F -E091C713F0EE3FF8A2EE1FFCA3EE0FFEAA17FC161FA217F8163F17F06E137F6E14E06EEB -FFC0DAF00313809139FC07FE0091383FFFF8020F13E0020390C7FC91C9FCACB512FCA42F -357EA435>I<9038FE03F000FFEB0FFEEC3FFF91387C7F809138F8FFC000075B6C6C5A5C -A29138807F80ED3F00150C92C7FC91C8FCB3A2B512FEA422257EA427>114 -D<90383FF0383903FFFEF8000F13FF381FC00F383F0003007E1301007C130012FC15787E -7E6D130013FCEBFFE06C13FCECFF806C14C06C14F06C14F81203C614FC131F9038007FFE -140700F0130114007E157E7E157C6C14FC6C14F8EB80019038F007F090B512C000F81400 -38E01FF81F257DA426>I<130FA55BA45BA25B5BA25A1207001FEBFFE0B6FCA3000390C7 -FCB21578A815F86CEB80F014816CEBC3E090383FFFC06D1380903803FE001D357EB425> -I<01FFEC3FC0B5EB3FFFA4000714016C80B3A35DA25DA26C5C6E4813E06CD9C03E13FF90 -387FFFFC011F13F00103138030257DA435>II120 DI E +01F0C8FCA913FF127FA412077EB3A9B512F8A4153B7DBA1B>I<141FEC7FC0ECFFE0A249 +13F0A56D13E0A2EC7FC0EC1F0091C7FCA9EC0FF0EB0FFFA4EB007F143FB3B0121FEA3F80 +EA7FC0EAFFE0EC7FE0A215C014FF6C481380903883FE006CB45A000F13F0000113801C4B +86BA1D>I<13FFB5FCA412077EAF92380FFFE0A4923803FC0016F0ED0FE0ED1F804BC7FC +157E5DEC03F8EC07E04A5A141FEC7FE04A7E8181A2ECCFFEEC0FFF496C7F806E7F6E7F82 +157F6F7E6F7E82150F82B5D8F83F13F8A42D3A7EB932>I<13FFB5FCA412077EB3B3ACB5 +12FCA4163A7DB91B>I<01FED97FE0EB0FFC00FF902601FFFC90383FFF80020701FF90B5 +12E0DA1F81903983F03FF0DA3C00903887801F000749DACF007F00034914DE6D48D97FFC +6D7E4A5CA24A5CA291C75BB3A3B5D8FC1FB50083B512F0A44C257DA451>I<01FEEB7FC0 +00FF903803FFF8020F13FE91381F03FFDA3C011380000713780003497E6D4814C05CA25C +A291C7FCB3A3B5D8FC3F13FFA430257DA435>I<903801FFC0010F13F8017F13FFD9FF80 +7F3A03FE003FE048486D7E48486D7E48486D7EA2003F81491303007F81A300FF1680A900 +7F1600A3003F5D6D1307001F5DA26C6C495A6C6C495A6C6C495A6C6C6CB45A6C6CB5C7FC +011F13FC010113C029257DA430>I<9039FF01FF80B5000F13F0023F13FC9138FE07FFDA +F00113800003496C13C00280EB7FE091C713F0EE3FF8A2EE1FFCA3EE0FFEAA17FC161FA2 +17F8163F17F06E137F6E14E06EEBFFC0DAF00313809139FC07FE0091383FFFF8020F13E0 +020390C7FC91C9FCACB512FCA42F357EA435>I<9038FE03F000FFEB0FFEEC3FFF91387C +7F809138F8FFC000075B6C6C5A5CA29138807F80ED3F00150C92C7FC91C8FCB3A2B512FE +A422257EA427>114 D<90383FF0383903FFFEF8000F13FF381FC00F383F0003007E1301 +007C130012FC15787E7E6D130013FCEBFFE06C13FCECFF806C14C06C14F06C14F81203C6 +14FC131F9038007FFE140700F0130114007E157E7E157C6C14FC6C14F8EB80019038F007 +F090B512C000F8140038E01FF81F257DA426>I<130FA55BA45BA25B5BA25A1207001FEB +FFE0B6FCA3000390C7FCB21578A815F86CEB80F014816CEBC3E090383FFFC06D13809038 +03FE001D357EB425>I<01FFEC3FC0B5EB3FFFA4000714016C80B3A35DA25DA26C5C6E48 +13E06CD9C03E13FF90387FFFFC011F13F00103138030257DA435>IIIII E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fb ecbx1200 12 47 -/Fb 47 122 df<157F913803FFC0020F7F4A7F91383FE1F891387F80789138FF007C4914 -3C495A163E4948131EA3130FA3163E163C167C16786E13F84B5A4B5A15075E6D6C485A4B -C70003B512E0153E15FC6D5B5D4B91390007C0004B5E6D6D150F4FC7FC6D6D151E49173E -496D5D491778496D15F890261FBFFE4A5AD93F3F5E9026FE1FFF1403D801FC6E495A0003 -6D5E48486C6D130F000F6F49C8FC001F6D6D133E48486C6D133C187C007F6D6D5B6F6C48 -5A00FF6E6C485A6FEB87C06F13CFEFFF806F91C9FC6D6D5B6F49EC01E06F7F6C6CEC3FFF -706D13036C6C4A6DEB07C06C6C91B500F0130FDA800702FCEB1F806C9026E03FF89039FF -80FF00000390B5D8F03FEBFFFE6CDBC00F5C6C6CDA00035C011F01F8D9007F13E0010301 -80020790C7FC4B477BC557>38 D45 DI49 DII<163FA25E5E5D5DA25D5D5D5DA25D92B5FCEC01F7EC03E7 -140715C7EC0F87EC1F07143E147E147C14F8EB01F0EB03E0130714C0EB0F80EB1F00133E -5BA25B485A485A485A120F5B48C7FC123E5A12FCB91280A5C8000F90C7FCAC027FB61280 -A531417DC038>I<0007150301E0143F01FFEB07FF91B6FC5E5E5E5E5E16804BC7FC5D15 -E092C8FC01C0C9FCAAEC3FF001C1B5FC01C714C001DF14F09039FFE03FFC9138000FFE01 -FC6D7E01F06D13804915C0497F6C4815E0C8FC6F13F0A317F8A4EA0F80EA3FE0487E12FF -7FA317F05B5D6C4815E05B007EC74813C0123E003F4A1380D81FC0491300D80FF0495AD8 -07FEEBFFFC6CB612F0C65D013F1480010F01FCC7FC010113C02D427BC038>I<4AB47E02 -1F13F0027F13FC49B6FC01079038807F8090390FFC001FD93FF014C04948137F4948EBFF -E048495A5A1400485A120FA248486D13C0EE7F80EE1E00003F92C7FCA25B127FA2EC07FC -91381FFF8000FF017F13E091B512F89039F9F01FFC9039FBC007FE9039FF8003FF17804A -6C13C05B6F13E0A24915F0A317F85BA4127FA5123FA217F07F121FA2000F4A13E0A26C6C -15C06D4913806C018014006C6D485A6C9038E01FFC6DB55A011F5C010714C0010191C7FC -9038003FF02D427BC038>I<121E121F13FC90B712FEA45A17FC17F817F017E017C0A248 -1680007EC8EA3F00007C157E5E00785D15014B5A00F84A5A484A5A5E151FC848C7FC157E -5DA24A5A14035D14074A5AA2141F5D143FA2147F5D14FFA25BA35B92C8FCA35BA55BAA6D -5A6D5A6D5A2F447AC238>III65 -D67 -DII71 -DI76 DII<923807FFC092B512FE0207ECFFC0021F15F091267FFE0013FC90 -2601FFF0EB1FFF01070180010313C04990C76C7FD91FFC6E6C7E49486F7E49486F7E01FF -8348496F7E48496F1380A248496F13C0A24890C96C13E0A24819F04982003F19F8A3007F -19FC49177FA400FF19FEAD007F19FC6D17FFA3003F19F8A26D5E6C19F0A26E5D6C19E0A2 -6C6D4B13C06C19806E5D6C6D4B13006C6D4B5A6D6C4B5A6D6C4B5A6D6C4A5B6D01C00107 -5B6D01F0011F5B010101FE90B5C7FC6D90B65A023F15F8020715C002004AC8FC030713C0 -47467AC454>II82 DI<003FBA12E0A59026FE000FEB8003D87FE09338003FF049171F90C71607 -A2007E1803007C1801A300781800A400F819F8481978A5C81700B3B3A20107B8FCA54543 -7CC24E>I86 D<903801FFE0011F13FE017F6D7E48B612E03A03FE007F -F84848EB1FFC6D6D7E486C6D7EA26F7FA36F7F6C5A6C5AEA00F090C7FCA40203B5FC91B6 -FC1307013F13F19038FFFC01000313E0481380381FFE00485A5B127F5B12FF5BA35DA26D -5B6C6C5B4B13F0D83FFE013EEBFFC03A1FFF80FC7F0007EBFFF86CECE01FC66CEB8007D9 -0FFCC9FC322F7DAD36>97 DIII -I103 DI<137C48B4FC4813804813C0A24813E0A56C13C0A26C13806C1300EA007C90C7 -FCAAEB7FC0EA7FFFA512037EB3AFB6FCA518467CC520>II108 D<90277F8007FEEC0FFCB590263FFFC090387FFF8092B5D8F001B5 -12E002816E4880913D87F01FFC0FE03FF8913D8FC00FFE1F801FFC0003D99F009026FF3E -007F6C019E6D013C130F02BC5D02F86D496D7EA24A5D4A5DA34A5DB3A7B60081B60003B5 -12FEA5572D7CAC5E>I<90397F8007FEB590383FFF8092B512E0028114F8913987F03FFC -91388F801F000390399F000FFE6C139E14BC02F86D7E5CA25CA35CB3A7B60083B512FEA5 -372D7CAC3E>II<90397FC0 -0FF8B590B57E02C314E002CF14F89139DFC03FFC9139FF001FFE000301FCEB07FF6C496D -13804A15C04A6D13E05C7013F0A2EF7FF8A4EF3FFCACEF7FF8A318F017FFA24C13E06E15 -C06E5B6E4913806E4913006E495A9139DFC07FFC02CFB512F002C314C002C091C7FCED1F -F092C9FCADB67EA536407DAC3E>I<90387F807FB53881FFE0028313F0028F13F8ED8FFC -91389F1FFE000313BE6C13BC14F8A214F0ED0FFC9138E007F8ED01E092C7FCA35CB3A5B6 -12E0A5272D7DAC2E>114 D<90391FFC038090B51287000314FF120F381FF003383FC000 -49133F48C7121F127E00FE140FA215077EA27F01E090C7FC13FE387FFFF014FF6C14C015 -F06C14FC6C800003806C15806C7E010F14C0EB003F020313E0140000F0143FA26C141F15 -0FA27EA26C15C06C141FA26DEB3F8001E0EB7F009038F803FE90B55A00FC5CD8F03F13E0 -26E007FEC7FC232F7CAD2C>IIII121 D E +%DVIPSBitmapFont: Fc ecbx1200 12 41 +/Fc 41 122 df45 DI49 DII<163FA25E5E5D5DA25D5D5D5DA25D92B5FCEC01F7EC03E7140715C7EC0F87 +EC1F07143E147E147C14F8EB01F0EB03E0130714C0EB0F80EB1F00133E5BA25B485A485A +485A120F5B48C7FC123E5A12FCB91280A5C8000F90C7FCAC027FB61280A531417DC038> +I<0007150301E0143F01FFEB07FF91B6FC5E5E5E5E5E16804BC7FC5D15E092C8FC01C0C9 +FCAAEC3FF001C1B5FC01C714C001DF14F09039FFE03FFC9138000FFE01FC6D7E01F06D13 +804915C0497F6C4815E0C8FC6F13F0A317F8A4EA0F80EA3FE0487E12FF7FA317F05B5D6C +4815E05B007EC74813C0123E003F4A1380D81FC0491300D80FF0495AD807FEEBFFFC6CB6 +12F0C65D013F1480010F01FCC7FC010113C02D427BC038>I<4AB47E021F13F0027F13FC +49B6FC01079038807F8090390FFC001FD93FF014C04948137F4948EBFFE048495A5A1400 +485A120FA248486D13C0EE7F80EE1E00003F92C7FCA25B127FA2EC07FC91381FFF8000FF +017F13E091B512F89039F9F01FFC9039FBC007FE9039FF8003FF17804A6C13C05B6F13E0 +A24915F0A317F85BA4127FA5123FA217F07F121FA2000F4A13E0A26C6C15C06D4913806C +018014006C6D485A6C9038E01FFC6DB55A011F5C010714C0010191C7FC9038003FF02D42 +7BC038>I65 D67 +D69 D72 D76 +DII<923807FFC092B512FE0207ECFFC0 +021F15F091267FFE0013FC902601FFF0EB1FFF01070180010313C04990C76C7FD91FFC6E +6C7E49486F7E49486F7E01FF8348496F7E48496F1380A248496F13C0A24890C96C13E0A2 +4819F04982003F19F8A3007F19FC49177FA400FF19FEAD007F19FC6D17FFA3003F19F8A2 +6D5E6C19F0A26E5D6C19E0A26C6D4B13C06C19806E5D6C6D4B13006C6D4B5A6D6C4B5A6D +6C4B5A6D6C4A5B6D01C001075B6D01F0011F5B010101FE90B5C7FC6D90B65A023F15F802 +0715C002004AC8FC030713C047467AC454>II83 D<003FBA12E0A59026FE000FEB8003D8 +7FE09338003FF049171F90C71607A2007E1803007C1801A300781800A400F819F8481978 +A5C81700B3B3A20107B8FCA545437CC24E>I86 +D<903801FFE0011F13FE017F6D7E48B612E03A03FE007FF84848EB1FFC6D6D7E486C6D7E +A26F7FA36F7F6C5A6C5AEA00F090C7FCA40203B5FC91B6FC1307013F13F19038FFFC0100 +0313E0481380381FFE00485A5B127F5B12FF5BA35DA26D5B6C6C5B4B13F0D83FFE013EEB +FFC03A1FFF80FC7F0007EBFFF86CECE01FC66CEB8007D90FFCC9FC322F7DAD36>97 +DIIIIIII<137C48 +B4FC4813804813C0A24813E0A56C13C0A26C13806C1300EA007C90C7FCAAEB7FC0EA7FFF +A512037EB3AFB6FCA518467CC520>II108 +D<90277F8007FEEC0FFCB590263FFFC090387FFF8092B5D8F001B512E002816E4880913D +87F01FFC0FE03FF8913D8FC00FFE1F801FFC0003D99F009026FF3E007F6C019E6D013C13 +0F02BC5D02F86D496D7EA24A5D4A5DA34A5DB3A7B60081B60003B512FEA5572D7CAC5E> +I<90397F8007FEB590383FFF8092B512E0028114F8913987F03FFC91388F801F00039039 +9F000FFE6C139E14BC02F86D7E5CA25CA35CB3A7B60083B512FEA5372D7CAC3E>II<90397FC00FF8B590B57E02C314 +E002CF14F89139DFC03FFC9139FF001FFE000301FCEB07FF6C496D13804A15C04A6D13E0 +5C7013F0A2EF7FF8A4EF3FFCACEF7FF8A318F017FFA24C13E06E15C06E5B6E4913806E49 +13006E495A9139DFC07FFC02CFB512F002C314C002C091C7FCED1FF092C9FCADB67EA536 +407DAC3E>I<90387F807FB53881FFE0028313F0028F13F8ED8FFC91389F1FFE000313BE +6C13BC14F8A214F0ED0FFC9138E007F8ED01E092C7FCA35CB3A5B612E0A5272D7DAC2E> +114 D<90391FFC038090B51287000314FF120F381FF003383FC00049133F48C7121F127E +00FE140FA215077EA27F01E090C7FC13FE387FFFF014FF6C14C015F06C14FC6C80000380 +6C15806C7E010F14C0EB003F020313E0140000F0143FA26C141F150FA27EA26C15C06C14 +1FA26DEB3F8001E0EB7F009038F803FE90B55A00FC5CD8F03F13E026E007FEC7FC232F7C +AD2C>III120 DI +E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fc ectt1000 10 59 -/Fc 59 126 df<121FEA3F80EA7FC0EAFFE0B0EA7FC0AEEA1F00C7FCA7121FEA3F80EA7F +%DVIPSBitmapFont: Fd ectt1000 10 73 +/Fd 73 126 df<121FEA3F80EA7FC0EAFFE0B0EA7FC0AEEA1F00C7FCA7121FEA3F80EA7F C0EAFFE0A5EA7FC0EA3F80EA1F000B3470B32C>33 D<003C131E007F137F481480A66C14 00A6007E7FA6003E133EA3003C131E001C131C191977B32C>I<143814FC13011303EB07 F8EB0FF0EB1FC0EB3F80EB7F0013FE485A485A5B12075B120F5B485AA2123F90C7FCA25A @@ -388,146 +388,191 @@ F8EB0FF0EB1FC0EB3F80EB7F0013FE485A485A5B12075B120F5B485AA2123F90C7FCA25A 80EB1FC0EB0FF0EB07F8EB03FC130113001438164272B92C>40 D<127012FC7E7E6C7E6C 7EEA0FE06C7E6C7E6C7E6C7E137F7F1480131F14C0130FEB07E0A214F01303A214F81301 A314FC1300AC130114F8A3130314F0A2130714E0A2EB0FC0131F1480133F14005B13FE48 -5A485A485A485AEA3FC0485A48C7FC5A5A1270164279B92C>I44 D<007FB512F0B612F8A36C14F01D0579942C>I<121FEA3F80EA -7FC0EAFFE0A5EA7FC0EA3F80EA1F000B0B708A2C>I<1507ED0F80A2151F16005D153E15 -7E157CA215FC5D14015D14035D14075D140F5D141F92C7FC5C143EA2147E147C14FC5C13 -015C13035C13075C130F5C131F91C8FC5B133EA2137E137C13FC5B12015B12035B12075B -120F5B121F90C9FCA25A123E127E127C12FC5AA2127021417BB92C>II<1307497EA2131FA2133F137F13FF5A1207127FB5FC13 -DF139FEA7C1F1200B3AE007FB512E0B612F0A36C14E01C3477B32C>I<121FEA3F80EA7F -C0EAFFE0A5EA7FC0EA3F80EA1F00C7FCAE121FEA3F80EA7FC0EAFFE0A5EA7FC0EA3F80EA -1F000B2470A32C>58 DI<007FB612F0B712F8A36C15F0CAFCA8007F -B612F0B712F8A36C15F025127DA12C>61 D64 +5A485A485A485AEA3FC0485A48C7FC5A5A1270164279B92C>II44 D<007FB512F0B612F8A36C14F01D0579942C>I<121FEA3F80EA7FC0EAFFE0A5EA7F +C0EA3F80EA1F000B0B708A2C>I<1507ED0F80A2151F16005D153E157E157CA215FC5D14 +015D14035D14075D140F5D141F92C7FC5C143EA2147E147C14FC5C13015C13035C13075C +130F5C131F91C8FC5B133EA2137E137C13FC5B12015B12035B12075B120F5B121F90C9FC +A25A123E127E127C12FC5AA2127021417BB92C>II<1307497EA2131FA2133F137F13FF5A1207127FB5FC13DF139FEA7C1F1200 +B3AE007FB512E0B612F0A36C14E01C3477B32C>IIII<000FB512FE4880A35D0180C8FCADEB83FE90389FFF8090B512E0 +15F8819038FE03FE9038F000FF01C07F49EB3F8090C7121F6C15C0C8120FA2ED07E0A412 +3C127EB4FC150F16C0A248141F007EEC3F80007FEC7F006C6C5B6D485A391FF80FFC6CB5 +5A6C5C000114C06C6C90C7FCEB0FF823347CB22C>I56 D +I<121FEA3F80EA7FC0EAFFE0A5EA7FC0EA3F80EA1F00C7FCAE121FEA3F80EA7FC0EAFFE0 +A5EA7FC0EA3F80EA1F000B2470A32C>II<007FB612F0B712F8A36C +15F0CAFCA8007FB612F0B712F8A36C15F025127DA12C>61 D64 D<14FE497EA4497FA214EFA2130781A214C7A2010F7FA314C390381F83F0A590383F01F8 A490387E00FCA549137E90B512FEA34880A29038F8003FA34848EB1F80A4000715C04913 -0FD87FFEEBFFFC6D5AB514FE6C15FC497E27347EB32C>I<02FF13700107EBE0F84913F9 -013F13FD4913FFEBFF813901FE007F4848131FD807F0130F1507485A491303485A150148 -C7FCA25A007EEC00F01600A212FE5AAB7E127EA3007F15F06CEC01F8A26C7EA26C6C1303 -6D14F06C6C130716E0D803FC131F6C6CEB3FC03A00FF81FF806DB512006D5B010F5B6D13 -F00100138025357DB32C>67 D<007FB612F0B712F8A37E3903F00001A7ED00F01600A4EC -01E04A7EA490B5FCA5EBF003A46E5A91C8FCA5163C167EA8007FB612FEB7FCA36C15FC27 -337EB22C>69 D<903901FC038090390FFF87C04913EF017F13FF90B6FC4813073803FC01 -497E4848137F4848133F49131F121F5B003F140F90C7FCA2127EED078092C7FCA212FE5A -A8913803FFF84A13FCA27E007E6D13F89138000FC0A36C141FA27F121F6D133F120F6D13 -7F6C7E6C6C13FF6D5A3801FF076C90B5FC6D13EF011F13CF6DEB0780D901FCC7FC26357D -B32C>71 DI<007FB512F8B612FCA36C14 -F839000FC000B3B3A5007FB512F8B612FCA36C14F81E3379B22C>I<387FFFE0B57EA36C -5BD803F0C8FCB3AE16F0ED01F8A8007FB6FCB7FCA36C15F025337DB22C>76 -DIII<007FB512C0B612F88115FF6C15802603F00013C0153FED0FE0ED07 -F0A2150316F81501A6150316F01507A2ED0FE0ED3FC015FF90B61280160015FC5D15C001 -F0C8FCB0387FFF80B57EA36C5B25337EB22C>I<387FFFFCB67E15E015F86C803907E007 -FE1401EC007F6F7E151FA26F7EA64B5AA2153F4BC7FCEC01FE140790B55A5D15E0818190 -38E007FCEC01FE1400157F81A8160FEE1F80A5D87FFEEB1FBFB5ECFF00815E6C486D5AC8 -EA01F029347EB22C>82 D<90381FF80790B5EA0F804814CF000714FF5A381FF01F383FC0 -03497E48C7FC007E147F00FE143F5A151FA46CEC0F00007E91C7FC127F7FEA3FE0EA1FFC -EBFFC06C13FC0003EBFFC06C14F06C6C7F01077F9038007FFEEC07FF02001380153FED1F -C0A2ED0FE0A20078140712FCA56CEC0FC0A26CEC1F806D133F01E0EB7F009038FE01FF90 -B55A5D00F914F0D8F83F13C0D8700790C7FC23357CB32C>I<007FB612FCB712FEA43AFC -007E007EA70078153CC71400B3AF90383FFFFCA2497F6D5BA227337EB22C>I86 D89 D<003FB612C04815E0A400 -7EC7EA1FC0ED3F80A2ED7F00157E15FE4A5A003C5CC712034A5AA24A5A4A5AA24A5A4AC7 -FCA214FE495AA2495A495AA2495A495AA2495A49C8FCA213FE485AA24848EB03C049EB07 -E01207485A5B121F485AA248C7FCB7FCA46C15C023337CB22C>I<007FB6FCB71280A46C -150021067B7D2C>95 D<3801FFF0000713FE001F6D7E15E048809038C01FF81407EC01FC -381F80000006C77EC8127EA3ECFFFE131F90B5FC1203120F48EB807E383FF800EA7FC090 -C7FC12FE5AA47E007F14FEEB8003383FE01F6CB612FC6C15FE6C14BF0001EBFE1F3A003F -F007FC27247CA32C>97 DI<903803FFE0011F13F8017F13FE48B5FC48804848C6FC -EA0FF0485A49137E4848131890C9FC5A127EA25AA8127EA2127F6C140F6DEB1F806C7E6D -133F6C6CEB7F003907FE03FF6CB55A6C5C6C6C5B011F13E0010390C7FC21247AA32C>I< -EC0FFE4A7EA380EC003FAAEB07F8EB3FFE90B512BF4814FF5A3807FC0F380FF00348487E -497E48487F90C7FC007E80A212FE5AA87E007E5CA2007F5C6C7E5C6C6C5A380FF0073807 -FC1F6CB612FC6CECBFFE6C143FEB3FFC90390FF01FFC27337DB22C>IIIII<1307EB1FC0A2497EA36D5AA20107C7FC90C8FCA7387FFFC080B5FC7E -A2EA0007B3A8007FB512FCB612FEA36C14FC1F3479B32C>I<140EEC3F80A2EC7FC0A3EC -3F80A2EC0E0091C7FCA748B512804814C0A37EC7120FB3B3A2141F003C1480007E133FB4 -14005CEB01FEEBFFFC6C5B5C001F5B000790C7FC1A467CB32C>II<387FFFE0B57EA37E -EA0003B3B3A5007FB61280B712C0A36C158022337BB22C>I<3A7F83F007E09039CFFC1F -F83AFFDFFE3FFCD87FFF13FF91B57E3A07FE1FFC3E01FCEBF83F496C487E01F013E001E0 -13C0A301C01380B33B7FFC3FF87FF0027F13FFD8FFFE6D13F8D87FFC4913F0023F137F2D -2481A32C>I<397FF01FE039FFF87FFC9038F9FFFE01FB7F6CB6FC00019038F03F80ECC0 -1F02807FEC000F5B5BA25BB3267FFFE0B5FCB500F11480A36C01E0140029247FA32C>I< -EB07FCEB1FFF017F13C048B512F048803907FC07FC390FF001FE48486C7E0180133F003F -158090C7121F007EEC0FC0A348EC07E0A76C140F007E15C0A2007F141F6C15806D133F6C -6CEB7F006D5B6C6C485A3907FC07FC6CB55A6C5C6C6C13C0011F90C7FCEB07FC23247CA3 -2C>I<397FF01FE039FFF8FFF801FB13FE90B6FC6C158000019038F07FC09138801FE091 -380007F049EB03F85BED01FC491300A216FE167EA816FE6D14FCA2ED01F86D13036DEB07 -F0150F9138801FE09138E07FC091B51280160001FB5B01F813F8EC3FC091C8FCAD387FFF -E0B57EA36C5B27367FA32C>I114 D<90387FF8700003B512F8120F5A5A387FC00F387E00034813015AA3 -6CEB00F0007F140013F0383FFFC06C13FE6CEBFF80000314E0C66C13F8010113FCEB0007 -EC00FE0078147F00FC143F151F7EA26C143F6D133E6D13FE9038F007FC90B5FC15F815E0 -00F8148039701FFC0020247AA32C>I<131E133FA9007FB6FCB71280A36C1500D8003FC8 -FCB1ED03C0ED07E0A5EC800F011FEB1FC0ECE07F6DB51280160001035B6D13F89038003F -E0232E7EAD2C>I<3A7FF003FF80486C487FA3007F7F0001EB000FB3A3151FA2153F6D13 -7F3900FE03FF90B7FC6D15807F6D13CF902603FE07130029247FA32C>I<3A7FFF01FFFC -B514FE148314016C15FC3A03E0000F80A26D131F00011500A26D5B0000143EA26D137E01 -7C137CA2017E13FC013E5BA2EB3F01011F5BA21483010F5BA214C701075BA214EF01035B -A214FF6D90C7FCA26D5A147C27247EA32C>II<3A3FFF03FFF048018713F8A36C010313F03A00FC007E005D90387E01F8013F5B -EB1F83EC87E090380FCFC0903807EF80EB03FF6D90C7FC5C6D5A147C14FE130180903803 -EF80903807CFC0EB0FC7EC83E090381F01F0013F7FEB7E00017C137C49137E0001803A7F -FF01FFFC1483B514FE6C15FC140127247EA32C>I<3A7FFF01FFFCB5008113FE14831481 -6C010113FC3A03E0000F806C7E151F6D140012005D6D133E137C017E137E013E137CA201 -3F13FC6D5BA2EB0F815DA2EB07C1ECC3E0A2EB03E3ECE7C0130114F75DEB00FFA292C7FC -80A2143EA2147E147CA214FC5CA2EA0C01003F5BEA7F83EB87E0EA7E0F495A387FFF806C -90C8FC6C5A6C5AEA07E027367EA32C>I<003FB612E04815F0A4007EC7EA1FE0ED3FC0ED -7F80EDFF004A5A003C495AC7485A4A5A4A5A4A5A4A5A4AC7FCEB01FC495AEB0FF0495A49 -5A495A49C8FC4848EB01E04848EB03F0485A485A485A485A485AB7FCA46C15E024247DA3 -2C>I<15FF02071380141F147F91B512004913C04AC7FCEB03F85CB31307EB1FE013FF00 -7F5BB55A49C8FC6D7E6C7FC67F131FEB07F01303B380EB01FEECFFC06D13FF6E1380141F -14070200130021417BB92C>I125 D E +0FD87FFEEBFFFC6D5AB514FE6C15FC497E27347EB32C>I<007FB512E015F8B612FE6C80 +16C03903F0003FED0FE0ED07F01503A2ED01F8A6ED03F0A21507ED0FE0ED1FC0EDFF8090 +B612005D5D15FF16C09039F0001FE0ED07F0ED03F81501ED00FCA216FE167EA616FE16FC +1501ED03F8150FED3FF0007FB612E016C0B712806CECFE0015F027337FB22C>I<02FF13 +700107EBE0F84913F9013F13FD4913FFEBFF813901FE007F4848131FD807F0130F150748 +5A491303485A150148C7FCA25A007EEC00F01600A212FE5AAB7E127EA3007F15F06CEC01 +F8A26C7EA26C6C13036D14F06C6C130716E0D803FC131F6C6CEB3FC03A00FF81FF806DB5 +12006D5B010F5B6D13F00100138025357DB32C>I<007FB5FCB612C015F0816C803907E0 +03FEEC00FFED7F80153FED1FC0ED0FE0A2150716F0150316F81501A4ED00FCACED01F8A3 +150316F0A2150716E0150FED1FC0153FED7F80EDFF00EC03FE007FB55AB65A5D15C06C91 +C7FC26337EB22C>I<007FB612F0B712F8A37E3903F00001A7ED00F01600A4EC01E04A7E +A490B5FCA5EBF003A46E5A91C8FCA5163C167EA8007FB612FEB7FCA36C15FC27337EB22C +>I<007FB612F8B712FCA37ED803F0C7FCA716781600A515F04A7EA490B5FCA5EBF001A4 +6E5A92C7FCAD387FFFE0B5FC805C7E26337EB22C>I<903901FC038090390FFF87C04913 +EF017F13FF90B6FC4813073803FC01497E4848137F4848133F49131F121F5B003F140F90 +C7FCA2127EED078092C7FCA212FE5AA8913803FFF84A13FCA27E007E6D13F89138000FC0 +A36C141FA27F121F6D133F120F6D137F6C7E6C6C13FF6D5A3801FF076C90B5FC6D13EF01 +1F13CF6DEB0780D901FCC7FC26357DB32C>II<007FB512F8B612FCA36C14F839000FC000B3B3A5007FB512F8B612FCA36C14F81E +3379B22C>I<0107B512804914C0A36D148090390003F000B3AF1218127EA2B4FCA24A5A +48130F007F131F9038C07FC06CB55A6C91C7FC6C5B000313F838007FC022347BB22C>I< +387FFFE0B57EA36C5BD803F0C8FCB3AE16F0ED01F8A8007FB6FCB7FCA36C15F025337DB2 +2C>76 DI +II<007FB512C0B612F88115FF6C15802603F00013C0153FED0F +E0ED07F0A2150316F81501A6150316F01507A2ED0FE0ED3FC015FF90B61280160015FC5D +15C001F0C8FCB0387FFF80B57EA36C5B25337EB22C>II<387FFFFCB67E15E0 +15F86C803907E007FE1401EC007F6F7E151FA26F7EA64B5AA2153F4BC7FCEC01FE140790 +B55A5D15E081819038E007FCEC01FE1400157F81A8160FEE1F80A5D87FFEEB1FBFB5ECFF +00815E6C486D5AC8EA01F029347EB22C>I<90381FF80790B5EA0F804814CF000714FF5A +381FF01F383FC003497E48C7FC007E147F00FE143F5A151FA46CEC0F00007E91C7FC127F +7FEA3FE0EA1FFCEBFFC06C13FC0003EBFFC06C14F06C6C7F01077F9038007FFEEC07FF02 +001380153FED1FC0A2ED0FE0A20078140712FCA56CEC0FC0A26CEC1F806D133F01E0EB7F +009038FE01FF90B55A5D00F914F0D8F83F13C0D8700790C7FC23357CB32C>I<007FB612 +FCB712FEA43AFC007E007EA70078153CC71400B3AF90383FFFFCA2497F6D5BA227337EB2 +2C>I<3B7FFF803FFFC0B56C4813E0A36C496C13C03B03F00001F800B3AF6D130300015D +A26D130700005D6D130F017F495A6D6C485AECE0FF6DB5C7FC6D5B010313F86D5B903800 +3F802B3480B22C>II<3A3FFF03FFE0484913F0148714076C6D13E03A01F800FE007F0000495A13FE017E +5BEB7F03013F5B1487011F5B14CF010F5B14FF6D5BA26D90C7FCA26D5AA26D5AA2497EA2 +497EA2497F81EB0FCF81EB1FC7EC87F0EB3F83EC03F8EB7F01017E7FEBFE00497F000114 +7E49137F000380491480151FD87FFEEBFFFC6D5AB514FE6C15FC497E27337EB22C>88 +DI<00 +3FB612C04815E0A4007EC7EA1FC0ED3F80A2ED7F00157E15FE4A5A003C5CC712034A5AA2 +4A5A4A5AA24A5A4AC7FCA214FE495AA2495A495AA2495A495AA2495A49C8FCA213FE485A +A24848EB03C049EB07E01207485A5B121F485AA248C7FCB7FCA46C15C023337CB22C>I< +007FB6FCB71280A46C150021067B7D2C>95 D<3801FFF0000713FE001F6D7E15E0488090 +38C01FF81407EC01FC381F80000006C77EC8127EA3ECFFFE131F90B5FC1203120F48EB80 +7E383FF800EA7FC090C7FC12FE5AA47E007F14FEEB8003383FE01F6CB612FC6C15FE6C14 +BF0001EBFE1F3A003FF007FC27247CA32C>97 DI<903803FFE0011F13F8017F13FE +48B5FC48804848C6FCEA0FF0485A49137E4848131890C9FC5A127EA25AA8127EA2127F6C +140F6DEB1F806C7E6D133F6C6CEB7F003907FE03FF6CB55A6C5C6C6C5B011F13E0010390 +C7FC21247AA32C>IIIIII<1307EB1FC0A2497EA36D5AA20107C7FC90C8FC +A7387FFFC080B5FC7EA2EA0007B3A8007FB512FCB612FEA36C14FC1F3479B32C>I<140E +EC3F80A2EC7FC0A3EC3F80A2EC0E0091C7FCA748B512804814C0A37EC7120FB3B3A2141F +003C1480007E133FB414005CEB01FEEBFFFC6C5B5C001F5B000790C7FC1A467CB32C>I< +EA7FE0487EA3127F1201AA91381FFFF04A13F8A36E13F0913800FE004A5A4A5A4A5A4A5A +4A5A4A5A4AC7FC14FEEBF1FC13F3EBF7FE90B5FCA2EC9F80EC0FC001FE7FEBFC07496C7E +496C7E811400157E811680151F3A7FFFC0FFFCB500E113FEA36C01C013FC27337EB22C> +I<387FFFE0B57EA37EEA0003B3B3A5007FB61280B712C0A36C158022337BB22C>I<3A7F +83F007E09039CFFC1FF83AFFDFFE3FFCD87FFF13FF91B57E3A07FE1FFC3E01FCEBF83F49 +6C487E01F013E001E013C0A301C01380B33B7FFC3FF87FF0027F13FFD8FFFE6D13F8D87F +FC4913F0023F137F2D2481A32C>I<397FF01FE039FFF87FFC9038F9FFFE01FB7F6CB6FC +00019038F03F80ECC01F02807FEC000F5B5BA25BB3267FFFE0B5FCB500F11480A36C01E0 +140029247FA32C>II<397FF01FE039FFF8FFF801FB13FE90B6FC6C158000019038 +F07FC09138801FE091380007F049EB03F85BED01FC491300A216FE167EA816FE6D14FCA2 +ED01F86D13036DEB07F0150F9138801FE09138E07FC091B51280160001FB5B01F813F8EC +3FC091C8FCAD387FFFE0B57EA36C5B27367FA32C>I114 D<90387FF8700003B512F8120F5A5A387FC00F +387E00034813015AA36CEB00F0007F140013F0383FFFC06C13FE6CEBFF80000314E0C66C +13F8010113FCEB0007EC00FE0078147F00FC143F151F7EA26C143F6D133E6D13FE9038F0 +07FC90B5FC15F815E000F8148039701FFC0020247AA32C>I<131E133FA9007FB6FCB712 +80A36C1500D8003FC8FCB1ED03C0ED07E0A5EC800F011FEB1FC0ECE07F6DB51280160001 +035B6D13F89038003FE0232E7EAD2C>I<3A7FF003FF80486C487FA3007F7F0001EB000F +B3A3151FA2153F6D137F3900FE03FF90B7FC6D15807F6D13CF902603FE07130029247FA3 +2C>I<3A7FFF01FFFCB514FE148314016C15FC3A03E0000F80A26D131F00011500A26D5B +0000143EA26D137E017C137CA2017E13FC013E5BA2EB3F01011F5BA21483010F5BA214C7 +01075BA214EF01035BA214FF6D90C7FCA26D5A147C27247EA32C>II<3A3FFF03FFF048018713F8A36C010313F03A00FC007E00 +5D90387E01F8013F5BEB1F83EC87E090380FCFC0903807EF80EB03FF6D90C7FC5C6D5A14 +7C14FE130180903803EF80903807CFC0EB0FC7EC83E090381F01F0013F7FEB7E00017C13 +7C49137E0001803A7FFF01FFFC1483B514FE6C15FC140127247EA32C>I<3A7FFF01FFFC +B5008113FE148314816C010113FC3A03E0000F806C7E151F6D140012005D6D133E137C01 +7E137E013E137CA2013F13FC6D5BA2EB0F815DA2EB07C1ECC3E0A2EB03E3ECE7C0130114 +F75DEB00FFA292C7FC80A2143EA2147E147CA214FC5CA2EA0C01003F5BEA7F83EB87E0EA +7E0F495A387FFF806C90C8FC6C5A6C5AEA07E027367EA32C>I<003FB612E04815F0A400 +7EC7EA1FE0ED3FC0ED7F80EDFF004A5A003C495AC7485A4A5A4A5A4A5A4A5A4AC7FCEB01 +FC495AEB0FF0495A495A495A49C8FC4848EB01E04848EB03F0485A485A485A485A485AB7 +FCA46C15E024247DA32C>I<15FF02071380141F147F91B512004913C04AC7FCEB03F85C +B31307EB1FE013FF007F5BB55A49C8FC6D7E6C7FC67F131FEB07F01303B380EB01FEECFF +C06D13FF6E1380141F14070200130021417BB92C>I125 +D E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fd ecbx1440 14.4 41 -/Fd 41 122 df27 @@ -689,8 +734,8 @@ A26F5AA26F5AA35E151F93C9FC5D153E157ED81FC0137C487E486C13FC486C5B14015D4A 5A14074A5A6C48485A4948CAFC495A383F81FC6CB45A6C5B000313C0C648CBFC3E4D7DB4 45>121 D E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fe ecss2074 20.74 10 -/Fe 10 116 df76 +%DVIPSBitmapFont: Ff ecss2074 20.74 10 +/Ff 10 116 df76 D115 D E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Ff ecrm0700 7 1 -/Ff 1 66 df<140EA2141FA34A7EA3EC6FC0A2ECEFE014C7A290380183F0A390380301F8 -A201067F1400A249137EA2011C137F01187FA24980013FB5FCA2903960000FC0A201E080 -491307A248486D7EA200038115011207D81FC0497ED8FFF890383FFFE0A22B2A7EA931> -65 D E +%DVIPSBitmapFont: Fg ecrm0700 7 2 +/Fg 2 66 df<13381378EA01F8121F12FE12E01200B3AB487EB512F8A215267BA521>49 +D<140EA2141FA34A7EA3EC6FC0A2ECEFE014C7A290380183F0A390380301F8A201067F14 +00A249137EA2011C137F01187FA24980013FB5FCA2903960000FC0A201E080491307A248 +486D7EA200038115011207D81FC0497ED8FFF890383FFFE0A22B2A7EA931>65 +D E %EndDVIPSBitmapFont -%DVIPSBitmapFont: Fg ecrm1000 10 78 -/Fg 78 123 df21 D21 D27 DII<007C137C00FE13FEEAFF01A3EAFE00A7007E13FC -007C137CA8003C137800381338A700181330171E77BA2A>34 D<030C497EA2031C130303 -1891C7FCA303385B03301306A30370130E0360130CA303E0131C4B1318A3020114384B13 -30A30203147092C71260A34A14E0007FB91280BA12C0C7270C000180C7FCA2021C130302 -1891C8FCA402385B02301306A50270130E0260130CA2BA12C06C1880280001C00038C8FC -4A1330A30103147091C71260A34914E001065CA3010E1301010C5CA3011C1303011891C9 -FCA301385B01301306A30170130E0160130CA23A4A7BB945>II<121C -127FEAFF80A213C0A3127F121C1200A412011380A2120313005A1206120E5A5A5A12600A -1979B917>39 D<146014E0EB01C0EB0380EB0700130E131E5B5BA25B485AA2485AA21207 -5B120F90C7FCA25A121EA2123EA35AA65AB2127CA67EA3121EA2121F7EA27F12077F1203 -A26C7EA26C7E1378A27F7F130E7FEB0380EB01C0EB00E01460135278BD20>I<12C07E12 -707E7E7E120F6C7E6C7EA26C7E6C7EA21378A2137C133C133E131EA2131F7FA21480A3EB -07C0A6EB03E0B2EB07C0A6EB0F80A31400A25B131EA2133E133C137C1378A25BA2485A48 -5AA2485A48C7FC120E5A5A5A5A5A13527CBD20>II<121C127FEAFF80A213C0A3127F121C1200A4 -12011380A2120313005A1206120E5A5A5A12600A19798817>44 DI<121C127FEAFF80A5EA7F00121C0909798817>I<1506A2150E150CA2151C1518153815 -30A215701560A215E015C0A214011580A2140315005C1406A2140E140CA2141C1418A214 -381430A21470146014E05CA213015CA2130391C7FCA25B1306A2130E130C131C1318A213 -381330A213701360A213E05BA212015B120390C8FCA25A1206A2120E120CA2121C1218A2 -1238123012701260A212E05AA21F537BBD2A>IIIII<1538A2157815F8A2140114031407A2140F141F141B14331473146314C3 -13011483EB030313071306130C131C131813301370136013C01201EA038013005A120E12 -0C5A123812305A12E0B712F8A3C73803F800AA4A7E0103B512F8A325387EB72A>I<0006 -140CD80780133C9038F003F890B5FC5D5D158092C7FC14FC38067FE090C9FCAAEB07F8EB -1FFE9038780F809038E007E03907C003F0496C7E130000066D7E81C8FC8181A21680A412 -1C127F5A7FA390C713005D12FC00605C12704A5A6C5C6C1303001E495A6C6C485A3907E0 -3F800001B5C7FC38007FFCEB1FE021397CB62A>I -I<12301238123E003FB612E0A316C05A168016000070C712060060140E5D5D00E0143048 -14705D5DC712014A5A4AC7FC1406140E5CA25C1478147014F05C1301A213035C1307A213 -0FA3131F5CA2133FA5137FA96DC8FC131E233A7BB72A>II<121C127FEAFF80A5EA7F00121CC7FCB2121C127FEAFF80A5EA7F00121C092479A317> -58 D64 D<1538A3157CA315FEA34A7EA34A6C7EA202077FEC063FA2020E7F -EC0C1FA2021C7FEC180FA202387FEC3007A202707FEC6003A202C07F1501A2D901807F81 -A249C77F167FA20106810107B6FCA24981010CC7121FA2496E7EA3496E7EA3496E7EA213 -E0707E1201486C81D80FFC02071380B56C90B512FEA3373C7DBB3E>II<913A01FF800180020FEBE003027F13F8903A01FF807E07903A03FC000F0FD90FF0EB -039F4948EB01DFD93F80EB00FF49C8127F01FE153F12014848151F4848150FA248481507 -A2485A1703123F5B007F1601A35B00FF93C7FCAD127F6DED0180A3123F7F001F16031800 -6C7E5F6C7E17066C6C150E6C6C5D00001618017F15386D6C5CD91FE05C6D6CEB03C0D903 -FCEB0F80902701FF803FC7FC9039007FFFFC020F13F002011380313D7BBA3C>IIIIIII<013FB512E0A39039001FFC -00EC07F8B3B3A3123FEA7F80EAFFC0A44A5A1380D87F005B0070131F6C5C6C495A6C49C7 -FC380781FC3801FFF038007F80233B7DB82B>I -76 DIIIIIII<003FB812E0A3D9C003EB001F273E0001FE130348EE01F00078160000 -701770A300601730A400E01738481718A4C71600B3B0913807FF80011FB612E0A335397D -B83C>III<007FB590383FFFFCA3C6 -01F801071380D97FE0D903FCC7FC013FEC01F06D6C5C5F6D6C5C6D6C13034CC8FC6D6C13 -06160E6D6C5B6DEB8018163891387FC0306E6C5A16E06E6C5A91380FF18015FB6EB4C9FC -5D14036E7EA26E7F6F7EA24B7E15DF9138019FF09138038FF8150F91380607FC91380E03 -FE140C4A6C7EEC38000230804A6D7E14E04A6D7E49486D7E130391C76C7E01066E7E130E -010C6E7E011C1401013C8101FE822607FF80010713E0B500E0013FEBFF80A339397EB83E ->88 DI<003FB7FCA39039FC0001FE01 -C0130349495A003EC7FC003C4A5A5E0038141F00784A5A12704B5A5E006014FF4A90C7FC -A24A5A5DC712074A5AA24A5A5D143F4A5AA24A5A92C8FC5B495AA2495A5C130F4948EB01 -80A2495A5C137F495A16034890C7FC5B1203485AEE0700485A495C001F5D48485C5E4848 -495A49130FB8FCA329397BB833>I<007FB81280B912C0A26C17803204797041>95 +007C137CA8003C137800381338A700181330171E77BA2A>34 D<141FEC7FC0903801F0E0 +903803C0600107137090380F803090381F00381518A25BA2133E133F15381530A215705D +5D140190381F838092CAFC1487148E02DC49B51280EB0FF85C4A9039003FF8000107ED0F +C06E5D71C7FC6E140E010F150CD91DFC141C01391518D970FE143801E015302601C07F14 +70D803805D00076D6C5BD80F00EBC00148011F5C4890380FE003003E6E48C8FC007E9038 +07F8060203130E00FE6E5A6E6C5A1400ED7F706C4B13036F5A6F7E6C6C6D6C5B7013066C +6C496C130E6DD979FE5B281FF001F07F133C3C07F80FE03FC0F86CB539800FFFF0C69026 +FE000313C0D91FF0D9007FC7FC393E7DBB41>38 D<121C127FEAFF80A213C0A3127F121C +1200A412011380A2120313005A1206120E5A5A5A12600A1979B917>I<146014E0EB01C0 +EB0380EB0700130E131E5B5BA25B485AA2485AA212075B120F90C7FCA25A121EA2123EA3 +5AA65AB2127CA67EA3121EA2121F7EA27F12077F1203A26C7EA26C7E1378A27F7F130E7F +EB0380EB01C0EB00E01460135278BD20>I<12C07E12707E7E7E120F6C7E6C7EA26C7E6C +7EA21378A2137C133C133E131EA2131F7FA21480A3EB07C0A6EB03E0B2EB07C0A6EB0F80 +A31400A25B131EA2133E133C137C1378A25BA2485A485AA2485A48C7FC120E5A5A5A5A5A +13527CBD20>II<121C127FEAFF80A213C0A3127F121C1200A412011380A2120313005A1206120E +5A5A5A12600A19798817>44 DI<121C127FEAFF80A5EA7F0012 +1C0909798817>I<1506A2150E150CA2151C151815381530A215701560A215E015C0A214 +011580A2140315005C1406A2140E140CA2141C1418A214381430A21470146014E05CA213 +015CA2130391C7FCA25B1306A2130E130C131C1318A213381330A213701360A213E05BA2 +12015B120390C8FCA25A1206A2120E120CA2121C1218A21238123012701260A212E05AA2 +1F537BBD2A>IIIII<1538A2157815 +F8A2140114031407A2140F141F141B14331473146314C313011483EB030313071306130C +131C131813301370136013C01201EA038013005A120E120C5A123812305A12E0B712F8A3 +C73803F800AA4A7E0103B512F8A325387EB72A>I<0006140CD80780133C9038F003F890 +B5FC5D5D158092C7FC14FC38067FE090C9FCAAEB07F8EB1FFE9038780F809038E007E039 +07C003F0496C7E130000066D7E81C8FC8181A21680A4121C127F5A7FA390C713005D12FC +00605C12704A5A6C5C6C1303001E495A6C6C485A3907E03F800001B5C7FC38007FFCEB1F +E021397CB62A>II<12301238123E003FB612E0A3 +16C05A168016000070C712060060140E5D5D00E014304814705D5DC712014A5A4AC7FC14 +06140E5CA25C1478147014F05C1301A213035C1307A2130FA3131F5CA2133FA5137FA96D +C8FC131E233A7BB72A>III<121C +127FEAFF80A5EA7F00121CC7FCB2121C127FEAFF80A5EA7F00121C092479A317>I<121C +127FEAFF80A5EA7F00121CC7FCB2121C127FEAFF80A213C0A3127F121C1200A412011380 +A2120313005A1206120E5A5A5A12600A3479A317>I64 +D<1538A3157CA315FEA34A7EA34A6C7EA202077FEC063FA2020E7FEC0C1FA2021C7FEC18 +0FA202387FEC3007A202707FEC6003A202C07F1501A2D901807F81A249C77F167FA20106 +810107B6FCA24981010CC7121FA2496E7EA3496E7EA3496E7EA213E0707E1201486C81D8 +0FFC02071380B56C90B512FEA3373C7DBB3E>II<913A01FF800180 +020FEBE003027F13F8903A01FF807E07903A03FC000F0FD90FF0EB039F4948EB01DFD93F +80EB00FF49C8127F01FE153F12014848151F4848150FA248481507A2485A1703123F5B00 +7F1601A35B00FF93C7FCAD127F6DED0180A3123F7F001F160318006C7E5F6C7E17066C6C +150E6C6C5D00001618017F15386D6C5CD91FE05C6D6CEB03C0D903FCEB0F80902701FF80 +3FC7FC9039007FFFFC020F13F002011380313D7BBA3C>IIIIIII75 DIIIIIIII<003FB812E0A3D9C003EB +001F273E0001FE130348EE01F00078160000701770A300601730A400E01738481718A4C7 +1600B3B0913807FF80011FB612E0A335397DB83C>IIII<007FB590383FFF +FCA3C601F801071380D97FE0D903FCC7FC013FEC01F06D6C5C5F6D6C5C6D6C13034CC8FC +6D6C1306160E6D6C5B6DEB8018163891387FC0306E6C5A16E06E6C5A91380FF18015FB6E +B4C9FC5D14036E7EA26E7F6F7EA24B7E15DF9138019FF09138038FF8150F91380607FC91 +380E03FE140C4A6C7EEC38000230804A6D7E14E04A6D7E49486D7E130391C76C7E01066E +7E130E010C6E7E011C1401013C8101FE822607FF80010713E0B500E0013FEBFF80A33939 +7EB83E>II<003FB7FCA39039FC0001 +FE01C0130349495A003EC7FC003C4A5A5E0038141F00784A5A12704B5A5E006014FF4A90 +C7FCA24A5A5DC712074A5AA24A5A5D143F4A5AA24A5A92C8FC5B495AA2495A5C130F4948 +EB0180A2495A5C137F495A16034890C7FC5B1203485AEE0700485A495C001F5D48485C5E +4848495A49130FB8FCA329397BB833>I<007FB81280B912C0A26C17803204797041>95 Ddata.v_${union_data}!=0) {free(impl->data.v_${union_data});}\n"; +} + +print <data.v_${union_data} = $assign } diff --git a/libical/src/Makefile.am b/libical/src/Makefile.am index 37dc5e39cb..4edf2a1d14 100644 --- a/libical/src/Makefile.am +++ b/libical/src/Makefile.am @@ -1 +1 @@ -SUBDIRS = libical libicalss test +SUBDIRS = libical libicalss libicalvcal test diff --git a/libical/src/libical/Makefile.am b/libical/src/libical/Makefile.am index d9af51bccd..35a08effc7 100644 --- a/libical/src/libical/Makefile.am +++ b/libical/src/libical/Makefile.am @@ -30,9 +30,16 @@ libical_a_SOURCES = \ icaltypes.h \ icalvalue.c \ icalvalue.h \ - icalvcal.h \ + icalrecur.c \ + icalrecur.h \ + icaltime.h \ + icaltime.c \ pvl.c \ - pvl.h + pvl.h \ + sspm.c \ + sspm.h \ + icalmime.c \ + icalmime.h include_HEADERS=\ ical.h \ @@ -46,9 +53,12 @@ include_HEADERS=\ icalrestriction.h \ icaltypes.h \ icalvalue.h \ - icalvcal.h \ + icalrecur.h \ icalversion.h \ - pvl.h + icaltime.h \ + pvl.h \ + sspm.h \ + icalmime.h # diff --git a/libical/src/libical/ical.h b/libical/src/libical/ical.h index d0f33cd1a1..05e7ca82bc 100644 --- a/libical/src/libical/ical.h +++ b/libical/src/libical/ical.h @@ -4,20 +4,19 @@ CREATOR: eric 20 March 1999 - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The original code is ical.h ======================================================================*/ @@ -36,6 +35,14 @@ #include "icalmemory.h" #include "icalerror.h" #include "icalrestriction.h" +#include "icaltime.h" +#include "icalrecur.h" + +#ifdef DMALLOC +#include "dmalloc.h" +#endif + + #endif /* !ICAL_H */ diff --git a/libical/src/libical/icalcomponent.c b/libical/src/libical/icalcomponent.c index bd2b13189c..52c2088140 100644 --- a/libical/src/libical/icalcomponent.c +++ b/libical/src/libical/icalcomponent.c @@ -1,25 +1,22 @@ -/* -*- Mode: C -*- */ /*====================================================================== FILE: icalcomponent.c CREATOR: eric 28 April 1999 $Id$ + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + This program is free software; you can redistribute it and/or modify + it under the terms of either: - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ - The original author is Eric Busboom The original code is icalcomponent.c ======================================================================*/ @@ -154,6 +151,7 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* component) struct icalcomponent_impl *new; icalproperty *p; icalcomponent *c; + pvl_elem itr; icalerror_check_arg_rv( (component!=0), "component"); @@ -164,20 +162,22 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* component) } - for(p = icalcomponent_get_first_property(old,ICAL_ANY_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(old,ICAL_ANY_PROPERTY)){ - - icalcomponent_add_property(new,icalproperty_new_clone(p)); - } + for( itr = pvl_head(old->properties); + itr != 0; + itr = pvl_next(itr)) + { + p = (icalproperty*)pvl_data(itr); + icalcomponent_add_property(new,icalproperty_new_clone(p)); + } - for(c = icalcomponent_get_first_component(old,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(old,ICAL_ANY_COMPONENT)){ - - icalcomponent_add_component(new,icalcomponent_new_clone(c)); - } + for( itr = pvl_head(old->components); + itr != 0; + itr = pvl_next(itr)) + { + c = (icalcomponent*)pvl_data(itr); + icalcomponent_add_component(new,icalcomponent_new_clone(c)); + } return new; @@ -242,6 +242,8 @@ icalcomponent_as_ical_string (icalcomponent* component) char* tmp_buf; size_t buf_size = 1024; char* buf_ptr = 0; + pvl_elem itr; + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; #ifdef ICAL_UNIX_NEWLINE char newline[] = "\n"; @@ -270,22 +272,28 @@ icalcomponent_as_ical_string (icalcomponent* component) icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); - for(p = icalcomponent_get_first_property(component,ICAL_ANY_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(component,ICAL_ANY_PROPERTY)){ - tmp_buf = icalproperty_as_ical_string(p); - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf); - } + for( itr = pvl_head(impl->properties); + itr != 0; + itr = pvl_next(itr)) + { + p = (icalproperty*)pvl_data(itr); + + icalerror_assert((p!=0),"Got a null property"); + tmp_buf = icalproperty_as_ical_string(p); + + icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf); + } - for(c = icalcomponent_get_first_component(component,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(component,ICAL_ANY_COMPONENT)){ + for( itr = pvl_head(impl->components); + itr != 0; + itr = pvl_next(itr)) + { + c = (icalcomponent*)pvl_data(itr); tmp_buf = icalcomponent_as_ical_string(c); - + icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf); } @@ -423,17 +431,23 @@ icalcomponent_remove_property (icalcomponent* component, icalproperty* property) } int -icalcomponent_count_properties (icalcomponent* component, icalproperty_kind kind) +icalcomponent_count_properties (icalcomponent* component, + icalproperty_kind kind) { int count=0; - icalproperty *p; + pvl_elem itr; + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; + icalerror_check_arg_rz( (component!=0), "component"); - for(p = icalcomponent_get_first_property(component,kind); - p != 0; - p = icalcomponent_get_next_property(component,kind)){ - - count++; + for( itr = pvl_head(impl->properties); + itr != 0; + itr = pvl_next(itr)) + { + if(kind == icalproperty_isa((icalproperty*)pvl_data(itr)) || + kind == ICAL_ANY_PROPERTY){ + count++; + } } @@ -545,30 +559,42 @@ icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child) if( pvl_data(itr) == (void*)child ){ if (impl->component_iterator == itr){ - /* impl->component_iterator = pvl_next(itr);*/ + /* Don't let the current iterator become invalid */ + + /* HACK. The semantics for this are troubling. */ + impl->component_iterator = + pvl_next(impl->component_iterator); + } pvl_remove( impl->components, itr); cimpl->parent = 0; + break; } } } int -icalcomponent_count_components (icalcomponent* component, icalcomponent_kind kind) +icalcomponent_count_components (icalcomponent* component, + icalcomponent_kind kind) { int count=0; - icalcomponent *c; + pvl_elem itr; + struct icalcomponent_impl *impl = + (struct iccalcomponent_impl*)component; + icalerror_check_arg_rz( (component!=0), "component"); - for(c = icalcomponent_get_first_component(component,kind); - c != 0; - c = icalcomponent_get_next_component(component,kind)){ - - count++; + for( itr = pvl_head(impl->components); + itr != 0; + itr = pvl_next(itr)) + { + if(kind == icalcomponent_isa((icalcomponent*)pvl_data(itr)) || + kind == ICAL_ANY_COMPONENT){ + count++; + } } - return count; } @@ -646,10 +672,14 @@ int icalcomponent_count_errors(icalcomponent* component) int errors = 0; icalproperty *p; icalcomponent *c; + pvl_elem itr; + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; - for(p = icalcomponent_get_first_property(component,ICAL_ANY_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(component,ICAL_ANY_PROPERTY)){ + for( itr = pvl_head(impl->properties); + itr != 0; + itr = pvl_next(itr)) + { + p = (icalproperty*)pvl_data(itr); if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY) { @@ -657,9 +687,12 @@ int icalcomponent_count_errors(icalcomponent* component) } } - for(c = icalcomponent_get_first_component(component,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(component,ICAL_ANY_COMPONENT)){ + + for( itr = pvl_head(impl->components); + itr != 0; + itr = pvl_next(itr)) + { + c = (icalcomponent*)pvl_data(itr); errors += icalcomponent_count_errors(c); @@ -671,30 +704,34 @@ int icalcomponent_count_errors(icalcomponent* component) void icalcomponent_strip_errors(icalcomponent* component) { - icalproperty *p, *next_p; + icalproperty *p; icalcomponent *c; + pvl_elem itr, next_itr; + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; - for(p = icalcomponent_get_first_property(component,ICAL_ANY_PROPERTY); - p != 0; - p = next_p){ - - next_p = icalcomponent_get_next_property(component,ICAL_ANY_PROPERTY); + for( itr = pvl_head(impl->properties); + itr != 0; + itr = next_itr) + { + p = (icalproperty*)pvl_data(itr); + next_itr = pvl_next(itr); if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY) { icalcomponent_remove_property(component,p); } } - - for(c = icalcomponent_get_first_component(component,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(component,ICAL_ANY_COMPONENT)){ - + + for( itr = pvl_head(impl->components); + itr != 0; + itr = pvl_next(itr)) + { + c = (icalcomponent*)pvl_data(itr); icalcomponent_strip_errors(c); } } - +/* Hack. This will change the state of the iterators */ void icalcomponent_convert_errors(icalcomponent* component) { icalproperty *p, *next_p; @@ -709,7 +746,6 @@ void icalcomponent_convert_errors(icalcomponent* component) if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY) { struct icalreqstattype rst; - char tmp[MAX_TMP]; icalparameter *param = icalproperty_get_first_parameter (p,ICAL_XLICERRORTYPE_PARAMETER); @@ -779,4 +815,111 @@ void icalcomponent_set_parent(icalcomponent* component, icalcomponent* parent) c->parent = parent; } +icalcompiter icalcompiter_null = {ICAL_NO_COMPONENT,0}; + +icalcompiter +icalcomponent_begin_component(icalcomponent* component,icalcomponent_kind kind) +{ + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; + icalcompiter itr; + pvl_elem i; + + itr.kind = kind; + + icalerror_check_arg_rz( (component!=0),"component"); + + for( i = pvl_head(impl->components); i != 0; i = pvl_next(itr.iter)) { + + icalcomponent *c = (icalcomponent*) pvl_data(i); + + if (icalcomponent_isa(c) == kind || kind == ICAL_ANY_COMPONENT) { + + itr.iter = i; + + return itr; + } + } + + return icalcompiter_null;; +} + +icalcompiter +icalcomponent_end_component(icalcomponent* component,icalcomponent_kind kind) +{ + struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component; + icalcompiter itr; + pvl_elem i; + + itr.kind = kind; + + icalerror_check_arg_rz( (component!=0),"component"); + + for( i = pvl_tail(impl->components); i != 0; i = pvl_prior(i)) { + + icalcomponent *c = (icalcomponent*) pvl_data(i); + + if (icalcomponent_isa(c) == kind || kind == ICAL_ANY_COMPONENT) { + + itr.iter = pvl_next(i); + + return itr; + } + } + + return icalcompiter_null;; +} + + +icalcomponent* icalcompiter_next(icalcompiter* i) +{ + if (i->iter == 0){ + return 0; + } + + for( i->iter = pvl_next(i->iter); + i->iter != 0; + i->iter = pvl_next(i->iter)) { + + icalcomponent *c = (icalcomponent*) pvl_data(i->iter); + + if (icalcomponent_isa(c) == i->kind + || i->kind == ICAL_ANY_COMPONENT) { + + return icalcompiter_deref(i);; + } + } + + return 0; + +} + +icalcomponent* icalcompiter_prior(icalcompiter* i) +{ + if (i->iter == 0){ + return 0; + } + + for( i->iter = pvl_prior(i->iter); + i->iter != 0; + i->iter = pvl_prior(i->iter)) { + + icalcomponent *c = (icalcomponent*) pvl_data(i->iter); + + if (icalcomponent_isa(c) == i->kind + || i->kind == ICAL_ANY_COMPONENT) { + + return icalcompiter_deref(i);; + } + } + return 0; + +} +icalcomponent* icalcompiter_deref(icalcompiter* i) +{ + if(i->iter ==0){ + return 0; + } + + return pvl_data(i->iter); +} diff --git a/libical/src/libical/icalcomponent.h b/libical/src/libical/icalcomponent.h index 8d9f22ca76..b0d1e33630 100644 --- a/libical/src/libical/icalcomponent.h +++ b/libical/src/libical/icalcomponent.h @@ -4,20 +4,19 @@ CREATOR: eric 20 March 1999 - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The original code is icalcomponent.h ======================================================================*/ @@ -28,9 +27,19 @@ #include "icalproperty.h" #include "icalvalue.h" #include "icalenums.h" /* defines icalcomponent_kind */ +#include "pvl.h" typedef void icalcomponent; +/* This is exposed so that callers will not have to allocate and + deallocate iterators. Pretend that you can't see it. */ +typedef struct icalcompiter +{ + icalcomponent_kind kind; + pvl_elem iter; + +} icalcompiter; + icalcomponent* icalcomponent_new(icalcomponent_kind kind); icalcomponent* icalcomponent_new_clone(icalcomponent* component); icalcomponent* icalcomponent_new_from_string(char* str); @@ -86,6 +95,20 @@ void icalcomponent_remove_component(icalcomponent* parent, int icalcomponent_count_components(icalcomponent* component, icalcomponent_kind kind); +/* Iteration Routines. There are two forms of iterators, internal and +external. The internal ones came first, and are almost completely +sufficient, but they fail badly when you want to construct a loop that +removes components from the container. + +The internal iterators are deprecated. */ + +/* Using external iterators */ +icalcompiter icalcomponent_begin_component(icalcomponent* component, + icalcomponent_kind kind); + +icalcompiter icalcomponent_end_component(icalcomponent* component, + icalcomponent_kind kind); + /* Iterate through components */ icalcomponent* icalcomponent_get_current_component (icalcomponent* component); @@ -94,6 +117,8 @@ icalcomponent* icalcomponent_get_first_component(icalcomponent* component, icalcomponent* icalcomponent_get_next_component(icalcomponent* component, icalcomponent_kind kind); + + /* Return a null-terminated array of icalproperties*/ icalproperty** icalcomponent_get_component(icalcomponent* component, icalproperty_kind kind); @@ -113,6 +138,14 @@ icalcomponent* icalcomponent_get_parent(icalcomponent* component); void icalcomponent_set_parent(icalcomponent* component, icalcomponent* parent); + + +/* External component iterator */ +icalcomponent* icalcompiter_next(icalcompiter* i); +icalcomponent* icalcompiter_prior(icalcompiter* i); +icalcomponent* icalcompiter_deref(icalcompiter* i); + + #endif /* !ICALCOMPONENT_H */ diff --git a/libical/src/libical/icalenums.c b/libical/src/libical/icalenums.c index 7f0aae6a0e..50d23c8d41 100644 --- a/libical/src/libical/icalenums.c +++ b/libical/src/libical/icalenums.c @@ -5,21 +5,19 @@ $Id$ + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + This program is free software; you can redistribute it and/or modify + it under the terms of either: - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ - The original author is Eric Busboom The original code is icalenum.c ======================================================================*/ @@ -33,7 +31,7 @@ struct icalproperty_kind_map { icalproperty_kind kind; - char name[20]; + char *name; }; static struct icalproperty_kind_map property_map[] = @@ -98,6 +96,10 @@ static struct icalproperty_kind_map property_map[] = /* libical private properties */ { ICAL_XLICERROR_PROPERTY,"X-LIC-ERROR"}, + { ICAL_XLICMIMECONTENTTYPE_PROPERTY,"X-LIC-MIME-CONTENT-TYPE"}, + { ICAL_XLICMIMEENCODING_PROPERTY,"X-LIC-MIME-ENCODING"}, + { ICAL_XLICMIMEOPTINFO_PROPERTY,"X-LIC-MIME-OPT-INFO"}, + { ICAL_XLICMIMECHARSET_PROPERTY,"X-LIC-MIME-CHARSET"}, { ICAL_XLICCLUSTERCOUNT_PROPERTY,"X-LIC-CLUSTERCOUNT"}, /* End of the list */ @@ -287,6 +289,7 @@ static struct icalcomponent_kind_map component_map[] = /* libical private components */ { ICAL_XLICINVALID_COMPONENT, "X-LIC-UNKNOWN" }, + { ICAL_XLICMIMEPART_COMPONENT, "X-LIC-MIME-PART" }, { ICAL_ANY_COMPONENT, "ANY" }, { ICAL_XROOT_COMPONENT, "XROOT" }, diff --git a/libical/src/libical/icalenums.h b/libical/src/libical/icalenums.h index ff7cee486e..ba3137803e 100644 --- a/libical/src/libical/icalenums.h +++ b/libical/src/libical/icalenums.h @@ -1,23 +1,23 @@ + /* -*- Mode: C -*-*/ /*====================================================================== FILE: icalenums.h - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ - The original author is Eric Busboom The original code is icalenums.h Contributions from: @@ -57,7 +57,10 @@ typedef enum icalcomponent_kind { ICAL_VQUERY_COMPONENT, ICAL_VCAR_COMPONENT, ICAL_VCOMMAND_COMPONENT, - ICAL_XLICINVALID_COMPONENT + ICAL_XLICINVALID_COMPONENT, + ICAL_XLICMIMEPART_COMPONENT /* a non-stardard component that mirrors + structure of MIME data */ + } icalcomponent_kind; /*********************************************************************** @@ -126,6 +129,12 @@ typedef enum icalproperty_kind { /* libical private properties */ ICAL_XLICERROR_PROPERTY, ICAL_XLICCLUSTERCOUNT_PROPERTY, + ICAL_XLICMIMECONTENTTYPE_PROPERTY, + ICAL_XLICMIMEENCODING_PROPERTY, + ICAL_XLICMIMECID_PROPERTY, + ICAL_XLICMIMEFILENAME_PROPERTY, + ICAL_XLICMIMECHARSET_PROPERTY, + ICAL_XLICMIMEOPTINFO_PROPERTY, ICAL_NO_PROPERTY /* This must be the last enum, for iteration */ @@ -323,7 +332,9 @@ typedef enum icalparameter_xlicerrortype { ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR, ICAL_XLICERRORTYPE_PROPERTYPARSEERROR, ICAL_XLICERRORTYPE_VALUEPARSEERROR, - ICAL_XLICERRORTYPE_INVALIDITIP + ICAL_XLICERRORTYPE_UNKVCALPROP, + ICAL_XLICERRORTYPE_INVALIDITIP, + ICAL_XLICERRORTYPE_MIMEPARSEERROR, } icalparameter_xlicerrortype; typedef enum icalparameter_xliccomparetype { @@ -359,17 +370,20 @@ typedef enum icalparameter_value { * Recurrances **********************************************************************/ - typedef enum icalrecurrencetype_frequency { - ICAL_NO_RECURRENCE, - ICAL_SECONDLY_RECURRENCE, - ICAL_MINUTELY_RECURRENCE, - ICAL_HOURLY_RECURRENCE, - ICAL_DAILY_RECURRENCE, - ICAL_WEEKLY_RECURRENCE, - ICAL_MONTHLY_RECURRENCE, - ICAL_YEARLY_RECURRENCE + /* These enums are used to index an array, so don't change the + order or the integers */ + + ICAL_SECONDLY_RECURRENCE=0, + ICAL_MINUTELY_RECURRENCE=1, + ICAL_HOURLY_RECURRENCE=2, + ICAL_DAILY_RECURRENCE=3, + ICAL_WEEKLY_RECURRENCE=4, + ICAL_MONTHLY_RECURRENCE=5, + ICAL_YEARLY_RECURRENCE=6, + ICAL_NO_RECURRENCE=7 + } icalrecurrencetype_frequency; typedef enum icalrecurrencetype_weekday diff --git a/libical/src/libical/icalerror.c b/libical/src/libical/icalerror.c index fb9e152b16..c7641da504 100644 --- a/libical/src/libical/icalerror.c +++ b/libical/src/libical/icalerror.c @@ -4,23 +4,23 @@ CREATOR: eric 16 May 1999 $Id$ + $Locker$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ - The original author is Eric Busboom The original code is icalerror.c ======================================================================*/ diff --git a/libical/src/libical/icalerror.h b/libical/src/libical/icalerror.h index 124699c21b..fbf6076dd6 100644 --- a/libical/src/libical/icalerror.h +++ b/libical/src/libical/icalerror.h @@ -6,20 +6,19 @@ $Id$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The original code is icalerror.h ======================================================================*/ @@ -122,6 +121,7 @@ typedef enum icalerrorenum { ICAL_USAGE_ERROR, ICAL_NO_ERROR, ICAL_MULTIPLEINCLUSION_ERROR, + ICAL_TIMEDOUT_ERROR, ICAL_UNKNOWN_ERROR /* Used for problems in input to icalerror_strerror()*/ } icalerrorenum; diff --git a/libical/src/libical/icalmemory.c b/libical/src/libical/icalmemory.c index 35544b14ee..e13c2c42ca 100644 --- a/libical/src/libical/icalmemory.c +++ b/libical/src/libical/icalmemory.c @@ -4,6 +4,7 @@ CREATOR: eric 30 June 1999 $Id$ + $Locker$ The contents of this file are subject to the Mozilla Public License @@ -16,12 +17,34 @@ the License for the specific language governing rights and limitations under the License. + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The Original Code is icalmemory.h - The Initial Developer of the Original Code is Eric Busboom - (C) COPYRIGHT 1999 The Software Studio. - http://www.softwarestudio.org + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + + The Initial Developer of the Original Code is Eric Busboom + + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ /* libical often passes strings back to the caller. To make these @@ -41,6 +64,9 @@ #include "config.h" #endif +#ifdef DMALLOC +#include "dmalloc.h" +#endif #include "icalmemory.h" #include "icalerror.h" @@ -52,18 +78,16 @@ #define BUFFER_RING_SIZE 25 #define MIN_BUFFER_SIZE 200 -void* buffer_ring[BUFFER_RING_SIZE+1]; -int buffer_pos = 0; +/* HACK. Not threadsafe */ +void* buffer_ring[BUFFER_RING_SIZE]; +int buffer_pos = -1; int initialized = 0; -/* Create a new temporary buffer on the ring. Libical owns these and wil deallocate them. */ -void* -icalmemory_tmp_buffer (size_t size) +/* Add an existing buffer to the buffer ring */ +void icalmemory_add_tmp_buffer(void* buf) { - void *rtrn; /* I don't think I need this -- I think static arrays are initialized to 0 as a standard part of C, but I am not sure. */ - if (initialized == 0){ int i; for(i=0; i BUFFER_RING_SIZE){ - buffer_pos = 0; + if( buf == 0){ + icalerror_set_errno(ICAL_NEWFAILED_ERROR); + return 0; } - return rtrn; + memset(buf,0,size); + + icalmemory_add_tmp_buffer(buf); + + return buf; } void icalmemory_free_ring() @@ -112,6 +151,8 @@ void icalmemory_free_ring() } + + /* Like strdup, but the buffer is on the ring. */ char* icalmemory_tmp_copy(char* str) @@ -124,6 +165,10 @@ icalmemory_tmp_copy(char* str) } +char* icalmemory_strdup(const char *s) +{ + return strdup(s); +} void icalmemory_free_tmp_buffer (void* buf) @@ -137,13 +182,18 @@ icalmemory_free_tmp_buffer (void* buf) } -/* These buffer routines create memory the old fashioned way -- so the caller will have to delocate the new memory */ +/* These buffer routines create memory the old fashioned way -- so the + caller will have to delocate the new memory */ void* icalmemory_new_buffer(size_t size) { - /* HACK. need to handle out of memory case */ void *b = malloc(size); + if( b == 0){ + icalerror_set_errno(ICAL_NEWFAILED_ERROR); + return 0; + } + memset(b,0,size); return b; @@ -151,9 +201,14 @@ void* icalmemory_new_buffer(size_t size) void* icalmemory_resize_buffer(void* buf, size_t size) { - /* HACK. need to handle out of memory case */ + void *b = realloc(buf, size); - return realloc(buf, size); + if( b == 0){ + icalerror_set_errno(ICAL_NEWFAILED_ERROR); + return 0; + } + + return b; } void icalmemory_free_buffer(void* buf) @@ -240,5 +295,5 @@ icalmemory_append_char(char** buf, char** pos, size_t* buf_size, **pos = ch; *pos += 1; - + **pos = 0; } diff --git a/libical/src/libical/icalmemory.h b/libical/src/libical/icalmemory.h index 26d22b7316..6c974cdc95 100644 --- a/libical/src/libical/icalmemory.h +++ b/libical/src/libical/icalmemory.h @@ -17,12 +17,34 @@ the License for the specific language governing rights and limitations under the License. + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The Original Code is icalmemory.h - The Initial Developer of the Original Code is Eric Busboom - (C) COPYRIGHT 1999 The Software Studio. - http://www.softwarestudio.org + This program is free software; you can redistribute it and/or modify + it under the terms of either: + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + + The Initial Developer of the Original Code is Eric Busboom + + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ #ifndef ICALMEMORY_H @@ -30,7 +52,8 @@ #include /* for size_t */ -/* Tmp buffers are managed by ical. References can be returned to the caller, although the caller will not own the memory. */ +/* Tmp buffers are managed by ical. References can be returned to the + caller, although the caller will not own the memory. */ void* icalmemory_tmp_buffer(size_t size); char* icalmemory_tmp_copy(char* str); @@ -70,6 +93,9 @@ void icalmemory_append_string(char** buf, char** pos, size_t* buf_size, void icalmemory_append_char(char** buf, char** pos, size_t* buf_size, char ch); +/* A wrapper around strdup */ +char* icalmemory_strdup(const char *s); + #endif /* !ICALMEMORY_H */ diff --git a/libical/src/libical/icalparameter.c b/libical/src/libical/icalparameter.c index cf37eb07b2..c77c223f1c 100644 --- a/libical/src/libical/icalparameter.c +++ b/libical/src/libical/icalparameter.c @@ -4,23 +4,23 @@ CREATOR: eric 09 May 1999 $Id$ + $Locker$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ - The original author is Eric Busboom The original code is icalderivedparameters.{c,h} Contributions from: @@ -114,7 +114,7 @@ icalparameter_new_clone(icalparameter* param) memcpy(new,old,sizeof(struct icalparameter_impl)); if (old->string != 0){ - new->string = strdup(old->string); + new->string = icalmemory_strdup(old->string); if (new->string == 0){ icalparameter_free(new); return 0; @@ -122,7 +122,7 @@ icalparameter_new_clone(icalparameter* param) } if (old->x_name != 0){ - new->x_name = strdup(old->x_name); + new->x_name = icalmemory_strdup(old->x_name); if (new->x_name == 0){ icalparameter_free(new); return 0; @@ -132,6 +132,116 @@ icalparameter_new_clone(icalparameter* param) return new; } +#if 0 + +struct param_string_map { + icalparameter_kind kind; + int val; /* Actually, union of several types of enums */ + char* str; +} param_string_map[] = +{ + {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_INDIVIDUAL,"INDIVIDUAL"}, + {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_GROUP,"GROUP"}, + {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_RESOURCE,"RESOURCE"}, + {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_ROOM,"ROOM"}, + {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_UNKNOWN,"UNKNOWN"}, + {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_FREE,"FREE"}, + {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSY,"BUSY"}, + {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSYUNAVAILABLE,"BUSYUNAVAILABLE"}, + {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSYTENTATIVE,"BUSYTENTATIVE"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_NEEDSACTION,"NEEDSACTION"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_ACCEPTED,"ACCEPTED"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DECLINED,"DECLINED"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_TENTATIVE,"TENTATIVE"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DELEGATED,"DELEGATED"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_COMPLETED,"COMPLETED"}, + {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_INPROCESS,"INPROCESS"}, + {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDPRIOR,"THISANDPRIOR"}, + {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDFUTURE,"THISANDFUTURE"}, + {ICAL_RELATED_PARAMETER,ICAL_RELATED_START,"START"}, + {ICAL_RELATED_PARAMETER,ICAL_RELATED_END,"END"}, + {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_PARENT,"PARENT"}, + {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_CHILD,"CHILD"}, + {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_SIBLING,"SIBLING"}, + {ICAL_ROLE_PARAMETER,ICAL_ROLE_CHAIR,"CHAIR"}, + {ICAL_RSVP_PARAMETER,ICAL_RSVP_PARAMETER,"TRUE"}, + {ICAL_RSVP_PARAMETER,ICAL_RSVP_PARAMETER,"FALSE"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_BINARY,"BINARY"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_BOOLEAN,"BOOLEAN"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_DATE,"DATE"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_DURATION,"DURATION"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_FLOAT,"FLOAT"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_INTEGER,"INTEGER"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_PERIOD,"PERIOD"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_RECUR,"RECUR"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_TEXT,"TEXT"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_TIME,"TIME"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_URI,"URI"}, + {ICAL_VALUE_PARAMETER,ICAL_VALUE_XNAME,"ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_COMPONENTPARSEERROR,"COMPONENT_PARSE_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PROPERTYPARSEERROR,"PROPERTY_PARSE_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR,"PARAMETER_NAME_PARSE_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR,"PARAMETER_VALUE_PARSE_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_VALUEPARSEERROR,"VALUE_PARSE_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_INVALIDITIP,"INVALID_ITIP"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_UNKVCALPROP,"UNKNOWN_VCAL_PROP_ERROR"}, + {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_MIMEPARSEERROR,"MIME_PARSE_ERROR"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_EQUAL,"EQUAL"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_NOTEQUAL,"NOTEQUAL"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESS,"LESS"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATER,"GREATER"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESSEQUAL,"LESSEQUAL"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATEREQUAL,"GREATEREQUAL"}, + {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_REGEX,"REGEX"}, + {ICAL_NO_PARAMETER,0,""}, + +}; + + +icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* val) +{ + int i =0; + icalparameter* param=0; + + icalerror_check_arg_rz((val!=0),"val"); + + switch(kind){ + case ICAL_SENTBY_PARAMETER: + case ICAL_TZID_PARAMETER: + case ICAL_X_PARAMETER: + case ICAL_FMTTYPE_PARAMETER: + case ICAL_LANGUAGE_PARAMETER: + case ICAL_MEMBER_PARAMETER: + case ICAL_DELEGATEDFROM_PARAMETER: + case ICAL_DELEGATEDTO_PARAMETER: + case ICAL_DIR_PARAMETER: + case ICAL_ALTREP_PARAMETER: + case ICAL_CN_PARAMETER: + { + if (impl->string == 0){ return no_parameter;} + strcpy(tend,impl->string);break; + break; + } + + case ICAL_NO_PARAMETER: + case ICAL_ANY_PARAMETER: + { + } + + default: { + /* All other types are enumerated */ + for(i = 0; param_string_map[i].kind != ICAL_NO_PARAMETER){ + if(kind == param_string_map[i].kind && + strcmp(val,param_string_map[i].str) == 0){ + + + } + } + } +} + +#endif + icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* val) { @@ -427,6 +537,12 @@ icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* val) else if(strcmp(val,"INVALID_ITIP") == 0){ param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP); } + else if(strcmp(val,"MIME_PARSE_ERROR") == 0){ + param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_MIMEPARSEERROR); + } + else if(strcmp(val,"UNKNOWN_VCAL_PROP_ERROR") == 0){ + param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_UNKVCALPROP); + } break; } @@ -839,6 +955,14 @@ icalparameter_as_ical_string (icalparameter* parameter) { strcpy(tend,"INVALID_ITIP");break; } + case ICAL_XLICERRORTYPE_UNKVCALPROP: + { + strcpy(tend,"UNKNOWN_VCAL_PROP_ERROR");break; + } + case ICAL_XLICERRORTYPE_MIMEPARSEERROR: + { + strcpy(tend,"MIME_PARSE_ERROR");break; + } } break; } @@ -969,7 +1093,7 @@ icalparameter_set_xname (icalparameter* param, char* v) free(impl->x_name); } - impl->x_name = strdup(v); + impl->x_name = icalmemory_strdup(v); if (impl->x_name == 0){ errno = ENOMEM; @@ -998,7 +1122,7 @@ icalparameter_set_xvalue (icalparameter* param, char* v) free(impl->string); } - impl->string = strdup(v); + impl->string = icalmemory_strdup(v); if (impl->string == 0){ errno = ENOMEM; @@ -1071,7 +1195,7 @@ void icalparameter_set_altrep(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* CN */ @@ -1107,7 +1231,7 @@ void icalparameter_set_cn(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* CUTYPE */ @@ -1184,7 +1308,7 @@ void icalparameter_set_delegatedfrom(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* DELEGATED-TO */ @@ -1220,7 +1344,7 @@ void icalparameter_set_delegatedto(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* DIR */ @@ -1256,7 +1380,7 @@ void icalparameter_set_dir(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* ENCODING */ @@ -1374,7 +1498,7 @@ void icalparameter_set_fmttype(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* LANGUAGE */ @@ -1410,7 +1534,7 @@ void icalparameter_set_language(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* MEMBER */ @@ -1446,7 +1570,7 @@ void icalparameter_set_member(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* PARTSTAT */ @@ -1719,7 +1843,7 @@ void icalparameter_set_sentby(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* TZID */ @@ -1755,7 +1879,7 @@ void icalparameter_set_tzid(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* VALUE */ @@ -1832,7 +1956,7 @@ void icalparameter_set_x(icalparameter* param, char* v) icalerror_check_arg_rv( (param!=0), "param"); icalerror_clear_errno(); - ((struct icalparameter_impl*)param)->string = strdup(v); + ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v); } /* X-LIC-ERRORTYPE */ diff --git a/libical/src/libical/icalparameter.h b/libical/src/libical/icalparameter.h index 174cae6f3f..ad97f34e58 100644 --- a/libical/src/libical/icalparameter.h +++ b/libical/src/libical/icalparameter.h @@ -9,20 +9,19 @@ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The original code is icalparam.h ======================================================================*/ diff --git a/libical/src/libical/icalparser.c b/libical/src/libical/icalparser.c index 3be754036a..b4563e23c9 100644 --- a/libical/src/libical/icalparser.c +++ b/libical/src/libical/icalparser.c @@ -4,6 +4,7 @@ CREATOR: eric 04 August 1999 $Id$ + $Locker$ The contents of this file are subject to the Mozilla Public License @@ -16,11 +17,21 @@ the License for the specific language governing rights and limitations under the License. - The Initial Developer of the Original Code is Eric Busboom - (C) COPYRIGHT 1999 The Software Studio. - http://www.softwarestudio.org + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + + The Initial Developer of the Original Code is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ #ifdef HAVE_CONFIG_H @@ -91,6 +102,7 @@ icalparser* icalparser_new() return (icalparser*)impl; } + void icalparser_free(icalparser* parser) { struct icalparser_impl* impl = (struct icalparser_impl*)parser; @@ -105,6 +117,8 @@ void icalparser_free(icalparser* parser) } pvl_free(impl->components); + + free(impl); } void icalparser_set_gen_data(icalparser* parser, void* data) @@ -115,7 +129,7 @@ void icalparser_set_gen_data(icalparser* parser, void* data) } -icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind, +icalvalue* icalvalue_new_From_string_with_error(icalvalue_kind kind, char* str, icalproperty **error); @@ -313,7 +327,6 @@ char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind) ) { /* The COMMA was followed by 'FREQ', is it a real seperator*/ /* Fall through */ - printf("%s\n",next); } else if (next != 0){ /* Not real, get the next COMMA */ p = next+1; @@ -404,7 +417,8 @@ char* icalparser_get_line(icalparser *parser, /* If the last position in the temp buffer is occupied, mark the buffer as full. The means we will do another read later, because the line is not finished */ - if (impl->temp[impl->tmp_buf_size-1] == 0){ + if (impl->temp[impl->tmp_buf_size-1] == 0 && + impl->temp[impl->tmp_buf_size-2] != '\n'){ impl->buffer_full = 1; } else { impl->buffer_full = 0; @@ -515,7 +529,6 @@ icalcomponent* icalparser_parse(icalparser *parser, do{ line = icalparser_get_line(parser, line_gen_func); - if ((c = icalparser_add_line(parser,line)) != 0){ if (root_component == 0){ /* Just one component */ @@ -538,6 +551,9 @@ icalcomponent* icalparser_parse(icalparser *parser, icalparser_claim(parser); } } + if(line != 0){ + free(line); + } } while ( line != 0); return root_component; @@ -568,7 +584,7 @@ icalcomponent* icalparser_add_line(icalparser* parser, /* Begin by getting the property name at the start of the line. The property name may end up being "BEGIN" or "END" in which case it - is not really a property, but the market for the start or end of + is not really a property, but the marker for the start or end of a component */ end = 0; @@ -591,8 +607,6 @@ icalcomponent* icalparser_add_line(icalparser* parser, /********************************************************************** * Handle begin and end of components **********************************************************************/ - - /* If the property name is BEGIN or END, we are actually starting or ending a new component */ diff --git a/libical/src/libical/icalparser.h b/libical/src/libical/icalparser.h index 25c07eca9f..161127379f 100644 --- a/libical/src/libical/icalparser.h +++ b/libical/src/libical/icalparser.h @@ -6,20 +6,19 @@ $Id$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The original code is icalparser.h ======================================================================*/ @@ -32,6 +31,16 @@ #include /* For FILE* */ typedef void* icalparser; + + +/*********************************************************************** + * Line-oriented parsing. + * + * Create a new parser via icalparse_new_parser, then add ines one at + * a time with icalparse_add_line(). icalparser_add_line() will return + * non-zero when it has finished with a component. + ***********************************************************************/ + typedef enum icalparser_state { ICALPARSER_ERROR, ICALPARSER_SUCCESS, @@ -40,6 +49,13 @@ typedef enum icalparser_state { ICALPARSER_IN_PROGRESS } icalparser_state; +icalparser* icalparser_new(); +icalcomponent* icalparser_add_line(icalparser* parser, char* str ); +icalcomponent* icalparser_claim(icalparser* parser); +icalcomponent* icalparser_clean(icalparser* parser); +icalparser_state icalparser_get_state(icalparser* parser); +void icalparser_free(icalparser* parser); + /*********************************************************************** * Message oriented parsing. icalparser_parse takes a string that @@ -51,25 +67,13 @@ typedef enum icalparser_state { icalcomponent* icalparser_parse(icalparser *parser, char* (*line_gen_func)(char *s, size_t size, void *d)); -/* A simple, and incorrect interface - can only return one component*/ -icalcomponent* icalparser_parse_string(char* str); +/* Set the data that icalparser_parse will give to the line_gen_func + as the parameter 'd'*/ +void icalparser_set_gen_data(icalparser* parser, void* data); -/*********************************************************************** - * Line-oriented parsing. - * - * Create a new parser via icalparse_new_parser, then add ines one at - * a time with icalparse_add_line(). icalparser_add_line() will return - * non-zero when it has finished with a component. - ***********************************************************************/ +icalcomponent* icalparser_parse_string(char* str); -icalparser* icalparser_new(); -void icalparser_set_gen_data(icalparser* parser, void* data); -icalcomponent* icalparser_add_line(icalparser* parser, char* str ); -icalcomponent* icalparser_claim(icalparser* parser); -icalcomponent* icalparser_clean(icalparser* parser); -icalparser_state icalparser_get_state(icalparser* parser); -void icalparser_free(icalparser* parser); /*********************************************************************** * Parser support functions @@ -81,14 +85,6 @@ icalvalue* icalparser_parse_value(icalvalue_kind kind, char* str, icalcomponent /* Given a line generator function, return a single iCal content line.*/ char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d)); - -/* a line_gen_function that returns lines from a string. To use it, - set string_line_generator_str to point to the input string, and set - string_line_generator_pos to 0. These globals make the routine not - thead-safe. */ - -extern char* string_line_generator_str; -extern char* string_line_generator_pos; char* string_line_generator(char *out, size_t buf_size, void *d); #endif /* !ICALPARSE_H */ diff --git a/libical/src/libical/icalproperty.c b/libical/src/libical/icalproperty.c index c3fe7c9073..1040215108 100644 --- a/libical/src/libical/icalproperty.c +++ b/libical/src/libical/icalproperty.c @@ -7,20 +7,19 @@ $Id$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ - The original author is Eric Busboom The original code is icalproperty.c ======================================================================*/ @@ -29,7 +28,7 @@ #include "config.h" #endif -#include /* For strdup, rindex */ +#include /* For icalmemory_strdup, rindex */ #include #include #include @@ -80,7 +79,7 @@ void icalproperty_add_parameters(struct icalproperty_impl *impl,va_list args) icalproperty_add_parameter((icalproperty*)impl, (icalparameter*)vp); } else { - abort(); + assert(0); } } @@ -138,7 +137,7 @@ icalproperty_new_clone(icalproperty* prop) if (old->x_name != 0) { - new->x_name = strdup(old->x_name); + new->x_name = icalmemory_strdup(old->x_name); if (new->x_name == 0) { icalproperty_free(new); @@ -269,6 +268,7 @@ icalproperty_as_ical_string (icalproperty* prop) icalerror_check_arg_rz( (prop!=0),"prop"); + /* Append property name */ if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){ @@ -315,8 +315,9 @@ icalproperty_as_ical_string (icalproperty* prop) value = icalproperty_get_value(prop); if (value != 0){ - icalmemory_append_string(&buf, &buf_ptr, &buf_size, - icalvalue_as_ical_string(icalproperty_get_value(prop))); + char *str = icalvalue_as_ical_string(value); + icalerror_assert((str !=0),"Could not get string representation of a value"); + icalmemory_append_string(&buf, &buf_ptr, &buf_size, str); } else { icalmemory_append_string(&buf, &buf_ptr, &buf_size,"ERROR: No Value"); @@ -479,7 +480,7 @@ void icalproperty_set_x_name(icalproperty* prop, char* name) free(impl->x_name); } - impl->x_name = strdup(name); + impl->x_name = icalmemory_strdup(name); if(impl->x_name == 0){ icalerror_set_errno(ICAL_ALLOCATION_ERROR); @@ -569,6 +570,59 @@ icalproperty_method icalproperty_get_method(icalproperty* prop) return icalvalue_get_method(value); } +/* X-LIC-MIMECID */ + +icalproperty* icalproperty_new_xlicmimecid(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecid((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimecid(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecid((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimecid(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimecid(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + /* LAST-MODIFIED */ icalproperty* icalproperty_new_lastmodified(struct icaltimetype v) @@ -1193,6 +1247,112 @@ char* icalproperty_get_contact(icalproperty* prop) return icalvalue_get_text(value); } +/* X-LIC-MIMECONTENTTYPE */ + +icalproperty* icalproperty_new_xlicmimecontenttype(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecontenttype((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimecontenttype(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecontenttype((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimecontenttype(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimecontenttype(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + +/* X-LIC-MIMEOPTINFO */ + +icalproperty* icalproperty_new_xlicmimeoptinfo(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimeoptinfo((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimeoptinfo(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimeoptinfo((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + /* RELATED-TO */ icalproperty* icalproperty_new_relatedto(char* v) @@ -1352,6 +1512,59 @@ char* icalproperty_get_comment(icalproperty* prop) return icalvalue_get_text(value); } +/* X-LIC-ERROR */ + +icalproperty* icalproperty_new_xlicerror(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicerror((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicerror(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicerror((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicerror(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_text(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicerror(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_text(value); +} + /* TRIGGER */ icalproperty* icalproperty_new_trigger(union icaltriggertype v) @@ -1402,27 +1615,27 @@ union icaltriggertype icalproperty_get_trigger(icalproperty* prop) return icalvalue_get_trigger(value); } -/* X-LIC-ERROR */ +/* CLASS */ -icalproperty* icalproperty_new_xlicerror(char* v) +icalproperty* icalproperty_new_class(char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); - icalproperty_set_xlicerror((icalproperty*)impl,v); + icalproperty_set_class((icalproperty*)impl,v); return (icalproperty*)impl; } -icalproperty* icalproperty_vanew_xlicerror(char* v, ...) +icalproperty* icalproperty_vanew_class(char* v, ...) { va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); - icalproperty_set_xlicerror((icalproperty*)impl,v); + icalproperty_set_class((icalproperty*)impl,v); va_start(args,v); icalproperty_add_parameters(impl, args); @@ -1431,7 +1644,7 @@ icalproperty* icalproperty_vanew_xlicerror(char* v, ...) return (icalproperty*)impl; } -void icalproperty_set_xlicerror(icalproperty* prop, char* v) +void icalproperty_set_class(icalproperty* prop, char* v) { icalvalue *value; @@ -1445,7 +1658,7 @@ void icalproperty_set_xlicerror(icalproperty* prop, char* v) } -char* icalproperty_get_xlicerror(icalproperty* prop) +char* icalproperty_get_class(icalproperty* prop) { icalvalue *value; icalerror_check_arg( (prop!=0),"prop"); @@ -1455,27 +1668,27 @@ char* icalproperty_get_xlicerror(icalproperty* prop) return icalvalue_get_text(value); } -/* CLASS */ +/* X */ -icalproperty* icalproperty_new_class(char* v) +icalproperty* icalproperty_new_x(char* v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); - icalproperty_set_class((icalproperty*)impl,v); + icalproperty_set_x((icalproperty*)impl,v); return (icalproperty*)impl; } -icalproperty* icalproperty_vanew_class(char* v, ...) +icalproperty* icalproperty_vanew_x(char* v, ...) { va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalerror_check_arg_rz( (v!=0),"v"); - icalproperty_set_class((icalproperty*)impl,v); + icalproperty_set_x((icalproperty*)impl,v); va_start(args,v); icalproperty_add_parameters(impl, args); @@ -1484,7 +1697,7 @@ icalproperty* icalproperty_vanew_class(char* v, ...) return (icalproperty*)impl; } -void icalproperty_set_class(icalproperty* prop, char* v) +void icalproperty_set_x(icalproperty* prop, char* v) { icalvalue *value; @@ -1498,7 +1711,7 @@ void icalproperty_set_class(icalproperty* prop, char* v) } -char* icalproperty_get_class(icalproperty* prop) +char* icalproperty_get_x(icalproperty* prop) { icalvalue *value; icalerror_check_arg( (prop!=0),"prop"); @@ -1611,6 +1824,59 @@ char* icalproperty_get_transp(icalproperty* prop) return icalvalue_get_text(value); } +/* X-LIC-MIMEENCODING */ + +icalproperty* icalproperty_new_xlicmimeencoding(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimeencoding((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimeencoding(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimeencoding((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimeencoding(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimeencoding(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + /* SEQUENCE */ icalproperty* icalproperty_new_sequence(int v) @@ -2432,6 +2698,59 @@ struct icalperiodtype icalproperty_get_rdate(icalproperty* prop) return icalvalue_get_datetimeperiod(value); } +/* X-LIC-MIMEFILENAME */ + +icalproperty* icalproperty_new_xlicmimefilename(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimefilename((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimefilename(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimefilename((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimefilename(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimefilename(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + /* URL */ icalproperty* icalproperty_new_url(char* v) @@ -2485,25 +2804,25 @@ char* icalproperty_get_url(icalproperty* prop) return icalvalue_get_uri(value); } -/* ATTACH */ +/* X-LIC-CLUSTERCOUNT */ -icalproperty* icalproperty_new_attach(struct icalattachtype v) +icalproperty* icalproperty_new_xlicclustercount(int v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); - icalproperty_set_attach((icalproperty*)impl,v); + icalproperty_set_xlicclustercount((icalproperty*)impl,v); return (icalproperty*)impl; } -icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...) +icalproperty* icalproperty_vanew_xlicclustercount(int v, ...) { va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); - icalproperty_set_attach((icalproperty*)impl,v); + icalproperty_set_xlicclustercount((icalproperty*)impl,v); va_start(args,v); icalproperty_add_parameters(impl, args); @@ -2512,48 +2831,48 @@ icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...) return (icalproperty*)impl; } -void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v) +void icalproperty_set_xlicclustercount(icalproperty* prop, int v) { icalvalue *value; icalerror_check_arg_rv( (prop!=0),"prop"); - value = icalvalue_new_attach(v); + value = icalvalue_new_integer(v); icalproperty_set_value(prop,value); } -struct icalattachtype icalproperty_get_attach(icalproperty* prop) +int icalproperty_get_xlicclustercount(icalproperty* prop) { icalvalue *value; icalerror_check_arg( (prop!=0),"prop"); value = icalproperty_get_value(prop); - return icalvalue_get_attach(value); + return icalvalue_get_integer(value); } -/* X-LIC-CLUSTERCOUNT */ +/* ATTACH */ -icalproperty* icalproperty_new_xlicclustercount(int v) +icalproperty* icalproperty_new_attach(struct icalattachtype v) { - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); - icalproperty_set_xlicclustercount((icalproperty*)impl,v); + icalproperty_set_attach((icalproperty*)impl,v); return (icalproperty*)impl; } -icalproperty* icalproperty_vanew_xlicclustercount(int v, ...) +icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...) { va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); - icalproperty_set_xlicclustercount((icalproperty*)impl,v); + icalproperty_set_attach((icalproperty*)impl,v); va_start(args,v); icalproperty_add_parameters(impl, args); @@ -2562,27 +2881,27 @@ icalproperty* icalproperty_vanew_xlicclustercount(int v, ...) return (icalproperty*)impl; } -void icalproperty_set_xlicclustercount(icalproperty* prop, int v) +void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v) { icalvalue *value; icalerror_check_arg_rv( (prop!=0),"prop"); - value = icalvalue_new_integer(v); + value = icalvalue_new_attach(v); icalproperty_set_value(prop,value); } -int icalproperty_get_xlicclustercount(icalproperty* prop) +struct icalattachtype icalproperty_get_attach(icalproperty* prop) { icalvalue *value; icalerror_check_arg( (prop!=0),"prop"); value = icalproperty_get_value(prop); - return icalvalue_get_integer(value); + return icalvalue_get_attach(value); } /* EXRULE */ @@ -2891,6 +3210,59 @@ struct icalgeotype icalproperty_get_geo(icalproperty* prop) return icalvalue_get_geo(value); } +/* X-LIC-MIMECHARSET */ + +icalproperty* icalproperty_new_xlicmimecharset(char* v) +{ + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecharset((icalproperty*)impl,v); + + return (icalproperty*)impl; +} + +icalproperty* icalproperty_vanew_xlicmimecharset(char* v, ...) +{ + va_list args; + struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); + icalerror_check_arg_rz( (v!=0),"v"); + + + icalproperty_set_xlicmimecharset((icalproperty*)impl,v); + + va_start(args,v); + icalproperty_add_parameters(impl, args); + va_end(args); + + return (icalproperty*)impl; +} + +void icalproperty_set_xlicmimecharset(icalproperty* prop, char* v) +{ + icalvalue *value; + + icalerror_check_arg_rv( (v!=0),"v"); + + icalerror_check_arg_rv( (prop!=0),"prop"); + + value = icalvalue_new_string(v); + + icalproperty_set_value(prop,value); + +} + +char* icalproperty_get_xlicmimecharset(icalproperty* prop) +{ + icalvalue *value; + icalerror_check_arg( (prop!=0),"prop"); + + value = icalproperty_get_value(prop); + + return icalvalue_get_string(value); +} + /* COMPLETED */ icalproperty* icalproperty_new_completed(struct icaltimetype v) diff --git a/libical/src/libical/icalproperty.h b/libical/src/libical/icalproperty.h index 2cd28fe179..278c4d533f 100644 --- a/libical/src/libical/icalproperty.h +++ b/libical/src/libical/icalproperty.h @@ -5,20 +5,7 @@ $Id$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ @@ -63,7 +50,6 @@ icalvalue* icalproperty_get_value(icalproperty* prop); void icalproperty_set_x_name(icalproperty* prop, char* name); char* icalproperty_get_x_name(icalproperty* prop); - /* Everything below this line is machine generated. Do not edit. */ /* METHOD */ @@ -72,6 +58,12 @@ icalproperty* icalproperty_vanew_method(icalproperty_method v, ...); void icalproperty_set_method(icalproperty* prop, icalproperty_method v); icalproperty_method icalproperty_get_method(icalproperty* prop); +/* X-LIC-MIMECID */ +icalproperty* icalproperty_new_xlicmimecid(char* v); +icalproperty* icalproperty_vanew_xlicmimecid(char* v, ...); +void icalproperty_set_xlicmimecid(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimecid(icalproperty* prop); + /* LAST-MODIFIED */ icalproperty* icalproperty_new_lastmodified(struct icaltimetype v); icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...); @@ -144,6 +136,18 @@ icalproperty* icalproperty_vanew_contact(char* v, ...); void icalproperty_set_contact(icalproperty* prop, char* v); char* icalproperty_get_contact(icalproperty* prop); +/* X-LIC-MIMECONTENTTYPE */ +icalproperty* icalproperty_new_xlicmimecontenttype(char* v); +icalproperty* icalproperty_vanew_xlicmimecontenttype(char* v, ...); +void icalproperty_set_xlicmimecontenttype(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimecontenttype(icalproperty* prop); + +/* X-LIC-MIMEOPTINFO */ +icalproperty* icalproperty_new_xlicmimeoptinfo(char* v); +icalproperty* icalproperty_vanew_xlicmimeoptinfo(char* v, ...); +void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop); + /* RELATED-TO */ icalproperty* icalproperty_new_relatedto(char* v); icalproperty* icalproperty_vanew_relatedto(char* v, ...); @@ -162,24 +166,30 @@ icalproperty* icalproperty_vanew_comment(char* v, ...); void icalproperty_set_comment(icalproperty* prop, char* v); char* icalproperty_get_comment(icalproperty* prop); -/* TRIGGER */ -icalproperty* icalproperty_new_trigger(union icaltriggertype v); -icalproperty* icalproperty_vanew_trigger(union icaltriggertype v, ...); -void icalproperty_set_trigger(icalproperty* prop, union icaltriggertype v); -union icaltriggertype icalproperty_get_trigger(icalproperty* prop); - /* X-LIC-ERROR */ icalproperty* icalproperty_new_xlicerror(char* v); icalproperty* icalproperty_vanew_xlicerror(char* v, ...); void icalproperty_set_xlicerror(icalproperty* prop, char* v); char* icalproperty_get_xlicerror(icalproperty* prop); +/* TRIGGER */ +icalproperty* icalproperty_new_trigger(union icaltriggertype v); +icalproperty* icalproperty_vanew_trigger(union icaltriggertype v, ...); +void icalproperty_set_trigger(icalproperty* prop, union icaltriggertype v); +union icaltriggertype icalproperty_get_trigger(icalproperty* prop); + /* CLASS */ icalproperty* icalproperty_new_class(char* v); icalproperty* icalproperty_vanew_class(char* v, ...); void icalproperty_set_class(icalproperty* prop, char* v); char* icalproperty_get_class(icalproperty* prop); +/* X */ +icalproperty* icalproperty_new_x(char* v); +icalproperty* icalproperty_vanew_x(char* v, ...); +void icalproperty_set_x(icalproperty* prop, char* v); +char* icalproperty_get_x(icalproperty* prop); + /* TZOFFSETTO */ icalproperty* icalproperty_new_tzoffsetto(int v); icalproperty* icalproperty_vanew_tzoffsetto(int v, ...); @@ -192,6 +202,12 @@ icalproperty* icalproperty_vanew_transp(char* v, ...); void icalproperty_set_transp(icalproperty* prop, char* v); char* icalproperty_get_transp(icalproperty* prop); +/* X-LIC-MIMEENCODING */ +icalproperty* icalproperty_new_xlicmimeencoding(char* v); +icalproperty* icalproperty_vanew_xlicmimeencoding(char* v, ...); +void icalproperty_set_xlicmimeencoding(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimeencoding(icalproperty* prop); + /* SEQUENCE */ icalproperty* icalproperty_new_sequence(int v); icalproperty* icalproperty_vanew_sequence(int v, ...); @@ -288,24 +304,30 @@ icalproperty* icalproperty_vanew_rdate(struct icalperiodtype v, ...); void icalproperty_set_rdate(icalproperty* prop, struct icalperiodtype v); struct icalperiodtype icalproperty_get_rdate(icalproperty* prop); +/* X-LIC-MIMEFILENAME */ +icalproperty* icalproperty_new_xlicmimefilename(char* v); +icalproperty* icalproperty_vanew_xlicmimefilename(char* v, ...); +void icalproperty_set_xlicmimefilename(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimefilename(icalproperty* prop); + /* URL */ icalproperty* icalproperty_new_url(char* v); icalproperty* icalproperty_vanew_url(char* v, ...); void icalproperty_set_url(icalproperty* prop, char* v); char* icalproperty_get_url(icalproperty* prop); -/* ATTACH */ -icalproperty* icalproperty_new_attach(struct icalattachtype v); -icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...); -void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v); -struct icalattachtype icalproperty_get_attach(icalproperty* prop); - /* X-LIC-CLUSTERCOUNT */ icalproperty* icalproperty_new_xlicclustercount(int v); icalproperty* icalproperty_vanew_xlicclustercount(int v, ...); void icalproperty_set_xlicclustercount(icalproperty* prop, int v); int icalproperty_get_xlicclustercount(icalproperty* prop); +/* ATTACH */ +icalproperty* icalproperty_new_attach(struct icalattachtype v); +icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...); +void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v); +struct icalattachtype icalproperty_get_attach(icalproperty* prop); + /* EXRULE */ icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v); icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...); @@ -342,6 +364,12 @@ icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...); void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v); struct icalgeotype icalproperty_get_geo(icalproperty* prop); +/* X-LIC-MIMECHARSET */ +icalproperty* icalproperty_new_xlicmimecharset(char* v); +icalproperty* icalproperty_vanew_xlicmimecharset(char* v, ...); +void icalproperty_set_xlicmimecharset(icalproperty* prop, char* v); +char* icalproperty_get_xlicmimecharset(icalproperty* prop); + /* COMPLETED */ icalproperty* icalproperty_new_completed(struct icaltimetype v); icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...); diff --git a/libical/src/libical/icalrestriction.c b/libical/src/libical/icalrestriction.c index 8371e87545..be0e292d28 100644 --- a/libical/src/libical/icalrestriction.c +++ b/libical/src/libical/icalrestriction.c @@ -2,20 +2,7 @@ /* ====================================================================== File: icalrestriction.c - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ #ifdef HAVE_CONFIG_H @@ -1466,7 +1453,7 @@ icalrestriction_property_record icalrestriction_property_records[] = { {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE} + {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE,0} }; icalrestriction_component_record icalrestriction_component_records[] = { {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0}, @@ -1596,5 +1583,5 @@ icalrestriction_component_record icalrestriction_component_records[] = { {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0}, {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0}, {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE} + {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE,0} }; diff --git a/libical/src/libical/icalrestriction.h b/libical/src/libical/icalrestriction.h index ca4beeea7b..12421d0f32 100644 --- a/libical/src/libical/icalrestriction.h +++ b/libical/src/libical/icalrestriction.h @@ -6,20 +6,19 @@ $Id$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The original code is icalrestriction.h Contributions from: diff --git a/libical/src/libical/icaltypes.c b/libical/src/libical/icaltypes.c index b60333887e..c7017eb2af 100644 --- a/libical/src/libical/icaltypes.c +++ b/libical/src/libical/icaltypes.c @@ -7,20 +7,19 @@ $Locker$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ - The original author is Eric Busboom The original code is icaltypes.c ======================================================================*/ @@ -31,9 +30,9 @@ #include "icaltypes.h" #include "icalerror.h" #include "icalmemory.h" -#include /* for malloc */ +#include /* for malloc and abs() */ #include /* for errno */ -#include /* for strdup */ +#include /* for icalmemory_strdup */ #include #include /* for SHRT_MAX */ @@ -106,9 +105,9 @@ void icalattachtype_set_url(struct icalattachtype* v, char* url) free (v->url); } - v->url = strdup(url); + v->url = icalmemory_strdup(url); - /* HACK This routine should do something if strdup returns NULL */ + /* HACK This routine should do something if icalmemory_strdup returns NULL */ } @@ -159,28 +158,6 @@ icalperiodtype_duration (struct icalperiodtype period); time_t icalperiodtype_end (struct icalperiodtype period); -struct icaltimetype -icaltimetype_from_timet(time_t v, int date) -{ - struct icaltimetype tt; - struct tm t; - time_t tm = time(&v); - -/* HACK Does not properly consider timezone */ - t = *(gmtime(&tm)); - - tt.second = t.tm_sec; - tt.minute = t.tm_min; - tt.hour = t.tm_hour; - tt.day = t.tm_mday; - tt.month = t.tm_mon + 1; - tt.year = t.tm_year+ 1900; - - tt.is_utc = 1; - tt.is_date = date; - - return tt; -} /* From Russel Steinthal */ time_t icaldurationtype_as_timet(struct icaldurationtype dur) @@ -210,7 +187,7 @@ struct icaldurationtype icaldurationtype_from_timet(time_t t) return dur; } - + void icalrecurrencetype_clear(struct icalrecurrencetype *recur) { memset(recur,ICAL_RECURRENCE_ARRAY_MAX_BYTE, @@ -218,16 +195,34 @@ void icalrecurrencetype_clear(struct icalrecurrencetype *recur) recur->week_start = ICAL_NO_WEEKDAY; recur->freq = ICAL_NO_RECURRENCE; - recur->interval = 0; - recur->until.year = 0; + recur->interval = 1; + memset(&(recur->until),0,sizeof(struct icaltimetype)); recur->count = 0; } +/* The 'day' element of icalrecurrencetype_weekday is encoded to allow +reporesentation of both the day of the week ( Monday, Tueday), but +also the Nth day of the week ( First tuesday of the month, last +thursday of the year) These routines decode the day values. + +The day's position in the period ( Nth-ness) and the numerical value +of the day are encoded together as: pos*7 + dow + */ + +enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day) +{ + return abs(day)%8; +} + +short icalrecurrencetype_day_position(short day) +{ + return (day-icalrecurrencetype_day_day_of_week(day))/8; +} + struct icalreqstattype icalreqstattype_from_string(char* str) { char *p1,*p2; - size_t len; struct icalreqstattype stat; int major, minor; @@ -235,7 +230,6 @@ struct icalreqstattype icalreqstattype_from_string(char* str) stat.code = ICAL_UNKNOWN_STATUS; stat.debug = 0; - stat.desc = 0; /* Get the status numbers */ @@ -278,7 +272,6 @@ struct icalreqstattype icalreqstattype_from_string(char* str) char* icalreqstattype_as_string(struct icalreqstattype stat) { - char format[20]; char *temp; temp = (char*)icalmemory_tmp_buffer(TEMP_MAX); diff --git a/libical/src/libical/icaltypes.h b/libical/src/libical/icaltypes.h index 77a67fae80..1130ab2457 100644 --- a/libical/src/libical/icaltypes.h +++ b/libical/src/libical/icaltypes.h @@ -4,20 +4,19 @@ CREATOR: eric 20 March 1999 - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The original code is icaltypes.h ======================================================================*/ @@ -27,6 +26,7 @@ #include #include "icalenums.h" /* for recurrence enums */ +#include "icaltime.h" /* This type type should probably be an opaque type... */ struct icalattachtype @@ -67,21 +67,6 @@ struct icalgeotype float lon; }; -struct icaltimetype -{ - int year; - int month; - int day; - int hour; - int minute; - int second; - - int is_utc; /* 1-> time is in UTC timezone */ - - int is_date; /* 1 -> interpret this as date. */ -}; - -struct icaltimetype icaltimetype_from_timet(time_t v, int is_date); /* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of @@ -112,7 +97,7 @@ struct icalrecurrencetype short by_second[61]; short by_minute[61]; short by_hour[25]; - short by_day[8]; + short by_day[8]; /* Encoded value, see below */ short by_month_day[32]; short by_year_day[367]; short by_week_no[54]; @@ -123,6 +108,17 @@ struct icalrecurrencetype void icalrecurrencetype_clear(struct icalrecurrencetype *r); +/* The 'day' element of icalrecurrencetype_weekday is encoded to allow +reporesentation of both the day of the week ( Monday, Tueday), but +also the Nth day of the week ( First tuesday of the month, last +thursday of the year) These routines decode the day values */ + +/* 1 == Monday, etc. */ +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); + struct icaldurationtype { unsigned int days; @@ -171,7 +167,7 @@ operating on a the value of a request_status property. */ struct icalreqstattype { - icalrequeststatus code; + icalrequeststatus code; char* desc; char* debug; }; diff --git a/libical/src/libical/icalvalue.c b/libical/src/libical/icalvalue.c index 79eb8d827a..db0e58efe8 100644 --- a/libical/src/libical/icalvalue.c +++ b/libical/src/libical/icalvalue.c @@ -5,21 +5,19 @@ $Id$ + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org + This program is free software; you can redistribute it and/or modify + it under the terms of either: - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ - The original author is Eric Busboom The original code is icalvalue.c Contributions from: @@ -49,7 +47,7 @@ #include /* for SHRT_MAX */ #if _MAC_OS_ -#include "strdup.h" +#include "icalmemory_strdup.h" #endif #define TMP_BUF_SIZE 1024 @@ -88,8 +86,10 @@ struct icalvalue_impl { /*struct icaltimetype v_datetime;*/ /*struct icaltimetype v_datetimedate;*/ - /* struct icalrecurrencetype was once a value in this - union, but it contributes 2000 bytes to every*/ + /* struct icalrecurrencetype was once included + directly ( not referenced ) in this union, but it + contributes 2000 bytes to every value, so now it is + a reference*/ struct icalrecurrencetype *v_recur; union icaltriggertype v_trigger; @@ -159,7 +159,7 @@ icalvalue* icalvalue_new_clone(icalvalue* value){ case ICAL_URI_VALUE: { if (old->data.v_string != 0) { - new->data.v_string=strdup(old->data.v_string); + new->data.v_string=icalmemory_strdup(old->data.v_string); if ( new->data.v_string == 0 ) { return 0; @@ -195,7 +195,7 @@ icalvalue* icalvalue_new_clone(icalvalue* value){ return new; } -char* strdup_and_dequote(char* str) +char* icalmemory_strdup_and_dequote(char* str) { char* p; char* out = (char*)malloc(sizeof(char) * strlen(str) +1); @@ -343,7 +343,7 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,char* str,ic case ICAL_TEXT_VALUE: { - char* dequoted_str = strdup_and_dequote(str); + char* dequoted_str = icalmemory_strdup_and_dequote(str); value = icalvalue_new_text(dequoted_str); free(dequoted_str); break; @@ -663,8 +663,11 @@ char* icalvalue_recur_as_ical_string(icalvalue* value) for(i=0; i< limit && array[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){ if (j == 3) { /* BYDAY */ - icalmemory_append_string(&str,&str_p,&buf_sz, - icalenum_weekday_to_string(array[i])); + short dow = icalrecurrencetype_day_day_of_week(array[i]); + char *daystr = icalenum_weekday_to_string(dow); + + /* HACK, does not correctly handle the integer value */ + icalmemory_append_string(&str,&str_p,&buf_sz,daystr); } else { sprintf(temp,"%d",array[i]); icalmemory_append_string(&str,&str_p,&buf_sz, temp); @@ -1369,6 +1372,7 @@ icalvalue_set_attach(icalvalue* value, struct icalattachtype v) icalerror_check_value_type(value, ICAL_ATTACH_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_attach = v; } @@ -1405,6 +1409,8 @@ icalvalue_set_binary(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_BINARY_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ @@ -1444,6 +1450,7 @@ icalvalue_set_boolean(icalvalue* value, int v) icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_int = v; } @@ -1480,6 +1487,8 @@ icalvalue_set_caladdress(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ @@ -1519,6 +1528,7 @@ icalvalue_set_date(icalvalue* value, struct icaltimetype v) icalerror_check_value_type(value, ICAL_DATE_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_time = v; } @@ -1553,6 +1563,7 @@ icalvalue_set_datetime(icalvalue* value, struct icaltimetype v) icalerror_check_value_type(value, ICAL_DATETIME_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_time = v; } @@ -1587,6 +1598,7 @@ icalvalue_set_datetimedate(icalvalue* value, struct icaltimetype v) icalerror_check_value_type(value, ICAL_DATETIMEDATE_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_time = v; } @@ -1621,6 +1633,7 @@ icalvalue_set_datetimeperiod(icalvalue* value, struct icalperiodtype v) icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_period = v; } @@ -1655,6 +1668,7 @@ icalvalue_set_duration(icalvalue* value, struct icaldurationtype v) icalerror_check_value_type(value, ICAL_DURATION_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_duration = v; } @@ -1689,6 +1703,7 @@ icalvalue_set_float(icalvalue* value, float v) icalerror_check_value_type(value, ICAL_FLOAT_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_float = v; } @@ -1723,6 +1738,7 @@ icalvalue_set_geo(icalvalue* value, struct icalgeotype v) icalerror_check_value_type(value, ICAL_GEO_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_geo = v; } @@ -1757,6 +1773,7 @@ icalvalue_set_integer(icalvalue* value, int v) icalerror_check_value_type(value, ICAL_INTEGER_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_int = v; } @@ -1791,6 +1808,7 @@ icalvalue_set_method(icalvalue* value, icalproperty_method v) icalerror_check_value_type(value, ICAL_METHOD_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_method = v; } @@ -1825,6 +1843,7 @@ icalvalue_set_period(icalvalue* value, struct icalperiodtype v) icalerror_check_value_type(value, ICAL_PERIOD_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_period = v; } @@ -1837,7 +1856,6 @@ icalvalue_get_period(icalvalue* value) return ((struct icalvalue_impl*)value)->data.v_period; } - icalvalue* icalvalue_new_string (char* v) { @@ -1861,6 +1879,8 @@ icalvalue_set_string(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_STRING_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ @@ -1878,6 +1898,7 @@ icalvalue_get_string(icalvalue* value) return ((struct icalvalue_impl*)value)->data.v_string; } + icalvalue* icalvalue_new_text (char* v) { @@ -1901,6 +1922,8 @@ icalvalue_set_text(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_TEXT_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ @@ -1940,6 +1963,7 @@ icalvalue_set_time(icalvalue* value, struct icaltimetype v) icalerror_check_value_type(value, ICAL_TIME_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_time = v; } @@ -1974,6 +1998,7 @@ icalvalue_set_trigger(icalvalue* value, union icaltriggertype v) icalerror_check_value_type(value, ICAL_TRIGGER_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_trigger = v; } @@ -2010,6 +2035,8 @@ icalvalue_set_uri(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_URI_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ @@ -2049,6 +2076,7 @@ icalvalue_set_utcoffset(icalvalue* value, int v) icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE); impl = (struct icalvalue_impl*)value; + impl->data.v_int = v; } @@ -2085,6 +2113,8 @@ icalvalue_set_query(icalvalue* value, char* v) icalerror_check_value_type(value, ICAL_QUERY_VALUE); impl = (struct icalvalue_impl*)value; + if(impl->data.v_string!=0) {free(impl->data.v_string);} + impl->data.v_string = strdup(v); if (impl->data.v_string == 0){ diff --git a/libical/src/libical/icalvalue.h b/libical/src/libical/icalvalue.h index ec7457d6aa..18c15abaf4 100644 --- a/libical/src/libical/icalvalue.h +++ b/libical/src/libical/icalvalue.h @@ -9,20 +9,19 @@ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The original code is icalvalue.h ======================================================================*/ diff --git a/libical/src/libical/icalyacc.c b/libical/src/libical/icalyacc.c index 46de31370d..04999747db 100644 --- a/libical/src/libical/icalyacc.c +++ b/libical/src/libical/icalyacc.c @@ -145,20 +145,19 @@ $Id$ $Locker$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The original code is icalitip.y @@ -189,6 +188,7 @@ struct icaldurationtype duration; struct icalrecurrencetype recur; short skiplist[367]; short skippos; +int dow_pos; void copy_list(short* array, size_t size); void clear_recur(); @@ -207,7 +207,7 @@ void ical_yy_error(char *s); /* Don't know why I need this.... */ VALUEs, that is, ) correctly. */ -#line 75 "icalyacc.y" +#line 76 "icalyacc.y" typedef union { float v_float; int v_int; @@ -274,7 +274,7 @@ typedef union { -#define YYFINAL 135 +#define YYFINAL 137 #define YYFLAG -32768 #define YYNTBASE 141 @@ -329,10 +329,10 @@ static const short yyprhs[] = { 0, 42, 45, 48, 51, 54, 57, 61, 64, 68, 71, 74, 75, 77, 79, 83, 87, 91, 101, 108, 112, 116, 120, 124, 128, 132, 136, 138, 140, 142, 144, - 146, 148, 150, 152, 155, 159, 161, 165, 169, 173, - 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, - 217, 221, 225, 229, 233, 237, 241, 245, 246, 250, - 253, 255, 257, 261 + 146, 148, 150, 152, 155, 159, 164, 166, 170, 174, + 178, 182, 186, 190, 194, 198, 202, 206, 210, 214, + 218, 222, 226, 230, 234, 238, 242, 246, 250, 251, + 255, 258, 260, 262, 266 }; static const short yyrhs[] = { 142, @@ -351,33 +351,33 @@ static const short yyrhs[] = { 142, 8, 26, 0, 16, 8, 30, 0, 16, 8, 28, 0, 16, 8, 32, 0, 39, 0, 37, 0, 40, 0, 41, 0, 42, 0, 43, 0, 38, 0, 159, - 0, 3, 159, 0, 160, 11, 159, 0, 3, 0, - 161, 11, 3, 0, 33, 8, 3, 0, 36, 8, - 39, 0, 36, 8, 37, 0, 36, 8, 40, 0, - 36, 8, 41, 0, 36, 8, 42, 0, 36, 8, - 43, 0, 36, 8, 38, 0, 22, 8, 161, 0, - 19, 8, 161, 0, 18, 8, 161, 0, 17, 8, - 160, 0, 20, 8, 161, 0, 21, 8, 161, 0, - 25, 8, 161, 0, 24, 8, 161, 0, 23, 8, - 161, 0, 35, 8, 147, 0, 35, 8, 144, 0, - 34, 8, 3, 0, 0, 163, 12, 162, 0, 158, - 163, 0, 137, 0, 138, 0, 165, 4, 4, 0, - 165, 4, 4, 4, 0 + 0, 3, 159, 0, 160, 11, 159, 0, 160, 11, + 3, 159, 0, 3, 0, 161, 11, 3, 0, 33, + 8, 3, 0, 36, 8, 39, 0, 36, 8, 37, + 0, 36, 8, 40, 0, 36, 8, 41, 0, 36, + 8, 42, 0, 36, 8, 43, 0, 36, 8, 38, + 0, 22, 8, 161, 0, 19, 8, 161, 0, 18, + 8, 161, 0, 17, 8, 160, 0, 20, 8, 161, + 0, 21, 8, 161, 0, 25, 8, 161, 0, 24, + 8, 161, 0, 23, 8, 161, 0, 35, 8, 147, + 0, 35, 8, 144, 0, 34, 8, 3, 0, 0, + 163, 12, 162, 0, 158, 163, 0, 137, 0, 138, + 0, 165, 4, 4, 0, 165, 4, 4, 4, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 158, 160, 161, 162, 163, 164, 165, 166, 167, 173, - 175, 178, 181, 196, 198, 201, 203, 205, 221, 222, - 224, 229, 232, 235, 239, 243, 248, 252, 257, 262, - 267, 270, 273, 277, 282, 287, 296, 317, 349, 351, - 352, 353, 354, 355, 356, 360, 362, 363, 364, 365, - 366, 367, 371, 373, 374, 377, 379, 382, 384, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 403, 406, 410, 412, 414, - 422, 423, 425, 431 + 159, 161, 162, 163, 164, 165, 166, 167, 168, 174, + 176, 179, 182, 197, 199, 202, 204, 206, 222, 223, + 225, 230, 233, 236, 240, 244, 249, 253, 258, 263, + 268, 271, 274, 278, 283, 288, 297, 318, 350, 352, + 353, 354, 355, 356, 357, 361, 364, 366, 368, 370, + 372, 374, 379, 381, 382, 383, 386, 388, 391, 393, + 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 412, 415, 419, 421, + 423, 431, 432, 434, 440 }; #endif @@ -415,10 +415,10 @@ static const short yyr1[] = { 0, 149, 150, 150, 150, 151, 151, 152, 152, 153, 154, 155, 155, 155, 156, 156, 156, 157, 157, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, - 159, 159, 160, 160, 160, 161, 161, 162, 162, 162, + 159, 159, 160, 160, 160, 160, 161, 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 163, 163, 164, - 165, 165, 166, 166 + 162, 162, 162, 162, 162, 162, 162, 162, 163, 163, + 164, 165, 165, 166, 166 }; static const short yyr2[] = { 0, @@ -427,55 +427,55 @@ static const short yyr2[] = { 0, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 0, 1, 1, 3, 3, 3, 9, 6, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 3, 1, 3, 3, 3, 3, + 1, 1, 1, 2, 3, 4, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 0, 3, 2, - 1, 1, 3, 4 + 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, + 2, 1, 1, 3, 4 }; static const short yydefact[] = { 0, 9, 13, 11, 12, 0, 10, 32, 33, 1, 2, - 3, 4, 0, 5, 6, 78, 7, 0, 8, 0, - 0, 0, 80, 0, 14, 42, 40, 44, 39, 43, - 41, 45, 0, 0, 34, 36, 35, 19, 0, 83, + 3, 4, 0, 5, 6, 79, 7, 0, 8, 0, + 0, 0, 81, 0, 14, 42, 40, 44, 39, 43, + 41, 45, 0, 0, 34, 36, 35, 19, 0, 84, 15, 18, 21, 30, 0, 22, 23, 24, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 79, 84, 31, 25, 27, 29, 0, 0, + 0, 0, 80, 85, 31, 25, 27, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 33, 38, 0, 26, 0, 28, 0, - 47, 52, 46, 48, 49, 50, 51, 53, 69, 56, - 68, 67, 70, 71, 66, 74, 73, 72, 58, 77, - 13, 76, 75, 60, 65, 59, 61, 62, 63, 64, - 0, 54, 0, 0, 0, 16, 55, 57, 14, 17, - 37, 18, 0, 0, 0 + 47, 52, 46, 48, 49, 50, 51, 53, 70, 57, + 69, 68, 71, 72, 67, 75, 74, 73, 59, 78, + 13, 77, 76, 61, 66, 60, 62, 63, 64, 65, + 0, 54, 0, 0, 0, 16, 0, 55, 58, 14, + 17, 37, 56, 18, 0, 0, 0 }; -static const short yydefgoto[] = { 133, - 9, 10, 11, 42, 131, 12, 35, 36, 37, 46, +static const short yydefgoto[] = { 135, + 9, 10, 11, 42, 132, 12, 35, 36, 37, 46, 47, 48, 38, 13, 14, 15, 16, 98, 99, 101, 63, 23, 17, 18, 19 }; static const short yypact[] = { -1, --32768, -123,-32768,-32768, 1,-32768, 3, 6,-32768,-32768, --32768,-32768, -127,-32768,-32768,-32768,-32768, 64,-32768, 66, - -10, -2, 58, 67, -58,-32768,-32768,-32768,-32768,-32768, --32768,-32768, -128, 70,-32768,-32768,-32768, -55, 28, 71, --32768, -64,-32768,-32768, -68,-32768,-32768,-32768,-32768, 69, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83,-32768,-32768, 2, 89, 90,-32768, 0, 91, - 91, 91, 91, 91, 91, 91, 91, 92, 93, 94, - -14, -51,-32768,-32768,-32768, -36,-32768, -56,-32768, -7, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 88,-32768, - 95, 95, 95, 95, 95, 95, 95, 95,-32768,-32768, - -29,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 98,-32768, -7, 99, 100, -26,-32768,-32768, -58,-32768, --32768,-32768, 105, 107,-32768 +-32768, -123,-32768,-32768, 1,-32768, 3, 8,-32768,-32768, +-32768,-32768, -122,-32768,-32768,-32768,-32768, 12,-32768, 33, + -7, -2, 40, 49, -119,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, -128, 51,-32768,-32768,-32768, -46, 39, 80, +-32768, -55,-32768,-32768, -100,-32768,-32768,-32768,-32768, 78, + 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91,-32768,-32768, 2, 97, 98,-32768, 0, 99, + 99, 99, 99, 99, 99, 99, 99, 100, 101, 102, + -11, -41,-32768,-32768,-32768, -28,-32768, -27,-32768, 28, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 96,-32768, + 103, 103, 103, 103, 103, 103, 103, 103,-32768,-32768, + -20,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 107,-32768, 7, 108, 109, -17, 28,-32768,-32768, -119, +-32768,-32768,-32768,-32768, 115, 116,-32768 }; static const short yypgoto[] = {-32768, --32768,-32768, 29, -21,-32768, 30,-32768,-32768, 84,-32768, - 45, 46,-32768,-32768, 47,-32768,-32768, -79,-32768, -17, +-32768,-32768, 37, -12,-32768, 41,-32768,-32768, 93,-32768, + 53, 55,-32768,-32768, 58,-32768,-32768, -72,-32768, 5, -32768,-32768,-32768,-32768,-32768 }; @@ -484,37 +484,37 @@ static const short yypgoto[] = {-32768, static const short yytable[] = { 1, - 33, 2, 90, 43, 82, 20, -81, 44, 21, -82, - 122, 22, 3, 4, 5, 26, 27, 28, 29, 30, - 31, 32, 114, 115, 116, 117, 118, 119, 120, 91, - 92, 93, 94, 95, 96, 97, 91, 92, 93, 94, - 95, 96, 97, 127, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 102, 103, 104, 105, 106, 107, 108, - 59, 60, 61, 62, 66, 67, 68, 24, 25, 39, - 40, 41, 45, 34, 64, 65, 69, 121, 68, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 86, 88, 100, 109, 110, 111, 67, 123, 125, - 126, 128, 129, 130, 134, 124, 135, 132, 112, 113, - 87, 85, 89, 0, 0, 0, 0, 0, 0, 0, - 0, 49, 0, 0, 0, 0, 34, 0, 0, 6, - 0, 0, 0, 0, 0, 7, 8, -31, 83, 84 + 33, 2, 90, 43, 82, 20, -82, 44, 21, 127, + 41, -83, 3, 4, 5, 24, 22, 122, 26, 27, + 28, 29, 30, 31, 32, 114, 115, 116, 117, 118, + 119, 120, 66, 67, 68, 25, 91, 92, 93, 94, + 95, 96, 97, 91, 92, 93, 94, 95, 96, 97, + 128, 39, 40, 45, 133, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 91, 92, 93, 94, 95, 96, + 97, 59, 60, 61, 62, 102, 103, 104, 105, 106, + 107, 108, 34, 64, 65, 69, 70, 121, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, + 88, 100, 109, 110, 111, 67, 123, 68, 125, 126, + 129, 130, 131, 124, 136, 137, 112, 134, 87, 0, + 113, 89, 85, 0, 0, 0, 34, 0, 0, 6, + 49, 0, 0, 0, 0, 7, 8, -31, 83, 84 }; static const short yycheck[] = { 1, - 3, 3, 3, 132, 3, 129, 4, 136, 8, 4, - 90, 139, 14, 15, 16, 26, 27, 28, 29, 30, - 31, 32, 37, 38, 39, 40, 41, 42, 43, 37, - 38, 39, 40, 41, 42, 43, 37, 38, 39, 40, - 41, 42, 43, 123, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 71, 72, 73, 74, 75, 76, 77, - 33, 34, 35, 36, 133, 134, 135, 4, 3, 12, - 4, 130, 3, 129, 4, 140, 8, 129, 135, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 3, 3, 3, 3, 3, 3, 134, 11, 129, - 3, 3, 3, 130, 0, 11, 0, 129, 80, 80, - 66, 65, 67, -1, -1, -1, -1, -1, -1, -1, - -1, 38, -1, -1, -1, -1, 129, -1, -1, 131, - -1, -1, -1, -1, -1, 137, 138, 139, 137, 138 + 3, 3, 3, 132, 3, 129, 4, 136, 8, 3, + 130, 4, 14, 15, 16, 4, 139, 90, 26, 27, + 28, 29, 30, 31, 32, 37, 38, 39, 40, 41, + 42, 43, 133, 134, 135, 3, 37, 38, 39, 40, + 41, 42, 43, 37, 38, 39, 40, 41, 42, 43, + 123, 12, 4, 3, 127, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 37, 38, 39, 40, 41, 42, + 43, 33, 34, 35, 36, 71, 72, 73, 74, 75, + 76, 77, 129, 4, 140, 8, 8, 129, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, + 3, 3, 3, 3, 3, 134, 11, 135, 129, 3, + 3, 3, 130, 11, 0, 0, 80, 130, 66, -1, + 80, 67, 65, -1, -1, -1, 129, -1, -1, 131, + 38, -1, -1, -1, -1, 137, 138, 139, 137, 138 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/lib/bison.simple" @@ -1060,7 +1060,7 @@ yyreduce: switch (yyn) { case 9: -#line 167 "icalyacc.y" +#line 168 "icalyacc.y" { icalparser_yy_value = 0; icalparser_clear_flex_input(); @@ -1068,15 +1068,15 @@ case 9: ; break;} case 11: -#line 177 "icalyacc.y" +#line 178 "icalyacc.y" { icalparser_yy_value = icalvalue_new_boolean(1); ; break;} case 12: -#line 179 "icalyacc.y" +#line 180 "icalyacc.y" { icalparser_yy_value = icalvalue_new_boolean(0); ; break;} case 13: -#line 182 "icalyacc.y" +#line 183 "icalyacc.y" { struct icaltimetype stm; @@ -1092,23 +1092,23 @@ case 13: ; break;} case 14: -#line 197 "icalyacc.y" +#line 198 "icalyacc.y" {utc = 0;; break;} case 15: -#line 198 "icalyacc.y" +#line 199 "icalyacc.y" {utc = 1;; break;} case 16: -#line 202 "icalyacc.y" +#line 203 "icalyacc.y" {utc_b = 0;; break;} case 17: -#line 203 "icalyacc.y" +#line 204 "icalyacc.y" {utc_b = 1;; break;} case 18: -#line 207 "icalyacc.y" +#line 208 "icalyacc.y" { struct icaltimetype stm; stm = fill_datetime(yyvsp[-3].v_string, yyvsp[-1].v_string); @@ -1120,100 +1120,100 @@ case 18: ; break;} case 21: -#line 225 "icalyacc.y" +#line 226 "icalyacc.y" { duration.weeks = atoi(yyvsp[-1].v_string); ; break;} case 22: -#line 230 "icalyacc.y" +#line 231 "icalyacc.y" { ; break;} case 23: -#line 233 "icalyacc.y" +#line 234 "icalyacc.y" { ; break;} case 24: -#line 236 "icalyacc.y" +#line 237 "icalyacc.y" { ; break;} case 25: -#line 240 "icalyacc.y" +#line 241 "icalyacc.y" { duration.hours = atoi(yyvsp[-1].v_string); ; break;} case 26: -#line 244 "icalyacc.y" +#line 245 "icalyacc.y" { duration.hours = atoi(yyvsp[-2].v_string); ; break;} case 27: -#line 249 "icalyacc.y" +#line 250 "icalyacc.y" { duration.minutes = atoi(yyvsp[-1].v_string); ; break;} case 28: -#line 253 "icalyacc.y" +#line 254 "icalyacc.y" { duration.minutes = atoi(yyvsp[-2].v_string); ; break;} case 29: -#line 258 "icalyacc.y" +#line 259 "icalyacc.y" { duration.seconds = atoi(yyvsp[-1].v_string); ; break;} case 30: -#line 263 "icalyacc.y" +#line 264 "icalyacc.y" { duration.days = atoi(yyvsp[-1].v_string); ; break;} case 31: -#line 268 "icalyacc.y" +#line 269 "icalyacc.y" { ; break;} case 32: -#line 271 "icalyacc.y" +#line 272 "icalyacc.y" { ; break;} case 33: -#line 274 "icalyacc.y" +#line 275 "icalyacc.y" { ; break;} case 34: -#line 278 "icalyacc.y" +#line 279 "icalyacc.y" { icalparser_yy_value = icalvalue_new_duration(duration); memset(&duration,0, sizeof(duration)); ; break;} case 35: -#line 283 "icalyacc.y" +#line 284 "icalyacc.y" { icalparser_yy_value = icalvalue_new_duration(duration); memset(&duration,0, sizeof(duration)); ; break;} case 36: -#line 288 "icalyacc.y" +#line 289 "icalyacc.y" { icalparser_yy_value = icalvalue_new_duration(duration); memset(&duration,0, sizeof(duration)); ; break;} case 37: -#line 297 "icalyacc.y" +#line 298 "icalyacc.y" { struct icalperiodtype p; @@ -1236,7 +1236,7 @@ case 37: ; break;} case 38: -#line 318 "icalyacc.y" +#line 319 "icalyacc.y" { struct icalperiodtype p; @@ -1265,175 +1265,194 @@ case 38: ; break;} case 39: -#line 350 "icalyacc.y" +#line 351 "icalyacc.y" {clear_recur();recur.freq = ICAL_SECONDLY_RECURRENCE;; break;} case 40: -#line 351 "icalyacc.y" +#line 352 "icalyacc.y" {clear_recur();recur.freq = ICAL_MINUTELY_RECURRENCE;; break;} case 41: -#line 352 "icalyacc.y" +#line 353 "icalyacc.y" {clear_recur();recur.freq = ICAL_HOURLY_RECURRENCE;; break;} case 42: -#line 353 "icalyacc.y" +#line 354 "icalyacc.y" {clear_recur();recur.freq = ICAL_DAILY_RECURRENCE;; break;} case 43: -#line 354 "icalyacc.y" +#line 355 "icalyacc.y" {clear_recur();recur.freq = ICAL_WEEKLY_RECURRENCE;; break;} case 44: -#line 355 "icalyacc.y" +#line 356 "icalyacc.y" {clear_recur();recur.freq = ICAL_MONTHLY_RECURRENCE;; break;} case 45: -#line 356 "icalyacc.y" +#line 357 "icalyacc.y" {clear_recur();recur.freq = ICAL_YEARLY_RECURRENCE;; break;} case 46: -#line 361 "icalyacc.y" -{ skiplist[skippos]=ICAL_SUNDAY_WEEKDAY; if( skippos<8) skippos++;; +#line 362 "icalyacc.y" +{ skiplist[skippos]=ICAL_SUNDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 47: -#line 362 "icalyacc.y" -{ skiplist[skippos]=ICAL_MONDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 364 "icalyacc.y" +{ skiplist[skippos]=ICAL_MONDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 48: -#line 363 "icalyacc.y" -{ skiplist[skippos]=ICAL_TUESDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 366 "icalyacc.y" +{ skiplist[skippos]=ICAL_TUESDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 49: -#line 364 "icalyacc.y" -{ skiplist[skippos]=ICAL_WEDNESDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 368 "icalyacc.y" +{ skiplist[skippos]=ICAL_WEDNESDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 50: -#line 365 "icalyacc.y" -{ skiplist[skippos]=ICAL_THURSDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 370 "icalyacc.y" +{ skiplist[skippos]=ICAL_THURSDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 51: -#line 366 "icalyacc.y" -{ skiplist[skippos]=ICAL_FRIDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 372 "icalyacc.y" +{ skiplist[skippos]=ICAL_FRIDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; break;} case 52: -#line 367 "icalyacc.y" -{ skiplist[skippos]=ICAL_SATURDAY_WEEKDAY;if( skippos<8) skippos++;; +#line 374 "icalyacc.y" +{ skiplist[skippos]=ICAL_SATURDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;; + break;} +case 53: +#line 380 "icalyacc.y" +{dow_pos = 0; break;} case 54: -#line 373 "icalyacc.y" -{ ; +#line 381 "icalyacc.y" +{ dow_pos = atoi(yyvsp[-1].v_string); + break;} +case 55: +#line 382 "icalyacc.y" +{dow_pos = 0; break;} case 56: -#line 378 "icalyacc.y" -{ skiplist[skippos] = atoi(yyvsp[0].v_string); skippos++;; +#line 383 "icalyacc.y" +{ dow_pos = atoi(yyvsp[-1].v_string); break;} case 57: -#line 379 "icalyacc.y" -{ skiplist[skippos] = atoi(yyvsp[0].v_string); if (skippos<367) skippos++;; +#line 387 "icalyacc.y" +{ skiplist[skippos] = atoi(yyvsp[0].v_string); skippos++;; break;} case 58: -#line 383 "icalyacc.y" -{recur.interval = atoi(yyvsp[0].v_string);; +#line 388 "icalyacc.y" +{ skiplist[skippos] = atoi(yyvsp[0].v_string); if (skippos<367) skippos++;; break;} case 59: -#line 384 "icalyacc.y" -{recur.week_start = ICAL_SUNDAY_WEEKDAY;; +#line 392 "icalyacc.y" +{recur.interval = atoi(yyvsp[0].v_string);; break;} case 60: -#line 385 "icalyacc.y" -{recur.week_start = ICAL_MONDAY_WEEKDAY;; +#line 393 "icalyacc.y" +{recur.week_start = ICAL_SUNDAY_WEEKDAY;; break;} case 61: -#line 386 "icalyacc.y" -{recur.week_start = ICAL_TUESDAY_WEEKDAY;; +#line 394 "icalyacc.y" +{recur.week_start = ICAL_MONDAY_WEEKDAY;; break;} case 62: -#line 387 "icalyacc.y" -{recur.week_start = ICAL_WEDNESDAY_WEEKDAY;; +#line 395 "icalyacc.y" +{recur.week_start = ICAL_TUESDAY_WEEKDAY;; break;} case 63: -#line 388 "icalyacc.y" -{recur.week_start = ICAL_THURSDAY_WEEKDAY;; +#line 396 "icalyacc.y" +{recur.week_start = ICAL_WEDNESDAY_WEEKDAY;; break;} case 64: -#line 389 "icalyacc.y" -{recur.week_start = ICAL_FRIDAY_WEEKDAY;; +#line 397 "icalyacc.y" +{recur.week_start = ICAL_THURSDAY_WEEKDAY;; break;} case 65: -#line 390 "icalyacc.y" -{recur.week_start = ICAL_SATURDAY_WEEKDAY;; +#line 398 "icalyacc.y" +{recur.week_start = ICAL_FRIDAY_WEEKDAY;; break;} case 66: -#line 391 "icalyacc.y" -{copy_list(recur.by_second,60);; +#line 399 "icalyacc.y" +{recur.week_start = ICAL_SATURDAY_WEEKDAY;; break;} case 67: -#line 392 "icalyacc.y" -{copy_list(recur.by_minute,60);; +#line 400 "icalyacc.y" +{copy_list(recur.by_second,60);; break;} case 68: -#line 393 "icalyacc.y" -{copy_list(recur.by_hour,24);; +#line 401 "icalyacc.y" +{copy_list(recur.by_minute,60);; break;} case 69: -#line 394 "icalyacc.y" -{copy_list(recur.by_day,7);; +#line 402 "icalyacc.y" +{copy_list(recur.by_hour,24);; break;} case 70: -#line 395 "icalyacc.y" -{copy_list(recur.by_month,12);; +#line 403 "icalyacc.y" +{copy_list(recur.by_day,7);; break;} case 71: -#line 396 "icalyacc.y" -{copy_list(recur.by_month_day,31);; +#line 404 "icalyacc.y" +{copy_list(recur.by_month,12);; break;} case 72: -#line 397 "icalyacc.y" -{copy_list(recur.by_year_day,366);; +#line 405 "icalyacc.y" +{copy_list(recur.by_month_day,31);; break;} case 73: -#line 398 "icalyacc.y" -{copy_list(recur.by_week_no,53);; +#line 406 "icalyacc.y" +{copy_list(recur.by_year_day,366);; break;} case 74: -#line 399 "icalyacc.y" -{copy_list(recur.by_set_pos,366);; +#line 407 "icalyacc.y" +{copy_list(recur.by_week_no,53);; break;} case 75: -#line 401 "icalyacc.y" +#line 408 "icalyacc.y" +{copy_list(recur.by_set_pos,366);; + break;} +case 76: +#line 410 "icalyacc.y" { recur.until = icalvalue_get_datetime(icalparser_yy_value); icalvalue_free(icalparser_yy_value); icalparser_yy_value=0;; break;} -case 76: -#line 404 "icalyacc.y" +case 77: +#line 413 "icalyacc.y" { recur.until = icalvalue_get_date(icalparser_yy_value); icalvalue_free(icalparser_yy_value); icalparser_yy_value=0;; break;} -case 77: -#line 407 "icalyacc.y" +case 78: +#line 416 "icalyacc.y" { recur.count = atoi(yyvsp[0].v_string); ; break;} -case 80: -#line 416 "icalyacc.y" +case 81: +#line 425 "icalyacc.y" { icalparser_yy_value = icalvalue_new_recur(recur); ; break;} -case 81: -#line 422 "icalyacc.y" +case 82: +#line 431 "icalyacc.y" { utcsign = 1; ; break;} -case 82: -#line 423 "icalyacc.y" +case 83: +#line 432 "icalyacc.y" { utcsign = -1; ; break;} -case 83: -#line 427 "icalyacc.y" +case 84: +#line 436 "icalyacc.y" { icalparser_yy_value = icalvalue_new_utcoffset( utcsign * (yyvsp[-1].v_int*3600) + (yyvsp[0].v_int*60) ); ; break;} -case 84: -#line 432 "icalyacc.y" +case 85: +#line 441 "icalyacc.y" { icalparser_yy_value = icalvalue_new_utcoffset(utcsign * (yyvsp[-2].v_int*3600) + (yyvsp[-1].v_int*60) +(yyvsp[0].v_int)); ; @@ -1660,7 +1679,7 @@ yyerrhandle: } return 1; } -#line 438 "icalyacc.y" +#line 447 "icalyacc.y" diff --git a/libical/src/libical/icalyacc.y b/libical/src/libical/icalyacc.y index 1fe2a737e9..0917daf371 100644 --- a/libical/src/libical/icalyacc.y +++ b/libical/src/libical/icalyacc.y @@ -6,7 +6,7 @@ DESCRIPTION: - $Id: icalyacc.y,v 1.4 2000/06/06 22:48:09 alves Exp $ + $Id: icalyacc.y,v 1.5 2000/08/24 20:12:04 jpr Exp $ $Locker: $ (C) COPYRIGHT 1999 Eric Busboom @@ -53,6 +53,7 @@ struct icaldurationtype duration; struct icalrecurrencetype recur; short skiplist[367]; short skippos; +int dow_pos; void copy_list(short* array, size_t size); void clear_recur(); @@ -358,20 +359,28 @@ recur_start: weekday: - SU { skiplist[skippos]=ICAL_SUNDAY_WEEKDAY; if( skippos<8) skippos++;} - | MO { skiplist[skippos]=ICAL_MONDAY_WEEKDAY;if( skippos<8) skippos++;} - | TU { skiplist[skippos]=ICAL_TUESDAY_WEEKDAY;if( skippos<8) skippos++;} - | WE { skiplist[skippos]=ICAL_WEDNESDAY_WEEKDAY;if( skippos<8) skippos++;} - | TH { skiplist[skippos]=ICAL_THURSDAY_WEEKDAY;if( skippos<8) skippos++;} - | FR { skiplist[skippos]=ICAL_FRIDAY_WEEKDAY;if( skippos<8) skippos++;} - | SA { skiplist[skippos]=ICAL_SATURDAY_WEEKDAY;if( skippos<8) skippos++;} + SU { skiplist[skippos]=ICAL_SUNDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | MO { skiplist[skippos]=ICAL_MONDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | TU { skiplist[skippos]=ICAL_TUESDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | WE { skiplist[skippos]=ICAL_WEDNESDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | TH { skiplist[skippos]=ICAL_THURSDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | FR { skiplist[skippos]=ICAL_FRIDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} + | SA { skiplist[skippos]=ICAL_SATURDAY_WEEKDAY+8*dow_pos; + if( skippos<8) skippos++;} ; weekday_list: - weekday - | DIGITS weekday { } /* HACK Incorectly handles int in BYDAY */ - | weekday_list COMMA weekday + weekday {dow_pos = 0}; + | DIGITS weekday { dow_pos = atoi($1)} + | weekday_list COMMA weekday {dow_pos = 0}; + | weekday_list COMMA DIGITS weekday { dow_pos = atoi($3)} recur_list: diff --git a/libical/src/libical/pvl.c b/libical/src/libical/pvl.c index d5225a541e..94eaeac874 100644 --- a/libical/src/libical/pvl.c +++ b/libical/src/libical/pvl.c @@ -3,18 +3,7 @@ CREATOR: eric November, 1995 - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ #ifdef HAVE_CONFIG_H @@ -505,6 +494,10 @@ pvl_remove(pvl_list l,pvl_elem e) data = E->d; + E->prior = 0; + E->next = 0; + E->d = 0; + free(E); return data; diff --git a/libical/src/libical/pvl.h b/libical/src/libical/pvl.h index 8113f7495a..40ca516e9f 100644 --- a/libical/src/libical/pvl.h +++ b/libical/src/libical/pvl.h @@ -3,27 +3,9 @@ CREATOR: eric November, 1995 - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org ======================================================================*/ -/* - struct pvl_elem_t - - This type is private. Always use pvl_elem instead - - */ #ifndef __PVL_H__ #define __PVL_H__ @@ -31,6 +13,14 @@ typedef void* pvl_list; typedef void* pvl_elem; +/* + struct pvl_elem_t + + This type is private. Always use pvl_elem instead. The struct would + not even appear in this header except to make code in the USE_MACROS + blocks work + + */ typedef struct pvl_elem_t { int MAGIC; /* Magic Identifier */ diff --git a/libical/src/libicalss/Makefile.am b/libical/src/libicalss/Makefile.am index 01a7fa4d9c..e4431cb492 100644 --- a/libical/src/libicalss/Makefile.am +++ b/libical/src/libicalss/Makefile.am @@ -6,16 +6,27 @@ lib_LIBRARIES = libicalss.a libicalss_a_SOURCES =\ icalcalendar.c \ icalcalendar.h \ - icalcluster.c \ - icalcluster.h \ - icalstore.c \ - icalstore.h + icalset.h \ + icalset.c \ + icalfileset.c \ + icalfileset.h \ + icalfilesetimpl.h \ + icaldirset.c \ + icaldirset.h \ + icalcsdb.h \ + icalcstp.h \ + icalgauge.h \ + icalgauge.c include_HEADERS =\ icalcalendar.h \ - icalcluster.h \ - icalstore.h - + icalset.h + icalfileset.h \ + icalfilesetimpl.h \ + icaldirset.h \ + icalcsdb.h \ + icalcstp.h \ + icalgauge.h INCLUDES = \ -I ../libical/ \ diff --git a/libical/src/libicalss/icalcalendar.c b/libical/src/libicalss/icalcalendar.c index 0f2231b1d7..e63b5330ad 100644 --- a/libical/src/libicalss/icalcalendar.c +++ b/libical/src/libicalss/icalcalendar.c @@ -1,27 +1,22 @@ -/* -*- Mode: C -*- - ====================================================================== +/*====================================================================== FILE: icalcalendar.c CREATOR: eric 23 December 1999 $Id$ $Locker$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ ======================================================================*/ @@ -32,7 +27,9 @@ #include "icalcalendar.h" -#include "icalcluster.h" +#include "icalset.h" +#include "icalfileset.h" +#include "icaldirset.h" #include #include /* For mkdir, stat */ #include /* For mkdir */ @@ -52,8 +49,8 @@ struct icalcalendar_impl char* dir; icalcomponent* freebusy; icalcomponent* properties; - icalstore* booked; - icalstore* incoming; + icalset* booked; + icalset* incoming; }; struct icalcalendar_impl* icalcalendar_new_impl() @@ -132,19 +129,19 @@ void icalcalendar_free(icalcalendar* calendar) } if (impl->freebusy !=0){ - icalcluster_free(impl->freebusy); + icalfileset_free(impl->freebusy); } if (impl->properties !=0){ - icalcluster_free(impl->properties); + icalfileset_free(impl->properties); } if (impl->booked !=0){ - icalstore_free(impl->booked); + icaldirset_free(impl->booked); } if (impl->incoming !=0){ - icalstore_free(impl->incoming); + icaldirset_free(impl->incoming); } impl->dir = 0; @@ -186,7 +183,7 @@ int icalcalendar_ownlock(icalcalendar* calendar) return 0; } -icalstore* icalcalendar_get_booked(icalcalendar* calendar) +icalset* icalcalendar_get_booked(icalcalendar* calendar) { struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; char dir[PATH_MAX]; @@ -200,7 +197,7 @@ icalstore* icalcalendar_get_booked(icalcalendar* calendar) if (impl->booked == 0){ icalerror_clear_errno(); - impl->booked = icalstore_new(dir); + impl->booked = icaldirset_new(dir); assert(icalerrno == ICAL_NO_ERROR); } @@ -208,7 +205,7 @@ icalstore* icalcalendar_get_booked(icalcalendar* calendar) } -icalcluster* icalcalendar_get_incoming(icalcalendar* calendar) +icalset* icalcalendar_get_incoming(icalcalendar* calendar) { char path[PATH_MAX]; struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; @@ -220,13 +217,13 @@ icalcluster* icalcalendar_get_incoming(icalcalendar* calendar) strcat(path,INCOMING_FILE); if (impl->properties == 0){ - impl->properties = icalcluster_new(path); + impl->properties = icalfileset_new(path); } return impl->properties; } -icalcluster* icalcalendar_get_properties(icalcalendar* calendar) +icalset* icalcalendar_get_properties(icalcalendar* calendar) { char path[PATH_MAX]; struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; @@ -238,13 +235,13 @@ icalcluster* icalcalendar_get_properties(icalcalendar* calendar) strcat(path,PROP_FILE); if (impl->properties == 0){ - impl->properties = icalcluster_new(path); + impl->properties = icalfileset_new(path); } return impl->properties; } -icalcluster* icalcalendar_get_freebusy(icalcalendar* calendar) +icalset* icalcalendar_get_freebusy(icalcalendar* calendar) { char path[PATH_MAX]; struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; @@ -257,7 +254,7 @@ icalcluster* icalcalendar_get_freebusy(icalcalendar* calendar) if (impl->freebusy == 0){ - impl->freebusy = icalcluster_new(path); + impl->freebusy = icalfileset_new(path); } return impl->freebusy; diff --git a/libical/src/libicalss/icalcalendar.h b/libical/src/libicalss/icalcalendar.h index 90e7b33c22..f07457c60d 100644 --- a/libical/src/libicalss/icalcalendar.h +++ b/libical/src/libicalss/icalcalendar.h @@ -7,19 +7,19 @@ $Id$ $Locker$ - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - + (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + The LGPL as published by the Free Software Foundation, version + 2.1, available at: http://www.fsf.org/copyleft/lesser.html + + Or: + + The Mozilla Public License Version 1.0. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + The Original Code is eric. The Initial Developer of the Original Code is Eric Busboom @@ -30,12 +30,11 @@ #define ICALCALENDAR_H #include "ical.h" -#include "icalstore.h" -#include "icalcluster.h" +#include "icalset.h" /* icalcalendar * Routines for storing calendar data in a file system. The calendar - * has two icalstores, one for incoming components and one for booked + * has two icaldirsets, one for incoming components and one for booked * components. It also has interfaces to access the free/busy list * and a list of calendar properties */ @@ -53,13 +52,13 @@ int icalcalendar_islocked(icalcalendar* calendar); int icalcalendar_ownlock(icalcalendar* calendar); -icalstore* icalcalendar_get_booked(icalcalendar* calendar); +icalset* icalcalendar_get_booked(icalcalendar* calendar); -icalcluster* icalcalendar_get_incoming(icalcalendar* calendar); +icalset* icalcalendar_get_incoming(icalcalendar* calendar); -icalcluster* icalcalendar_get_properties(icalcalendar* calendar); +icalset* icalcalendar_get_properties(icalcalendar* calendar); -icalcluster* icalcalendar_get_freebusy(icalcalendar* calendar); +icalset* icalcalendar_get_freebusy(icalcalendar* calendar); #endif /* !ICALCALENDAR_H */ diff --git a/libical/src/test/Makefile.am b/libical/src/test/Makefile.am index 81ffff8c39..bd76fca669 100644 --- a/libical/src/test/Makefile.am +++ b/libical/src/test/Makefile.am @@ -1,7 +1,7 @@ -noinst_PROGRAMS = usecases copycluster regression parser findobj storage stow +noinst_PROGRAMS = copycluster regression parser findobj storage stow testvcal recur testmime -LDADD = ../libical/libical.a ../libicalss/libicalss.a +LDADD = ../libical/libical.a ../libicalss/libicalss.a ../libicalvcal/libicalvcal.a INCLUDES = \ -I . \ -I $(srcdir) \ @@ -9,11 +9,15 @@ INCLUDES = \ -I $(srcdir)/../libical \ -I../libicalss \ -I $(srcdir)/../libicalss + -I../libicalvcal \ + -I $(srcdir)/../libicalvcal findobj_SOURCES = findobj.c -usecases_SOURCES = usecases.c copycluster_SOURCES = copycluster.c regression_SOURCES = regression.c parser_SOURCES = icaltestparser.c storage_SOURCES = storage.c -stow_SOURCES = stow.c \ No newline at end of file +stow_SOURCES = stow.c +testvcal_SOURCES =testvcal.c +recur_SOURCES = recur.c +test_mime = testmime.c \ No newline at end of file diff --git a/libical/src/test/Makefile.in b/libical/src/test/Makefile.in deleted file mode 100644 index 8a7cf257c3..0000000000 --- a/libical/src/test/Makefile.in +++ /dev/null @@ -1,385 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = ../.. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ -AR = @AR@ -AS = @AS@ -CC = @CC@ -DLLTOOL = @DLLTOOL@ -LEX = @LEX@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -MAKEINFO = @MAKEINFO@ -OBJDUMP = @OBJDUMP@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -VERSION = @VERSION@ -YACC = @YACC@ - -noinst_PROGRAMS = usecases copycluster regression parser findobj storage stow - -LDADD = ../libical/libical.a ../libicalss/libicalss.a -INCLUDES = -I . -I $(srcdir) -I../libical -I $(srcdir)/../libical -I../libicalss -I $(srcdir)/../libicalss - - -findobj_SOURCES = findobj.c -usecases_SOURCES = usecases.c -copycluster_SOURCES = copycluster.c -regression_SOURCES = regression.c -parser_SOURCES = icaltestparser.c -storage_SOURCES = storage.c -stow_SOURCES = stow.c -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../../config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(noinst_PROGRAMS) - - -DEFS = @DEFS@ -I. -I$(srcdir) -I../.. -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -usecases_OBJECTS = usecases.o -usecases_LDADD = $(LDADD) -usecases_DEPENDENCIES = ../libical/libical.a ../libicalss/libicalss.a -usecases_LDFLAGS = -copycluster_OBJECTS = copycluster.o -copycluster_LDADD = $(LDADD) -copycluster_DEPENDENCIES = ../libical/libical.a \ -../libicalss/libicalss.a -copycluster_LDFLAGS = -regression_OBJECTS = regression.o -regression_LDADD = $(LDADD) -regression_DEPENDENCIES = ../libical/libical.a ../libicalss/libicalss.a -regression_LDFLAGS = -parser_OBJECTS = icaltestparser.o -parser_LDADD = $(LDADD) -parser_DEPENDENCIES = ../libical/libical.a ../libicalss/libicalss.a -parser_LDFLAGS = -findobj_OBJECTS = findobj.o -findobj_LDADD = $(LDADD) -findobj_DEPENDENCIES = ../libical/libical.a ../libicalss/libicalss.a -findobj_LDFLAGS = -storage_OBJECTS = storage.o -storage_LDADD = $(LDADD) -storage_DEPENDENCIES = ../libical/libical.a ../libicalss/libicalss.a -storage_LDFLAGS = -stow_OBJECTS = stow.o -stow_LDADD = $(LDADD) -stow_DEPENDENCIES = ../libical/libical.a ../libicalss/libicalss.a -stow_LDFLAGS = -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -DEP_FILES = .deps/copycluster.P .deps/findobj.P .deps/icaltestparser.P \ -.deps/regression.P .deps/storage.P .deps/stow.P .deps/usecases.P -SOURCES = $(usecases_SOURCES) $(copycluster_SOURCES) $(regression_SOURCES) $(parser_SOURCES) $(findobj_SOURCES) $(storage_SOURCES) $(stow_SOURCES) -OBJECTS = $(usecases_OBJECTS) $(copycluster_OBJECTS) $(regression_OBJECTS) $(parser_OBJECTS) $(findobj_OBJECTS) $(storage_OBJECTS) $(stow_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .lo .o .s -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-noinstPROGRAMS: - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) - -distclean-noinstPROGRAMS: - -maintainer-clean-noinstPROGRAMS: - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -maintainer-clean-libtool: - -usecases: $(usecases_OBJECTS) $(usecases_DEPENDENCIES) - @rm -f usecases - $(LINK) $(usecases_LDFLAGS) $(usecases_OBJECTS) $(usecases_LDADD) $(LIBS) - -copycluster: $(copycluster_OBJECTS) $(copycluster_DEPENDENCIES) - @rm -f copycluster - $(LINK) $(copycluster_LDFLAGS) $(copycluster_OBJECTS) $(copycluster_LDADD) $(LIBS) - -regression: $(regression_OBJECTS) $(regression_DEPENDENCIES) - @rm -f regression - $(LINK) $(regression_LDFLAGS) $(regression_OBJECTS) $(regression_LDADD) $(LIBS) - -parser: $(parser_OBJECTS) $(parser_DEPENDENCIES) - @rm -f parser - $(LINK) $(parser_LDFLAGS) $(parser_OBJECTS) $(parser_LDADD) $(LIBS) - -findobj: $(findobj_OBJECTS) $(findobj_DEPENDENCIES) - @rm -f findobj - $(LINK) $(findobj_LDFLAGS) $(findobj_OBJECTS) $(findobj_LDADD) $(LIBS) - -storage: $(storage_OBJECTS) $(storage_DEPENDENCIES) - @rm -f storage - $(LINK) $(storage_LDFLAGS) $(storage_OBJECTS) $(storage_LDADD) $(LIBS) - -stow: $(stow_OBJECTS) $(stow_DEPENDENCIES) - @rm -f stow - $(LINK) $(stow_LDFLAGS) $(stow_OBJECTS) $(stow_LDADD) $(LIBS) - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = src/test - -distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/test/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) - --include $(DEP_FILES) - -mostlyclean-depend: - -clean-depend: - -distclean-depend: - -rm -rf .deps - -maintainer-clean-depend: - -%.o: %.c - @echo '$(COMPILE) -c $<'; \ - $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - -%.lo: %.c - @echo '$(LTCOMPILE) -c $<'; \ - $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ - mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \ - clean-depend clean-generic mostlyclean-am - -clean: clean-am - -distclean-am: distclean-noinstPROGRAMS distclean-compile \ - distclean-libtool distclean-tags distclean-depend \ - distclean-generic clean-am - -rm -f libtool - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-noinstPROGRAMS \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ -clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir \ -mostlyclean-depend distclean-depend clean-depend \ -maintainer-clean-depend info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/libical/src/test/copycluster.c b/libical/src/test/copycluster.c index b059130c13..11bd94c62d 100644 --- a/libical/src/test/copycluster.c +++ b/libical/src/test/copycluster.c @@ -27,7 +27,7 @@ #include /* for printf */ #include "ical.h" -#include "icalcluster.h" +#include "icalfileset.h" #include #include /* For strerror */ #include "icalrestriction.h" @@ -41,7 +41,7 @@ void usage(char* arg0) { int main(int c, char *argv[]){ - icalcluster *clusterin, *clusterout; + icalfileset *clusterin, *clusterout; icalcomponent *itr; int count=0; int tostdout = 0; @@ -55,7 +55,7 @@ int main(int c, char *argv[]){ tostdout = 1; } - clusterin = icalcluster_new(argv[1]); + clusterin = icalfileset_new(argv[1]); if (clusterin == 0){ printf("Could not open input cluster \"%s\"",argv[1]); @@ -64,7 +64,7 @@ int main(int c, char *argv[]){ } if (!tostdout){ - clusterout = icalcluster_new(argv[2]); + clusterout = icalfileset_new(argv[2]); if (clusterout == 0){ printf("Could not open output cluster \"%s\"\n",argv[2]); exit(1); @@ -72,10 +72,10 @@ int main(int c, char *argv[]){ } - for (itr = icalcluster_get_first_component(clusterin, + for (itr = icalfileset_get_first_component(clusterin, ICAL_ANY_COMPONENT); itr != 0; - itr = icalcluster_get_next_component(clusterin, + itr = icalfileset_get_next_component(clusterin, ICAL_ANY_COMPONENT)){ icalrestriction_check(itr); @@ -87,7 +87,7 @@ int main(int c, char *argv[]){ printf("--------------\n%s\n",icalcomponent_as_ical_string(itr)); } else { - icalcluster_add_component(clusterout, + icalfileset_add_component(clusterout, icalcomponent_new_clone(itr)); } @@ -101,11 +101,11 @@ int main(int c, char *argv[]){ printf("Transfered %d components\n",count); - icalcluster_free(clusterin); + icalfileset_free(clusterin); if (!tostdout){ - icalcluster_mark(clusterout); - icalcluster_free(clusterout); + icalfileset_mark(clusterout); + icalfileset_free(clusterout); } return 0; diff --git a/libical/src/test/findobj.c b/libical/src/test/findobj.c index e7ec59169a..c31101c33d 100644 --- a/libical/src/test/findobj.c +++ b/libical/src/test/findobj.c @@ -28,6 +28,7 @@ #include /* for printf */ #include "ical.h" #include "icalcalendar.h" +#include "icaldirset.h" #include #include /* For strerror */ #include "icalrestriction.h" @@ -41,7 +42,7 @@ void usage(char* arg0) { int main(int c, char *argv[]){ icalcalendar *cal; - icalstore *booked; + icaldirset *booked; icalcomponent *itr; if(c < 2 || c > 3){ @@ -59,7 +60,7 @@ int main(int c, char *argv[]){ booked = icalcalendar_get_booked(cal); - itr = icalstore_fetch(booked,argv[2]); + itr = icaldirset_fetch(booked,argv[2]); if(itr != 0){ diff --git a/libical/src/test/icaltestparser.c b/libical/src/test/icaltestparser.c index 98dbcff94f..71f91b641f 100644 --- a/libical/src/test/icaltestparser.c +++ b/libical/src/test/icaltestparser.c @@ -91,7 +91,6 @@ char* read_stream(char *s, size_t size, void *d) int main(int argc, char* argv[]) { - int lineno = 0; char* line; FILE* stream; icalcomponent *c; @@ -120,5 +119,5 @@ int main(int argc, char* argv[]) } while ( line != 0); - -} + return 0; + } diff --git a/libical/src/test/regression.c b/libical/src/test/regression.c index 7b1606d432..dc6a5301f1 100644 --- a/libical/src/test/regression.c +++ b/libical/src/test/regression.c @@ -34,11 +34,12 @@ #include /* for printf */ #include /* for time() */ #include "icalmemory.h" -#include "icalstore.h" -#include "icalcluster.h" #include "icalerror.h" #include "icalrestriction.h" #include "icalcalendar.h" +#include "icalgauge.h" +#include "icaldirset.h" +#include "icalfileset.h" /* This example creates and minipulates the ical object that appears * in rfc 2445, page 137 */ @@ -92,8 +93,8 @@ icalcomponent* create_simple_component() icalcomponent* calendar; struct icalperiodtype rtime; - rtime.start = icaltimetype_from_timet( time(0),0); - rtime.end = icaltimetype_from_timet( time(0),0); + rtime.start = icaltime_from_timet( time(0),0,0); + rtime.end = icaltime_from_timet( time(0),0,0); rtime.end.hour++; @@ -122,12 +123,12 @@ icalcomponent* create_new_component() icalcomponent* timezone; icalcomponent* tzc; icalcomponent* event; - struct icaltimetype atime = icaltimetype_from_timet( time(0),0); + struct icaltimetype atime = icaltime_from_timet( time(0),0,0); struct icalperiodtype rtime; icalproperty* property; - rtime.start = icaltimetype_from_timet( time(0),0); - rtime.end = icaltimetype_from_timet( time(0),0); + rtime.start = icaltime_from_timet( time(0),0,0); + rtime.end = icaltime_from_timet( time(0),0,0); rtime.end.hour++; @@ -331,11 +332,11 @@ icalcomponent* create_new_component_with_va_args() { icalcomponent* calendar; - struct icaltimetype atime = icaltimetype_from_timet( time(0),0); + struct icaltimetype atime = icaltime_from_timet( time(0),0,0); struct icalperiodtype rtime; - rtime.start = icaltimetype_from_timet( time(0),0); - rtime.end = icaltimetype_from_timet( time(0),0); + rtime.start = icaltime_from_timet( time(0),0,0); + rtime.end = icaltime_from_timet( time(0),0,0); rtime.end.hour++; @@ -524,9 +525,9 @@ void test_values() icalvalue_free(copy); - v = icalvalue_new_date(icaltimetype_from_timet( time(0),0)); + v = icalvalue_new_date(icaltime_from_timet( time(0),0,0)); printf("date 1: %s\n",icalvalue_as_ical_string(v)); - icalvalue_set_date(v,icaltimetype_from_timet( time(0)+3600,0)); + icalvalue_set_date(v,icaltime_from_timet( time(0)+3600,0,0)); printf("date 2: %s\n",icalvalue_as_ical_string(v)); copy = icalvalue_new_clone(v); @@ -662,6 +663,7 @@ void test_components() void test_memory() { size_t bufsize = 256; + int i; char *p; char S1[] = "1) When in the Course of human events, "; @@ -682,8 +684,7 @@ void test_memory() char *f, *b1, *b2, *b3, *b4, *b5, *b6, *b7, *b8; - #define BUFSIZE 1024 - +#define BUFSIZE 1024 f = icalmemory_new_buffer(bufsize); p = f; @@ -737,32 +738,61 @@ void test_memory() free(f); bufsize = 4; + f = icalmemory_new_buffer(bufsize); + + memset(f,0,bufsize); p = f; icalmemory_append_char(&f, &p, &bufsize, 'a'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'b'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'c'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'd'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'e'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'f'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'g'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'h'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'i'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'j'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'a'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'b'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'c'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'd'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'e'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'f'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'g'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'h'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'i'); + printf("Char-by-Char buffer: %s\n", f); icalmemory_append_char(&f, &p, &bufsize, 'j'); - printf("Char-by-Char buffer: %s\n", f); + + for(i=0; i<100; i++){ + f = icalmemory_tmp_buffer(bufsize); + + assert(f!=0); + memset(f,0,bufsize); + sprintf(f,"%d",i); + } } @@ -772,14 +802,14 @@ int test_store() icalcomponent *c, *gauge; icalerrorenum error; icalcomponent *next, *itr; - icalcluster* cluster; + icalfileset* cluster; struct icalperiodtype rtime; - icalstore *s = icalstore_new("store"); + icaldirset *s = icaldirset_new("store"); int i; - rtime.start = icaltimetype_from_timet( time(0),0); + rtime.start = icaltime_from_timet( time(0),0,0); - cluster = icalcluster_new("clusterin.vcd"); + cluster = icalfileset_new("clusterin.vcd"); if (cluster == 0){ printf("Failed to create cluster: %s\n",icalerror_strerror(icalerrno)); @@ -799,10 +829,10 @@ int test_store() rtime.end = rtime.start; rtime.end.hour++; - for (itr = icalcluster_get_first_component(cluster, + for (itr = icalfileset_get_first_component(cluster, ICAL_ANY_COMPONENT); itr != 0; - itr = icalcluster_get_next_component(cluster, + itr = icalfileset_get_next_component(cluster, ICAL_ANY_COMPONENT)){ icalcomponent *clone; icalproperty *p; @@ -847,7 +877,7 @@ int test_store() printf("\n----------\n%s\n---------\n",icalcomponent_as_ical_string(clone)); - error = icalstore_add_component(s,clone); + error = icaldirset_add_component(s,clone); assert(icalerrno == ICAL_NO_ERROR); @@ -877,15 +907,15 @@ int test_store() #if 0 - icalstore_select(s,gauge); + icaldirset_select(s,gauge); - for(c = icalstore_first(s); c != 0; c = icalstore_next(s)){ + for(c = icaldirset_first(s); c != 0; c = icaldirset_next(s)){ printf("Got one! (%d)\n", count++); if (c != 0){ printf("%s", icalcomponent_as_ical_string(c));; - if (icalstore_store(s2,c) == 0){ + if (icaldirset_store(s2,c) == 0){ printf("Failed to write!\n"); } icalcomponent_free(c); @@ -895,18 +925,18 @@ int test_store() } - icalstore_free(s2); + icaldirset_free(s2); #endif - for(c = icalstore_get_first_component(s); + for(c = icaldirset_get_first_component(s,ICAL_ANY_COMPONENT); c != 0; c = next){ - next = icalstore_get_next_component(s); + next = icaldirset_get_next_component(s,ICAL_ANY_COMPONENT); if (c != 0){ - /*icalstore_remove_component(s,c);*/ + /*icaldirset_remove_component(s,c);*/ printf("%s", icalcomponent_as_ical_string(c));; } else { printf("Failed to get component\n"); @@ -915,7 +945,7 @@ int test_store() } - icalstore_free(s); + icaldirset_free(s); return 0; } @@ -976,7 +1006,7 @@ int test_compare() printf("%s",icalcomponent_as_ical_string(gauge)); - printf("%d\n",icalstore_test(c,gauge)); + printf("%d\n",icalgauge_test(c,gauge)); return 0; } @@ -984,13 +1014,13 @@ int test_compare() void test_restriction() { icalcomponent *comp; - struct icaltimetype atime = icaltimetype_from_timet( time(0),0); + struct icaltimetype atime = icaltime_from_timet( time(0),0,0); int valid; struct icalperiodtype rtime; - rtime.start = icaltimetype_from_timet( time(0),0); - rtime.end = icaltimetype_from_timet( time(0),0); + rtime.start = icaltime_from_timet( time(0),0,0); + rtime.end = icaltime_from_timet( time(0),0,0); rtime.end.hour++; @@ -1097,11 +1127,11 @@ void test_restriction() void test_calendar() { icalcomponent *comp; - icalcluster *c; - icalstore *s; + icalfileset *c; + icaldirset *s; icalcalendar* calendar = icalcalendar_new("calendar"); icalerrorenum error; - struct icaltimetype atime = icaltimetype_from_timet( time(0),0); + struct icaltimetype atime = icaltime_from_timet( time(0),0,0); comp = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, @@ -1125,13 +1155,13 @@ void test_calendar() s = icalcalendar_get_booked(calendar); - error = icalstore_add_component(s,comp); + error = icaldirset_add_component(s,comp); assert(error == ICAL_NO_ERROR); c = icalcalendar_get_properties(calendar); - error = icalcluster_add_component(c,icalcomponent_new_clone(comp)); + error = icalfileset_add_component(c,icalcomponent_new_clone(comp)); assert(error == ICAL_NO_ERROR); @@ -1170,6 +1200,19 @@ void test_recur() } +void test_recur_expansion() +{ + + icalvalue *v; + + v = icalvalue_new_from_string(ICAL_RECUR_VALUE, + "FREQ=YEARLY;UNTIL=123456T123456;INTERVAL=2;BYMONTH=1;BYDAY=SU;BYHOUR=8,9;BYMINUTE=30"); + + printf("%s\n",icalvalue_as_ical_string(v)); + + icalrecurrencetype_test(); +} + void test_duration() { @@ -1278,19 +1321,213 @@ void test_requeststat() } +void test_time() +{ + struct icaltimetype ictt; + time_t tt,tt2; + icalvalue *v; + short day_of_week,start_day_of_week, day_of_year; + + + tt = time(0); + + printf("System time is: %s\n",ctime(&tt)); + + ictt = icaltime_from_timet(tt,0,0); + + v = icalvalue_new_datetime(ictt); + + printf("System time from libical: %s\n",icalvalue_as_ical_string(v)); + + tt2 = icaltime_as_timet(ictt); + printf("Converted back to libc: %s\n",ctime(&tt2)); + + + ictt.year++; + tt2 = icaltime_as_timet(ictt); + printf("Add a year: %s\n",ctime(&tt2)); + + ictt.month+=13; + tt2 = icaltime_as_timet(ictt); + printf("Add 13 months: %s\n",ctime(&tt2)); + + ictt.second+=90; + tt2 = icaltime_as_timet(ictt); + printf("Add 90 seconds: %s\n",ctime(&tt2)); + + ictt = icaltime_from_timet(tt,0,0); + + + day_of_week = icaltime_day_of_week(ictt); + start_day_of_week = icaltime_start_doy_of_week(ictt); + day_of_year = icaltime_day_of_year(ictt); + + printf("Today is day of week %d, day of year %d\n",day_of_week,day_of_year); + printf("Week started n doy of %d\n",start_day_of_week); + + +} + +void test_iterators() +{ + icalcomponent *c,*inner,*next; + icalcompiter i; + + c= icalcomponent_vanew( + ICAL_VCALENDAR_COMPONENT, + icalcomponent_vanew(ICAL_VEVENT_COMPONENT, + icalproperty_vanew_version("1"),0), + icalcomponent_vanew(ICAL_VEVENT_COMPONENT, + icalproperty_vanew_version("2"),0), + icalcomponent_vanew(ICAL_VEVENT_COMPONENT, + icalproperty_vanew_version("3"),0), + icalcomponent_vanew(ICAL_VEVENT_COMPONENT, + icalproperty_vanew_version("4"),0), + icalcomponent_vanew(ICAL_VTODO_COMPONENT, + icalproperty_vanew_version("5"),0), + icalcomponent_vanew(ICAL_VJOURNAL_COMPONENT, + icalproperty_vanew_version("6"),0), + icalcomponent_vanew(ICAL_VEVENT_COMPONENT, + icalproperty_vanew_version("7"),0), + icalcomponent_vanew(ICAL_VJOURNAL_COMPONENT, + icalproperty_vanew_version("8"),0), + icalcomponent_vanew(ICAL_VJOURNAL_COMPONENT, + icalproperty_vanew_version("9"),0), + icalcomponent_vanew(ICAL_VJOURNAL_COMPONENT, + icalproperty_vanew_version("10"),0), + 0); + + printf("1: "); + + /* List all of the VEVENTS */ + for(i = icalcomponent_begin_component(c,ICAL_VEVENT_COMPONENT); + icalcompiter_deref(&i)!= 0; icalcompiter_next(&i)){ + + icalcomponent *this = icalcompiter_deref(&i); + + icalproperty *p = + icalcomponent_get_first_property(this, + ICAL_VERSION_PROPERTY); + char* s = icalproperty_get_version(p); + + printf("%s ",s); + + } + + printf("\n2: "); + +#if 0 + for(inner = icalcomponent_get_first_component(c,ICAL_VEVENT_COMPONENT); + inner != 0; + inner = next){ + + next = icalcomponent_get_next_component(c,ICAL_VEVENT_COMPONENT); + + icalcomponent_remove_component(c,inner); + + icalcomponent_free(inner); + } +#endif + + /* Delete all of the VEVENTS */ + /* reset iterator */ + icalcomponent_get_first_component(c,ICAL_VEVENT_COMPONENT); + + while((inner=icalcomponent_get_current_component(c)) != 0 ){ + if(icalcomponent_isa(inner) == ICAL_VEVENT_COMPONENT){ + icalcomponent_remove_component(c,inner); + } else { + icalcomponent_get_next_component(c,ICAL_VEVENT_COMPONENT); + } + } + + + + /* List all remaining components */ + for(inner = icalcomponent_get_first_component(c,ICAL_ANY_COMPONENT); + inner != 0; + inner = icalcomponent_get_next_component(c,ICAL_ANY_COMPONENT)){ + + + icalproperty *p = + icalcomponent_get_first_property(inner,ICAL_VERSION_PROPERTY); + + char* s = icalproperty_get_version(p); + + printf("%s ",s); + } + + printf("\n3: "); + + + /* Remove all remaining components */ + for(inner = icalcomponent_get_first_component(c,ICAL_ANY_COMPONENT); + inner != 0; + inner = next){ + + icalcomponent *this; + icalproperty *p; + char* s; + next = icalcomponent_get_next_component(c,ICAL_ANY_COMPONENT); + + p=icalcomponent_get_first_property(inner,ICAL_VERSION_PROPERTY); + s = icalproperty_get_version(p); + printf("rem:%s ",s); + + icalcomponent_remove_component(c,inner); + + this = icalcomponent_get_current_component(c); + + if(this != 0){ + p=icalcomponent_get_first_property(this,ICAL_VERSION_PROPERTY); + s = icalproperty_get_version(p); + printf("next:%s; ",s); + } + + icalcomponent_free(inner); + } + + printf("\n4: "); + + + /* List all remaining components */ + for(inner = icalcomponent_get_first_component(c,ICAL_ANY_COMPONENT); + inner != 0; + inner = icalcomponent_get_next_component(c,ICAL_ANY_COMPONENT)){ + + icalproperty *p = + icalcomponent_get_first_property(inner,ICAL_VERSION_PROPERTY); + + char* s = icalproperty_get_version(p); + + printf("%s ",s); + } + + printf("\n"); +} + int main(int argc, char *argv[]) { + printf("\n------------Test Memory---------------\n"); + test_memory(); + +exit(0); + + + printf("\n------------Test Iterators-----------\n"); + test_iterators(); + + + printf("\n------------Test time----------------\n"); + test_time(); printf("\n------------Test Restriction---------------\n"); test_restriction(); - exit(0); - printf("\n------------Test request status-------\n"); test_requeststat(); - printf("\n------------Test strings---------------\n"); test_strings(); @@ -1303,9 +1540,6 @@ int main(int argc, char *argv[]) printf("\n------------Test Compare---------------\n"); test_compare(); - printf("\n------------Test Memory---------------\n"); - test_memory(); - printf("\n------------Test Values---------------\n"); test_values(); diff --git a/libical/src/test/storage.c b/libical/src/test/storage.c index f6d0dd69e5..d53001b574 100644 --- a/libical/src/test/storage.c +++ b/libical/src/test/storage.c @@ -34,14 +34,13 @@ #include /* for printf */ #include /* for time() */ #include "icalmemory.h" -#include "icalstore.h" -#include "icalcluster.h" +#include "icaldirset.h" +#include "icalfileset.h" #include "icalerror.h" #include "icalrestriction.h" #include "icalcalendar.h" -/* This example creates and minipulates the ical object that appears - * in rfc 2445, page 137 */ +#define OUTPUT_FILE "filesetout.ics" char str[] = "BEGIN:VCALENDAR\n\ PRODID:\"-//RDU Software//NONSGML HandCal//EN\"\n\ @@ -106,29 +105,31 @@ END:VCALENDAR\n\ "; -void test_cluster() +void test_fileset() { - icalcluster *cin, *cout; + icalfileset *cout; int month = 0; int count=0; struct icaltimetype start, end; icalcomponent *c,*clone, *itr; - start = icaltimetype_from_timet( time(0),0); + start = icaltime_from_timet( time(0),0,0); end = start; end.hour++; - cout = icalcluster_new("clusterout.ics"); + cout = icalfileset_new(OUTPUT_FILE); assert(cout != 0); c = icalparser_parse_string(str2); assert(c != 0); - for(month = 1; month < 2; month++){ + /* Add data to the file */ + + for(month = 1; month < 10; month++){ icalcomponent *event; icalproperty *dtstart, *dtend; - cout = icalcluster_new("clusterout.ics"); + cout = icalfileset_new(OUTPUT_FILE); assert(cout != 0); start.month = month; @@ -147,10 +148,10 @@ void test_cluster() assert(dtend!=0); icalproperty_set_dtend(dtend,end); - icalcluster_add_component(cout,clone); - icalcluster_commit(cout); + icalfileset_add_component(cout,clone); + icalfileset_commit(cout); - icalcluster_free(cout); + icalfileset_free(cout); } @@ -158,13 +159,13 @@ void test_cluster() /* Print them out */ - cout = icalcluster_new("clusterout.ics"); + cout = icalfileset_new(OUTPUT_FILE); assert(cout != 0); - for (itr = icalcluster_get_first_component(cout, + for (itr = icalfileset_get_first_component(cout, ICAL_ANY_COMPONENT); itr != 0; - itr = icalcluster_get_next_component(cout, + itr = icalfileset_get_next_component(cout, ICAL_ANY_COMPONENT)){ icalcomponent *event; @@ -184,34 +185,34 @@ void test_cluster() /* Remove all of them */ - icalcluster_free(cout); + icalfileset_free(cout); - cout = icalcluster_new("clusterout.ics"); + cout = icalfileset_new(OUTPUT_FILE); assert(cout != 0); - for (itr = icalcluster_get_first_component(cout, + for (itr = icalfileset_get_first_component(cout, ICAL_ANY_COMPONENT); itr != 0; - itr = icalcluster_get_next_component(cout, + itr = icalfileset_get_next_component(cout, ICAL_ANY_COMPONENT)){ - icalcluster_remove_component(cout, itr); + icalfileset_remove_component(cout, itr); } - icalcluster_free(cout); + icalfileset_free(cout); /* Print them out again */ - cout = icalcluster_new("clusterout.ics"); + cout = icalfileset_new(OUTPUT_FILE); assert(cout != 0); count =0; - for (itr = icalcluster_get_first_component(cout, + for (itr = icalfileset_get_first_component(cout, ICAL_ANY_COMPONENT); itr != 0; - itr = icalcluster_get_next_component(cout, + itr = icalfileset_get_next_component(cout, ICAL_ANY_COMPONENT)){ icalcomponent *event; @@ -229,29 +230,29 @@ void test_cluster() } - icalcluster_free(cout); + icalfileset_free(cout); } -int test_store() +int test_dirset() { icalcomponent *c, *gauge; icalerrorenum error; - icalcomponent *next, *itr; - icalcluster* cluster; + icalcomponent *itr; + icalfileset* cluster; struct icalperiodtype rtime; - icalstore *s = icalstore_new("store"); + icaldirset *s = icaldirset_new("store"); int i; assert(s != 0); - rtime.start = icaltimetype_from_timet( time(0),0); + rtime.start = icaltime_from_timet( time(0),0,0); - cluster = icalcluster_new("clusterout.ics"); + cluster = icalfileset_new(OUTPUT_FILE); assert(cluster != 0); @@ -268,10 +269,10 @@ int test_store() rtime.end = rtime.start; rtime.end.hour++; - for (itr = icalcluster_get_first_component(cluster, + for (itr = icalfileset_get_first_component(cluster, ICAL_ANY_COMPONENT); itr != 0; - itr = icalcluster_get_next_component(cluster, + itr = icalfileset_get_next_component(cluster, ICAL_ANY_COMPONENT)){ icalcomponent *clone, *inner; icalproperty *p; @@ -316,7 +317,8 @@ int test_store() printf("\n----------\n%s\n---------\n",icalcomponent_as_ical_string(inner)); - error = icalstore_add_component(s,inner); + error = icaldirset_add_component(s, + icalcomponent_new_clone(itr)); assert(icalerrno == ICAL_NO_ERROR); @@ -346,15 +348,15 @@ int test_store() #if 0 - icalstore_select(s,gauge); + icaldirset_select(s,gauge); - for(c = icalstore_first(s); c != 0; c = icalstore_next(s)){ + for(c = icaldirset_first(s); c != 0; c = icaldirset_next(s)){ printf("Got one! (%d)\n", count++); if (c != 0){ printf("%s", icalcomponent_as_ical_string(c));; - if (icalstore_store(s2,c) == 0){ + if (icaldirset_store(s2,c) == 0){ printf("Failed to write!\n"); } icalcomponent_free(c); @@ -364,38 +366,43 @@ int test_store() } - icalstore_free(s2); + icaldirset_free(s2); #endif - for(c = icalstore_get_first_component(s); + for(c = icaldirset_get_first_component(s,ICAL_ANY_COMPONENT); c != 0; - c = next){ - - next = icalstore_get_next_component(s); + c = icaldirset_get_next_component(s,ICAL_ANY_COMPONENT)){ if (c != 0){ - /*icalstore_remove_component(s,c);*/ printf("%s", icalcomponent_as_ical_string(c));; } else { printf("Failed to get component\n"); } + } + + /* Remove all of the components */ + i=0; + while((c=icaldirset_get_current_component(s)) != 0 ){ + i++; + icaldirset_remove_component(s,c); } + - icalstore_free(s); + icaldirset_free(s); return 0; } void test_calendar() { icalcomponent *comp; - icalcluster *c; - icalstore *s; + icalfileset *c; + icaldirset *s; icalcalendar* calendar = icalcalendar_new("calendar"); icalerrorenum error; - struct icaltimetype atime = icaltimetype_from_timet( time(0),0); + struct icaltimetype atime = icaltime_from_timet( time(0),0,0); comp = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, @@ -419,13 +426,13 @@ void test_calendar() s = icalcalendar_get_booked(calendar); - error = icalstore_add_component(s,comp); + error = icaldirset_add_component(s,comp); assert(error == ICAL_NO_ERROR); c = icalcalendar_get_properties(calendar); - error = icalcluster_add_component(c,icalcomponent_new_clone(comp)); + error = icalfileset_add_component(c,icalcomponent_new_clone(comp)); assert(error == ICAL_NO_ERROR); @@ -437,16 +444,14 @@ void test_calendar() int main(int argc, char *argv[]) { +/* printf("\n------------Test File Set---------------\n"); + test_fileset(); */ - printf("\n------------Test Cluster---------------\n"); - test_cluster(); + printf("\n------------Test Dir Set---------------\n"); + test_dirset(); #if 0 - printf("\n------------Test Store---------------\n"); - test_store(); - - printf("\n------------Test Calendar---------------\n"); test_calendar(); diff --git a/libical/src/test/stow.c b/libical/src/test/stow.c index d7629855c5..f742b417a5 100644 --- a/libical/src/test/stow.c +++ b/libical/src/test/stow.c @@ -33,35 +33,85 @@ #include #include /* for uname */ #include /* for stat */ -#include /* for stat, getpid */ +#include /* for stat, getpid, getopt */ +#include /* For getpwent */ +#include /* For getpwent */ +#include /* for tolower */ #include "ical.h" #include "icalcalendar.h" - +#include "icalfileset.h" +#include "icalmime.h" char* program_name; #define TMPSIZE 2048 +#define SENDMAIL "/usr/lib/sendmail -t" enum options { - STORE_IN_DIR, + STORE_IN_FILE, STORE_IN_DB, - INPUT_IS_EMAIL, + INPUT_IS_MIME, INPUT_IS_ICAL, INPUT_FROM_STDIN, - INPUT_FROM_FILE + INPUT_FROM_FILE, + ERRORS_TO_STDOUT, + ERRORS_TO_ORGANIZER }; struct options_struct { enum options storage; enum options input_type; + enum options input_source; + enum options errors; char* input_file; - char* input_text; char* calid; - char* caldir; + char* output_file; +}; + + +enum file_type +{ + ERROR, + NO_FILE, + DIRECTORY, + REGULAR, + OTHER }; +enum file_type test_file(char *path) +{ + struct stat sbuf; + enum file_type type; + + errno = 0; + + /* Check if the path already exists and if it is a directory*/ + if (stat(path,&sbuf) != 0){ + + /* A file by the given name does not exist, or there was + another error */ + if(errno == ENOENT) + { + type = NO_FILE; + } else { + type = ERROR; + } + + } else { + /* A file by the given name exists, but is it a directory? */ + + if (S_ISDIR(sbuf.st_mode)){ + type = DIRECTORY; + } else if(S_ISREG(sbuf.st_mode)){ + type = REGULAR; + } else { + type = OTHER; + } + } + return type; +} char* lowercase(char* str) { @@ -79,23 +129,33 @@ char* lowercase(char* str) return new; } +#if 0 char* get_local_attendee(struct options_struct *opt) { char attendee[PATH_MAX]; - char* user = getenv("USER"); - struct utsname uts; + if(opt->calid){ - uname(&uts); + strncpy(attendee,opt->calid,PATH_MAX); - /* HACK nodename may not be a fully qualified domain name */ - snprintf(attendee,PATH_MAX,"%s@%s",user,uts.nodename); + } else { + + char* user = getenv("USER"); + struct utsname uts; + uname(&utget_option); + /* HACK nodename may not be a fully qualified domain name */ + snprintf(attendee,PATH_MAX,"%s@%s",user,uts.nodename); + } + return lowercase(attendee); } +#endif void usage(char *message) { + fprintf(stderr,"Usage: %s [-emdcn] [-i inputfile] [-o outputfile] [-u calid]\n",program_name); + } icalcomponent* get_first_real_component(icalcomponent *comp) @@ -140,20 +200,20 @@ char* make_mime(char* to, char* from, char* subject, uname(&uts); srand(time(0)<calid; + FILE* p; - fputs(make_mime("Dest", "Source", "iMIP error", - message, "reply", - icalcomponent_as_ical_string(comp)),stdout); + icalcomponent *inner = get_first_real_component(comp); + + icalproperty *organizer_prop = icalcomponent_get_first_property(inner,ICAL_ORGANIZER_PROPERTY); + char *organizer = icalproperty_get_organizer(organizer_prop); + + organizer += 7; + if (opt->errors == ERRORS_TO_ORGANIZER){ + p = popen(SENDMAIL,"w"); + } else { + p = stdout; + } + + if(p == 0){ + fprintf(stderr, + "%s: fatal. Could not open pipe to sendmail (\"%s\") \n", + program_name,SENDMAIL); + exit(1); + } + + fputs(make_mime(organizer, local_attendee, "iMIP error", + message, "reply", + icalcomponent_as_ical_string(comp)),p); + + if (opt->errors == ERRORS_TO_ORGANIZER){ + pclose(p); + } } /* The program had a fatal error and could not process the incoming component*/ @@ -201,43 +287,124 @@ void return_error(icalcomponent* comp, char* message, struct options_struct *op } -char* check_component(icalcomponent* comp, struct options_struct *opt) +icalcomponent* make_reply(icalcomponent *comp, icalproperty *return_status, + struct options_struct *opt) + +{ + icalcomponent *reply, *rinner; + icalcomponent *inner = get_first_real_component(comp); + icalproperty *p=0; + char* local_attendee = opt->calid; + char attendee[TMPSIZE]; + + char prodid[TMPSIZE]; + + snprintf(attendee,TMPSIZE,"mailto:%s",local_attendee); + + snprintf(prodid,TMPSIZE,"-//Softwarestudio.org//%s version %s//EN",ICAL_PACKAGE,ICAL_VERSION); + + /* Create the base component */ + reply = icalcomponent_vanew( + ICAL_VCALENDAR_COMPONENT, + icalproperty_new_version(strdup("2.0")), + icalproperty_new_prodid(strdup(prodid)), + icalproperty_new_method(ICAL_METHOD_REPLY), + icalcomponent_vanew( + ICAL_VEVENT_COMPONENT, + icalproperty_new_clone( + icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY)), + icalproperty_new_clone( + icalcomponent_get_first_property(inner,ICAL_ORGANIZER_PROPERTY)), + icalproperty_new_clone( + icalcomponent_get_first_property(inner,ICAL_UID_PROPERTY)), + icalproperty_new_attendee(attendee), + 0), + 0); + + + /* Convert errors into request-status properties and transfers + them to the reply component */ + + icalcomponent_convert_errors(comp); + + rinner = get_first_real_component(reply); + + for(p = icalcomponent_get_first_property(inner, + ICAL_REQUESTSTATUS_PROPERTY); + p != 0; + p = icalcomponent_get_next_property(inner, + ICAL_REQUESTSTATUS_PROPERTY)){ + + icalcomponent_add_property(rinner,icalproperty_new_clone(p)); + } + + if(return_status != 0){ + icalcomponent_add_property(rinner, return_status); + } + + return reply; + +} + +int check_attendee(icalproperty *p, struct options_struct *opt){ + char* s = icalproperty_get_attendee(p); + char* lower_attendee = lowercase(s); + char* local_attendee = opt->calid; + + /* Check that attendee begins with "mailto:" */ + if (strncmp(lower_attendee,"mailto:",7) == 0){ + /* skip over the mailto: part */ + lower_attendee += 7; + + if(strcmp(lower_attendee,local_attendee) == 0){ + return 1; + } + + lower_attendee -= 7; + + free(lower_attendee); + } + + return 0; +} + +char static_component_error_str[PATH_MAX]; +char* check_component(icalcomponent* comp, icalproperty **return_status, + struct options_struct *opt) { - static char static_component_error_str[PATH_MAX]; char* component_error_str=0; icalcomponent* inner; int errors = 0; icalproperty *p; int found_attendee = 0; + *return_status = 0; + /* This do/while loop only executes once because it is being used to fake exceptions */ do { - /* Check that the root component is a VCALENDAR */ - if(icalcomponent_isa(comp) != ICAL_VCALENDAR_COMPONENT){ + /* Check that we actually got a component */ + if(comp == 0){ strcpy(static_component_error_str, - "Root component is not a VCALENDAR"); + "Did not find a component"); component_error_str = static_component_error_str; break; } - /* Check that the component passes iTIP restrictions */ - - errors = icalcomponent_count_errors(comp); - icalrestriction_check(comp); - - if(errors != icalcomponent_count_errors(comp)){ + /* Check that the root component is a VCALENDAR */ + if(icalcomponent_isa(comp) != ICAL_VCALENDAR_COMPONENT){ strcpy(static_component_error_str, - "The component does not conform to iTIP restrictions"); + "Root component is not a VCALENDAR"); component_error_str = static_component_error_str; break; } + /* Check that the component has a METHOD */ - if (!icalcomponent_get_first_property(comp,ICAL_METHOD_PROPERTY) == 0) + if (icalcomponent_get_first_property(comp,ICAL_METHOD_PROPERTY) == 0) { strcpy(static_component_error_str, "Component does not have a METHOD property"); @@ -245,208 +412,288 @@ char* check_component(icalcomponent* comp, struct options_struct *opt) break; } - /* Check for this user as an attendee */ + inner = get_first_real_component(comp); - inner = get_first_real_component(comp); + /* Check that the compopnent has an organizer */ + if(icalcomponent_get_first_property(inner,ICAL_ORGANIZER_PROPERTY) == 0){ + fprintf(stderr,"%s: fatal. Component does not have an ORGANIZER property\n",program_name); + + exit(1); + } + + + /* Check for this user as an attendee or organizer */ for(p = icalcomponent_get_first_property(inner,ICAL_ATTENDEE_PROPERTY); p != 0; p = icalcomponent_get_next_property(inner,ICAL_ATTENDEE_PROPERTY)){ - - char* s = icalproperty_get_attendee(p); - char* lower_attendee = lowercase(s); - char* local_attendee = get_local_attendee(opt); - - /* Check that attendee begins with "mailto:" */ - if (strncmp(lower_attendee,"mailto:",7) == 0){ - /* skip over the mailto: part */ - lower_attendee += 7; - - if(strcmp(lower_attendee,local_attendee) == 0){ - found_attendee = 1; - } - - lower_attendee -= 7; + + found_attendee += check_attendee(p,opt); + } - free(local_attendee); - free(lower_attendee); - - } + for(p = icalcomponent_get_first_property(inner,ICAL_ORGANIZER_PROPERTY); + p != 0; + p = icalcomponent_get_next_property(inner,ICAL_ORGANIZER_PROPERTY)){ + + found_attendee += check_attendee(p,opt); } - + if (found_attendee == 0){ - char* local_attendee = get_local_attendee(opt); + struct icalreqstattype rs; + char* rs_string; + memset(static_component_error_str,0,PATH_MAX); + snprintf(static_component_error_str,PATH_MAX, - "This target user (%s) is not listed as an attendee", - local_attendee ); + "This target user (%s) is not listed as an attendee or organizer", + opt->calid ); component_error_str = static_component_error_str; - free(local_attendee); + + rs.code = ICAL_3_7_INVCU_STATUS; + rs.desc = 0; + rs.debug = component_error_str; + rs_string = icalreqstattype_as_string(rs); + + *return_status = icalproperty_new_requeststatus(rs_string); break; } + + + /* Check that the component passes iTIP restrictions */ + + errors = icalcomponent_count_errors(comp); + icalrestriction_check(comp); + + if(errors != icalcomponent_count_errors(comp)){ + snprintf(static_component_error_str,PATH_MAX, + "The component does not conform to iTIP restrictions.\n Here is the original component; look at the X-LIC-ERROR properties\nfor details\n\n%s",icalcomponent_as_ical_string(comp)); + component_error_str = static_component_error_str; + break; + } + + + } while(0); return component_error_str; } + void get_options(int argc, char* argv[], struct options_struct *opt) { - opt->storage = STORE_IN_DIR; - opt->input_type = INPUT_FROM_STDIN; + int c; + extern char *optarg; + extern int optind, optopt; + int errflg=0; + + opt->storage = STORE_IN_FILE; + opt->input_source = INPUT_FROM_STDIN; + opt->input_type = INPUT_IS_ICAL; opt->input_file = 0; - opt->input_text = 0; + opt->errors = ERRORS_TO_ORGANIZER; opt->calid = 0; - opt->caldir = 0; -} - -char* check_options(struct options_struct *opt) -{ - return 0; -} - -void store_component(icalcomponent *comp, icalcalendar* cal, - struct options_struct *opt) -{ - - icalcluster *incoming = 0; - icalerrorenum error; - - incoming = icalcalendar_get_incoming(cal); + opt->output_file = 0; + + + while ((c = getopt(argc, argv, "nemu:o:d:b:c:i:")) != -1) { + switch (c) { + case 'e': { /* Input data is MIME encapsulated */ + opt->input_type = INPUT_IS_MIME; + break; + } + case 'm': { /* Input is iCal. Default*/ + opt->input_type = INPUT_IS_ICAL; + break; + } + case 'i': { /* Input comes from named file */ + opt->input_source = INPUT_FROM_FILE; + opt->input_file = strdup(optarg); + break; + } + case 'o': { /* Output goes to named file. Default*/ + opt->output_file = strdup(optarg); + opt->storage = STORE_IN_FILE; + break; + } + case 'd': { /* Output goes to database */ + fprintf(stderr,"%s: option -d is unimplmented\n",program_name); + opt->storage = STORE_IN_DB; + errflg++; + break; + } + case 'c': { + + break; + } + case 'u': { /* Set the calid for the output database or + file. Default is user name of user running + program */ + opt->calid = strdup(optarg); + break; + } + + case 'n': { /* Dump error to stdout. Default is to + send error to the organizer specified + in the iCal data */ + opt->errors = ERRORS_TO_STDOUT; + break; + } + + case ':': {/* Option given without an operand */ + fprintf(stderr, + "%s: Option -%c requires an operand\n", + program_name,optopt); + errflg++; + break; + } + case '?': { + errflg++; + } + + } + + if (errflg >0){ + usage(""); + exit(1); + } + } - if (incoming == 0){ - fprintf(stderr,"%s: Failed to get incoming component directory: %s\n", - program_name, icalerror_strerror(icalerrno)); - exit(1); - } + if(opt->calid == 0){ + /* If no calid specified, use username */ + char attendee[PATH_MAX]; + char* user = getenv("USER"); + struct utsname uts; + uname(&uts); + /* HACK nodename may not be a fully qualified domain name */ + snprintf(attendee,PATH_MAX,"%s@%s",user,uts.nodename); - error = icalcluster_add_component(incoming,comp); - - if (error != ICAL_NO_ERROR){ - fprintf(stderr,"%s: Failed to write incoming component: %s\n", - program_name, icalerror_strerror(icalerrno)); - exit(1); - } - - error = icalcluster_commit(incoming); - - if (error != ICAL_NO_ERROR){ - fprintf(stderr,"%s: Failed to commit incoming cluster: %s\n", - program_name, icalerror_strerror(icalerrno)); - exit(1); + opt->calid = lowercase(attendee); } - - return; -} - -enum file_type -{ - ERROR, - NO_FILE, - DIRECTORY, - REGULAR, - OTHER -}; -enum file_type test_file(char *path) -{ - struct stat sbuf; - enum file_type type; - - errno = 0; + if(opt->storage == STORE_IN_FILE && + opt->output_file ==0){ + char file[PATH_MAX]; + char* user = getenv("USER"); + struct passwd *pw; - /* Check if the path already exists and if it is a directory*/ - if (stat(path,&sbuf) != 0){ + if(!user){ + fprintf(stderr,"%s: Can't get username. Try explicitly specifing the output file with -o", program_name); + exit(1); + } - /* A file by the given name does not exist, or there was - another error */ - if(errno == ENOENT) - { - type = NO_FILE; - } else { - type = ERROR; + /* Find password entry for user */ + while( (pw = getpwent())!=0){ + if(strcmp(user,pw->pw_name)==0){ + break; + } + } + + if(pw==0){ + fprintf(stderr,"%s: Can't get get password entry for user \"%s\" Try explicitly specifing the output file with -o", + program_name,user); + exit(1); } - } else { - /* A file by the given name exists, but is it a directory? */ - - if (S_ISDIR(sbuf.st_mode)){ - type = DIRECTORY; - } else if(S_ISREG(sbuf.st_mode)){ - type = REGULAR; - } else { - type = OTHER; + if(pw->pw_dir==0){ + fprintf(stderr,"%s: User \"%s\" has no home directory. Try explicitly specifing the output file with -o", + program_name, user); + exit(1); } + + snprintf(file,PATH_MAX,"%s/.facs/%s",pw->pw_dir,opt->calid); + + opt->output_file = strdup(file); } - return type; -} -icalcalendar* get_calendar(icalcomponent* comp, struct options_struct *opt) -{ - - struct stat sbuf; - char calpath[PATH_MAX]; - char facspath[PATH_MAX]; - char* home = getenv("HOME"); - char* user = getenv("USER"); - enum file_type type; - icalcalendar* cal; + /* Now try to create the calendar directory if it does + not exist */ - snprintf(facspath,PATH_MAX,"%s/.facs",home); + if(opt->storage == STORE_IN_FILE ) { + char * p; + char* facspath = strdup(opt->output_file); + enum file_type type; - type = test_file(facspath); + /* Cut off the last slash to make it just a directoy */ - errno = 0; - if (type == NO_FILE){ + p = strrchr(facspath,'/'); - if(mkdir(facspath,0775) != 0){ - fprintf(stderr,"%s: Failed to create calendar store directory %s: %s\n", - program_name,facspath, strerror(errno)); - exit(1); - } else { - printf("%s: Creating calendar store directory %s\n",program_name,facspath); - } + if (p == 0){ + fprintf(stderr,"%s: Invalid calendar filename \"%s\"", + program_name,facspath); + exit(1); + } + + *p='\0'; + + type = test_file(facspath); - } else if(type==REGULAR || type == ERROR){ - fprintf(stderr,"%s: Cannot create calendar store directory %s\n", + errno = 0; + if (type == NO_FILE){ + + if(mkdir(facspath,0775) != 0){ + fprintf(stderr, + "%s: Failed to create calendar directory %s: %s\n", + program_name,facspath, strerror(errno)); + exit(1); + } else { + fprintf(stderr,"%s: Creating calendar directory %s\n", + program_name,facspath); + } + + } else if(type==REGULAR || type == ERROR){ + fprintf(stderr,"%s: Cannot create calendar directory %s\n", program_name,facspath); exit(1); - } + } + } +} +char* check_options(struct options_struct *opt) +{ + return 0; +} +void store_component(icalcomponent *comp, struct options_struct *opt) +{ + icalerrorenum error; - snprintf(calpath,PATH_MAX,"%s/%s",facspath,user); - type = test_file(calpath); + if(opt->storage == STORE_IN_FILE){ + icalfileset *fs = icalfileset_new(opt->output_file); - errno = 0; + if (fs == 0){ + fprintf(stderr, + "%s: Failed to get incoming component directory: %s\n", + program_name, icalerror_strerror(icalerrno)); + exit(1); + } - if (type == NO_FILE){ - if(mkdir(calpath,0775) != 0){ - fprintf(stderr,"%s: Failed to create calendar directory %s: %s\n", - program_name,calpath, strerror(errno)); - } else { - printf("%s: Creating calendar store directory %s\n",program_name,facspath); + error = icalfileset_add_component(fs,comp); + + if (error != ICAL_NO_ERROR){ + fprintf(stderr,"%s: Failed to write incoming component: %s\n", + program_name, icalerror_strerror(icalerrno)); + exit(1); } - } else if(type==REGULAR || type == ERROR){ - fprintf(stderr,"%s: Cannot create calendar directory %s\n", - program_name,calpath); + + error = icalfileset_commit(fs); + + if (error != ICAL_NO_ERROR){ + fprintf(stderr,"%s: Failed to commit incoming cluster: %s\n", + program_name, icalerror_strerror(icalerrno)); exit(1); - } - - cal = icalcalendar_new(calpath); + } + + icalfileset_free(fs); - if(cal == 0){ - fprintf(stderr,"%s: Failed to open calendar at %s: %s", - program_name,calpath,icalerror_strerror(icalerrno)); - exit(1); + return; + } else { + assert(0); } - - return cal; - } char* read_stream(char *s, size_t size, void *d) @@ -456,14 +703,14 @@ char* read_stream(char *s, size_t size, void *d) return c; } -icalcomponent* read_component(struct options_struct *opt) +icalcomponent* read_nonmime_component(struct options_struct *opt) { FILE *stream; icalcomponent *comp; icalparser* parser = icalparser_new(); char* line; - if(opt->input_type == INPUT_FROM_FILE){ + if(opt->input_source == INPUT_FROM_FILE){ stream = fopen(opt->input_file,"r"); if (stream == 0){ @@ -490,22 +737,89 @@ icalcomponent* read_component(struct options_struct *opt) } while ( line != 0); - if(opt->input_type == INPUT_FROM_FILE){ + if(opt->input_source == INPUT_FROM_FILE){ fclose(stream); } + return comp; } +icalcomponent* find_vcalendar(icalcomponent* comp) +{ + icalcomponent *c,*rtrn; + + for(c = icalcomponent_get_first_component(comp,ICAL_ANY_COMPONENT); + c != 0; + c = icalcomponent_get_next_component(comp,ICAL_ANY_COMPONENT)){ + + if(icalcomponent_isa(c) == ICAL_VCALENDAR_COMPONENT){ + icalcomponent_remove_component(comp,c); + return c; + } + + if((rtrn=find_vcalendar(c)) != 0){ + return rtrn; + } + } + + return 0; +} + +icalcomponent* read_mime_component(struct options_struct *opt) +{ + icalcomponent *comp,*mimecomp; + FILE* stream; + + if(opt->input_source == INPUT_FROM_FILE){ + stream = fopen(opt->input_file,"r"); + + if (stream == 0){ + perror("Can't open input file"); + exit(1); + } + + } else { + stream = stdin; + } + + assert(stream != 0); + + mimecomp = icalmime_parse(read_stream,(void*)stream); + + /* now find the iCal component embedded within the mime component */ + comp = find_vcalendar(mimecomp); + + + if(comp == 0){ + return 0; + } + + return comp; +} + +icalcomponent* read_component(struct options_struct *opt) +{ + if(opt->input_type == INPUT_IS_MIME){ + return read_mime_component(opt); + } else if (opt->input_type == INPUT_IS_ICAL){ + return read_nonmime_component(opt); + } else { + fprintf(stderr,"%s: Internal Error; unknown option for input_type\n", + program_name); + exit(1); + } +} + int main(int argc, char* argv[] ) { char* options_error_str; char* component_error_str; - icalcalendar* cal; icalcomponent* comp, *reply; struct options_struct opt; + icalproperty *return_status; - program_name = argv[0]; + program_name = strrchr(argv[0],'/'); get_options(argc, argv, &opt); @@ -516,17 +830,19 @@ int main(int argc, char* argv[] ) comp = read_component(&opt); - if ( (component_error_str = check_component(comp,&opt)) != 0){ - return_failure(comp, component_error_str, &opt); - exit(1); + if ( (component_error_str = + check_component(comp,&return_status,&opt)) != 0){ + reply = make_reply(comp,return_status,&opt); + return_failure(reply, component_error_str, &opt); + icalcomponent_free(reply); + exit(0); } - cal = get_calendar(comp,&opt); + store_component(comp,&opt); - store_component(comp,cal, &opt); - icalcomponent_free(comp); - icalcalendar_free(cal); + /* Don't free the component comp, since it is now part of the + store, and will be freed there */ exit(0); } diff --git a/libical/test-data/Makefile.am b/libical/test-data/Makefile.am index bf2079606c..83a434b288 100644 --- a/libical/test-data/Makefile.am +++ b/libical/test-data/Makefile.am @@ -10,4 +10,11 @@ EXTRA_DIST = \ 5 \ 6 \ 7 \ -smallcluster.ics \ No newline at end of file +smallcluster.ics \ +recur.txt \ +user-cal.vcf \ +complex-mime.txt \ +simple-mime.txt \ +stresstest.ics + + -- cgit v1.2.3