bug 322827: store names of x- properties, and use that name when serializing. r=daniel.boelze, dmose

This commit is contained in:
mvl%exedo.nl 2006-09-18 20:47:39 +00:00
parent 4001b0411f
commit a4b5da6c25
3 changed files with 25 additions and 2 deletions

View File

@ -212,6 +212,19 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* old)
}
/** @brief Constructor
*/
icalcomponent*
icalcomponent_new_x (const char* x_name)
{
icalcomponent* comp = icalcomponent_new_impl(ICAL_X_COMPONENT);
if (!comp) {
return 0;
}
comp->x_name = icalmemory_strdup(x_name);
return comp;
}
/*** @brief Destructor
*/
void
@ -298,7 +311,11 @@ icalcomponent_as_ical_string (icalcomponent* impl)
icalerror_check_arg_rz( (impl!=0), "component");
icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT");
kind_string = icalcomponent_kind_to_string(kind);
if (kind != ICAL_X_COMPONENT) {
kind_string = icalcomponent_kind_to_string(kind);
} else {
kind_string = impl->x_name;
}
icalerror_check_arg_rz( (kind_string!=0),"Unknown kind of component");

View File

@ -53,6 +53,7 @@ icalcomponent* icalcomponent_new(icalcomponent_kind kind);
icalcomponent* icalcomponent_new_clone(icalcomponent* component);
icalcomponent* icalcomponent_new_from_string(char* str);
icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...);
icalcomponent* icalcomponent_new_x(const char* x_name);
void icalcomponent_free(icalcomponent* component);
char* icalcomponent_as_ical_string(icalcomponent* component);

View File

@ -664,7 +664,12 @@ icalcomponent* icalparser_add_line(icalparser* parser,
ICAL_XLICERRORTYPE_COMPONENTPARSEERROR);
}
c = icalcomponent_new(comp_kind);
if (comp_kind != ICAL_X_COMPONENT) {
c = icalcomponent_new(comp_kind);
} else {
c = icalcomponent_new_x(str);
}
if (c == 0){
c = icalcomponent_new(ICAL_XLICINVALID_COMPONENT);