vCard implementation for Citadel
[showing / editing VCards]


Data Structures

struct  vCard
 This data structure represents a vCard object currently in memory. More...

Defines

#define CTDL_VCARD_MAGIC   0xa1f9

Functions

vCardvcard_new (void)
 Constructor (empty vCard).
vCardvcard_load (char *)
 Constructor (supply serialized vCard).
void vcard_free (struct vCard *)
 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_get_prop (struct vCard *v, char *propname, int is_partial, int instance, int return_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.
char * vcard_serialize (struct vCard *)
 Serialize a struct vcard into its standard format.
void vcard_add_prop (struct vCard *v, char *propname, char *propvalue)

Define Documentation

#define CTDL_VCARD_MAGIC   0xa1f9

magic byte vcards start with???

Definition at line 14 of file vcard.h.

Referenced by vcard_free(), vcard_new(), vcard_serialize(), and vcard_set_prop().


Function Documentation

struct vCard* vcard_new ( void   )  [read]

Constructor (empty vCard).

Returns:
an 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().

struct vCard* vcard_load ( char *  vtext  )  [read]

Constructor (supply serialized vCard).

Parameters:
vtext the text to parse into the new vcard
Returns:
the parsed 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().

void vcard_free ( struct vCard v  ) 

Destructor kill a vCard.

Parameters:
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.

Parameters:
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_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.

Parameters:
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???
Returns:
the requested value / token / propertyname

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().

char* vcard_serialize ( struct vCard v  ) 

Serialize a struct vcard into its standard format.

Parameters:
v vCard to serialize
Returns:
the serialized vCard

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().


Generated on Wed Jun 20 23:13:14 2007 for webcit by  doxygen 1.5.2