
2003-10-09 Jeffrey Stedfast <fejj@ximian.com> * src/libical/Makefile.am: Fixed INCLUDES and don't autogenerate ical.h, no need to. Plus it caused problems anyways. * src/libical/*.[c,h]: Fixed the #includes * src/libicalss/Makefile.am: Fixed INCLUDES and don't autogenerate icalss.h, no need to. Plus it caused problems anyways. * src/libicalss/*.[c,h]: Fixed the #includes * tests/*.c: #include <libical/ical.h> rather than "ical.h" * tests/Makefile.am: Fixed INCLUDES * examples/*.c: #include <libical/ical.h> rather than "ical.h" * examples/Makefile.am: Fixed INCLUDES * src/libicalvcal/icalvcal.h: #include <libical/ical.h> which is no longer autogenerated. * src/libicalvcal/icalvcal.c (icalvcal_convert_with_defaults): Use the proper macro names from config.h svn path=/trunk/; revision=22844
71 lines
1.7 KiB
C
71 lines
1.7 KiB
C
/* errors.c */
|
|
|
|
#include <libical/ical.h>
|
|
#include <stdio.h>
|
|
|
|
void program_errors()
|
|
{
|
|
/*Most routines will set icalerrno on errors. This is an
|
|
enumeration defined in icalerror.h */
|
|
|
|
icalcomponent *c;
|
|
|
|
icalerror_clear_errno();
|
|
|
|
c = icalcomponent_new(ICAL_VEVENT_COMPONENT);
|
|
|
|
if (icalerrno != ICAL_NO_ERROR){
|
|
|
|
fprintf(stderr,"Horrible libical error: %s\n",
|
|
icalerror_strerror(icalerrno));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void component_errors(icalcomponent *comp)
|
|
{
|
|
int errors;
|
|
icalproperty *p;
|
|
|
|
/* presume that we just got this component from the parser */
|
|
|
|
errors = icalcomponent_count_errors(comp);
|
|
|
|
printf("This component has %d parsing errors\n", errors);
|
|
|
|
/* Print out all of the parsing errors. This is not strictly
|
|
correct, because it does not descend into any sub-components,
|
|
as icalcomponent_count_errors() does. */
|
|
|
|
for(p = icalcomponent_get_first_property(comp,ICAL_XLICERROR_PROPERTY);
|
|
p != 0;
|
|
p = icalcomponent_get_next_property(comp,ICAL_XLICERROR_PROPERTY))
|
|
{
|
|
|
|
printf("-- The error is %s:\n",icalproperty_get_xlicerror(p));
|
|
}
|
|
|
|
|
|
|
|
/* Check the component for iTIP compilance, and add more
|
|
X-LIC-ERROR properties if it is non-compilant. */
|
|
icalrestriction_check(comp);
|
|
|
|
|
|
/* Count the new errors. */
|
|
if(errors != icalcomponent_count_errors(comp)){
|
|
printf(" -- The component also has iTIP restriction errors \n");
|
|
}
|
|
|
|
/* Since there are iTIP restriction errors, it may be impossible
|
|
to process this component as an iTIP request. In this case, the
|
|
X-LIC-ERROR proeprties should be expressed as REQUEST-STATUS
|
|
properties in the reply. This following routine makes this
|
|
conversion */
|
|
|
|
|
|
icalcomponent_convert_errors(comp);
|
|
|
|
}
|