[evolution/gnome-3-8] Bug #704369 - Meeting change asks on save, but tries to send update anyway



commit e5950443fc12c0eefb4e745f53fbef66caea420b
Author: Milan Crha <mcrha redhat com>
Date:   Fri Aug 9 10:59:10 2013 +0200

    Bug #704369 - Meeting change asks on save, but tries to send update anyway

 calendar/gui/dialogs/send-comp.c |   59 ++------------------------------------
 calendar/gui/e-calendar-view.c   |    3 ++
 calendar/gui/itip-utils.c        |   54 ++++++++++++++++++++++++++++++++++
 calendar/gui/itip-utils.h        |    1 +
 4 files changed, 61 insertions(+), 56 deletions(-)
---
diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c
index 70dd372..9be9406 100644
--- a/calendar/gui/dialogs/send-comp.c
+++ b/calendar/gui/dialogs/send-comp.c
@@ -31,6 +31,7 @@
 #include <glib/gi18n-lib.h>
 
 #include "e-util/e-util.h"
+#include "gui/itip-utils.h"
 
 static gboolean
 component_has_new_attendees (ECalComponent *comp)
@@ -44,60 +45,6 @@ component_has_new_attendees (ECalComponent *comp)
 }
 
 static gboolean
-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;
-}
-
-static gboolean
 have_nonprocedural_alarm (ECalComponent *comp)
 {
        GList *uids, *l;
@@ -174,7 +121,7 @@ send_component_dialog (GtkWindow *parent,
        if (strip_alarms)
                *strip_alarms = TRUE;
 
-       if (e_cal_client_check_save_schedules (client) || !component_has_recipients (comp))
+       if (e_cal_client_check_save_schedules (client) || !itip_component_has_recipients (comp))
                return FALSE;
 
        vtype = e_cal_component_get_vtype (comp);
@@ -263,7 +210,7 @@ send_dragged_or_resized_component_dialog (GtkWindow *parent,
        if (strip_alarms)
                *strip_alarms = TRUE;
 
-       if (e_cal_client_check_save_schedules (client) || !component_has_recipients (comp))
+       if (e_cal_client_check_save_schedules (client) || !itip_component_has_recipients (comp))
                save_schedules = TRUE;
 
        vtype = e_cal_component_get_vtype (comp);
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 9344d9f..61a8885 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -1830,6 +1830,9 @@ e_calendar_view_send (ECalendarView *cal_view,
        ECalModel *model;
        ECalComponent *send_comp = NULL;
 
+       if (!itip_component_has_recipients (comp))
+               return;
+
        if (mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (comp)) {
                /* Ensure we send the master object, not the instance only */
                icalcomponent *icalcomp = NULL;
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 12152e3..4a3aa28 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;
+}
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index 18d2dca..5c3ed3b 100644
--- a/calendar/gui/itip-utils.h
+++ b/calendar/gui/itip-utils.h
@@ -95,6 +95,7 @@ gboolean      reply_to_calendar_comp          (ESourceRegistry *registry,
                                                 icalcomponent *zones,
                                                 GSList *attachments_list);
 gboolean       is_icalcomp_valid               (icalcomponent *icalcomp);
+gboolean       itip_component_has_recipients   (ECalComponent *comp);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]