aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/calobj.c
diff options
context:
space:
mode:
authorRussell Steinthal <rms39@columbia.edu>2000-02-16 22:27:38 +0800
committerSeth Alves <alves@src.gnome.org>2000-02-16 22:27:38 +0800
commit08f2b4e43ff25f5be620bfb3a3e3786b57849ad5 (patch)
treec0bf25e53209065c401325d27580982ac30c6e87 /calendar/calobj.c
parentf926f10e86aee8df632613d9c5b5022e6b8597ca (diff)
downloadgsoc2013-evolution-08f2b4e43ff25f5be620bfb3a3e3786b57849ad5.tar
gsoc2013-evolution-08f2b4e43ff25f5be620bfb3a3e3786b57849ad5.tar.gz
gsoc2013-evolution-08f2b4e43ff25f5be620bfb3a3e3786b57849ad5.tar.bz2
gsoc2013-evolution-08f2b4e43ff25f5be620bfb3a3e3786b57849ad5.tar.lz
gsoc2013-evolution-08f2b4e43ff25f5be620bfb3a3e3786b57849ad5.tar.xz
gsoc2013-evolution-08f2b4e43ff25f5be620bfb3a3e3786b57849ad5.tar.zst
gsoc2013-evolution-08f2b4e43ff25f5be620bfb3a3e3786b57849ad5.zip
Change iCalObject.organizer from char* to iCalPerson*
2000-02-16 Russell Steinthal <rms39@columbia.edu> * calobj.[ch], eventedit.c, main.c: Change iCalObject.organizer from char* to iCalPerson* * calobj.[ch]: Change iCalObject.related from list of char* to list of iCalRelation*; assorted related fixes * icalendar.c: interface between libical and the gnomecal internal representation svn path=/trunk/; revision=1791
Diffstat (limited to 'calendar/calobj.c')
-rw-r--r--calendar/calobj.c55
1 files changed, 48 insertions, 7 deletions
diff --git a/calendar/calobj.c b/calendar/calobj.c
index 01e90e3b50..ce0d330303 100644
--- a/calendar/calobj.c
+++ b/calendar/calobj.c
@@ -82,7 +82,8 @@ ical_new (char *comment, char *organizer, char *summary)
ico = ical_object_new ();
ico->comment = g_strdup (comment);
- ico->organizer = g_strdup (organizer);
+ ico->organizer = g_new0 (iCalPerson, 1);
+ ico->organizer->addr = g_strdup (organizer);
ico->summary = g_strdup (summary);
ico->class = g_strdup ("PUBLIC");
ico->status = g_strdup ("NEEDS ACTION");
@@ -705,13 +706,23 @@ ical_object_create_from_vobject (VObject *o, const char *object_name)
/* Organizer */
if (has (o, VCOrgNameProp)){
- ical->organizer = g_strdup (str_val (vo));
+ ical->organizer = g_new0 (iCalPerson, 1);
+ ical->organizer->addr = g_strdup (str_val (vo));
free (the_str);
}
/* related */
if (has (o, VCRelatedToProp)){
- ical->related = set_list (str_val (vo));
+ char *str;
+ char *s;
+ iCalRelation *rel;
+ str = str_val (vo);
+ for (s = strtok (str, ";"); s; s = strtok (NULL, ";")) {
+ rel = g_new0 (iCalRelation, 1);
+ rel->uid = g_strdup (s);
+ rel->reltype = g_strdup ("PARENT");
+ ical->related = g_list_prepend (ical->related, rel);
+ }
free (the_str);
}
@@ -855,6 +866,36 @@ store_list (VObject *o, char *prop, GList *values)
}
static void
+store_rel_list (VObject *o, char *prop, GList *values)
+{
+ GList *l;
+ int len;
+ char *result, *p;
+
+ for (len = 0, l = values; l; l = l->next)
+ len += strlen (((iCalRelation*)(l->data))->uid) + 1;
+
+ result = g_malloc (len);
+
+ for (p = result, l = values; l; l = l->next) {
+ int len = strlen (((iCalRelation*)(l->data))->uid);
+
+ strcpy (p, ((iCalRelation*)(l->data))->uid);
+
+ if (l->next) {
+ p [len] = ';';
+ p += len+1;
+ } else
+ p += len;
+ }
+
+ *p = 0;
+
+ addPropValue (o, prop, result);
+ g_free (result);
+}
+
+static void
store_date_list (VObject *o, char *prop, GList *values)
{
GList *l;
@@ -1001,13 +1042,13 @@ ical_object_to_vobject (iCalObject *ical)
/* transparency */
addPropValue (o, VCTranspProp, to_str (ical->transp));
- /* Owenr/organizer */
- if (ical->organizer)
- addPropValue (o, VCOrgNameProp, ical->organizer);
+ /* Owner/organizer */
+ if (ical->organizer && ical->organizer->addr)
+ addPropValue (o, VCOrgNameProp, ical->organizer->addr);
/* related */
if (ical->related)
- store_list (o, VCRelatedToProp, ical->related);
+ store_rel_list (o, VCRelatedToProp, ical->related);
/* attach */
for (l = ical->attach; l; l = l->next)