icalparameter *icalparameter_new_size(const char *sz) { icalparameter *param = icalparameter_new(ICAL_IANA_PARAMETER); icalparameter_set_iana_name(param, "SIZE"); icalparameter_set_iana_value(param, sz); return param; }
icalparameter *icalparameter_new_schedulestatus(const char *stat) { icalparameter *param = icalparameter_new(ICAL_IANA_PARAMETER); icalparameter_set_iana_name(param, "SCHEDULE-STATUS"); icalparameter_set_iana_value(param, stat); return param; }
icalparameter *icalparameter_new_managedid(const char *id) { icalparameter *param = icalparameter_new(ICAL_IANA_PARAMETER); icalparameter_set_iana_name(param, "MANAGED-ID"); icalparameter_set_iana_value(param, id); return param; }
icalparameter *icalparameter_new_filename(const char *fname) { icalparameter *param = icalparameter_new(ICAL_IANA_PARAMETER); icalparameter_set_iana_name(param, "FILENAME"); icalparameter_set_iana_value(param, fname); return param; }
NS_IMETHODIMP calIcalProperty::SetParameter(const nsACString ¶m, const nsACString &value) { icalparameter_kind paramkind = icalparameter_string_to_kind(PromiseFlatCString(param).get()); if (paramkind == ICAL_NO_PARAMETER) return NS_ERROR_INVALID_ARG; // Because libical's support for manipulating parameters is weak, and // X-PARAMETERS doubly so, we walk the list looking for an existing one of // that name, and reset its value if found. if (paramkind == ICAL_X_PARAMETER) { icalparameter *icalparam = FindParameter(mProperty, param, ICAL_X_PARAMETER); if (icalparam) { icalparameter_set_xvalue(icalparam, PromiseFlatCString(value).get()); return NS_OK; } // If not found, fall through to adding a new parameter below. } else if (paramkind == ICAL_IANA_PARAMETER) { icalparameter *icalparam = FindParameter(mProperty, param, ICAL_IANA_PARAMETER); if (icalparam) { icalparameter_set_iana_value(icalparam, PromiseFlatCString(value).get()); return NS_OK; } // If not found, fall through to adding a new parameter below. } else { // We could try getting an existing parameter here and resetting its // value, but this is easier and I don't care that much about parameter // performance at this point. RemoveParameter(param); } icalparameter *icalparam = icalparameter_new_from_value_string(paramkind, PromiseFlatCString(value).get()); if (!icalparam) return NS_ERROR_OUT_OF_MEMORY; // You might ask me "why does libical not do this for us?" and I would // just nod knowingly but sadly at you in return. // // You might also, if you were not too distracted by the first question, // ask why we have icalproperty_set_x_name but icalparameter_set_xname. // More nodding would ensue. if (paramkind == ICAL_X_PARAMETER) icalparameter_set_xname(icalparam, PromiseFlatCString(param).get()); else if (paramkind == ICAL_IANA_PARAMETER) icalparameter_set_iana_name(icalparam, PromiseFlatCString(param).get()); icalproperty_add_parameter(mProperty, icalparam); // XXX check ical errno return NS_OK; }
void icalparameter_set_size(icalparameter *param, const char *sz) { icalparameter_set_iana_value(param, sz); }
void icalparameter_set_managedid(icalparameter *param, const char *id) { icalparameter_set_iana_value(param, id); }
void icalparameter_set_filename(icalparameter *param, const char *fname) { icalparameter_set_iana_value(param, fname); }