[evolution/webkit] Bug #635828 - Do not send meeting mails with no recipient



commit 476014be51ffd0c80ec1f2a9e9e4591901778288
Author: Milan Crha <mcrha redhat com>
Date:   Fri Nov 26 12:23:01 2010 +0100

    Bug #635828 - Do not send meeting mails with no recipient

 calendar/gui/dialogs/send-comp.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c
index 4a9f80e..a965c3d 100644
--- a/calendar/gui/dialogs/send-comp.c
+++ b/calendar/gui/dialogs/send-comp.c
@@ -43,6 +43,37 @@ component_has_new_attendees (ECalComponent *comp)
 	return g_object_get_data (G_OBJECT (comp), "new-attendees") != NULL;
 }
 
+
+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_attendee_list (comp, &attendees);
+
+	if (!attendees)
+		return FALSE;
+
+	if (g_slist_length (attendees) > 1 || !e_cal_component_has_organizer (comp)) {
+		e_cal_component_free_attendee_list (attendees);
+		return TRUE;
+	}
+
+	attendee = attendees->data;
+
+	e_cal_component_get_organizer (comp, &organizer);
+	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)
 {
@@ -114,7 +145,7 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo
 	if (strip_alarms)
 		*strip_alarms = TRUE;
 
-	if (e_cal_get_save_schedules (client))
+	if (e_cal_get_save_schedules (client) || !component_has_recipients (comp))
 		return FALSE;
 
 	vtype = e_cal_component_get_vtype (comp);



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