Initial revision

svn path=/trunk/; revision=6915
This commit is contained in:
Federico Mena Quintero
2000-12-11 22:07:10 +00:00
parent 23be726b60
commit 1a8645d8b8
36 changed files with 20368 additions and 0 deletions

1121
libical/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1232
libical/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

3078
libical/ltconfig Executable file

File diff suppressed because it is too large Load Diff

4012
libical/ltmain.sh Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalparam.h
CREATOR: eric 20 March 1999
$Id: icalparameter.h.in,v 1.1 2000/12/11 22:05:59 federico Exp $
$Locker: $
(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
======================================================================*/
#ifndef ICALPARAM_H
#define ICALPARAM_H
#include "icalenums.h"
typedef void icalparameter;
icalparameter* icalparameter_new(icalparameter_kind kind);
icalparameter* icalparameter_new_clone(icalparameter* p);
icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* value);
void icalparameter_free(icalparameter* parameter);
char* icalparameter_as_ical_string(icalparameter* parameter);
int icalparameter_is_valid(icalparameter* parameter);
icalparameter_kind icalparameter_isa(icalparameter* parameter);
int icalparameter_isa_parameter(void* param);
/* Acess the name of an X parameer */
void icalparameter_set_xname (icalparameter* param, const char* v);
const char* icalparameter_get_xname(icalparameter* param);
void icalparameter_set_xvalue (icalparameter* param, const char* v);
const char* icalparameter_get_xvalue(icalparameter* param);
/* Everything below this line is machine generated. Do not edit. */

View File

@ -0,0 +1,560 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalproperty.c
CREATOR: eric 28 April 1999
$Id: icalproperty.c.in,v 1.1 2000/12/11 22:05:59 federico Exp $
(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 icalproperty.c
======================================================================*/
#line 27 "icalproperty.c.in"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalproperty.h"
#include "icalcomponent.h"
#include "pvl.h"
#include "icalenums.h"
#include "icalerror.h"
#include "icalmemory.h"
#include <string.h> /* For icalmemory_strdup, rindex */
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h> /* for printf */
#include <stdarg.h> /* for va_list, va_start, etc. */
#define TMP_BUF_SIZE 1024
/* Private routines for icalproperty */
void icalvalue_set_parent(icalvalue* value,
icalproperty* property);
icalproperty* icalvalue_get_parent(icalvalue* value);
void icalparameter_set_parent(icalparameter* param,
icalproperty* property);
icalproperty* icalparameter_get_parent(icalparameter* value);
void icalproperty_set_x_name(icalproperty* prop, char* name);
struct icalproperty_impl
{
char id[5];
icalproperty_kind kind;
char* x_name;
pvl_list parameters;
pvl_elem parameter_iterator;
icalvalue* value;
icalcomponent *parent;
};
void icalproperty_add_parameters(struct icalproperty_impl *impl,va_list args)
{
void* vp;
while((vp = va_arg(args, void*)) != 0) {
if (icalvalue_isa_value(vp) != 0 ){
} else if (icalparameter_isa_parameter(vp) != 0 ){
icalproperty_add_parameter((icalproperty*)impl,
(icalparameter*)vp);
} else {
assert(0);
}
}
}
struct icalproperty_impl*
icalproperty_new_impl (icalproperty_kind kind)
{
struct icalproperty_impl* prop;
if ( ( prop = (struct icalproperty_impl*)
malloc(sizeof(struct icalproperty_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
strcpy(prop->id,"prop");
prop->kind = kind;
prop->parameters = pvl_newlist();
prop->parameter_iterator = 0;
prop->value = 0;
prop->x_name = 0;
prop->parent = 0;
return prop;
}
icalproperty*
icalproperty_new (icalproperty_kind kind)
{
icalproperty *prop = (icalproperty*)icalproperty_new_impl(kind);
return prop;
}
icalproperty*
icalproperty_new_clone(icalproperty* prop)
{
struct icalproperty_impl *old = (struct icalproperty_impl*)prop;
struct icalproperty_impl *new = icalproperty_new_impl(old->kind);
pvl_elem p;
icalerror_check_arg_rz((prop!=0),"Prop");
icalerror_check_arg_rz((old!=0),"old");
icalerror_check_arg_rz((new!=0),"new");
if (old->value !=0) {
new->value = icalvalue_new_clone(old->value);
}
if (old->x_name != 0) {
new->x_name = icalmemory_strdup(old->x_name);
if (new->x_name == 0) {
icalproperty_free(new);
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
}
for(p=pvl_head(old->parameters);p != 0; p = pvl_next(p)){
icalparameter *param = icalparameter_new_clone(pvl_data(p));
if (param == 0){
icalproperty_free(new);
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
pvl_push(new->parameters,param);
}
return new;
}
/* This one works a little differently from the other *_from_string
routines; the string input is the name of the property, not the
data associated with the property, as it is in
icalvalue_from_string. All of the parsing associated with
properties is driven by routines in icalparse.c */
icalproperty* icalproperty_new_from_string(char* str)
{
icalproperty_kind kind;
icalerror_check_arg_rz( (str!=0),"str");
kind = icalenum_string_to_property_kind(str);
if (kind == ICAL_NO_PROPERTY){
if( str[0] == 'X' && str[1] == '-'){
icalproperty *p = icalproperty_new(ICAL_X_PROPERTY);
icalproperty_set_x_name(p,str);
return p;
} else {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return 0;
}
} else {
return icalproperty_new(kind);
}
}
void
icalproperty_free (icalproperty* prop)
{
struct icalproperty_impl *p;
icalparameter* param;
icalerror_check_arg_rv((prop!=0),"prop");
p = (struct icalproperty_impl*)prop;
#ifdef ICAL_FREE_ON_LIST_IS_ERROR
icalerror_assert( (p->parent ==0),"Tried to free a property that is still attached to a component. ");
#else
if(p->parent !=0){
return;
}
#endif
if (p->value != 0){
icalvalue_set_parent(p->value,0);
icalvalue_free(p->value);
}
while( (param = pvl_pop(p->parameters)) != 0){
icalparameter_free(param);
}
pvl_free(p->parameters);
if (p->x_name != 0) {
free(p->x_name);
}
p->kind = ICAL_NO_PROPERTY;
p->parameters = 0;
p->parameter_iterator = 0;
p->value = 0;
p->x_name = 0;
p->id[0] = 'X';
free(p);
}
char*
icalproperty_as_ical_string (icalproperty* prop)
{
icalparameter *param;
/* Create new buffer that we can append names, parameters and a
value to, and reallocate as needed. Later, this buffer will be
copied to a icalmemory_tmp_buffer, which is managed internally
by libical, so it can be given to the caller without fear of
the caller forgetting to free it */
const char* property_name = 0;
size_t buf_size = 1024;
char* buf = icalmemory_new_buffer(buf_size);
char* buf_ptr = buf;
icalvalue* value;
char *out_buf;
char newline[] = "\n";
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
/* Append property name */
if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){
property_name = impl->x_name;
} else {
property_name = icalenum_property_kind_to_string(impl->kind);
}
if (property_name == 0 ) {
icalerror_warn("Got a property of an unknown kind.");
icalmemory_free_buffer(buf);
return 0;
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
/* Append parameters */
for(param = icalproperty_get_first_parameter(prop,ICAL_ANY_PARAMETER);
param != 0;
param = icalproperty_get_next_parameter(prop,ICAL_ANY_PARAMETER)) {
char* kind_string = icalparameter_as_ical_string(param);
if (kind_string == 0 ) {
char temp[TMP_BUF_SIZE];
snprintf(temp, TMP_BUF_SIZE,"Got a parameter of unknown kind in %s property",property_name);
icalerror_warn(temp);
continue;
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
}
/* Append value */
icalmemory_append_string(&buf, &buf_ptr, &buf_size, " :");
value = icalproperty_get_value(prop);
if (value != 0){
const 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");
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
/* Now, copy the buffer to a tmp_buffer, which is safe to give to
the caller without worring about de-allocating it. */
out_buf = icalmemory_tmp_buffer(strlen(buf)+1);
strcpy(out_buf, buf);
icalmemory_free_buffer(buf);
return out_buf;
}
icalproperty_kind
icalproperty_isa (icalproperty* property)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)property;
if(property != 0){
return p->kind;
}
return ICAL_NO_PROPERTY;
}
int
icalproperty_isa_property (void* property)
{
struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
icalerror_check_arg_rz( (property!=0), "property");
if (strcmp(impl->id,"prop") == 0) {
return 1;
} else {
return 0;
}
}
void
icalproperty_add_parameter (icalproperty* prop,icalparameter* parameter)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
icalerror_check_arg_rv( (prop!=0),"prop");
icalerror_check_arg_rv( (parameter!=0),"parameter");
pvl_push(p->parameters, parameter);
}
void
icalproperty_set_parameter (icalproperty* prop,icalparameter* parameter)
{
icalproperty_kind kind;
kind = icalparameter_isa(parameter);
icalproperty_remove_parameter(prop,kind);
icalproperty_add_parameter(prop,parameter);
}
void
icalproperty_remove_parameter (icalproperty* prop, icalparameter_kind kind)
{
pvl_elem p;
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
icalerror_check_arg_rv((prop!=0),"prop");
for(p=pvl_head(impl->parameters);p != 0; p = pvl_next(p)){
icalparameter* param = (icalparameter *)pvl_data (p);
if (icalparameter_isa(param) == kind) {
pvl_remove (impl->parameters, p);
icalparameter_free (param);
break;
}
}
}
int
icalproperty_count_parameters (icalproperty* prop)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
if(prop != 0){
return pvl_count(p->parameters);
}
icalerror_set_errno(ICAL_USAGE_ERROR);
return -1;
}
icalparameter*
icalproperty_get_first_parameter (icalproperty* prop, icalparameter_kind kind)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
p->parameter_iterator = pvl_head(p->parameters);
if (p->parameter_iterator == 0) {
return 0;
}
for( p->parameter_iterator = pvl_head(p->parameters);
p->parameter_iterator !=0;
p->parameter_iterator = pvl_next(p->parameter_iterator)){
icalparameter *param = (icalparameter*)pvl_data(p->parameter_iterator);
if(icalparameter_isa(param) == kind || kind == ICAL_ANY_PARAMETER){
return param;
}
}
return 0;
}
icalparameter*
icalproperty_get_next_parameter (icalproperty* prop, icalparameter_kind kind)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
if (p->parameter_iterator == 0) {
return 0;
}
for( p->parameter_iterator = pvl_next(p->parameter_iterator);
p->parameter_iterator !=0;
p->parameter_iterator = pvl_next(p->parameter_iterator)){
icalparameter *param = (icalparameter*)pvl_data(p->parameter_iterator);
if(icalparameter_isa(param) == kind || kind == ICAL_ANY_PARAMETER){
return param;
}
}
return 0;
}
void
icalproperty_set_value (icalproperty* prop, icalvalue* value)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
icalerror_check_arg_rv((prop !=0),"prop");
icalerror_check_arg_rv((value !=0),"value");
if (p->value != 0){
icalvalue_set_parent(p->value,0);
icalvalue_free(p->value);
p->value = 0;
}
p->value = value;
icalvalue_set_parent(value,prop);
}
icalvalue*
icalproperty_get_value (icalproperty* prop)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
return p->value;
}
void icalproperty_set_x_name(icalproperty* prop, char* name)
{
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
icalerror_check_arg_rv( (name!=0),"name");
icalerror_check_arg_rv( (prop!=0),"prop");
if (impl->x_name != 0) {
free(impl->x_name);
}
impl->x_name = icalmemory_strdup(name);
if(impl->x_name == 0){
icalerror_set_errno(ICAL_ALLOCATION_ERROR);
}
}
char* icalproperty_get_x_name(icalproperty* prop){
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
return impl->x_name;
}
void icalproperty_set_parent(icalproperty* property,
icalcomponent* component)
{
struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
icalerror_check_arg_rv( (property!=0),"property");
impl->parent = component;
}
icalcomponent* icalproperty_get_parent(icalproperty* property)
{
struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
icalerror_check_arg_rv( (property!=0),"property");
return impl->parent;
}
/* Everything below this line is machine generated. Do not edit. */

View File

@ -0,0 +1,57 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalderivedproperties.{c,h}
CREATOR: eric 09 May 1999
$Id: icalproperty.h.in,v 1.1 2000/12/11 22:05:59 federico Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
======================================================================*/
#ifndef ICALPROPERTY_H
#define ICALPROPERTY_H
#include <time.h>
#include "icalparameter.h"
#include "icalvalue.h"
#include "icalrecur.h"
typedef void icalproperty;
icalproperty* icalproperty_new(icalproperty_kind kind);
icalproperty* icalproperty_new_clone(icalproperty * prop);
icalproperty* icalproperty_new_from_string(char* str);
char* icalproperty_as_ical_string(icalproperty* prop);
void icalproperty_free(icalproperty* prop);
icalproperty_kind icalproperty_isa(icalproperty* property);
int icalproperty_isa_property(void* property);
void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter);
void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter);
void icalproperty_remove_parameter(icalproperty* prop,
icalparameter_kind kind);
int icalproperty_count_parameters(icalproperty* prop);
/* Iterate through the parameters */
icalparameter* icalproperty_get_first_parameter(icalproperty* prop,
icalparameter_kind kind);
icalparameter* icalproperty_get_next_parameter(icalproperty* prop,
icalparameter_kind kind);
/* Access the value of the property */
void icalproperty_set_value(icalproperty* prop, icalvalue* value);
icalvalue* icalproperty_get_value(icalproperty* prop);
/* Deal with X properties */
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. */

View File

