diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /libkcal/libical/examples/errors.c | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkcal/libical/examples/errors.c')
-rw-r--r-- | libkcal/libical/examples/errors.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/libkcal/libical/examples/errors.c b/libkcal/libical/examples/errors.c new file mode 100644 index 000000000..86d963bd7 --- /dev/null +++ b/libkcal/libical/examples/errors.c @@ -0,0 +1,70 @@ +/* errors.c */ + +#include "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); + +} |