diff options
author | Milan Crha <mcrha@redhat.com> | 2013-08-09 16:59:10 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2013-08-09 16:59:10 +0800 |
commit | e5950443fc12c0eefb4e745f53fbef66caea420b (patch) | |
tree | cc355e2fdffd5dbdcb293d6a4cce1cc7378b7f03 /calendar/gui/itip-utils.c | |
parent | 87364872b4c73c8d28d106eb7041ef3220f9a4e7 (diff) | |
download | gsoc2013-evolution-e5950443fc12c0eefb4e745f53fbef66caea420b.tar gsoc2013-evolution-e5950443fc12c0eefb4e745f53fbef66caea420b.tar.gz gsoc2013-evolution-e5950443fc12c0eefb4e745f53fbef66caea420b.tar.bz2 gsoc2013-evolution-e5950443fc12c0eefb4e745f53fbef66caea420b.tar.lz gsoc2013-evolution-e5950443fc12c0eefb4e745f53fbef66caea420b.tar.xz gsoc2013-evolution-e5950443fc12c0eefb4e745f53fbef66caea420b.tar.zst gsoc2013-evolution-e5950443fc12c0eefb4e745f53fbef66caea420b.zip |
Bug #704369 - Meeting change asks on save, but tries to send update anyway
Diffstat (limited to 'calendar/gui/itip-utils.c')
-rw-r--r-- | calendar/gui/itip-utils.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 12152e37b0..4a3aa28fde 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -2283,3 +2283,57 @@ is_icalcomp_valid (icalcomponent *icalcomp) return TRUE; } + +gboolean +itip_component_has_recipients (ECalComponent *comp) +{ + GSList *attendees = NULL; + ECalComponentAttendee *attendee; + ECalComponentOrganizer organizer; + gboolean res = FALSE; + + g_return_val_if_fail (comp != NULL, FALSE); + + e_cal_component_get_organizer (comp, &organizer); + e_cal_component_get_attendee_list (comp, &attendees); + + if (!attendees) { + if (organizer.value && e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_JOURNAL) { + /* memos store recipients in an extra property */ + icalcomponent *icalcomp; + icalproperty *icalprop; + + icalcomp = e_cal_component_get_icalcomponent (comp); + + for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); + icalprop != NULL; + icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) { + const gchar *x_name; + + x_name = icalproperty_get_x_name (icalprop); + + if (g_str_equal (x_name, "X-EVOLUTION-RECIPIENTS")) { + const gchar *str_recipients = icalproperty_get_x (icalprop); + + res = str_recipients && g_ascii_strcasecmp (organizer.value, str_recipients) != 0; + break; + } + } + } + + return res; + } + + if (g_slist_length (attendees) > 1 || !e_cal_component_has_organizer (comp)) { + e_cal_component_free_attendee_list (attendees); + return TRUE; + } + + attendee = attendees->data; + + res = organizer.value && attendee && attendee->value && g_ascii_strcasecmp (organizer.value, attendee->value) != 0; + + e_cal_component_free_attendee_list (attendees); + + return res; +} |