@ -0,0 +1,447 @@
/* -*- Mode: C -*- */
/* ======================================================================
File: icalrestriction.c
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
======================================================================*/
/*#line 7 "icalrestriction.c.in"*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalrestriction.h"
#include "icalenums.h"
#include "icalerror.h"
#include <assert.h>
#include <stdio.h> /* For snprintf */
#define TMP_BUF_SIZE 1024
/* Define the structs for the restrictions. these data are filled out
in machine generated code below */
struct icalrestriction_property_record;
typedef char* (*restriction_func)(struct icalrestriction_property_record* rec,icalcomponent* comp,icalproperty* prop);
typedef struct icalrestriction_property_record {
icalproperty_method method;
icalcomponent_kind component;
icalproperty_kind property;
icalrestriction_kind restriction;
restriction_func function;
} icalrestriction_property_record;
typedef struct icalrestriction_component_record {
icalproperty_method method;
icalcomponent_kind component;
icalcomponent_kind subcomponent;
icalrestriction_kind restriction;
restriction_func function;
} icalrestriction_component_record;
icalrestriction_property_record*
icalrestriction_get_property_restriction(icalproperty_method method,
icalcomponent_kind component,
icalproperty_kind property);
icalrestriction_component_record*
icalrestriction_get_component_restriction(icalproperty_method method,
icalcomponent_kind component,
icalcomponent_kind subcomponent);
icalrestriction_component_record icalrestriction_component_records[];
icalrestriction_property_record icalrestriction_property_records[];
icalrestriction_property_record null_prop_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_UNKNOWN,0};
icalrestriction_component_record null_comp_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_UNKNOWN,0};
/* The each row gives the result of comparing a restriction against a
count. The columns in each row represent 0,1,2+. '-1' indicates
'invalid, 'don't care' or 'needs more analysis' So, for
ICAL_RESTRICTION_ONE, if there is 1 of a property with that
restriction, it passes, but if there are 0 or 2+, it fails. */
char compare_map[ICAL_RESTRICTION_UNKNOWN+1][3] = {
{ 1, 1, 1},/*ICAL_RESTRICTION_NONE*/
{ 1, 0, 0},/*ICAL_RESTRICTION_ZERO*/
{ 0, 1, 0},/*ICAL_RESTRICTION_ONE*/
{ 1, 1, 1},/*ICAL_RESTRICTION_ZEROPLUS*/
{ 0, 1, 1},/*ICAL_RESTRICTION_ONEPLUS*/
{ 1, 1, 0},/*ICAL_RESTRICTION_ZEROORONE*/
{ 1, 1, 0},/*ICAL_RESTRICTION_ONEEXCLUSIVE*/
{ 1, 1, 0},/*ICAL_RESTRICTION_ONEMUTUAL*/
{ 1, 1, 1} /*ICAL_RESTRICTION_UNKNOWN*/
};
char restr_string_map[ICAL_RESTRICTION_UNKNOWN+1][60] = {
"unknown number",/*ICAL_RESTRICTION_NONE*/
"0",/*ICAL_RESTRICTION_ZERO*/
"1",/*ICAL_RESTRICTION_ONE*/
"zero or more",/*ICAL_RESTRICTION_ZEROPLUS*/
"one or more" ,/*ICAL_RESTRICTION_ONEPLUS*/
"zero or one",/*ICAL_RESTRICTION_ZEROORONE*/
"zero or one, exclusive with another property",/*ICAL_RESTRICTION_ONEEXCLUSIVE*/
"zero or one, mutual with another property",/*ICAL_RESTRICTION_ONEMUTUAL*/
"unknown number" /*ICAL_RESTRICTION_UNKNOWN*/
};
int
icalrestriction_compare(icalrestriction_kind restr, int count){
if ( restr < ICAL_RESTRICTION_NONE || restr > ICAL_RESTRICTION_UNKNOWN
|| count < 0){
return -1;
}
if (count > 2) {
count = 2;
}
return compare_map[restr][count];
}
/* Special case routines */
char* icalrestriction_may_be_draft_final_canceled(
icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop)
{
icalproperty_status stat = icalproperty_get_status(prop);
if( !( stat == ICAL_STATUS_DRAFT ||
stat == ICAL_STATUS_FINAL ||
stat == ICAL_STATUS_CANCELLED )){
return "Failed iTIP restrictions for STATUS property. Value must be one of DRAFT, FINAL, or CANCELED";
}
return 0;
}
char* icalrestriction_may_be_comp_need_process(
icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop)
{
icalproperty_status stat = icalproperty_get_status(prop);
if( !( stat == ICAL_STATUS_COMPLETED ||
stat == ICAL_STATUS_NEEDSACTION ||
stat == ICAL_STATUS_INPROCESS )){
return "Failed iTIP restrictions for STATUS property. Value must be one of COMPLETED, NEEDS-ACTION or IN-PROCESS";
}
return 0;
}
char* icalrestriction_may_be_tent_conf(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
icalproperty_status stat = icalproperty_get_status(prop);
if( !( stat == ICAL_STATUS_TENTATIVE ||
stat == ICAL_STATUS_CONFIRMED )){
return "Failed iTIP restrictions for STATUS property. Value must be one of TENTATIVE or CONFIRMED";
}
return 0;
}
char* icalrestriction_may_be_tent_conf_cancel(
icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop)
{
icalproperty_status stat = icalproperty_get_status(prop);
if( !( stat == ICAL_STATUS_TENTATIVE ||
stat == ICAL_STATUS_CONFIRMED ||
stat == ICAL_STATUS_CANCELLED )){
return "Failed iTIP restrictions for STATUS property. Value must be one of TENTATIVE, CONFIRMED or CANCELED";
}
return 0;
}
char* icalrestriction_must_be_cancel_if_present(
icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop)
{
/* This routine will not be called if prop == 0 */
icalproperty_status stat = icalproperty_get_status(prop);
if( stat != ICAL_STATUS_CANCELLED)
{
return "Failed iTIP restrictions for STATUS property. Value must be CANCELLED";
}
return 0;
}
char* icalrestriction_must_be_canceled_no_attendee(
icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop)
{
/* Hack. see rfc2446, 3.2.5 CANCEL for porperty STATUS. I don't
understand the note */
return 0;
}
char* icalrestriction_must_be_recurring(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
/* Hack */
return 0;
}
char* icalrestriction_must_have_duration(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
if( !icalcomponent_get_first_property(comp,ICAL_DURATION_PROPERTY)){
return "Failed iTIP restrictions for STATUS property. This component must have a DURATION property";
}
return 0;
}
char* icalrestriction_must_have_repeat(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
if( !icalcomponent_get_first_property(comp,ICAL_REPEAT_PROPERTY)){
return "Failed iTIP restrictions for STATUS property. This component must have a REPEAT property";
}
return 0;
}
char* icalrestriction_must_if_tz_ref(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
/* Hack */
return 0;
}
char* icalrestriction_no_dtend(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
if( !icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){
return "Failed iTIP restrictions for STATUS property. The component must not have both DURATION and DTEND";
}
return 0;
}
char* icalrestriction_no_duration(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
/* _no_dtend takes care of this one */
return 0;
}
int icalrestriction_check_component(icalproperty_method method,
icalcomponent* comp)
{
icalproperty_kind kind;
icalcomponent_kind comp_kind;
icalrestriction_kind restr;
icalrestriction_property_record *prop_record;
icalrestriction_component_record *comp_record;
char* funcr = 0;
icalproperty *prop;
int count;
int compare;
int valid = 1;
comp_kind = icalcomponent_isa(comp);
/* Check all of the properties in this component */
for(kind = ICAL_ANY_PROPERTY+1; kind != ICAL_NO_PROPERTY; kind++){
count = icalcomponent_count_properties(comp, kind);
prop_record = icalrestriction_get_property_restriction(method,
comp_kind,
kind);
restr = prop_record->restriction;
if(restr == ICAL_RESTRICTION_ONEEXCLUSIVE ||
restr == ICAL_RESTRICTION_ONEMUTUAL) {
/* First treat is as a 0/1 restriction */
restr = ICAL_RESTRICTION_ZEROORONE;
compare = icalrestriction_compare(restr,count);
} else {
compare = icalrestriction_compare(restr,count);
}
assert(compare != -1);
if (compare == 0){
char temp[TMP_BUF_SIZE];
snprintf(temp, TMP_BUF_SIZE,"Failed iTIP restrictions for %s property. Expected %s instances of the property and got %d",
icalenum_property_kind_to_string(kind),
restr_string_map[restr], count);
icalcomponent_add_property
(comp,
icalproperty_vanew_xlicerror(
temp,
icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP),
0));
}
prop = icalcomponent_get_first_property(comp, kind);
if (prop != 0 && prop_record->function !=0 ){
funcr = prop_record->function(prop_record,comp,prop);
}
if(funcr !=0){
icalcomponent_add_property
(comp,
icalproperty_vanew_xlicerror(
funcr,
icalparameter_new_xlicerrortype(
ICAL_XLICERRORTYPE_INVALIDITIP),
0));
compare = 0;
}
valid = valid && compare;
}
return valid;
}
int icalrestriction_check(icalcomponent* outer_comp)
{
icalcomponent_kind comp_kind;
icalproperty_method method;
icalcomponent* inner_comp;
icalproperty *method_prop;
int valid;
icalerror_check_arg_rz( (outer_comp!=0), "outer comp");
/* Get the Method value from the outer component */
comp_kind = icalcomponent_isa(outer_comp);
if (comp_kind != ICAL_VCALENDAR_COMPONENT){
icalerror_set_errno(ICAL_BADARG_ERROR);
return 0;
}
method_prop = icalcomponent_get_first_property(outer_comp,
ICAL_METHOD_PROPERTY);
if (method_prop == 0){
method = ICAL_METHOD_NONE;
} else {
method = icalproperty_get_method(method_prop);
}
/* Check the VCALENDAR wrapper */
valid = icalrestriction_check_component(ICAL_METHOD_NONE,outer_comp);
/* Now check the inner components */
for(inner_comp= icalcomponent_get_first_component(outer_comp,
ICAL_ANY_COMPONENT);
inner_comp != 0;
inner_comp= icalcomponent_get_next_component(outer_comp,
ICAL_ANY_COMPONENT)){
valid = valid && icalrestriction_check_component(method,inner_comp);
}
return valid;
}
icalrestriction_property_record*
icalrestriction_get_property_restriction(icalproperty_method method,
icalcomponent_kind component,
icalproperty_kind property)
{
int i;
for(i = 0;
icalrestriction_property_records[i].restriction != ICAL_RESTRICTION_NONE;
i++){
if (method == icalrestriction_property_records[i].method &&
component == icalrestriction_property_records[i].component &&
property == icalrestriction_property_records[i].property ){
return &icalrestriction_property_records[i];
}
}
return &null_prop_record;
}
icalrestriction_component_record*
icalrestriction_get_component_restriction(icalproperty_method method,
icalcomponent_kind component,
icalcomponent_kind subcomponent)
{
int i;
for(i = 0;
icalrestriction_component_records[i].restriction != ICAL_RESTRICTION_NONE;
i++){
if (method == icalrestriction_component_records[i].method &&
component == icalrestriction_component_records[i].component &&
subcomponent == icalrestriction_component_records[i].subcomponent ){
return &icalrestriction_component_records[i];
}
}
return &null_comp_record;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalvalue.h
CREATOR: eric 20 March 1999
$Id: icalvalue.h.in,v 1.1 2000/12/11 22:06:03 federico Exp $
$Locker: $
(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
======================================================================*/
#ifndef ICALVALUE_H
#define ICALVALUE_H
#include <time.h>
#include "icalenums.h"
#include "icaltypes.h"
#include "icalrecur.h"
typedef void icalvalue;
icalvalue* icalvalue_new(icalvalue_kind kind);
icalvalue* icalvalue_new_clone(icalvalue* value);
icalvalue* icalvalue_new_from_string(icalvalue_kind kind, const char* str);
void icalvalue_free(icalvalue* value);
int icalvalue_is_valid(icalvalue* value);
const char* icalvalue_as_ical_string(icalvalue* value);
icalvalue_kind icalvalue_isa(icalvalue* value);
int icalvalue_isa_value(void*);
icalparameter_xliccomparetype
icalvalue_compare(icalvalue* a, icalvalue *b);
/* Everything below this line is machine generated. Do not edit. */

View File

@ -0,0 +1,701 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalclassify.c
CREATOR: ebusboom 23 aug 2000
$Id$
$Locker$
(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/
======================================================================*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "ical.h"
#include "icalclassify.h"
#include "icalmemory.h"
#include <ctype.h> /* For tolower() */
#include <string.h> /* for index() */
#include <stdlib.h> /* for malloc and free */
struct icalclassify_parts {
icalcomponent *c;
icalproperty_method method;
char* organizer;
icalparameter_partstat reply_partstat;
char* reply_attendee;
char* uid;
int sequence;
struct icaltimetype dtstamp;
struct icaltimetype recurrence_id;
};
char* icalclassify_lowercase(const char* str)
{
char* p = 0;
char* new = icalmemory_strdup(str);
if(str ==0){
return 0;
}
for(p = new; *p!=0; p++){
*p = tolower(*p);
}
return new;
}
/* Return a set of components that intersect in time with comp. For
component X and Y to intersect:
X.DTSTART < Y.DTEND && X.DTEND > Y.DTSTART
*/
icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp)
{
icalcomponent *return_set;
icalcomponent *c;
struct icaltime_span span,compspan;
icalerror_clear_errno();
compspan = icalcomponent_get_span(comp);
if(icalerrno != ICAL_NO_ERROR){
return 0;
}
return_set = icalcomponent_new(ICAL_XROOT_COMPONENT);
for(c = icalset_get_first_component(set);
c != 0;
c = icalset_get_next_component(set)){
icalerror_clear_errno();
span = icalcomponent_get_span(c);
if(icalerrno != ICAL_NO_ERROR){
continue;
}
if (compspan.start < span.end &&
compspan.end > span.start){
icalcomponent *clone = icalcomponent_new_clone(c);
icalcomponent_add_component(return_set,clone);
}
}
if(icalcomponent_count_components(return_set,ICAL_ANY_COMPONENT) !=0){
return return_set;
} else {
icalcomponent_free(return_set);
return 0;
}
}
icalparameter_partstat icalclassify_find_attendee(icalcomponent *c,
const char* attendee)
{
icalproperty *p;
char* lattendee = icalclassify_lowercase(attendee);
char* upn = index(lattendee,':');
icalcomponent *inner = icalcomponent_get_first_real_component(c);
for(p = icalcomponent_get_first_property(inner,ICAL_ATTENDEE_PROPERTY);
p != 0;
p = icalcomponent_get_next_property(inner,ICAL_ATTENDEE_PROPERTY))
{
const char* this_attendee
= icalclassify_lowercase(icalproperty_get_attendee(p));
char* this_upn = index(this_attendee,':');
if(strcmp(this_upn,upn)==0){
icalparameter *param = icalproperty_get_first_parameter(p,
ICAL_PARTSTAT_PARAMETER);
if (param != 0){
free(lattendee);
free((void*)this_attendee);
return icalparameter_get_partstat(param);
}
}
}
free(lattendee);
return ICAL_PARTSTAT_NONE;
}
void icalssutil_free_parts(struct icalclassify_parts *parts)
{
if(parts == 0){
return;
}
if(parts->organizer != 0){
free(parts->organizer);
}
if(parts->uid != 0){
free(parts->uid);
}
if(parts->reply_attendee){
free(parts->reply_attendee);
}
}
void icalssutil_get_parts(icalcomponent* c,
struct icalclassify_parts* parts)
{
icalproperty *p;
icalcomponent *inner;
memset(parts,0,sizeof(struct icalclassify_parts));
parts->method = ICAL_METHOD_NONE;
parts->sequence = 0;
parts->reply_partstat = ICAL_PARTSTAT_NONE;
if(c == 0){
return;
}
parts->c = c;
p = icalcomponent_get_first_property(c,ICAL_METHOD_PROPERTY);
if(p!=0){
parts->method = icalproperty_get_method(p);
}
inner = icalcomponent_get_first_real_component(c);
p = icalcomponent_get_first_property(inner,ICAL_ORGANIZER_PROPERTY);
if(p!=0){
parts->organizer = strdup(icalproperty_get_organizer(p));
}
p = icalcomponent_get_first_property(inner,ICAL_SEQUENCE_PROPERTY);
if(p!=0){
parts->sequence = icalproperty_get_sequence(p);
}
p = icalcomponent_get_first_property(inner,ICAL_UID_PROPERTY);
if(p!=0){
parts->uid = strdup(icalproperty_get_uid(p));
}
p = icalcomponent_get_first_property(inner,ICAL_RECURRENCEID_PROPERTY);
if(p!=0){
parts->recurrence_id = icalproperty_get_recurrenceid(p);
}
p = icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY);
if(p!=0){
parts->dtstamp = icalproperty_get_dtstamp(p);
}
if(parts->method==ICAL_METHOD_REPLY){
icalparameter *param;
p = icalcomponent_get_first_property(inner,ICAL_ATTENDEE_PROPERTY);
if(p!=0){
param = icalproperty_get_first_parameter(p,ICAL_PARTSTAT_PARAMETER);
if(param != 0){
parts->reply_partstat =
icalparameter_get_partstat(param);
}
parts->reply_attendee = strdup(icalproperty_get_attendee(p));
}
}
}
int icalssutil_is_rescheduled(icalcomponent* a,icalcomponent* b)
{
icalproperty *p1,*p2;
icalcomponent *i1,*i2;
int i;
icalproperty_kind kind_array[] = {
ICAL_DTSTART_PROPERTY,
ICAL_DTEND_PROPERTY,
ICAL_DURATION_PROPERTY,
ICAL_DUE_PROPERTY,
ICAL_RRULE_PROPERTY,
ICAL_RDATE_PROPERTY,
ICAL_EXRULE_PROPERTY,
ICAL_EXDATE_PROPERTY,
ICAL_NO_PROPERTY
};
i1 = icalcomponent_get_first_real_component(a);
i2 = icalcomponent_get_first_real_component(b);
for(i =0; kind_array[i] != ICAL_NO_PROPERTY; i++){
p1 = icalcomponent_get_first_property(i1,kind_array[i]);
p2 = icalcomponent_get_first_property(i2,kind_array[i]);
if( (p1!=0)^(p1!=0) ){
/* Return true if the property exists in one component and not
the other */
return 1;
}
if(p1 && strcmp(icalproperty_as_ical_string(p1),
icalproperty_as_ical_string(p2)) != 0){
return 1;
}
}
return 0;
}
#define icalclassify_pre \
int rtrn =0;
#define icalclassify_post \
return rtrn;
int icalclassify_publish_new(struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre;
if(comp->method == ICAL_METHOD_PUBLISH &&
match == 0){
rtrn = 1;
}
icalclassify_post;
}
int icalclassify_publish_update(struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre;
if(comp->method == ICAL_METHOD_PUBLISH &&
match !=0 ){
rtrn = 1;
}
icalclassify_post;
}
int icalclassify_publish_freebusy(struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre;
if(comp->method == ICAL_METHOD_PUBLISH &&
match == 0){
rtrn = 1;
}
icalclassify_post;
}
int icalclassify_request_new(struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
/* Method is REQUEST, and there is no match */
icalclassify_pre
if(match->c==0 && comp->method == ICAL_METHOD_REQUEST){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_request_update(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
/* REQUEST method, Higher SEQUENCE than match, and all
time-related properties are unchanged */
icalclassify_pre
if (match != 0 &&
comp->sequence >= match->sequence &&
!icalssutil_is_rescheduled(comp->c,match->c)){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_request_reschedule(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
/* REQUEST method, Higher SEQUENCE than match, and one or more
time-related properties are changed */
icalclassify_pre
if (match->c != 0 &&
comp->sequence > match->sequence &&
icalssutil_is_rescheduled(comp->c,match->c)){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_request_delegate(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
if (match->c != 0 &&
comp->sequence > match->sequence &&
icalssutil_is_rescheduled(comp->c,match->c)){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_request_new_organizer(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
/* Organizer has changed between match and component */
icalclassify_pre
icalclassify_post
}
int icalclassify_request_status(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
icalclassify_post
}
int icalclassify_request_forward(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
icalclassify_post
}
int icalclassify_request_freebusy(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
icalclassify_post
}
int icalclassify_reply_accept(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalparameter_partstat partstat;
icalclassify_pre;
partstat = icalclassify_find_attendee(match->c,comp->reply_attendee);
if(partstat != ICAL_PARTSTAT_NONE &&
comp->reply_partstat == ICAL_PARTSTAT_ACCEPTED){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_reply_decline(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalparameter_partstat partstat;
icalclassify_pre;
partstat = icalclassify_find_attendee(match->c,comp->reply_attendee);
if(partstat != ICAL_PARTSTAT_NONE &&
comp->reply_partstat == ICAL_PARTSTAT_DECLINED){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_reply_crasher_accept(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalparameter_partstat partstat;
icalclassify_pre;
partstat = icalclassify_find_attendee(match->c,comp->reply_attendee);
if(partstat == ICAL_PARTSTAT_NONE &&
comp->reply_partstat == ICAL_PARTSTAT_ACCEPTED){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_reply_crasher_decline(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalparameter_partstat partstat;
icalclassify_pre;
partstat = icalclassify_find_attendee(match->c,comp->reply_attendee);
if(partstat == ICAL_PARTSTAT_NONE &&
comp->reply_partstat == ICAL_PARTSTAT_DECLINED){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_add_instance(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
if(comp->method == ICAL_METHOD_ADD){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_cancel_event(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
if(comp->method == ICAL_METHOD_CANCEL){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_cancel_instance(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
if(comp->method == ICAL_METHOD_CANCEL){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_cancel_all(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
if(comp->method == ICAL_METHOD_CANCEL){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_refesh(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
if(comp->method == ICAL_METHOD_REFRESH){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_counter(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
if(comp->method == ICAL_METHOD_COUNTER){
rtrn = 1;
}
icalclassify_post
}
int icalclassify_delinecounter(
struct icalclassify_parts *comp,
struct icalclassify_parts *match,
const char* user)
{
icalclassify_pre
if(comp->method == ICAL_METHOD_DECLINECOUNTER){
rtrn = 1;
}
icalclassify_post
}
struct icalclassify_map {
icalproperty_method method;
int (*fn)(struct icalclassify_parts *comp,struct icalclassify_parts *match, const char* user);
ical_class class;
} icalclassify_map[] =
{ {ICAL_METHOD_PUBLISH,icalclassify_publish_new,ICAL_PUBLISH_NEW_CLASS},
{ICAL_METHOD_PUBLISH,icalclassify_publish_update,ICAL_PUBLISH_UPDATE_CLASS},
{ICAL_METHOD_PUBLISH,icalclassify_publish_freebusy,ICAL_PUBLISH_FREEBUSY_CLASS},
{ICAL_METHOD_REQUEST,icalclassify_request_new,ICAL_REQUEST_NEW_CLASS},
{ICAL_METHOD_REQUEST,icalclassify_request_update,ICAL_REQUEST_UPDATE_CLASS},
{ICAL_METHOD_REQUEST,icalclassify_request_reschedule,ICAL_REQUEST_RESCHEDULE_CLASS},
{ICAL_METHOD_REQUEST,icalclassify_request_delegate,ICAL_REQUEST_DELEGATE_CLASS},
{ICAL_METHOD_REQUEST,icalclassify_request_new_organizer,ICAL_REQUEST_NEW_ORGANIZER_CLASS},
{ICAL_METHOD_REQUEST,icalclassify_request_forward,ICAL_REQUEST_FORWARD_CLASS},
{ICAL_METHOD_REQUEST,icalclassify_request_status,ICAL_REQUEST_STATUS_CLASS},
{ICAL_METHOD_REQUEST,icalclassify_request_freebusy,ICAL_REQUEST_FREEBUSY_CLASS},
{ICAL_METHOD_REPLY,icalclassify_reply_accept,ICAL_REPLY_ACCEPT_CLASS},
{ICAL_METHOD_REPLY,icalclassify_reply_decline,ICAL_REPLY_DECLINE_CLASS},
{ICAL_METHOD_REPLY,icalclassify_reply_crasher_accept,ICAL_REPLY_CRASHER_ACCEPT_CLASS},
{ICAL_METHOD_REPLY,icalclassify_reply_crasher_decline,ICAL_REPLY_CRASHER_DECLINE_CLASS},
{ICAL_METHOD_ADD,icalclassify_add_instance,ICAL_ADD_INSTANCE_CLASS},
{ICAL_METHOD_CANCEL,icalclassify_cancel_event,ICAL_CANCEL_EVENT_CLASS},
{ICAL_METHOD_CANCEL,icalclassify_cancel_instance,ICAL_CANCEL_INSTANCE_CLASS},
{ICAL_METHOD_CANCEL,icalclassify_cancel_all,ICAL_CANCEL_ALL_CLASS},
{ICAL_METHOD_REFRESH,icalclassify_refesh,ICAL_REFRESH_CLASS},
{ICAL_METHOD_COUNTER,icalclassify_counter,ICAL_COUNTER_CLASS},
{ICAL_METHOD_DECLINECOUNTER,icalclassify_delinecounter,ICAL_DECLINECOUNTER_CLASS},
{ICAL_METHOD_NONE,0,ICAL_NO_CLASS}
};
ical_class icalclassify(icalcomponent* c,icalcomponent* match,
const char* user)
{
icalcomponent *inner;
icalproperty *p;
icalproperty_method method;
ical_class class = ICAL_UNKNOWN_CLASS;
int i;
struct icalclassify_parts comp_parts;
struct icalclassify_parts match_parts;
inner = icalcomponent_get_first_real_component(c);
if (inner == 0) {
return ICAL_NO_CLASS;
}
icalssutil_get_parts(c,&comp_parts);
icalssutil_get_parts(match,&match_parts);
/* Determine if the incoming component is obsoleted by the match */
if(match != 0 && (
comp_parts.method == ICAL_METHOD_REQUEST
)){
assert ( ! ((comp_parts.dtstamp.is_utc==1)^
(match_parts.dtstamp.is_utc==1)));
if( comp_parts.sequence<match_parts.sequence &&
icaltime_compare(comp_parts.dtstamp,match_parts.dtstamp)>0)
{
/* comp has a smaller sequence and a later DTSTAMP */
return ICAL_MISSEQUENCED_CLASS;
}
if( (comp_parts.sequence<match_parts.sequence )
/*&&icaltime_compare(comp_parts.dtstamp,match_parts.dtstamp)<=0*/
||
( comp_parts.sequence == match_parts.sequence &&
icaltime_compare(comp_parts.dtstamp,match_parts.dtstamp)<=0)){
return ICAL_OBSOLETE_CLASS;
}
}
p = icalcomponent_get_first_property(c,ICAL_METHOD_PROPERTY);
if (p == 0) {
return ICAL_UNKNOWN_CLASS;
}
method = icalproperty_get_method(p);
for (i =0; icalclassify_map[i].method != ICAL_METHOD_NONE; i++){
if(icalclassify_map[i].method == method){
if( (*(icalclassify_map[i].fn))(&comp_parts,&match_parts,user)==1){
class = icalclassify_map[i].class;
break;
}
}
}
icalssutil_free_parts(&comp_parts);
icalssutil_free_parts(&match_parts);
return class;
}

View File

@ -0,0 +1,73 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalclassify.h
CREATOR: eric 21 Aug 2000
$Id$
$Locker$
(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/
=========================================================================*/
#ifndef ICALCLASSIFY_H
#define ICALCLASSIFY_H
#include "ical.h"
#include "icalset.h"
typedef enum icalclass {
ICAL_NO_CLASS,
ICAL_PUBLISH_NEW_CLASS,
ICAL_PUBLISH_UPDATE_CLASS,
ICAL_PUBLISH_FREEBUSY_CLASS,
ICAL_REQUEST_NEW_CLASS,
ICAL_REQUEST_UPDATE_CLASS,
ICAL_REQUEST_RESCHEDULE_CLASS,
ICAL_REQUEST_DELEGATE_CLASS,
ICAL_REQUEST_NEW_ORGANIZER_CLASS,
ICAL_REQUEST_FORWARD_CLASS,
ICAL_REQUEST_STATUS_CLASS,
ICAL_REQUEST_FREEBUSY_CLASS,
ICAL_REPLY_ACCEPT_CLASS,
ICAL_REPLY_DECLINE_CLASS,
ICAL_REPLY_CRASHER_ACCEPT_CLASS,
ICAL_REPLY_CRASHER_DECLINE_CLASS,
ICAL_ADD_INSTANCE_CLASS,
ICAL_CANCEL_EVENT_CLASS,
ICAL_CANCEL_INSTANCE_CLASS,
ICAL_CANCEL_ALL_CLASS,
ICAL_REFRESH_CLASS,
ICAL_COUNTER_CLASS,
ICAL_DECLINECOUNTER_CLASS,
ICAL_MALFORMED_CLASS,
ICAL_OBSOLETE_CLASS, /* 21 */
ICAL_MISSEQUENCED_CLASS, /* 22 */
ICAL_UNKNOWN_CLASS /* 23 */
} ical_class;
ical_class icalclassify(icalcomponent* c,icalcomponent* match,
const char* user);
icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp);
#endif /* ICALCLASSIFY_H*/

View File

@ -0,0 +1,376 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalcstps.c
CREATOR: ebusboom 23 Jun 2000
$Id$
$Locker$
(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/
======================================================================*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "ical.h"
#include "icalcstp.h"
#include "pvl.h"
#include <sys/types.h> /* For send(), others */
#include <sys/socket.h> /* For send(), others. */
#include <unistd.h> /* For alarm */
#include <errno.h>
enum cstps_state {
NO_STATE,
CONNECTED,
AUTHENTICATED,
IDENTIFIED,
DISCONNECTED,
RECEIVE,
};
struct icalcstps_impl {
int timeout;
icalparser *parser;
enum cstps_state major_state;
struct icalcstps_stubs stubs;
};
enum cstp_command {
ABORT,
AUTHENTICATE,
CAPABILITY,
CONTINUE,
EXPANDCALID,
IDENTIFY,
DISCONNECT,
SENDDATA,
STARTTLS,
EXPANDUPN,
COMMAND_COMPLETE,
UNKNOWN
};
struct command_map {
enum cstp_command command;
char *str;
} command_map[] =
{
{ABORT,"ABORT"},
{AUTHENTICATE,"AUTHENTICATE"},
{CAPABILITY,"CAPABILITY"},
{CONTINUE,"CONTINUE"},
{EXPANDCALID,"EXPANDCALID"},
{IDENTIFY,"IDENTIFY"},
{DISCONNECT,"DISCONNECT"},
{SENDDATA,"SENDDATA"},
{STARTTLS,"STARTTLS"},
{EXPANDUPN,"EXPANDUPN"},
{UNKNOWN,"UNKNOWN"}
};
/* This state machine is a Mealy-type: actions occur on the
transitions, not in the states.
Here is the state machine diagram from the CAP draft:
STARTTLS /
CAPABILITY
+-------+
| | +---------------+
| +-----------+ AUTHENTICATE | |
+-->| Connected |-------------->| Authenticated |
+-----------+ | |
| +---------------+
| |
| |
| |
| | +-----+ STARTTLS /
| V | | CAPABILITY /
| +---------------+ | IDENTIFY
| | |<-+
| | Identified |<----+
| +--------| | |
| | +---------------+ | command
| | | | completes
V |DISCONNECT | |
+--------------+ | |SENDDATA |
| Disconnected |<--+ | |
+--------------+ | | ABORT
A | |
| V |
| DISCONNECT +---------------+ |
+--------------------| Receive |--+
| |<--+
+---------------+ |
| | CONTINUTE
+----+
In this implmenetation, the transition from CONNECTED to IDENTIFIED
is non-standard. The spec specifies that on the ATHENTICATE
command, the machine transitions from CONNECTED to AUTHENTICATED,
and then immediately goes to IDENTIFIED. This makes AUTHENTICATED a
useless state, so I removed it */
struct state_table {
enum cstps_state major_state;
enum cstp_command command;
void (*action)();
enum cstps_state next_state;
} server_state_table[] =
{
{ CONNECTED, CAPABILITY , 0, CONNECTED},
{ CONNECTED, AUTHENTICATE , 0, IDENTIFIED}, /* Non-standard */
{ IDENTIFIED, STARTTLS, 0, IDENTIFIED},
{ IDENTIFIED, IDENTIFY, 0, IDENTIFIED},
{ IDENTIFIED, CAPABILITY, 0, IDENTIFIED},
{ IDENTIFIED, SENDDATA, 0, RECEIVE},
{ IDENTIFIED, DISCONNECT, 0, DISCONNECTED},
{ DISCONNECTED, 0, 0, 0},
{ RECEIVE, DISCONNECT, 0, DISCONNECTED},
{ RECEIVE, CONTINUE, 0, RECEIVE},
{ RECEIVE, ABORT , 0, IDENTIFIED},
{ RECEIVE, COMMAND_COMPLETE , 0, IDENTIFIED}
};
/**********************************************************************/
icalcstps* icalcstps_new(struct icalcstps_stubs stubs)
{
struct icalcstps_impl* impl;
if ( ( impl = (struct icalcstps_impl*)
malloc(sizeof(struct icalcstps_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
impl->stubs = stubs;
impl->timeout = 10;
return (icalcstps*)impl;
}
void icalcstps_free(icalcstps* cstp);
int icalcstps_set_timeout(icalcstps* cstp, int sec)
{
struct icalcstps_impl *impl = (struct icalcstps_impl *) cstp;
icalerror_check_arg_rz( (cstp!=0), "cstp");
impl->timeout = sec;
return sec;
}
typedef struct icalcstps_response {
icalrequeststatus code;
char caluid[1024];
void* result;
} icalcstps_response;
int line_is_command(char* line);
int line_is_response(char* line);
int line_is_endofdata(char* line);
int line_is_mime(char* line);
icalerrorenum prep_abort(struct icalcstps_impl* impl, char* data);
icalerrorenum prep_authenticate(struct icalcstps_impl* impl, char* data);
icalerrorenum prep_capability(struct icalcstps_impl* impl, char* data);
icalerrorenum prep_calidexpand(struct icalcstps_impl* impl, char* data);
icalerrorenum prep_continue(struct icalcstps_impl* impl, char* data);
icalerrorenum prep_disconnect(struct icalcstps_impl* impl, char* data);
icalerrorenum prep_identify(struct icalcstps_impl* impl, char* data);
icalerrorenum prep_starttls(struct icalcstps_impl* impl, char* data);
icalerrorenum prep_upnexpand(struct icalcstps_impl* impl, char* data);
icalerrorenum prep_sendata(struct icalcstps_impl* impl, char* data);
char* icalcstps_process_incoming(icalcstps* cstp, char* input)
{
struct icalcstps_impl *impl = (struct icalcstps_impl *) cstp;
char *i;
char *cmd_or_resp;
char *data;
char *input_cpy;
icalerrorenum error;
icalerror_check_arg_rz(cstp !=0,"cstp");
icalerror_check_arg_rz(input !=0,"input");
if ((input_cpy = (char*)strdup(input)) == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
i = (char*)index(" ",input_cpy);
cmd_or_resp = input_cpy;
if (i != 0){
*i = '\0';
data = ++i;
} else {
data = 0;
}
printf("cmd: %s\n",cmd_or_resp);
printf("data: %s\n",data);
/* extract the command, look up in the state table, and dispatch
to the proper handler */
if(strcmp(cmd_or_resp,"ABORT") == 0){
error = prep_abort(impl,data);
} else if(strcmp(cmd_or_resp,"AUTHENTICATE") == 0){
error = prep_authenticate(impl,data);
} else if(strcmp(cmd_or_resp,"CAPABILITY") == 0){
error = prep_capability(impl,data);
} else if(strcmp(cmd_or_resp,"CALIDEXPAND") == 0){
error = prep_calidexpand(impl,data);
} else if(strcmp(cmd_or_resp,"CONTINUE") == 0){
error = prep_continue(impl,data);
} else if(strcmp(cmd_or_resp,"DISCONNECT") == 0){
error = prep_disconnect(impl,data);
} else if(strcmp(cmd_or_resp,"IDENTIFY") == 0){
error = prep_identify(impl,data);
} else if(strcmp(cmd_or_resp,"STARTTLS") == 0){
error = prep_starttls(impl,data);
} else if(strcmp(cmd_or_resp,"UPNEXPAND") == 0){
error = prep_upnexpand(impl,data);
} else if(strcmp(cmd_or_resp,"SENDDATA") == 0){
error = prep_sendata(impl,data);
}
}
/* Read data until we get a end of data marker */
struct icalcstps_server_stubs {
icalerrorenum (*abort)(icalcstps* cstp);
icalerrorenum (*authenticate)(icalcstps* cstp, char* mechanism,
char* data);
icalerrorenum (*calidexpand)(icalcstps* cstp, char* calid);
icalerrorenum (*capability)(icalcstps* cstp);
icalerrorenum (*cont)(icalcstps* cstp, unsigned int time);
icalerrorenum (*identify)(icalcstps* cstp, char* id);
icalerrorenum (*disconnect)(icalcstps* cstp);
icalerrorenum (*sendata)(icalcstps* cstp, unsigned int time,
icalcomponent *comp);
icalerrorenum (*starttls)(icalcstps* cstp, char* command,
char* data);
icalerrorenum (*upnexpand)(icalcstps* cstp, char* upn);
icalerrorenum (*unknown)(icalcstps* cstp, char* command, char* data);
};
/********************** Client (Sender) Interfaces **************************/
struct icalcstpc_impl {
int timeout;
icalparser *parser;
enum cstp_command command;
char* next_output;
char* next_input;
};
icalcstps* icalcstpc_new();
void* icalcstpc_free(icalcstpc* cstpc);
/* Get the next string to send to the server */
char* icalcstpc_next_output(icalcstpc* cstp)
{
}
/* process the next string to send to the server */
int icalcstpc_next_input(icalcstpc* cstp)
{
}
/* After icalcstpc_next_input returns a 0, there are responses
ready. use these to get them */
icalcstpc_response icalcstpc_first_response(icalcstpc* cstp);
icalcstpc_response icalcstpc_next_response(icalcstpc* cstp);
int icalcstpc_set_timeout(icalcstpc* cstp, int sec);
icalerrorenum icalcstpc_abort(icalcstpc* cstp)
{
struct icalcstpc_impl* impl = (struct icalcstpc_impl*)cstp;
icalerror_check_arg_re(cstp!=0,"cstp",ICAL_BADARG_ERROR);
impl->next_output = "ABORT";
}
icalerrorenum icalcstpc_authenticate(icalcstpc* cstp, char* mechanism,
char* data, char* f(char*))
{
}
icalerrorenum icalcstpc_capability(icalcstpc* cstp)
{
}
icalerrorenum icalcstpc_calidexpand(icalcstpc* cstp,char* calid)
{
}
icalerrorenum icalcstpc_continue(icalcstpc* cstp, unsigned int time)
{
}
icalerrorenum icalcstpc_disconnect(icalcstpc* cstp)
{
}
icalerrorenum icalcstpc_identify(icalcstpc* cstp, char* id)
{
}
icalerrorenum icalcstpc_starttls(icalcstpc* cstp, char* command,
char* data, char * f(char*))
{
}
icalerrorenum icalcstpc_upnexpand(icalcstpc* cstp,char* calid)
{
}
icalerrorenum icalcstpc_sendata(icalcstpc* cstp, unsigned int time,
icalcomponent *comp)
{
}

View File

@ -0,0 +1,47 @@
/* -*- Mode: C -*-
======================================================================
FILE: icaldirsetimpl.h
CREATOR: eric 21 Aug 2000
$Id$
$Locker$
(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
======================================================================*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* This definition is in its own file so it can be kept out of the
main header file, but used by "friend classes" like icalset*/
#define ICALDIRSET_ID "dset"
struct icaldirset_impl
{
char id[5]; /* "dset" */
char* dir;
icalcomponent* gauge;
icaldirset* cluster;
int first_component;
pvl_list directory;
pvl_elem directory_iterator;
};

View File

@ -0,0 +1,39 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalgaugeimpl.h
CREATOR: eric 09 Aug 2000
$Id$
$Locker$
(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
======================================================================*/
#include "ical.h"
struct icalgauge_impl
{
icalcomponent* select;
icalcomponent* from;
icalcomponent* where;
};

View File

@ -0,0 +1,376 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalmessage.c
CREATOR: ebusboom 07 Nov 2000
$Id$
$Locker$
(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/
======================================================================*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "icalmessage.h"
#include "icalenums.h"
#include <ctype.h> /* for tolower()*/
#include <string.h> /* for strstr */
#include <stdlib.h> /* for free(), malloc() */
icalcomponent* icalmessage_get_inner(icalcomponent* comp)
{
if (icalcomponent_isa(comp) == ICAL_VCALENDAR_COMPONENT){
return icalcomponent_get_first_real_component(comp);
} else {
return comp;
}
}
char* lowercase(const char* str)
{
char* p = 0;
char* new = icalmemory_strdup(str);
if(str ==0){
return 0;
}
for(p = new; *p!=0; p++){
*p = tolower(*p);
}
return new;
}
icalproperty* icalmessage_find_attendee(icalcomponent* comp, const char* user)
{
icalcomponent *inner = icalmessage_get_inner(comp);
icalproperty *p,*attendee = 0;
char* luser = lowercase(user);
for(p = icalcomponent_get_first_property(inner, ICAL_ATTENDEE_PROPERTY);
p != 0;
p = icalcomponent_get_next_property(inner, ICAL_ATTENDEE_PROPERTY)
){
char* lattendee;
lattendee = lowercase(icalproperty_get_attendee(p));
if (strstr(lattendee,user) != 0){
attendee = p;
break;
}
free(lattendee);
}
free(luser);
return attendee;
}
void icalmessage_copy_properties(icalcomponent* to, icalcomponent* from,
icalproperty_kind kind)
{
icalcomponent *to_inner = icalmessage_get_inner(to);
icalcomponent *from_inner = icalmessage_get_inner(from);
if (to_inner == 0 && from_inner == 0){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return;
}
if(!icalcomponent_get_first_property(from_inner,kind)){
return;
}
icalcomponent_add_property(to_inner,
icalproperty_new_clone(
icalcomponent_get_first_property(
from_inner,
kind)
)
);
}
icalcomponent *icalmessage_new_reply_base(icalcomponent* c,
const char* user,
const char* msg)
{
icalproperty *attendee;
char tmp[45];
icalcomponent *reply = icalcomponent_vanew(
ICAL_VCALENDAR_COMPONENT,
icalproperty_new_method(ICAL_METHOD_REPLY),
icalcomponent_vanew(
ICAL_VEVENT_COMPONENT,
icalproperty_new_dtstamp(icaltime_from_timet(time(0),0,1)),
0),
0);
icalcomponent *inner = icalmessage_get_inner(reply);
icalerror_check_arg_rz(c,"c");
icalmessage_copy_properties(reply,c,ICAL_UID_PROPERTY);
icalmessage_copy_properties(reply,c,ICAL_ORGANIZER_PROPERTY);
icalmessage_copy_properties(reply,c,ICAL_RECURRENCEID_PROPERTY);
icalmessage_copy_properties(reply,c,ICAL_SUMMARY_PROPERTY);
icalmessage_copy_properties(reply,c,ICAL_SEQUENCE_PROPERTY);
icalcomponent_set_dtstamp(reply,icaltime_from_timet(time(0),0,1));
if(msg != 0){
icalcomponent_add_property(inner,icalproperty_new_comment(msg));
}
/* Copy this user's attendee property */
attendee = icalmessage_find_attendee(c,user);
if (attendee == 0){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
icalcomponent_free(reply);
return 0;
}
icalcomponent_add_property(inner,icalproperty_new_clone(attendee));
/* Add PRODID and VERSION */
icalcomponent_add_property(reply,icalproperty_new_version("2.0"));
sprintf(tmp,
"-//SoftwareStudio//NONSGML %s %s //EN",PACKAGE,VERSION);
icalcomponent_add_property(reply,icalproperty_new_prodid(tmp));
return reply;
}
icalcomponent* icalmessage_new_accept_reply(icalcomponent* c,
const char* user,
const char* msg)
{
icalcomponent *reply;
icalproperty *attendee;
icalcomponent *inner;
icalerror_check_arg_rz(c,"c");
reply = icalmessage_new_reply_base(c,user,msg);
if(reply == 0){
return 0;
}
inner = icalmessage_get_inner(reply);
attendee = icalcomponent_get_first_property(inner,
ICAL_ATTENDEE_PROPERTY);
icalproperty_set_parameter(attendee,
icalparameter_new_partstat(ICAL_PARTSTAT_ACCEPTED));
return reply;
}
icalcomponent* icalmessage_new_decline_reply(icalcomponent* c,
const char* user,
const char* msg)
{
icalcomponent *reply;
icalproperty *attendee;
icalcomponent *inner;
icalerror_check_arg_rz(c,"c");
reply = icalmessage_new_reply_base(c,user,msg);
inner = icalmessage_get_inner(reply);
if(reply == 0){
return 0;
}
attendee = icalcomponent_get_first_property(inner,
ICAL_ATTENDEE_PROPERTY);
icalproperty_set_parameter(attendee,
icalparameter_new_partstat(ICAL_PARTSTAT_DECLINED));
return reply;
}
/* New is modified version of old */
icalcomponent* icalmessage_new_counterpropose_reply(icalcomponent* old,
icalcomponent* new,
const char* user,
const char* msg)
{
icalcomponent *reply;
icalerror_check_arg_rz(old,"old");
icalerror_check_arg_rz(new,"new");
reply = icalcomponent_new_clone(new);
icalcomponent_set_method(reply,ICAL_METHOD_COUNTER);
return new;
}
icalcomponent* icalmessage_new_delegate_reply(icalcomponent* c,
const char* user,
const char* delegatee,
const char* msg)
{
icalcomponent *reply;
icalproperty *attendee;
icalcomponent *inner;
icalerror_check_arg_rz(c,"c");
reply = icalmessage_new_reply_base(c,user,msg);
inner = icalmessage_get_inner(reply);
if(reply == 0){
return 0;
}
attendee = icalcomponent_get_first_property(inner,
ICAL_ATTENDEE_PROPERTY);
icalproperty_set_parameter(attendee,
icalparameter_new_partstat(ICAL_PARTSTAT_DELEGATED));
icalproperty_set_parameter(attendee,
icalparameter_new_delegatedto(delegatee));
return reply;
}
icalcomponent* icalmessage_new_delegate_request(icalcomponent* c,
const char* user,
const char* delegatee,
const char* msg)
{
icalcomponent *reply;
icalproperty *attendee;
icalcomponent *inner;
icalerror_check_arg_rz(c,"c");
reply = icalmessage_new_reply_base(c,user,msg);
inner = icalmessage_get_inner(reply);
if(reply == 0){
return 0;
}
icalcomponent_set_method(reply,ICAL_METHOD_REQUEST);
attendee = icalcomponent_get_first_property(inner,
ICAL_ATTENDEE_PROPERTY);
icalproperty_set_parameter(attendee,
icalparameter_new_partstat(ICAL_PARTSTAT_DELEGATED));
icalproperty_set_parameter(attendee,
icalparameter_new_delegatedto(delegatee));
icalcomponent_add_property(
inner,
icalproperty_vanew_attendee(
delegatee,
icalparameter_new_delegatedfrom(
icalproperty_get_attendee(attendee)
),
0
)
);
return reply;
}
icalcomponent* icalmessage_new_cancel_event(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_cancel_instance(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_cancel_all(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_error_reply(icalcomponent* c,
const char* user,
const char* msg,
const char* debug,
icalrequeststatus code)
{
icalcomponent *reply;
icalcomponent *inner, *cinner;
struct icalreqstattype rs;
icalerror_check_arg_rz(c,"c");
reply = icalmessage_new_reply_base(c,user,msg);
inner = icalmessage_get_inner(reply);
cinner = icalmessage_get_inner(c);
if(reply == 0){
return 0;
}
if( code != ICAL_UNKNOWN_STATUS){
rs.code = code;
rs.debug = debug;
icalcomponent_add_property(inner,
icalproperty_new_requeststatus(
icalreqstattype_as_string(rs)
)
);
} else { /* code == ICAL_UNKNOWN_STATUS */
/* Copy all of the request status properties */
icalproperty *p;
for(p = icalcomponent_get_first_property(cinner,
ICAL_REQUESTSTATUS_PROPERTY);
p != 0;
p = icalcomponent_get_next_property(cinner,
ICAL_REQUESTSTATUS_PROPERTY)){
icalcomponent_add_property(inner,icalproperty_new_clone(p));
}
}
return reply;
}

View File

@ -0,0 +1,72 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalmessage.h
CREATOR: eric 07 Nov 2000
$Id$
$Locker$
(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/
=========================================================================*/
#include "ical.h"
#ifndef ICALMESSAGE_H
#define ICALMESSAGE_H
icalcomponent* icalmessage_new_accept_reply(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_decline_reply(icalcomponent* c,
const char* user,
const char* msg);
/* New is modified version of old */
icalcomponent* icalmessage_new_counterpropose_reply(icalcomponent* old,
icalcomponent* new,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_delegate_reply(icalcomponent* c,
const char* user,
const char* delegatee,
const char* msg);
icalcomponent* icalmessage_new_cancel_event(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_cancel_instance(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_cancel_all(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_error_reply(icalcomponent* c,
const char* user,
const char* msg,
const char* debug,
icalrequeststatus rs);
#endif /* ICALMESSAGE_H*/

View File

@ -0,0 +1,309 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalspanlist.c
CREATOR: ebusboom 23 aug 2000
$Id$
$Locker$
(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/
======================================================================*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "ical.h"
#include "icalspanlist.h"
#include "pvl.h"
#include <stdlib.h> /* for free and malloc */
struct icalspanlist_impl {
pvl_list spans;
};
int compare_span(void* a, void* b)
{
struct icaltime_span *span_a = (struct icaltime_span *)a ;
struct icaltime_span *span_b = (struct icaltime_span *)b ;
if(span_a->start == span_b->start){
return 0;
} else if(span_a->start < span_b->start){
return -1;
} else { /*if(span_a->start > span->b.start)*/
return 1;
}
}
icalcomponent* icalspanlist_get_inner(icalcomponent* comp)
{
if (icalcomponent_isa(comp) == ICAL_VCALENDAR_COMPONENT){
return icalcomponent_get_first_real_component(comp);
} else {
return comp;
}
}
void print_span(int c, struct icaltime_span span );
/* Make a free list from a set of component */
icalspanlist* icalspanlist_new(icalset *set,
struct icaltimetype start,
struct icaltimetype end)
{
struct icaltime_span range;
pvl_elem itr;
icalcomponent *c,*inner;
icalcomponent_kind kind, inner_kind;
struct icalspanlist_impl *sl;
struct icaltime_span *freetime;
if ( ( sl = (struct icalspanlist_impl*)
malloc(sizeof(struct icalspanlist_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
sl->spans = pvl_newlist();
range.start = icaltime_as_timet(start);
range.end = icaltime_as_timet(end);
printf("Range start: %s",ctime(&range.start));
printf("Range end : %s",ctime(&range.end));
/* Get a list of spans of busy time from the events in the set
and order the spans based on the start time */
for(c = icalset_get_first_component(set);
c != 0;
c = icalset_get_next_component(set)){
struct icaltime_span span;
kind = icalcomponent_isa(c);
inner = icalcomponent_get_inner(c);
if(!inner){
continue;
}
inner_kind = icalcomponent_isa(inner);
if( kind != ICAL_VEVENT_COMPONENT &&
inner_kind != ICAL_VEVENT_COMPONENT){
continue;
}
icalerror_clear_errno();
span = icalcomponent_get_span(c);
span.is_busy = 1;
if(icalerrno != ICAL_NO_ERROR){
continue;
}
if ((range.start < span.end && icaltime_is_null_time(end)) ||
(range.start < span.end && range.end > span.start )){
struct icaltime_span *s;
if ((s=(struct icaltime_span *)
malloc(sizeof(struct icaltime_span))) == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
memcpy(s,&span,sizeof(span));
pvl_insert_ordered(sl->spans,compare_span,(void*)s);
}
}
/* Now Fill in the free time spans. loop through the spans. if the
start of the range is not within the span, create a free entry
that runs from the start of the range to the start of the
span. */
for( itr = pvl_head(sl->spans);
itr != 0;
itr = pvl_next(itr))
{
struct icaltime_span *s = (icalproperty*)pvl_data(itr);
if ((freetime=(struct icaltime_span *)
malloc(sizeof(struct icaltime_span))) == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
if(range.start < s->start){
freetime->start = range.start;
freetime->end = s->start;
freetime->is_busy = 0;
pvl_insert_ordered(sl->spans,compare_span,(void*)freetime);
} else {
free(freetime);
}
range.start = s->end;
}
/* If the end of the range is null, then assume that everything
after the last item in the calendar is open and add a span
that indicates this */
if( icaltime_is_null_time(end)){
struct icaltime_span* last_span;
last_span = pvl_data(pvl_tail(sl->spans));
if (last_span != 0){
if ((freetime=(struct icaltime_span *)
malloc(sizeof(struct icaltime_span))) == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
freetime->is_busy = 0;
freetime->start = last_span->end;
freetime->end = freetime->start;
pvl_insert_ordered(sl->spans,compare_span,(void*)freetime);
}
}
return sl;
}
void icalspanlist_free(icalspanlist* s)
{
struct icaltime_span *span;
struct icalspanlist_impl* impl = (struct icalspanlist_impl*)s;
while( (span=pvl_pop(impl->spans)) != 0){
free(span);
}
pvl_free(impl->spans);
impl->spans = 0;
}
void icalspanlist_dump(icalspanlist* s){
int i = 0;
struct icalspanlist_impl* sl = (struct icalspanlist_impl*)s;
pvl_elem itr;
for( itr = pvl_head(sl->spans);
itr != 0;
itr = pvl_next(itr))
{
struct icaltime_span *s = (icalproperty*)pvl_data(itr);
printf("#%02d %d start: %s",++i,s->is_busy,ctime(&s->start));
printf(" end : %s",ctime(&s->end));
}
}
icalcomponent* icalspanlist_make_free_list(icalspanlist* sl);
icalcomponent* icalspanlist_make_busy_list(icalspanlist* sl);
struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
struct icaltimetype t)
{
struct icalspanlist_impl* impl = (struct icalspanlist_impl*)sl;
pvl_elem itr;
struct icalperiodtype period;
struct icaltime_span *s;
time_t rangett= icaltime_as_timet(t);
period.start = icaltime_null_time();
period.end = icaltime_null_time();
/* Is the reference time before the first span? If so, assume
that the reference time is free */
itr = pvl_head(impl->spans);
s = (icalproperty*)pvl_data(itr);
if (s == 0){
/* No elements in span */
return period;
}
if(rangett <s->start ){
/* End of period is start of first span if span is busy, end
of the span if it is free */
period.start = t;
if (s->is_busy == 0){
period.end = icaltime_from_timet(s->start,0,0);
} else {
period.end = icaltime_from_timet(s->end,0,0);
}
return period;
}
/* Otherwise, find the first free span that contains the
reference time. */
for( itr = pvl_head(impl->spans);
itr != 0;
itr = pvl_next(itr))
{
s = (icalproperty*)pvl_data(itr);
if(s->is_busy == 0 && s->start >= rangett &&
( rangett < s->end || s->end == s->start)){
if (rangett < s->start){
period.start = icaltime_from_timet(s->start,0,0);
} else {
period.start = icaltime_from_timet(rangett,0,0);
}
period.end = icaltime_from_timet(s->end,0,0);
return period;
}
}
period.start = icaltime_null_time();
period.end = icaltime_null_time();
return period;
}
struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl,
struct icaltimetype t);

View File

@ -0,0 +1,54 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalspanlist.h
CREATOR: eric 21 Aug 2000
$Id$
$Locker$
(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/
=========================================================================*/
#ifndef ICALSPANLIST_H
#define ICALSPANLIST_H
#include "ical.h"
#include "icalset.h"
typedef void icalspanlist;
/* Make a free list from a set of component. Start and end should be in UTC */
icalspanlist* icalspanlist_new(icalset *set,
struct icaltimetype start,
struct icaltimetype end);
void icalspanlist_free(icalspanlist* spl);
icalcomponent* icalspanlist_make_free_list(icalspanlist* sl);
icalcomponent* icalspanlist_make_busy_list(icalspanlist* sl);
/* Get first free or busy time after time t. all times are in UTC */
struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
struct icaltimetype t);
struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl,
struct icaltimetype t);
void icalspanlist_dump(icalspanlist* s);
#endif

View File

@ -0,0 +1,763 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalset.h
CREATOR: eric 28 November 1999
Icalset is the "base class" for representations of a collection of
iCal components. Derived classes (actually delegatees) include:
icalfileset Store componetns in a single file
icaldirset Store components in multiple files in a directory
icalheapset Store components on the heap
icalmysqlset Store components in a mysql database.
$Id$
$Locker$
(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
======================================================================*/
#ifndef ICALSET_H
#define ICALSET_H
typedef void icalset;
typedef enum icalset_kind {
ICAL_FILE_SET,
ICAL_DIR_SET,
ICAL_HEAP_SET,
ICAL_MYSQL_SET,
ICAL_CAP_SET
} icalset_kind;
/* Create a specific derived type of set */
icalset* icalset_new_file(const char* path);
icalset* icalset_new_dir(const char* path);
icalset* icalset_new_heap(void);
icalset* icalset_new_mysql(const char* path);
/*icalset* icalset_new_cap(icalcstp* cstp);*/
void icalset_free(icalset* set);
const char* icalset_path(icalset* set);
/* Mark the cluster as changed, so it will be written to disk when it
is freed. Commit writes to disk immediately*/
void icalset_mark(icalset* set);
icalerrorenum icalset_commit(icalset* set);
icalerrorenum icalset_add_component(icalset* set, icalcomponent* comp);
icalerrorenum icalset_remove_component(icalset* set, icalcomponent* comp);
int icalset_count_components(icalset* set,
icalcomponent_kind kind);
/* Restrict the component returned by icalset_first, _next to those
that pass the gauge. _clear removes the gauge. */
icalerrorenum icalset_select(icalset* set, icalcomponent* gauge);
void icalset_clear_select(icalset* set);
/* Get a component by uid */
icalcomponent* icalset_fetch(icalset* set, const char* uid);
int icalset_has_uid(icalset* set, const char* uid);
icalcomponent* icalset_fetch_match(icalset* set, icalcomponent *c);
/* Modify components according to the MODIFY method of CAP. Works on
the currently selected components. */
icalerrorenum icalset_modify(icalset* set, icalcomponent *oldc,
icalcomponent *newc);
/* Iterate through the components. If a guage has been defined, these
will skip over components that do not pass the gauge */
icalcomponent* icalset_get_current_component(icalset* set);
icalcomponent* icalset_get_first_component(icalset* set);
icalcomponent* icalset_get_next_component(icalset* set);
#endif /* !ICALSET_H */
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalfileset.h
CREATOR: eric 23 December 1999
$Id$
$Locker$
(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
======================================================================*/
#ifndef ICALFILESET_H
#define ICALFILESET_H
typedef void icalfileset;
/* icalfileset
icalfilesetfile
icalfilesetdir
*/
icalfileset* icalfileset_new(const char* path);
void icalfileset_free(icalfileset* cluster);
const char* icalfileset_path(icalfileset* cluster);
/* Mark the cluster as changed, so it will be written to disk when it
is freed. Commit writes to disk immediately. */
void icalfileset_mark(icalfileset* cluster);
icalerrorenum icalfileset_commit(icalfileset* cluster);
icalerrorenum icalfileset_add_component(icalfileset* cluster,
icalcomponent* child);
icalerrorenum icalfileset_remove_component(icalfileset* cluster,
icalcomponent* child);
int icalfileset_count_components(icalfileset* cluster,
icalcomponent_kind kind);
/* Restrict the component returned by icalfileset_first, _next to those
that pass the gauge. _clear removes the gauge */
icalerrorenum icalfileset_select(icalfileset* store, icalcomponent* gauge);
void icalfileset_clear(icalfileset* store);
/* Get and search for a component by uid */
icalcomponent* icalfileset_fetch(icalfileset* cluster, const char* uid);
int icalfileset_has_uid(icalfileset* cluster, const char* uid);
icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *c);
/* Modify components according to the MODIFY method of CAP. Works on
the currently selected components. */
icalerrorenum icalfileset_modify(icalfileset* store, icalcomponent *oldcomp,
icalcomponent *newcomp);
/* Iterate through components. If a guage has been defined, these
will skip over components that do not pass the gauge */
icalcomponent* icalfileset_get_current_component (icalfileset* cluster);
icalcomponent* icalfileset_get_first_component(icalfileset* cluster);
icalcomponent* icalfileset_get_next_component(icalfileset* cluster);
/* Return a reference to the internal component. You probably should
not be using this. */
icalcomponent* icalfileset_get_component(icalfileset* cluster);
#endif /* !ICALFILESET_H */
/* -*- Mode: C -*- */
/*======================================================================
FILE: icaldirset.h
CREATOR: eric 28 November 1999
$Id$
$Locker$
(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
======================================================================*/
#ifndef ICALDIRSET_H
#define ICALDIRSET_H
/* icaldirset Routines for storing, fetching, and searching for ical
* objects in a database */
typedef void icaldirset;
icaldirset* icaldirset_new(const char* path);
void icaldirset_free(icaldirset* store);
const char* icaldirset_path(icaldirset* store);
/* Mark the cluster as changed, so it will be written to disk when it
is freed. Commit writes to disk immediately*/
void icaldirset_mark(icaldirset* store);
icalerrorenum icaldirset_commit(icaldirset* store);
icalerrorenum icaldirset_add_component(icaldirset* store, icalcomponent* comp);
icalerrorenum icaldirset_remove_component(icaldirset* store, icalcomponent* comp);
int icaldirset_count_components(icaldirset* store,
icalcomponent_kind kind);
/* Restrict the component returned by icaldirset_first, _next to those
that pass the gauge. _clear removes the gauge. */
icalerrorenum icaldirset_select(icaldirset* store, icalcomponent* gauge);
void icaldirset_clear(icaldirset* store);
/* Get a component by uid */
icalcomponent* icaldirset_fetch(icaldirset* store, const char* uid);
int icaldirset_has_uid(icaldirset* store, const char* uid);
icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c);
/* Modify components according to the MODIFY method of CAP. Works on
the currently selected components. */
icalerrorenum icaldirset_modify(icaldirset* store, icalcomponent *oldc,
icalcomponent *newc);
/* Iterate through the components. If a guage has been defined, these
will skip over components that do not pass the gauge */
icalcomponent* icaldirset_get_current_component(icaldirset* store);
icalcomponent* icaldirset_get_first_component(icaldirset* store);
icalcomponent* icaldirset_get_next_component(icaldirset* store);
#endif /* !ICALDIRSET_H */
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalcalendar.h
CREATOR: eric 23 December 1999
$Id$
$Locker$
(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
======================================================================*/
#ifndef ICALCALENDAR_H
#define ICALCALENDAR_H
/* icalcalendar
* Routines for storing calendar data in a file system. The calendar
* 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 */
typedef void icalcalendar;
icalcalendar* icalcalendar_new(char* dir);
void icalcalendar_free(icalcalendar* calendar);
int icalcalendar_lock(icalcalendar* calendar);
int icalcalendar_unlock(icalcalendar* calendar);
int icalcalendar_islocked(icalcalendar* calendar);
int icalcalendar_ownlock(icalcalendar* calendar);
icalset* icalcalendar_get_booked(icalcalendar* calendar);
icalset* icalcalendar_get_incoming(icalcalendar* calendar);
icalset* icalcalendar_get_properties(icalcalendar* calendar);
icalset* icalcalendar_get_freebusy(icalcalendar* calendar);
#endif /* !ICALCALENDAR_H */
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalgauge.h
CREATOR: eric 23 December 1999
$Id$
$Locker$
(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
======================================================================*/
#ifndef ICALGAUGE_H
#define ICALGAUGE_H
typedef void icalgauge;
icalgauge* icalgauge_new_from_sql(char* sql);
void icalgauge_free(icalgauge* gauge);
char* icalgauge_as_sql(icalcomponent* gauge);
int icalgauge_test(icalcomponent* comp, icalcomponent* gaugecontainer);
#endif /* ICALGAUGE_H*/
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalssutil.h
CREATOR: eric 21 Aug 2000
$Id$
$Locker$
(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/
=========================================================================*/
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalclassify.h
CREATOR: eric 21 Aug 2000
$Id$
$Locker$
(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/
=========================================================================*/
#ifndef ICALCLASSIFY_H
#define ICALCLASSIFY_H
typedef enum icalclass {
ICAL_NO_CLASS,
ICAL_PUBLISH_NEW_CLASS,
ICAL_PUBLISH_UPDATE_CLASS,
ICAL_PUBLISH_FREEBUSY_CLASS,
ICAL_REQUEST_NEW_CLASS,
ICAL_REQUEST_UPDATE_CLASS,
ICAL_REQUEST_RESCHEDULE_CLASS,
ICAL_REQUEST_DELEGATE_CLASS,
ICAL_REQUEST_NEW_ORGANIZER_CLASS,
ICAL_REQUEST_FORWARD_CLASS,
ICAL_REQUEST_STATUS_CLASS,
ICAL_REQUEST_FREEBUSY_CLASS,
ICAL_REPLY_ACCEPT_CLASS,
ICAL_REPLY_DECLINE_CLASS,
ICAL_REPLY_CRASHER_ACCEPT_CLASS,
ICAL_REPLY_CRASHER_DECLINE_CLASS,
ICAL_ADD_INSTANCE_CLASS,
ICAL_CANCEL_EVENT_CLASS,
ICAL_CANCEL_INSTANCE_CLASS,
ICAL_CANCEL_ALL_CLASS,
ICAL_REFRESH_CLASS,
ICAL_COUNTER_CLASS,
ICAL_DECLINECOUNTER_CLASS,
ICAL_MALFORMED_CLASS,
ICAL_OBSOLETE_CLASS, /* 21 */
ICAL_MISSEQUENCED_CLASS, /* 22 */
ICAL_UNKNOWN_CLASS /* 23 */
} ical_class;
ical_class icalclassify(icalcomponent* c,icalcomponent* match,
const char* user);
icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp);
#endif /* ICALCLASSIFY_H*/
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalspanlist.h
CREATOR: eric 21 Aug 2000
$Id$
$Locker$
(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/
=========================================================================*/
#ifndef ICALSPANLIST_H
#define ICALSPANLIST_H
typedef void icalspanlist;
/* Make a free list from a set of component. Start and end should be in UTC */
icalspanlist* icalspanlist_new(icalset *set,
struct icaltimetype start,
struct icaltimetype end);
void icalspanlist_free(icalspanlist* spl);
icalcomponent* icalspanlist_make_free_list(icalspanlist* sl);
icalcomponent* icalspanlist_make_busy_list(icalspanlist* sl);
/* Get first free or busy time after time t. all times are in UTC */
struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
struct icaltimetype t);
struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl,
struct icaltimetype t);
void icalspanlist_dump(icalspanlist* s);
#endif
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalmessage.h
CREATOR: eric 07 Nov 2000
$Id$
$Locker$
(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/
=========================================================================*/
#ifndef ICALMESSAGE_H
#define ICALMESSAGE_H
icalcomponent* icalmessage_new_accept_reply(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_decline_reply(icalcomponent* c,
const char* user,
const char* msg);
/* New is modified version of old */
icalcomponent* icalmessage_new_counterpropose_reply(icalcomponent* old,
icalcomponent* new,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_delegate_reply(icalcomponent* c,
const char* user,
const char* delegatee,
const char* msg);
icalcomponent* icalmessage_new_cancel_event(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_cancel_instance(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_cancel_all(icalcomponent* c,
const char* user,
const char* msg);
icalcomponent* icalmessage_new_error_reply(icalcomponent* c,
const char* user,
const char* msg,
const char* debug,
icalrequeststatus rs);
#endif /* ICALMESSAGE_H*/
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalcstp.h
CREATOR: eric 20 April 1999
$Id$
(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 icalcstp.h
======================================================================*/
#ifndef ICALCSTP_H
#define ICALCSTP_H
/********************** Server (Reciever) Interfaces *************************/
/* On the server side, the caller will recieve data from the incoming
socket and pass it to icalcstps_next_input. The caller then takes
the return from icalcstps_next_outpu and sends it out through the
socket. This gives the caller a point of control. If the cstp code
connected to the socket itself, it would be hard for the caller to
do anything else after the cstp code was started.
All of the server abd client command routines will generate
response codes. On the server side, these responses will be turned
into text and sent to the client. On the client side, the reponse
is the one sent from the server.
Since each command can return multiple responses, the responses are
stored in the icalcstps object and are accesses by
icalcstps_first_response() and icalcstps_next_response()
How to use:
1) Construct a new icalcstps, bound to your code via stubs
2) Repeat forever:
2a) Get string from client & give to icalcstps_next_input()
2b) Call icalcstps_next_output. Send string to client.
*/
typedef void icalcstps;
/* Er, they aren't really stubs, but pointers to the rountines that
icalcstps_process_incoming will call when it recognizes a CSTP
command in the data. BTW, the CONTINUE command is named 'cont'
because 'continue' is a C keyword */
struct icalcstps_stubs {
icalerrorenum (*abort)(icalcstps* cstp);
icalerrorenum (*authenticate)(icalcstps* cstp, char* mechanism,
char* data);
icalerrorenum (*calidexpand)(icalcstps* cstp, char* calid);
icalerrorenum (*capability)(icalcstps* cstp);
icalerrorenum (*cont)(icalcstps* cstp, unsigned int time);
icalerrorenum (*identify)(icalcstps* cstp, char* id);
icalerrorenum (*disconnect)(icalcstps* cstp);
icalerrorenum (*sendata)(icalcstps* cstp, unsigned int time,
icalcomponent *comp);
icalerrorenum (*starttls)(icalcstps* cstp, char* command,
char* data);
icalerrorenum (*upnexpand)(icalcstps* cstp, char* upn);
icalerrorenum (*unknown)(icalcstps* cstp, char* command, char* data);
};
icalcstps* icalcstps_new(struct icalcstps_stubs stubs);
void icalcstps_free(icalcstps* cstp);
int icalcstps_set_timeout(icalcstps* cstp, int sec);
/* Get the next string to send to the client */
char* icalcstps_next_output(icalcstps* cstp);
/* process the next string from the client */
int icalcstps_next_input(icalcstps* cstp);
/********************** Client (Sender) Interfaces **************************/
/* How to use:
1) Construct a new icalcstpc
2) Issue a command
3) Repeat until both call icalcstpc_next_output and
icalcstpc_next_input return 0:
3a) Call icalcstpc_next_output. Send string to server.
3b) Get string from server, & give to icalcstp_next_input()
4) Iterate with icalcstpc_first_response & icalcstp_next_response to
get the servers responses
5) Repeat at #2
*/
typedef void* icalcstpc;
/* Response code sent by the server. */
typedef struct icalcstpc_response {
icalrequeststatus code;
char *arg; /* These strings are owned by libical */
char *debug_text;
char *more_text;
void* result;
} icalcstpc_response;
icalcstps* icalcstpc_new();
void* icalcstpc_free(icalcstpc* cstpc);
int icalcstpc_set_timeout(icalcstpc* cstp, int sec);
/* Get the next string to send to the server */
char* icalcstpc_next_output(icalcstpc* cstp);
/* process the next string from the server */
int icalcstpc_next_input(icalcstpc* cstp);
/* After icalcstpc_next_input returns a 0, there are responses
ready. use these to get them */
icalcstpc_response icalcstpc_first_response(icalcstpc* cstp);
icalcstpc_response icalcstpc_next_response(icalcstpc* cstp);
/* Issue a command */
icalerrorenum icalcstpc_abort(icalcstpc* cstp);
icalerrorenum icalcstpc_authenticate(icalcstpc* cstp, char* mechanism,
char* init_data, char* f(char*) );
icalerrorenum icalcstpc_capability(icalcstpc* cstp);
icalerrorenum icalcstpc_calidexpand(icalcstpc* cstp,char* calid);
icalerrorenum icalcstpc_continue(icalcstpc* cstp, unsigned int time);
icalerrorenum icalcstpc_disconnect(icalcstpc* cstp);
icalerrorenum icalcstpc_identify(icalcstpc* cstp, char* id);
icalerrorenum icalcstpc_starttls(icalcstpc* cstp, char* command,
char* init_data, char* f(char*));
icalerrorenum icalcstpc_senddata(icalcstpc* cstp, unsigned int time,
icalcomponent *comp);
icalerrorenum icalcstpc_upnexpand(icalcstpc* cstp,char* calid);
icalerrorenum icalcstpc_sendata(icalcstpc* cstp, unsigned int time,
icalcomponent *comp);
#endif /* !ICALCSTP_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,111 @@
%{
/* -*- Mode: C -*-
======================================================================
FILE: icalsslexer.l
CREATOR: eric 8 Aug 2000
DESCRIPTION:
$Id: icalsslexer.l,v 1.1 2000/12/11 22:06:17 federico Exp $
$Locker: $
(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
======================================================================*/
#include "icalssyacc.h"
#include "icalgaugeimpl.h"
#include "assert.h"
#include <string.h> /* For strdup() */
int icalparser_flex_input(char* buf, int max_size);
void icalparser_clear_flex_input();
#undef YY_INPUT
#define YY_INPUT(b,r,ms) ( r= icalparser_flex_input(b,ms))
#undef SS_FATAL_ERROR
#define SS_FATAL_ERROR(msg) sserror(msg)
%}
crlf \x0D?\x0A
space [ ]
qsafechar [^\x00-\x1F\"]
safechar [^\x00-\x1F\"\:\;\,]
tsafechar [\x20-\x21\x23-\x2B\x2D-\x39\x3C-\x5B\x5D-\x7E]
valuechar [^\x00-\x08\x10-\x1F]
xname X-[a-zA-Z0-9\-]+
xname2 [a-zA-Z0-9\-\ ]
paramtext {safechar}+
value {valuechar}+
quotedstring \"{qsafechar}+\"
digit [0-9]
%array /* Make yytext an array. Slow, but handy. HACK */
%option caseless
%s sql string_value
%%
%{
%}
SELECT { return SELECT; }
FROM { return FROM; }
WHERE { return WHERE; }
, { return COMMA; }
"=" { return EQUALS; }
"!=" { return NOTEQUALS; }
"<" { return LESS; }
">" { return GREATER; }
"<=" { return LESSEQUALS; }
">=" { return GREATEREQUALS; }
AND { return AND; }
OR { return OR; }
[ \t\n\r]+ ;
; { return EOL; }
[\*A-Za-z0-9\-\.]+ { sslval.v_string= icalmemory_tmp_copy(sstext);
return STRING; }
'[^'\n]*' {
int c = input();
unput(c);
if(c!='\''){
sslval.v_string= icalmemory_tmp_copy(sstext);
return STRING;
} else {
/*ssmore();*/
}
}
. { return yytext[0]; }
%%
int sswrap()
{
return 1;
}

View File

@ -0,0 +1,29 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalssutil.c
CREATOR: ebusboom 23 aug 2000
$Id$
$Locker$
(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/
======================================================================*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

View File

@ -0,0 +1,27 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalssutil.h
CREATOR: eric 21 Aug 2000
$Id$
$Locker$
(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/
=========================================================================*/
#include "ical.h"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
typedef union {
char* v_string;
} YYSTYPE;
#define STRING 257
#define SELECT 258
#define FROM 259
#define WHERE 260
#define COMMA 261
#define EQUALS 262
#define NOTEQUALS 263
#define LESS 264
#define GREATER 265
#define LESSEQUALS 266
#define GREATEREQUALS 267
#define AND 268
#define OR 269
#define EOL 270
#define END 271
extern YYSTYPE sslval;

View File

@ -0,0 +1,215 @@
%{
/* -*- Mode: C -*-
======================================================================
FILE: icalssyacc.y
CREATOR: eric 08 Aug 2000
DESCRIPTION:
$Id: icalssyacc.y,v 1.1 2000/12/11 22:06:18 federico Exp $
$Locker: $
(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
======================================================================*/
#include <stdlib.h>
#include <string.h> /* for strdup() */
#include <limits.h> /* for SHRT_MAX*/
#include "ical.h"
#include "pvl.h"
#include "icalgaugeimpl.h"
extern struct icalgauge_impl *icalss_yy_gauge;
void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
enum icalparameter_xliccomparetype compare , char* str2);
void ssyacc_add_select(struct icalgauge_impl* impl, char* str1);
void ssyacc_add_from(struct icalgauge_impl* impl, char* str1);
void move_where(int w);
void sserror(char *s); /* Don't know why I need this.... */
%}
%union {
char* v_string;
}
%token <v_string> STRING
%token SELECT FROM WHERE COMMA EQUALS NOTEQUALS LESS GREATER LESSEQUALS
%token GREATEREQUALS AND OR EOL END
%%
query_min: SELECT select_list FROM from_list WHERE where_list
| error {
icalparser_clear_flex_input();
yyclearin;
}
;
select_list:
STRING {ssyacc_add_select(icalss_yy_gauge,$1);}
| select_list COMMA STRING {ssyacc_add_select(icalss_yy_gauge,$3);}
;
from_list:
STRING {ssyacc_add_from(icalss_yy_gauge,$1);}
| from_list COMMA STRING {ssyacc_add_from(icalss_yy_gauge,$3);}
;
where_clause:
/* Empty */
| STRING EQUALS STRING {ssyacc_add_where(icalss_yy_gauge,$1,ICAL_XLICCOMPARETYPE_EQUAL,$3); }
| STRING NOTEQUALS STRING {ssyacc_add_where(icalss_yy_gauge,$1,ICAL_XLICCOMPARETYPE_NOTEQUAL,$3); }
| STRING LESS STRING {ssyacc_add_where(icalss_yy_gauge,$1,ICAL_XLICCOMPARETYPE_LESS,$3); }
| STRING GREATER STRING {ssyacc_add_where(icalss_yy_gauge,$1,ICAL_XLICCOMPARETYPE_GREATER,$3); }
| STRING LESSEQUALS STRING {ssyacc_add_where(icalss_yy_gauge,$1,ICAL_XLICCOMPARETYPE_LESSEQUAL,$3); }
| STRING GREATEREQUALS STRING {ssyacc_add_where(icalss_yy_gauge,$1,ICAL_XLICCOMPARETYPE_GREATEREQUAL,$3); }
;
where_list:
where_clause {move_where(1);}
| where_list AND where_clause {move_where(2);}
| where_list OR where_clause {move_where(3);}
;
%%
void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
enum icalparameter_xliccomparetype compare , char* str2)
{
icalproperty *p;
icalvalue *v;
icalproperty_kind kind;
kind = icalenum_string_to_property_kind(str1);
if(kind == ICAL_NO_PROPERTY){
assert(0);
}
p = icalproperty_new(kind);
v = icalvalue_new_text(str2);
if(v == 0){
assert(0);
}
icalproperty_set_value(p,v);
icalproperty_add_parameter(p,icalparameter_new_xliccomparetype(compare));
icalcomponent_add_property(impl->where,p);
}
void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
{
icalproperty *p;
icalproperty_kind pkind;
icalcomponent_kind ckind = ICAL_NO_COMPONENT;
char* c;
char* compstr;
char* propstr;
/* Is there a period in str1 ? If so, the string specified both a
component and a property*/
if( (c = strrchr(str1,'.')) != 0){
compstr = str1;
propstr = c+1;
*c = '\0';
} else {
compstr = 0;
propstr = str1;
}
/* Handle the case where a component was specified */
if(compstr != 0){
ckind = icalenum_string_to_component_kind(compstr);
if(ckind == ICAL_NO_COMPONENT){
assert(0);
}
} else {
ckind = ICAL_NO_COMPONENT;
}
/* If the property was '*', then accept all properties */
if(strcmp("*",propstr) == 0) {
pkind = ICAL_ANY_PROPERTY;
} else {
pkind = icalenum_string_to_property_kind(str1);
}
if(pkind == ICAL_NO_PROPERTY){
assert(0);
}
if(ckind == ICAL_NO_COMPONENT){
p = icalproperty_new(pkind);
assert(p!=0);
icalcomponent_add_property(impl->select,p);
} else {
icalcomponent *comp =
icalcomponent_new(ckind);
p = icalproperty_new(pkind);
assert(p!=0);
icalcomponent_add_property(comp,p);
icalcomponent_add_component(impl->select,comp);
}
}
void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
{
icalcomponent *c;
icalcomponent_kind ckind;
ckind = icalenum_string_to_component_kind(str1);
if(ckind == ICAL_NO_COMPONENT){
assert(0);
}
c = icalcomponent_new(ckind);
icalcomponent_add_component(impl->from,c);
}
void move_where(int w)
{
}
void sserror(char *s){
fprintf(stderr,"Parse error \'%s\'\n", s);
}

452
libical/src/test/process.c Normal file
View File

@ -0,0 +1,452 @@
/* -*- Mode: C -*-
======================================================================
FILE: process.c
CREATOR: eric 11 February 2000
$Id$
$Locker$
(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.
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
======================================================================*/
#include <stdio.h> /* for printf */
#include "ical.h"
#include "icalss.h"
#include <errno.h>
#include <string.h> /* For strerror */
#include <stdlib.h> /* for free */
struct class_map {
ical_class class;
char *str;
} class_map[] = {
{ICAL_NO_CLASS,"No class"},
{ICAL_PUBLISH_NEW_CLASS,"New Publish"},
{ICAL_PUBLISH_UPDATE_CLASS,"New Publish"},
{ICAL_REQUEST_NEW_CLASS,"New request"},
{ICAL_REQUEST_UPDATE_CLASS,"Update"},
{ICAL_REQUEST_RESCHEDULE_CLASS,"Reschedule"},
{ICAL_REQUEST_DELEGATE_CLASS,"Delegate"},
{ICAL_REQUEST_NEW_ORGANIZER_CLASS,"New Organizer"},
{ICAL_REQUEST_FORWARD_CLASS,"Forward"},
{ICAL_REQUEST_STATUS_CLASS,"Status request"},
{ICAL_REPLY_ACCEPT_CLASS,"Accept reply"},
{ICAL_REPLY_DECLINE_CLASS,"Decline reply"},
{ICAL_REPLY_CRASHER_ACCEPT_CLASS,"Crasher's accept reply"},
{ICAL_REPLY_CRASHER_DECLINE_CLASS,"Crasher's decline reply"},
{ICAL_ADD_INSTANCE_CLASS,"Add instance"},
{ICAL_CANCEL_EVENT_CLASS,"Cancel event"},
{ICAL_CANCEL_INSTANCE_CLASS,"Cancel instance"},
{ICAL_CANCEL_ALL_CLASS,"Cancel all instances"},
{ICAL_REFRESH_CLASS,"Refresh"},
{ICAL_COUNTER_CLASS,"Counter"},
{ICAL_DECLINECOUNTER_CLASS,"Decline counter"},
{ICAL_MALFORMED_CLASS,"Malformed"},
{ICAL_OBSOLETE_CLASS,"Obsolete"},
{ICAL_MISSEQUENCED_CLASS,"Missequenced"},
{ICAL_UNKNOWN_CLASS,"Unknown"}
};
char* find_class_string(ical_class class)
{
int i;
for (i = 0;class_map[i].class != ICAL_UNKNOWN_CLASS;i++){
if (class_map[i].class == class){
return class_map[i].str;
}
}
return "Unknown";
}
void send_message(icalcomponent *reply,const char* this_user)
{
printf("From: %s\n\n%s\n",this_user,icalcomponent_as_ical_string(reply));
}
int main(int argc, char* argv[])
{
icalcomponent *c, *next_c;
int i=0;
char *class_string;
int dont_remove;
icalset* f = icalset_new_file("../../test-data/process-incoming.ics");
icalset* trash = icalset_new_file("trash.ics");
icalset* cal = icalset_new_file("../../test-data/process-calendar.ics");
icalset* out = icalset_new_file("outgoing.ics");
const char* this_user = "alice@cal.softwarestudio.org";
assert(f!= 0);
assert(cal!=0);
assert(trash!=0);
assert(out!=0);
/* Foreach incoming message */
for(c=icalset_get_first_component(f);c!=0;c = next_c){
ical_class class;
icalcomponent *match;
icalcomponent *inner;
icalcomponent *p;
icalcomponent *reply = 0;
assert(c!=0);
inner = icalcomponent_get_first_real_component(c);
i++;
reply = 0;
dont_remove = 0;
if(inner == 0){
printf("Bad component, no inner\n %s\n",
icalcomponent_as_ical_string(c));
continue;
}
/* Find a booked component that is matched to the incoming
message, based on the incoming component's UID, SEQUENCE
and RECURRENCE-ID*/
match = icalset_fetch_match(cal,c);
class = icalclassify(c,match,this_user);
class_string = find_class_string(class);
/* Print out the notes associated with the incoming component
and the matched component in the */
{
const char *c_note=0;
const char *m_note=0;
icalproperty *p;
for(p = icalcomponent_get_first_property(c,ICAL_X_PROPERTY);
p!= 0;
p = icalcomponent_get_next_property(c,ICAL_X_PROPERTY)){
if(strcmp(icalproperty_get_x_name(p),"X-LIC-NOTE")==0){
c_note = icalproperty_get_x(p);
}
}
if (match != 0){
for(p = icalcomponent_get_first_property(match,
ICAL_X_PROPERTY);
p!= 0;
p = icalcomponent_get_next_property(match,
ICAL_X_PROPERTY)){
if(strcmp(icalproperty_get_x_name(p),"X-LIC-NOTE")==0){
m_note = icalproperty_get_x(p);
}
}
}
if(c_note != 0){
printf("Incoming: %s\n",c_note);
}
if(m_note != 0){
printf("Match : %s\n",m_note);
}
}
/* Main processing structure */
switch (class){
case ICAL_NO_CLASS: {
char temp[1024];
/* Huh? Return an error to sender */
icalrestriction_check(c);
icalcomponent_convert_errors(c);
snprintf(temp,1024,"I can't understand the component you sent. \n Here is the component you sent, possibly with error messages:\n %s",icalcomponent_as_ical_string(c));
reply = icalmessage_new_error_reply(
c,
this_user,
temp,
"",
ICAL_UNKNOWN_STATUS
);
break;
}
case ICAL_PUBLISH_NEW_CLASS: {
/* Don't accept published events from anyone but
self. If self, fall through to ICAL_REQUEST_NEW_CLASS */
}
case ICAL_REQUEST_NEW_CLASS: {
/* Book the new component if it does not overlap
anything. If the time is busy and the start time is
an even modulo 4, delegate to
bob@cal.softwarestudio.org. If the time is busy and
is 1 modulo 4, counterpropose for the first
available free time. Otherwise, deline the meeting */
icalcomponent *overlaps;
overlaps = icalclassify_find_overlaps(cal,c);
if(overlaps == 0){
/* No overlaps, book the meeting */
/* icalset_add_component(cal,icalcomponent_new_clone(c));*/
/* Return a reply */
reply = icalmessage_new_accept_reply(c,this_user,
"I can make it to this meeting");
icalset_add_component(out,reply);
} else {
/* There was a conflict, so delegate, counterpropose
or decline it */
struct icaltimetype dtstart
= icalcomponent_get_dtstart(c);
if(dtstart.hour%4 == 0){
/* Delegate the meeting */
reply = icalmessage_new_delegate_reply(c,
this_user,
"bob@cal.softwarestudio.org",
"Unfortunately, I have another commitment that \
conflicts with this meeting. I am delegating my attendance to Bob. ");
icalset_add_component(out,reply);
} else if (dtstart.hour%4 == 1) {
/* Counter propose to next available time */
icalcomponent *newc;
struct icalperiodtype next_time;
icalspanlist *spanl =
icalspanlist_new(cal,dtstart,
icaltime_null_time());
next_time = icalspanlist_next_free_time(
spanl,icalcomponent_get_dtstart(c));
newc = icalcomponent_new_clone(c);
icalcomponent_set_dtstart(newc,next_time.start);
/* Hack, the duration of the counterproposed
meeting may be longer than the free time
available */
icalcomponent_set_duration(newc,
icalcomponent_get_duration(c));
reply = icalmessage_new_counterpropose_reply(c,
newc,
this_user,
"Unfortunately, I have another commitment that \
conflicts with this meeting. I am proposing a time that works better for me.");
icalset_add_component(out,reply);
} else {
/* Decline the meeting */
reply = icalmessage_new_decline_reply(c,
this_user,
"I can't make it to this meeting");
icalset_add_component(out,reply);
}
}
break;
}
case ICAL_PUBLISH_FREEBUSY_CLASS: {
/* Store the busy time information in a file named after
the sender */
break;
}
case ICAL_PUBLISH_UPDATE_CLASS: {
/* Only accept publish updates from self. If self, fall
throught to ICAL_REQUEST_UPDATE_CLASS */
}
case ICAL_REQUEST_UPDATE_CLASS: {
/* always accept the changes */
break;
}
case ICAL_REQUEST_RESCHEDULE_CLASS: {
/* Use same rules as REQUEST_NEW */
icalcomponent *overlaps;
overlaps = icalclassify_find_overlaps(cal,c);
break;
}
case ICAL_REQUEST_DELEGATE_CLASS: {
break;
}
case ICAL_REQUEST_NEW_ORGANIZER_CLASS: {
break;
}
case ICAL_REQUEST_FORWARD_CLASS: {
break;
}
case ICAL_REQUEST_STATUS_CLASS: {
break;
}
case ICAL_REQUEST_FREEBUSY_CLASS: {
break;
}
case ICAL_REPLY_ACCEPT_CLASS: {
/* Change the PARTSTAT of the sender */
break;
}
case ICAL_REPLY_DECLINE_CLASS: {
/* Change the PARTSTAT of the sender */
break;
}
case ICAL_REPLY_CRASHER_ACCEPT_CLASS: {
/* Add the crasher to the ATTENDEE list with the
appropriate PARTSTAT */
break;
}
case ICAL_REPLY_CRASHER_DECLINE_CLASS: {
/* Add the crasher to the ATTENDEE list with the
appropriate PARTSTAT */
break;
}
case ICAL_ADD_INSTANCE_CLASS: {
break;
}
case ICAL_CANCEL_EVENT_CLASS: {
/* Remove the component */
break;
}
case ICAL_CANCEL_INSTANCE_CLASS: {
break;
}
case ICAL_CANCEL_ALL_CLASS: {
/* Remove the component */
break;
}
case ICAL_REFRESH_CLASS: {
/* Resend the latest copy of the request */
break;
}
case ICAL_COUNTER_CLASS: {
break;
}
case ICAL_DECLINECOUNTER_CLASS: {
break;
}
case ICAL_MALFORMED_CLASS: {
/* Send back an error */
break;
}
case ICAL_OBSOLETE_CLASS: {
printf(" ** Got an obsolete component:\n%s",
icalcomponent_as_ical_string(c));
/* Send back an error */
break;
}
case ICAL_MISSEQUENCED_CLASS: {
printf(" ** Got a missequenced component:\n%s",
icalcomponent_as_ical_string(c));
/* Send back an error */
break;
}
case ICAL_UNKNOWN_CLASS: {
printf(" ** Don't know what to do with this component:\n%s",
icalcomponent_as_ical_string(c));
/* Send back an error */
break;
}
}
#if(0)
if (reply != 0){
/* Don't send the reply if the RSVP parameter indicates not to*/
icalcomponent *reply_inner;
icalproperty *attendee;
icalparameter *rsvp;
reply_inner = icalcomponent_get_first_real_component(reply);
attendee = icalcomponent_get_first_property(reply_inner,
ICAL_ATTENDEE_PROPERTY);
rsvp = icalproperty_get_first_parameter(attendee,
ICAL_RSVP_PARAMETER);
if(rsvp == 0 || icalparameter_get_rsvp(rsvp) == 1){
icalrestriction_check(reply);
send_message(reply,this_user);
}
icalcomponent_free(reply);
}
#endif
if(reply !=0){
printf("%s\n",icalcomponent_as_ical_string(reply));
}
next_c = icalset_get_next_component(f);
if(dont_remove == 0){
/*icalset_remove_component(f,c);
icalset_add_component(trash,c);*/
}
}
#if (0)
for(c = icalset_get_first_component(out);
c!=0;
c = icalset_get_next_component(out)){
printf("%s",icalcomponent_as_ical_string(c));
}
#endif
icalset_free(f);
icalset_free(trash);
icalset_free(cal);
icalset_free(out);
return 0;
}

View File

@ -0,0 +1,157 @@
/* -*- Mode: C -*-
======================================================================
FILE: testclassify.c
CREATOR: eric 11 February 2000
$Id$
$Locker$
(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.
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
======================================================================*/
#include <stdio.h> /* for printf */
#include "ical.h"
#include <errno.h>
#include <string.h> /* For strerror */
#include "icalset.h"
#include "icalclassify.h"
#include "icalssutil.h"
struct class_map {
ical_class class;
char *str;
} class_map[] = {
{ICAL_NO_CLASS,"No class"},
{ICAL_PUBLISH_NEW_CLASS,"New Publish"},
{ICAL_PUBLISH_UPDATE_CLASS,"Update Publish"},
{ICAL_REQUEST_NEW_CLASS,"New request"},
{ICAL_REQUEST_UPDATE_CLASS,"Update"},
{ICAL_REQUEST_RESCHEDULE_CLASS,"Reschedule"},
{ICAL_REQUEST_DELEGATE_CLASS,"Delegate"},
{ICAL_REQUEST_NEW_ORGANIZER_CLASS,"New Organizer"},
{ICAL_REQUEST_FORWARD_CLASS,"Forward"},
{ICAL_REQUEST_STATUS_CLASS,"Status request"},
{ICAL_REPLY_ACCEPT_CLASS,"Accept reply"},
{ICAL_REPLY_DECLINE_CLASS,"Decline reply"},
{ICAL_REPLY_CRASHER_ACCEPT_CLASS,"Crasher's accept reply"},
{ICAL_REPLY_CRASHER_DECLINE_CLASS,"Crasher's decline reply"},
{ICAL_ADD_INSTANCE_CLASS,"Add instance"},
{ICAL_CANCEL_EVENT_CLASS,"Cancel event"},
{ICAL_CANCEL_INSTANCE_CLASS,"Cancel instance"},
{ICAL_CANCEL_ALL_CLASS,"Cancel all instances"},
{ICAL_REFRESH_CLASS,"Refresh"},
{ICAL_COUNTER_CLASS,"Counter"},
{ICAL_DECLINECOUNTER_CLASS,"Decline counter"},
{ICAL_MALFORMED_CLASS,"Malformed"},
{ICAL_OBSOLETE_CLASS,"Obsolete"},
{ICAL_MISSEQUENCED_CLASS,"Missequenced"},
{ICAL_UNKNOWN_CLASS,"Unknown"}
};
char* find_class_string(ical_class class)
{
int i;
for (i = 0;class_map[i].class != ICAL_UNKNOWN_CLASS;i++){
if (class_map[i].class == class){
return class_map[i].str;
}
}
return "Unknown";
}
int main(int argc, char* argv[])
{
icalcomponent *c;
int i=0;
icalset* f = icalset_new_file("../../test-data/incoming.ics");
icalset* cal = icalset_new_file("../../test-data/calendar.ics");
assert(f!= 0);
assert(cal!=0);
/* Foreach incoming message */
for(c=icalset_get_first_component(f);c!=0;
c=icalset_get_next_component(f)){
ical_class class;
icalcomponent *match;
icalcomponent *inner = icalcomponent_get_first_real_component(c);
icalcomponent *p;
const char *this_uid;
const char *i_x_note=0;
const char *c_x_note=0;
i++;
if(inner == 0){
continue;
}
p = icalcomponent_get_first_property(inner,ICAL_UID_PROPERTY);
this_uid = icalproperty_get_uid(p);
assert(this_uid != 0);
/* Find a booked component that is matched to the incoming
message, based on the incoming component's UID, SEQUENCE
and RECURRENCE-ID*/
match = icalset_fetch(cal,this_uid);
class = icalclassify(c,match,"A@example.com");
for(p = icalcomponent_get_first_property(c,ICAL_X_PROPERTY);
p!= 0;
p = icalcomponent_get_next_property(c,ICAL_X_PROPERTY)){
if(strcmp(icalproperty_get_x_name(p),"X-LIC-NOTE")==0){
i_x_note = icalproperty_get_x(p);
}
}
if(i_x_note == 0){
i_x_note = "None";
}
for(p = icalcomponent_get_first_property(match,ICAL_X_PROPERTY);
p!= 0;
p = icalcomponent_get_next_property(match,ICAL_X_PROPERTY)){
if(strcmp(icalproperty_get_x_name(p),"X-LIC-NOTE")==0){
c_x_note = icalproperty_get_x(p);
}
}
if(c_x_note == 0){
c_x_note = "None";
}
printf("Test %d\nIncoming: %s\nMatched: %s\nClassification: %s\n\n",i,i_x_note,c_x_note,find_class_string(class));
}
return 0;
}

View File

@ -0,0 +1,47 @@
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:CREATE
X-LIC-NOTE: #C1. Rescheduled by #I1\ and updated by #I2
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:B@example.com
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:A@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B:Mailto:B@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:C@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com
ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
DTSTAMP:19970611T190000Z
DTSTART:19970701T190000Z
DTEND:19970701T1930000Z
SUMMARY:Conference
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
X-LIC-NOTE: #C2. The test user is the organizer.
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:A@example.com
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:C@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE;
CUTYPE=ROOM:Mailto:Conf@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
DTSTART:19970701T180000Z
DTEND:19970701T190000Z
SUMMARY:Phone Conference
UID:calsrv.example.com-873970198738785@example.com
SEQUENCE:0
DTSTAMP:19970613T190000Z
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR

View File

@ -0,0 +1,43 @@
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:A@example.com
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:A@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B:Mailto:B@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:C@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com
ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
DTSTAMP:19970611T190000Z
DTSTART:19960701T200000Z
DTEND:19970701T2000000Z
SUMMARY:Conference
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:A@example.com
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:A@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B:Mailto:B@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:C@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com
ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
DTSTAMP:19950611T190000Z
DTSTART:19970701T200000Z
DTEND:19970701T2000000Z
SUMMARY:Conference in the park
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:0
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR

View File

@ -0,0 +1,168 @@
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
X-LIC-NOTE: #I1. Reschedules C1
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:B@example.com
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:A@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B:Mailto:B@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:C@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com
ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
DTSTAMP:19970611T190000Z
DTSTART:19970701T200000Z
DTEND:19970701T2000000Z
SUMMARY:Conference
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:2
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
X-LIC-NOTE: #I2. Updates C1
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:B@example.com
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:A@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B:Mailto:B@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:C@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com
ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
DTSTAMP:19970611T193000Z
DTSTART:19970701T190000Z
DTEND:19970701T1930000Z
SUMMARY: Pool party
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:2
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
X-LIC-NOTE: #I2: This is an obsolete request\, otherwise identical to #I1
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:B@example.com
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:C@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE;
CUTYPE=ROOM:Mailto:Conf@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
DTSTART:19960701T180000Z
DTEND:19970701T190000Z
SUMMARY:Phone Conference
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:0
DTSTAMP:19960613T190000Z
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REPLY
X-LIC-NOTE: #I3: User B is accepting A's request\, #C2
VERSION:2.0
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED:Mailto:B@example.com
ORGANIZER:MAILTO:A@example.com
UID:calsrv.example.com-873970198738785@example.com
SEQUENCE:1
REQUEST-STATUS:2.0;Success
DTSTAMP:19970612T190000Z
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REPLY
X-LIC-NOTE: #I4: User C is rejecting A's request\, #C2
VERSION:2.0
BEGIN:VEVENT
ATTENDEE;PARTSTAT=DECLINED:Mailto:C@example.com
ORGANIZER:MAILTO:A@example.com
UID:calsrv.example.com-873970198738785@example.com
SEQUENCE:1
REQUEST-STATUS:2.0;Success
DTSTAMP:19970612T190000Z
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REPLY
X-LIC-NOTE: #I5: Crasher X is accepting A's request\, #C2
VERSION:2.0
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED:Mailto:X@example.com
ORGANIZER:MAILTO:A@example.com
UID:calsrv.example.com-873970198738785@example.com
SEQUENCE:1
REQUEST-STATUS:2.0;Success
DTSTAMP:19970612T190000Z
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REPLY
X-LIC-NOTE: #I6: Crasher Y is declining A's request\, #C2
VERSION:2.0
BEGIN:VEVENT
ATTENDEE;PARTSTAT=DECLINED:Mailto:Y@example.com
ORGANIZER:MAILTO:A@example.com
UID:calsrv.example.com-873970198738785@example.com
SEQUENCE:1
REQUEST-STATUS:2.0;Success
DTSTAMP:19970612T190000Z
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:CANCEL
X-LIC-NOTE: #I7: Cancel #c1
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:B@example.com
ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:A@example.com
ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:B@example.com
ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:C@example.com
ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:D@example.com
COMMENT:Mr. B cannot attend. It's raining. Lets cancel.
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:1
UID:calsrv.example.com-873970198738777@example.com
STATUS:CANCELLED
DTSTAMP:19970613T190000Z
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:COUNTER
X-LIC-NOTE: #I8. Counter to #C1. Changed DTEND to DURATION.
VERSION:2.0
BEGIN:VEVENT
DTSTAMP:19970611T190000Z
DTSTART:19970701T190000Z
DURATION:PT2H
ORGANIZER:Mailto:B@example.com
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:C@example.com
SUMMARY:Conference
COMMENT: I think the conference should be 2 hours long
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:1
END:VEVENT
END:VCALENDAR

View File

@ -0,0 +1,32 @@
BEGIN:VEVENT
DTSTART
:20001104T150000
DTEND
:20001104T160000
END:VEVENT
BEGIN:VEVENT
DTSTART
:20001104T153000
DTEND
:20001104T163000
END:VEVENT
BEGIN:VEVENT
DTSTART
:20001104T160000
DTEND
:20001104T170000
END:VEVENT
BEGIN:VEVENT
DTSTART
:20001104T163000
DTEND
:20001104T173000
END:VEVENT
BEGIN:VEVENT
DTSTART
:20001104T170000
DTEND
:20001104T180000
END:VEVENT

View File

@ -0,0 +1,107 @@
BEGIN:VCALENDAR
X-LIC-NOTE: Overlap with Slot 1\, 1200 to 1300\, should be delegated
METHOD
:REQUEST
VERSION
:2.0
BEGIN:VEVENT
ORGANIZER
:Mailto:bob@cal.softwarestudio.org
ATTENDEE
;ROLE=CHAIR
;CUTYPE=INDIVIDUAL
;CN=Alice
:Mailto:alice@cal.softwarestudio.org
ATTENDEE
;RSVP=TRUE
;CUTYPE=INDIVIDUAL
;CN=B
:Mailto:B@example.com
DTSTAMP
:19970611T030000Z
DTSTART
:19970701T120000Z
DTEND
:19970701T1300Z
SUMMARY
: Overlap 1
UID
:calsrv.example.com-873970198738703@example.com
SEQUENCE
:0
STATUS
:CONFIRMED
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
X-LIC-NOTE: Overlap with Slot 2\, 1300 to 1400\, should be counterproposed
METHOD
:REQUEST
VERSION
:2.0
BEGIN:VEVENT
ORGANIZER
:Mailto:bob@cal.softwarestudio.org
ATTENDEE
;ROLE=CHAIR
;CUTYPE=INDIVIDUAL
;CN=Alice
:Mailto:alice@cal.softwarestudio.org
ATTENDEE
;RSVP=TRUE
;CUTYPE=INDIVIDUAL
;CN=B
:Mailto:B@example.com
DTSTAMP
:19970611T040000Z
DTSTART
:19970701T13000Z
DTEND
:19970701T140000Z
SUMMARY
:Overlap 2
UID
:calsrv.example.com-873970198738704@example.com
SEQUENCE
:0
STATUS
:CONFIRMED
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
X-LIC-NOTE: Overlap with Slot 3\, 1400 to 1500\, should be declined
METHOD
:REQUEST
VERSION
:2.0
BEGIN:VEVENT
ORGANIZER
:Mailto:bob@cal.softwarestudio.org
ATTENDEE
;ROLE=CHAIR
;CUTYPE=INDIVIDUAL
;CN=Alice
:Mailto:alice@cal.softwarestudio.org
ATTENDEE
;RSVP=TRUE
;CUTYPE=INDIVIDUAL
;CN=B
:Mailto:B@example.com
DTSTAMP
:19970611T050000Z
DTSTART
:19970701T140000Z
DTEND
:19970701T150000Z
SUMMARY
:Overlap 3
UID
:calsrv.example.com-873970198738705@example.com
SEQUENCE
:0
STATUS
:CONFIRMED
END:VEVENT
END:VCALENDAR

View File

@ -0,0 +1,49 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
METHOD: REQUEST
BEGIN:VEVENT
UID:19970901T130000Z-123401@host.com
DTSTAMP:19970901T1300Z
DTSTART:19970903T163000Z
DTEND:19970903T190000Z
DURATION:PT15M
SUMMARY:Annual Employee Review
CLASS:PRIVATE
CATEGORIES:BUSINESS,HUMAN RESOURCES
STATUS:TENTATIVE
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
METHOD: PUBLISHca
BEGIN:VEVENT
RECURRENCE-ID:19970701T210000Z
RECURRENCE-ID:19970701T210000Z
SEQUENCE:0
SEQUENCE:1
CATEGORIES: A
CATEGORIES: B
CLASS: A
CLASS: B
ATTENDEE: BOB
REQUEST-STATUS: 3.0
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REPLY
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:MAILTO:A@Example.com
ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-
TO="Mailto:E@example.com":Mailto:C@example.com
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:0
DTSTAMP:19970611T190000Z
END:VEVENT
END:VCALENDAR