aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-05-18 18:10:59 +0800
committerChris Lahey <clahey@src.gnome.org>2000-05-18 18:10:59 +0800
commita2b1d5bcc273d7de53c0367b4b1fa2586f37f109 (patch)
tree2096096b2acfa0efe24ba546238ac27d021d5068 /addressbook
parent5e14c9cb896ab5077f6aeac383330733e773a00b (diff)
downloadgsoc2013-evolution-a2b1d5bcc273d7de53c0367b4b1fa2586f37f109.tar.gz
gsoc2013-evolution-a2b1d5bcc273d7de53c0367b4b1fa2586f37f109.tar.zst
gsoc2013-evolution-a2b1d5bcc273d7de53c0367b4b1fa2586f37f109.zip
Fixed the code to write out and read in arbitrary fields.
2000-05-18 Christopher James Lahey <clahey@helixcode.com> * backend/ebook/e-card.c: Fixed the code to write out and read in arbitrary fields. svn path=/trunk/; revision=3118
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog5
-rw-r--r--addressbook/backend/ebook/e-card.c59
2 files changed, 46 insertions, 18 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 9d231f4308..79953ff9e5 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,10 @@
2000-05-18 Christopher James Lahey <clahey@helixcode.com>
+ * backend/ebook/e-card.c: Fixed the code to write out and read in
+ arbitrary fields.
+
+2000-05-18 Christopher James Lahey <clahey@helixcode.com>
+
* backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h,
backend/ebook/e-card-types.h, backend/ebook/e-card.c,
backend/ebook/e-card.h: Implemented "MAILER" field. Added
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index 342ab86071..eb453950da 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -428,14 +428,17 @@ char
for (iterator = e_card_list_get_iterator(card->arbitrary); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
const ECardArbitrary *arbitrary = e_card_iterator_get(iterator);
VObject *arb_object;
- if (arbitrary->value)
+ if (arbitrary->value) {
arb_object = addPropValue (vobj, XEV_ARBITRARY, arbitrary->value);
- else
+ } else {
arb_object = addProp (vobj, XEV_ARBITRARY);
- if (arbitrary->type)
+ }
+ if (arbitrary->type) {
addPropValue (arb_object, "TYPE", arbitrary->type);
- if (arbitrary->key)
+ }
+ if (arbitrary->key) {
addProp (arb_object, arbitrary->key);
+ }
}
}
@@ -811,6 +814,23 @@ parse_categories(ECard *card, VObject *vobj)
}
}
+typedef union ValueItem {
+ const char *strs;
+ const wchar_t *ustrs;
+ unsigned int i;
+ unsigned long l;
+ void *any;
+ VObject *vobj;
+} ValueItem;
+
+struct VObject {
+ VObject *next;
+ const char *id;
+ VObject *prop;
+ unsigned short valType;
+ ValueItem val;
+};
+
static void
parse_arbitrary(ECard *card, VObject *vobj)
{
@@ -825,7 +845,7 @@ parse_arbitrary(ECard *card, VObject *vobj)
assign_string(temp, &(arbitrary->type));
} else {
g_free(arbitrary->key);
- assign_string(temp, &(arbitrary->key));
+ arbitrary->key = g_strdup(name);
}
}
@@ -1607,9 +1627,22 @@ e_card_init (ECard *card)
static void
assign_string(VObject *vobj, char **string)
{
- char *str = (vObjectValueType (vobj) ? fakeCString (vObjectUStringZValue (vobj)) : calloc(1, 1));
- *string = g_strdup(str);
- free(str);
+ int type = vObjectValueType(vobj);
+ char *str;
+
+ switch(type) {
+ case VCVT_STRINGZ:
+ *string = g_strdup (vObjectStringZValue(vobj));
+ break;
+ case VCVT_USTRINGZ:
+ str = (vObjectValueType (vobj) ? fakeCString (vObjectUStringZValue (vobj)) : calloc(1, 1));
+ *string = g_strdup(str);
+ free(str);
+ break;
+ default:
+ *string = g_strdup("");
+ break;
+ }
}
#if 0
@@ -2783,16 +2816,6 @@ add_SoundType (VObject *o, enum SoundType sound_type)
return o;
}
-char *card_bday_str (CardBDay bday)
-{
- char *str;
-
- str = malloc (12);
- snprintf (str, 12, "%04d-%02d-%02d", bday.year, bday.month, bday.day);
-
- return str;
-}
-
char *card_timezn_str (CardTimeZone timezn)
{
char *str;