Functions | |
vCard * | vcard_new () |
Constructor (empty vCard). | |
void | remove_charset_attribute (char *strbuf) |
Remove the "charset=" attribute from a vCard property name. | |
void | vcard_add_prop (struct vCard *v, char *propname, char *propvalue) |
vCard * | vcard_load (char *vtext) |
Constructor (supply serialized vCard). | |
char * | vcard_get_prop (struct vCard *v, char *propname, int is_partial, int instance, int get_propname) |
Fetch the value of a particular key. If is_partial is set to 1, a partial match is ok (for example, a key of "tel;home" will satisfy a search for "tel"). Set "instance" to a value higher than 0 to return subsequent instances of the same key. Set "get_propname" to nonzero to fetch the property name instead of value. | |
void | vcard_free (struct vCard *v) |
Destructor kill a vCard. | |
void | vcard_set_prop (struct vCard *v, char *name, char *value, int append) |
Set a name/value pair in the card. | |
char * | vcard_serialize (struct vCard *v) |
Serialize a struct vcard into its standard format. | |
void | vcard_fn_to_n (char *vname, char *n, size_t vname_size) |
struct vCard* vcard_new | ( | void | ) | [read] |
Constructor (empty vCard).
Definition at line 20 of file vcard.c.
References CTDL_VCARD_MAGIC, vCard::magic, vCard::numprops, and vCard::prop.
Referenced by vcard_load().
void remove_charset_attribute | ( | char * | strbuf | ) |
Remove the "charset=" attribute from a vCard property name.
strbuf | The property name string to be stripped |
Definition at line 38 of file vcard.c.
References extract_token(), num_tokens(), remove_token(), and striplt().
Referenced by vcard_load().
struct vCard* vcard_load | ( | char * | vtext | ) | [read] |
Constructor (supply serialized vCard).
vtext | the text to parse into the new vcard |
First, fix this big pile o' vCard to make it more parseable. To make it easier to parse, we convert CRLF to LF, and unfold any multi-line fields into single lines.
Definition at line 81 of file vcard.c.
References vCard::vCardProp::name, vCard::numprops, pattern2(), vCard::prop, remove_charset_attribute(), vCard::vCardProp::value, and vcard_new().
Referenced by display_vcard(), do_edit_vcard(), and submit_vcard().
char* vcard_get_prop | ( | struct vCard * | v, | |
char * | propname, | |||
int | is_partial, | |||
int | instance, | |||
int | get_propname | |||
) |
Fetch the value of a particular key. If is_partial is set to 1, a partial match is ok (for example, a key of "tel;home" will satisfy a search for "tel"). Set "instance" to a value higher than 0 to return subsequent instances of the same key. Set "get_propname" to nonzero to fetch the property name instead of value.
v | vCard to get keyvalue from | |
propname | key to retrieve | |
is_partial | dunno??? | |
instance | if >0 return a later token of the value | |
get_propname | if nonzero get the real property name??? |
Definition at line 175 of file vcard.c.
References vCard::vCardProp::name, vCard::numprops, vCard::prop, and vCard::vCardProp::value.
Referenced by display_parsed_vcard(), display_vcard(), do_edit_vcard(), and fetchname_parsed_vcard().
void vcard_free | ( | struct vCard * | v | ) |
Destructor kill a vCard.
v | the vCard to purge from memory |
Definition at line 209 of file vcard.c.
References CTDL_VCARD_MAGIC, vCard::magic, vCard::vCardProp::name, vCard::numprops, vCard::prop, and vCard::vCardProp::value.
Referenced by display_vcard(), do_edit_vcard(), and submit_vcard().
void vcard_set_prop | ( | struct vCard * | v, | |
char * | name, | |||
char * | value, | |||
int | append | |||
) |
Set a name/value pair in the card.
v | vCard to inspect | |
name | key to set | |
value | the value to assign to key | |
append | should we append the value to an existing one? |
Self-check
If this key is already present, replace it
Otherwise, append it
Definition at line 235 of file vcard.c.
References CTDL_VCARD_MAGIC, vCard::magic, vCard::vCardProp::name, vCard::numprops, vCard::prop, and vCard::vCardProp::value.
char* vcard_serialize | ( | struct vCard * | v | ) |
Serialize a struct vcard into its standard format.
v | vCard to serialize |
self check
Figure out how big a buffer we need to allocate
for begin, end, and a little padding for safety
Definition at line 267 of file vcard.c.
References CTDL_VCARD_MAGIC, vCard::magic, vCard::vCardProp::name, vCard::numprops, vCard::prop, safestrncpy(), and vCard::vCardProp::value.
Referenced by submit_vcard().