diff options
author | Harish Krishnaswamy <kharish@src.gnome.org> | 2004-04-06 12:24:31 +0000 |
---|---|---|
committer | Harish Krishnaswamy <kharish@src.gnome.org> | 2004-04-06 12:24:31 +0000 |
commit | 7dccbfc4a5208677ec2399fdf36a4655f8814dd4 (patch) | |
tree | b1bffe88f5ba6091a26c0496b708a47256baf7e7 | |
parent | 11c255fd29be692d8cf6dbfa5cc098f5e088a3e8 (diff) | |
download | evolution-data-server-7dccbfc4a5208677ec2399fdf36a4655f8814dd4.tar.gz |
Fixes #55169 Use icalproperty to add free/busy data to ECalComponent.
Fixes #55169
* backends/groupwise/e-cal-backend-groupwise-utils.c
(e_gw_connection_get_freebusy_info) : Use icalproperty
to add free/busy data to ECalComponent.
-rw-r--r-- | calendar/ChangeLog | 8 | ||||
-rw-r--r-- | calendar/backends/groupwise/e-cal-backend-groupwise-utils.c | 90 |
2 files changed, 62 insertions, 36 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 43d5613f7..732947caf 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,11 @@ +2004-04-06 Harish K <kharish@novell.com> + + Fixes #55169 + + * backends/groupwise/e-cal-backend-groupwise-utils.c + (e_gw_connection_get_freebusy_info) : Use icalproperty + to add free/busy data to ECalComponent. + 2004-04-05 Rodrigo Moya <rodrigo@ximian.com> * backends/groupwise/e-cal-backend-groupwise.c diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c index dcd31bd79..4efcb32e7 100644 --- a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c +++ b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c @@ -521,7 +521,11 @@ e_gw_connection_get_freebusy_info (EGwConnection *cnc, GList *users, time_t star subparam = soup_soap_parameter_get_next_child_by_name (subparam, "user")) { SoupSoapParameter *param_blocks, *subparam_block, *tmp; const char *uuid = NULL, *email = NULL, *name = NULL; - + ECalComponent *comp; + ECalComponentAttendee attendee; + GSList *attendee_list = NULL; + icalcomponent *icalcomp = NULL; + tmp = soup_soap_parameter_get_first_child_by_name (subparam, "email"); if (tmp) email = soup_soap_parameter_get_string_value (tmp); @@ -532,6 +536,29 @@ e_gw_connection_get_freebusy_info (EGwConnection *cnc, GList *users, time_t star if (tmp) name = soup_soap_parameter_get_string_value (tmp); + comp = e_cal_component_new (); + e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_FREEBUSY); + e_cal_component_commit_sequence (comp); + icalcomp = e_cal_component_get_icalcomponent (comp); + + memset (&attendee, 0, sizeof (ECalComponentAttendee)); + if (name) + attendee.cn = name; + if (email) + attendee.value = email; + + attendee.cutype = ICAL_CUTYPE_INDIVIDUAL; + attendee.role = ICAL_ROLE_REQPARTICIPANT; + attendee.status = ICAL_PARTSTAT_NEEDSACTION; + + /* XXX the uuid is not currently used. hence it is + * discarded */ + + attendee_list = g_slist_append (attendee_list, &attendee); + + e_cal_component_set_attendee_list (comp, attendee_list); + + param_blocks = soup_soap_parameter_get_first_child_by_name (subparam, "blocks"); if (!param_blocks) { g_object_unref (response); @@ -545,58 +572,49 @@ e_gw_connection_get_freebusy_info (EGwConnection *cnc, GList *users, time_t star /* process each block and create ECal free/busy components.*/ SoupSoapParameter *tmp; - ECalComponent *comp; - ECalComponentAttendee attendee; - ECalComponentDateTime dt; + struct icalperiodtype ipt; + icalproperty *icalprop; icaltimetype itt; time_t t; - const char *start, *end; - GSList *attendee_list = NULL; - - comp = e_cal_component_new (); - e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_FREEBUSY); - /* FIXME verify the mappings b/w response and ECalComponent */ - memset (&attendee, 0, sizeof (ECalComponentAttendee)); - if (name) - attendee.cn = name; - if (email) - attendee.value = email; + const char *start, *end, *accept_level; - attendee.cutype = ICAL_CUTYPE_INDIVIDUAL; - attendee.role = ICAL_ROLE_REQPARTICIPANT; - attendee.status = ICAL_PARTSTAT_NEEDSACTION; - - /* XXX the uuid is not currently used. hence it is - * discarded */ - - attendee_list = g_slist_append (attendee_list, &attendee); - - e_cal_component_set_attendee_list (comp, attendee_list); - + memset (&ipt, 0, sizeof (struct icalperiodtype)); tmp = soup_soap_parameter_get_first_child_by_name (subparam_block, "startDate"); if (tmp) { start = soup_soap_parameter_get_string_value (tmp); t = e_gw_connection_get_date_from_string (start); itt = icaltime_from_timet (t, 0); - dt.value = &itt; - dt.tzid = "UTC"; - e_cal_component_set_dtstart (comp, &dt); + ipt.start = itt; } - tmp = soup_soap_parameter_get_first_child_by_name (subparam, "endDate"); + tmp = soup_soap_parameter_get_first_child_by_name (subparam_block, "endDate"); if (tmp) { end = soup_soap_parameter_get_string_value (tmp); t = e_gw_connection_get_date_from_string (end); itt = icaltime_from_timet (t, 0); - dt.value = &itt; - dt.tzid = "UTC"; - e_cal_component_set_dtend (comp, &dt); + ipt.end = itt; } + icalprop = icalproperty_new_freebusy (ipt); + + tmp = soup_soap_parameter_get_first_child_by_name (subparam_block, "acceptLevel"); + if (tmp) { + accept_level = soup_soap_parameter_get_string_value (tmp); + if (!strcmp (accept_level, "Busy")) + icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "BUSY"); + else if (!strcmp (accept_level, "Tentative")) + icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "BUSYTENTATIVE"); + else if (!strcmp (accept_level, "OutOfOffice")) + icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "BUSYUNAVAILABLE"); + else if (!strcmp (accept_level, "Free")) + icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "FREE"); + } + icalcomponent_add_property(icalcomp, icalprop); - e_cal_component_commit_sequence (comp); - *freebusy = g_list_append (*freebusy, g_strdup (e_cal_component_get_as_string (comp))); - g_object_unref (comp); } + + e_cal_component_commit_sequence (comp); + *freebusy = g_list_append (*freebusy, g_strdup (e_cal_component_get_as_string (comp))); + g_object_unref (comp); } g_object_unref (msg); |