*
* vCard implementation for Citadel
*
- * Copyright (C) 1999-2007 by the citadel.org development team.
+ * Copyright (C) 1999-2008 by the citadel.org development team.
* This code is freely redistributable under the terms of the GNU General
* Public License. All other rights reserved.
*/
#include <libcitadel.h>
-/**
+/*
* Constructor (empty vCard)
* Returns an empty vcard
*/
return v;
}
-/**
+/*
* Remove the "charset=" attribute from a vCard property name
*
*/
-/**
+/*
* Constructor - returns a new struct vcard given a serialized vcard
*/
struct vCard *vcard_load(char *vtext) {
mycopy = strdup(vtext);
if (mycopy == NULL) return NULL;
- /**
+ /*
* 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.
}
-/**
+/*
* 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").
if (v->magic != CTDL_VCARD_MAGIC) return; /* Self-check */
- /** If this key is already present, replace it */
+ /* If this key is already present, replace it */
if (!append) if (v->numprops) for (i=0; i<(v->numprops); ++i) {
if (!strcasecmp(v->prop[i].name, name)) {
free(v->prop[i].name);
size_t len;
int is_utf8 = 0;
+ if (v == NULL) return NULL; /* self check */
if (v->magic != CTDL_VCARD_MAGIC) return NULL; /* self check */
- /** Figure out how big a buffer we need to allocate */
+ /* Set the vCard version number to 3.0 at this time. */
+ vcard_set_prop(v, "VERSION", "3.0", 0);
+
+ /* Figure out how big a buffer we need to allocate */
len = 64; /* for begin, end, and a little padding for safety */
if (v->numprops) for (i=0; i<(v->numprops); ++i) {
len = len +