aboutsummaryrefslogtreecommitdiffstats
path: root/libical
diff options
context:
space:
mode:
Diffstat (limited to 'libical')
-rw-r--r--libical/ChangeLog12
-rw-r--r--libical/src/libical/icalenums.c11
-rw-r--r--libical/src/libical/icalparameter.c.in41
-rw-r--r--libical/src/libical/icalparser.c11
-rw-r--r--libical/src/libical/icalproperty.c.in16
-rw-r--r--libical/src/libical/icaltypes.c2
6 files changed, 66 insertions, 27 deletions
diff --git a/libical/ChangeLog b/libical/ChangeLog
index e6797bc6fe..02731b88cd 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,3 +1,15 @@
+2000-12-12 Eric Busboom <eric@softwarestudio.org>
+
+ * icalparser.c Addedd support for x-parameters.
+
+ * icalenum.c Fixed icalenum_parameter_type_to_string and
+ icalenum_property_type_to_string to property identify X- parameers
+ and properties.
+
+ * icalparameter.c Fixed icalparameter_as_ical_string to property
+ write out X-Parameters.
+
+
2000-12-13 Christopher James Lahey <clahey@helixcode.com>
* src/libical/icalerror.h: Added a name to the parameter to
diff --git a/libical/src/libical/icalenums.c b/libical/src/libical/icalenums.c
index 2e04214739..cd5ec43203 100644
--- a/libical/src/libical/icalenums.c
+++ b/libical/src/libical/icalenums.c
@@ -134,12 +134,18 @@ icalproperty_kind icalenum_string_to_property_kind(char* string)
return ICAL_NO_PROPERTY;
}
+
for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
if (strcmp(property_map[i].name, string) == 0) {
return property_map[i].kind;
}
}
+ if(strncmp(string,"X-",2)==0){
+ return ICAL_X_PROPERTY;
+ }
+
+
return ICAL_NO_PROPERTY;
}
@@ -173,6 +179,7 @@ static struct icalparameter_kind_map parameter_map[] =
{ ICAL_SENTBY_PARAMETER, "SENT-BY"},
{ ICAL_TZID_PARAMETER, "TZID"},
{ ICAL_VALUE_PARAMETER, "VALUE"},
+ { ICAL_X_PARAMETER, "X"},
/* CAP parameters */
@@ -212,6 +219,10 @@ icalparameter_kind icalenum_string_to_parameter_kind(char* string)
}
}
+ if(strncmp(string,"X-",2)==0){
+ return ICAL_X_PARAMETER;
+ }
+
return ICAL_NO_PARAMETER;
}
diff --git a/libical/src/libical/icalparameter.c.in b/libical/src/libical/icalparameter.c.in
index 0a0efc1332..ad83927e87 100644
--- a/libical/src/libical/icalparameter.c.in
+++ b/libical/src/libical/icalparameter.c.in
@@ -3,7 +3,7 @@
FILE: icalderivedparameters.{c,h}
CREATOR: eric 09 May 1999
- $Id: icalparameter.c.in,v 1.1 2000/12/11 22:05:59 federico Exp $
+ $Id: icalparameter.c.in,v 1.2 2000/12/14 02:13:54 federico Exp $
$Locker: $
@@ -26,7 +26,7 @@
Graham Davison (g.m.davison@computer.org)
======================================================================*/
-#line 29 "icalparameter.c.in"
+/*#line 29 "icalparameter.c.in"*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -727,18 +727,29 @@ icalparameter_as_ical_string (icalparameter* parameter)
buf_ptr = buf;
impl = (struct icalparameter_impl*)parameter;
- kind_string = icalenum_parameter_kind_to_string(impl->kind);
+ if(impl->kind == ICAL_X_PARAMETER) {
+
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size,
+ icalparameter_get_xname(impl));
+
+ } else {
+
+ kind_string = icalenum_parameter_kind_to_string(impl->kind);
+
+ if (impl->kind == ICAL_NO_PARAMETER ||
+ impl->kind == ICAL_ANY_PARAMETER ||
+ kind_string == 0)
+ {
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ return 0;
+ }
+
+
+ /* Put the parameter name into the string */
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
- if (impl->kind == ICAL_NO_PARAMETER ||
- impl->kind == ICAL_ANY_PARAMETER ||
- kind_string == 0)
- {
- icalerror_set_errno(ICAL_BADARG_ERROR);
- return 0;
}
-
- /* Put the parameter name into the string */
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
+
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "=");
switch (impl->kind) {
@@ -1068,12 +1079,12 @@ icalparameter_as_ical_string (icalparameter* parameter)
{
strcpy(tend,"REGEX");break;
}
+ default:{
+ icalerror_set_errno(ICAL_BADARG_ERROR);break;
+ }
break;
}
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
break;
}
diff --git a/libical/src/libical/icalparser.c b/libical/src/libical/icalparser.c
index e7960eacae..6359d42d27 100644
--- a/libical/src/libical/icalparser.c
+++ b/libical/src/libical/icalparser.c
@@ -737,7 +737,16 @@ icalcomponent* icalparser_add_line(icalparser* parser,
kind = icalenum_string_to_parameter_kind(name);
- if (kind != ICAL_NO_PARAMETER){
+ if(kind == ICAL_X_PARAMETER){
+ param = icalparameter_new(ICAL_X_PARAMETER);
+
+ if(param != 0){
+ icalparameter_set_xname(param,name);
+ icalparameter_set_xvalue(param,pvalue);
+ }
+
+
+ } else if (kind != ICAL_NO_PARAMETER){
param = icalparameter_new_from_string(kind,pvalue);
} else {
/* Error. Failed to parse the parameter*/
diff --git a/libical/src/libical/icalproperty.c.in b/libical/src/libical/icalproperty.c.in
index 12a9ec4afa..3b5cff835b 100644
--- a/libical/src/libical/icalproperty.c.in
+++ b/libical/src/libical/icalproperty.c.in
@@ -4,7 +4,7 @@
FILE: icalproperty.c
CREATOR: eric 28 April 1999
- $Id: icalproperty.c.in,v 1.1 2000/12/11 22:05:59 federico Exp $
+ $Id: icalproperty.c.in,v 1.2 2000/12/14 02:13:54 federico Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
@@ -23,7 +23,7 @@
The original code is icalproperty.c
======================================================================*/
-#line 27 "icalproperty.c.in"
+/*#line 27 "icalproperty.c.in"*/
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -180,17 +180,13 @@ icalproperty* icalproperty_new_from_string(char* str)
kind = icalenum_string_to_property_kind(str);
- if (kind == ICAL_NO_PROPERTY){
-
- if( str[0] == 'X' && str[1] == '-'){
+ if(kind == ICAL_X_PROPERTY){
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 if (kind == ICAL_NO_PROPERTY){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
} else {
return icalproperty_new(kind);
}
diff --git a/libical/src/libical/icaltypes.c b/libical/src/libical/icaltypes.c
index 16d0ebf1b8..e726904fcf 100644
--- a/libical/src/libical/icaltypes.c
+++ b/libical/src/libical/icaltypes.c
@@ -182,7 +182,7 @@ struct icalreqstattype icalreqstattype_from_string(char* str)
p1 = strchr(str,';');
if (p1 == 0){
- icalerror_set_errno(ICAL_BADARG_ERROR);
+/* icalerror_set_errno(ICAL_BADARG_ERROR);*/
return stat;
}