diff options
author | Seth Alves <alves@src.gnome.org> | 2000-05-01 10:38:32 +0800 |
---|---|---|
committer | Seth Alves <alves@src.gnome.org> | 2000-05-01 10:38:32 +0800 |
commit | d256a1683d895ea02150aa4488d243a8c754adb2 (patch) | |
tree | d977fe06efcb300b42ab7c215513e6c21b4b6b1c | |
parent | c4f6855cebd5b13deca8109e79f0beb7dabdd0ce (diff) | |
download | gsoc2013-evolution-d256a1683d895ea02150aa4488d243a8c754adb2.tar gsoc2013-evolution-d256a1683d895ea02150aa4488d243a8c754adb2.tar.gz gsoc2013-evolution-d256a1683d895ea02150aa4488d243a8c754adb2.tar.bz2 gsoc2013-evolution-d256a1683d895ea02150aa4488d243a8c754adb2.tar.lz gsoc2013-evolution-d256a1683d895ea02150aa4488d243a8c754adb2.tar.xz gsoc2013-evolution-d256a1683d895ea02150aa4488d243a8c754adb2.tar.zst gsoc2013-evolution-d256a1683d895ea02150aa4488d243a8c754adb2.zip |
set attendee and contact address correctly.
* pcs/icalendar-save.c (icalcomponent_create_from_ical_object): set
attendee and contact address correctly.
* pcs/cal-backend.c (icalendar_calendar_load): init priv->object_hash
when loading.
(cal_get_type_from_filename): if file extension is .ical, consider
the file an ical file.
svn path=/trunk/; revision=2702
-rw-r--r-- | calendar/cal-util/icalendar-save.c | 6 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.c | 42 | ||||
-rw-r--r-- | calendar/pcs/icalendar-save.c | 6 |
3 files changed, 34 insertions, 20 deletions
diff --git a/calendar/cal-util/icalendar-save.c b/calendar/cal-util/icalendar-save.c index 1b35d2dadf..14cdcca65c 100644 --- a/calendar/cal-util/icalendar-save.c +++ b/calendar/cal-util/icalendar-save.c @@ -184,7 +184,7 @@ icalcomponent_create_from_ical_object (iCalObject *ical) GList *cur; for (cur = ical->attendee; cur; cur = cur->next) { iCalPerson *person = (iCalPerson *) cur->data; - prop = icalproperty_new_attendee ("FIX ME"); + prop = icalproperty_new_attendee (person->addr); unparse_person (person, prop); icalcomponent_add_property (comp, prop); } @@ -196,7 +196,7 @@ icalcomponent_create_from_ical_object (iCalObject *ical) GList *cur; for (cur = ical->contact; cur; cur = cur->next) { iCalPerson *person = (iCalPerson *) cur->data; - prop = icalproperty_new_contact ("FIX ME"); + prop = icalproperty_new_contact (person->addr); unparse_person (person, prop); icalcomponent_add_property (comp, prop); } @@ -204,7 +204,7 @@ icalcomponent_create_from_ical_object (iCalObject *ical) /*** organizer ***/ if (ical->organizer) { - prop = icalproperty_new_organizer ("FIX ME"); + prop = icalproperty_new_organizer (ical->organizer->addr); unparse_person (ical->organizer, prop); icalcomponent_add_property (comp, prop); } diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 8864206cd2..3eb2ab2f17 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -646,10 +646,20 @@ icalendar_parse_file (char* fname) static void icalendar_calendar_load (CalBackend * cal, char* fname) { + CalBackendPrivate *priv; icalcomponent *comp; icalcomponent *subcomp; iCalObject *ical; + g_assert (cal); + + priv = cal->priv; + + g_assert (!priv->loaded); + g_assert (priv->object_hash == NULL); + + priv->object_hash = g_hash_table_new (g_str_hash, g_str_equal); + comp = icalendar_parse_file (fname); subcomp = icalcomponent_get_first_component (comp, ICAL_ANY_COMPONENT); @@ -682,28 +692,32 @@ cal_get_type_from_filename (char *str_uri) { int len; - if (str_uri == NULL){ + if (str_uri == NULL) return CAL_VCAL; - } len = strlen (str_uri); - if (len < 5){ + if (len < 4) return CAL_VCAL; - } - if (str_uri[ len-4 ] == '.' && - str_uri[ len-3 ] == 'i' && - str_uri[ len-2 ] == 'c' && - str_uri[ len-1 ] == 's'){ + if (str_uri[ len-4 ] == '.' && str_uri[ len-3 ] == 'i' && + str_uri[ len-2 ] == 'c' && str_uri[ len-1 ] == 's') return CAL_ICAL; - } - if (str_uri[ len-4 ] == '.' && - str_uri[ len-3 ] == 'i' && - str_uri[ len-2 ] == 'f' && - str_uri[ len-1 ] == 'b'){ + if (str_uri[ len-4 ] == '.' && str_uri[ len-3 ] == 'i' && + str_uri[ len-2 ] == 'f' && str_uri[ len-1 ] == 'b') + return CAL_ICAL; + + if (str_uri[ len-4 ] == '.' && str_uri[ len-3 ] == 'i' && + str_uri[ len-2 ] == 'c' && str_uri[ len-1 ] == 's') + return CAL_ICAL; + + if (len < 5) + return CAL_VCAL; + + if (str_uri[ len-5 ] == '.' && str_uri[ len-4 ] == 'i' && + str_uri[ len-3 ] == 'c' && str_uri[ len-2 ] == 'a' && + str_uri[ len-1 ] == 'l') return CAL_ICAL; - } return CAL_VCAL; } diff --git a/calendar/pcs/icalendar-save.c b/calendar/pcs/icalendar-save.c index 1b35d2dadf..14cdcca65c 100644 --- a/calendar/pcs/icalendar-save.c +++ b/calendar/pcs/icalendar-save.c @@ -184,7 +184,7 @@ icalcomponent_create_from_ical_object (iCalObject *ical) GList *cur; for (cur = ical->attendee; cur; cur = cur->next) { iCalPerson *person = (iCalPerson *) cur->data; - prop = icalproperty_new_attendee ("FIX ME"); + prop = icalproperty_new_attendee (person->addr); unparse_person (person, prop); icalcomponent_add_property (comp, prop); } @@ -196,7 +196,7 @@ icalcomponent_create_from_ical_object (iCalObject *ical) GList *cur; for (cur = ical->contact; cur; cur = cur->next) { iCalPerson *person = (iCalPerson *) cur->data; - prop = icalproperty_new_contact ("FIX ME"); + prop = icalproperty_new_contact (person->addr); unparse_person (person, prop); icalcomponent_add_property (comp, prop); } @@ -204,7 +204,7 @@ icalcomponent_create_from_ical_object (iCalObject *ical) /*** organizer ***/ if (ical->organizer) { - prop = icalproperty_new_organizer ("FIX ME"); + prop = icalproperty_new_organizer (ical->organizer->addr); unparse_person (ical->organizer, prop); icalcomponent_add_property (comp, prop); } |