[evolution-patches] 62452 Crashing in itip control if the user is not in the attendee list




-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
? 62021.patch
? 62030.diff
? 62452.patch
? editable.patch
? invitations.patch
? recur-dialog.patch
? repeat-load.patch
? gui/scroll.patch
? gui/select-auto.patch
? gui/select.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2477
diff -u -r1.2477 ChangeLog
--- ChangeLog	6 Aug 2004 10:05:23 -0000	1.2477
+++ ChangeLog	6 Aug 2004 16:03:59 -0000
@@ -1,3 +1,15 @@
+2004-08-06  JP Rosevear  <jpr ximian com>
+
+	Fixes #62452
+	
+	* gui/e-itip-control.c (find_my_address): take option to retrieve
+	current status as well, actually look for the delegator in the
+	list so we can retrieve status there as well
+	(show_current_event): use find_my_address to get the status so we
+	properly handle not finding the address in the list of attendees
+	(show_current): pass extra param
+	(ok_clicked_cb): ditto
+
 2004-08-05  Parthasarathi S A   <sparthasarathi novell com>
 
 	Fix for bug #61673.
Index: gui/e-itip-control.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-itip-control.c,v
retrieving revision 1.156
diff -u -r1.156 e-itip-control.c
--- gui/e-itip-control.c	4 Aug 2004 04:32:12 -0000	1.156
+++ gui/e-itip-control.c	6 Aug 2004 16:03:59 -0000
@@ -367,20 +367,13 @@
 }
 
 static void
-find_my_address (EItipControl *itip, icalcomponent *ical_comp)
+find_my_address (EItipControl *itip, icalcomponent *ical_comp, icalparameter_partstat *status)
 {
 	EItipControlPrivate *priv;
 	icalproperty *prop;
 	char *my_alt_address = NULL;
 	
 	priv = itip->priv;
-
-	/* If the mailer told us the address to use, use that */
-	if (priv->delegator_address != NULL) {
-		priv->my_address = g_strdup (itip_strip_mailto (priv->delegator_address));
-		priv->my_address = g_strstrip (priv->my_address);
-		return;
-	}
 	
 	for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
 	     prop != NULL;
@@ -411,34 +404,60 @@
 			name_clean = NULL;
 		}
 
-		it = e_list_get_iterator((EList *)priv->accounts);
-		while (e_iterator_is_valid(it)) {
-			const EAccount *account = e_iterator_get(it);
-
-			/* Check for a matching address */
-			if (attendee_clean != NULL
-			    && !g_ascii_strcasecmp (account->id->address, attendee_clean)) {
-				priv->my_address = g_strdup (account->id->address);
-				g_free (attendee_clean);
-				g_free (name_clean);
-				g_free (my_alt_address);
-				g_object_unref(it);
-				return;
-			}
+		if (priv->delegator_address) {
+			char *delegator_clean;
+			
+			delegator_clean = g_strdup (itip_strip_mailto (attendee));
+			delegator_clean = g_strstrip (attendee_clean);
 			
-			/* Check for a matching cname to fall back on */
-			if (name_clean != NULL 
-			    && !g_ascii_strcasecmp (account->id->name, name_clean))
-				my_alt_address = g_strdup (attendee_clean);
+			/* If the mailer told us the address to use, use that */
+			if (delegator_clean != NULL
+			    && !g_ascii_strcasecmp (attendee_clean, delegator_clean)) {
+				priv->my_address = g_strdup (itip_strip_mailto (priv->delegator_address));
+				priv->my_address = g_strstrip (priv->my_address);
 
-			e_iterator_next(it);
+				if (status) {
+					param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER);
+					*status = icalparameter_get_partstat (param);
+				}
+			}
+		} else {
+			it = e_list_get_iterator((EList *)priv->accounts);
+			while (e_iterator_is_valid(it)) {
+				const EAccount *account = e_iterator_get(it);
+				
+				/* Check for a matching address */
+				if (attendee_clean != NULL
+				    && !g_ascii_strcasecmp (account->id->address, attendee_clean)) {
+					priv->my_address = g_strdup (account->id->address);
+					if (status) {
+						param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER);
+						*status = icalparameter_get_partstat (param);
+					}
+					g_free (attendee_clean);
+					g_free (name_clean);
+					g_free (my_alt_address);
+					g_object_unref(it);
+					return;
+				}
+				
+				/* Check for a matching cname to fall back on */
+				if (name_clean != NULL 
+				    && !g_ascii_strcasecmp (account->id->name, name_clean))
+					my_alt_address = g_strdup (attendee_clean);
+				
+				e_iterator_next(it);
+			}
+			g_object_unref(it);
 		}
+		
 		g_free (attendee_clean);
 		g_free (name_clean);
-		g_object_unref(it);
 	}
 
 	priv->my_address = my_alt_address;
+	if (status)
+		*status = ICAL_PARTSTAT_NEEDSACTION;
 }
 
 static icalproperty *
@@ -1218,33 +1237,20 @@
 			itip_desc = _("<b>%s</b> requests your presence at a meeting.");
 		itip_title = _("Meeting Proposal");
 		if (priv->current_ecal) {
-			ECalComponentAttendee *attendee= NULL, *tmp;
-			GList *attendee_list, *l;
+			icalparameter_partstat status;
 			
-			e_cal_component_get_attendee_list (priv->comp, &attendee_list);
-			if (priv->my_address == NULL)
-				find_my_address (itip, priv->ical_comp);
-			g_assert (priv->my_address != NULL);
-	
-			for (l = attendee_list; l ; l = g_slist_next (l)) {
-				tmp = (ECalComponentAttendee *) (l->data);
-				if (!strcmp (tmp->value + 7, priv->my_address)) {
-					attendee = tmp;
-					break;
-				}
-			 }
-			if (attendee) {
-				switch (attendee->status) {
-					case ICAL_PARTSTAT_ACCEPTED: 
-					case ICAL_PARTSTAT_DECLINED:
-					case ICAL_PARTSTAT_TENTATIVE:
-						options = get_request_options (FALSE);
-						break;
-
-					/* otherwise it must be needs action */			
-					default:
-						options = get_request_options (TRUE);
-				}
+			find_my_address (itip, priv->ical_comp, &status);
+
+			switch (status) {
+			case ICAL_PARTSTAT_ACCEPTED: 
+			case ICAL_PARTSTAT_DECLINED:
+			case ICAL_PARTSTAT_TENTATIVE:
+				options = get_request_options (FALSE);
+				break;
+				
+				/* otherwise it must be needs action */			
+			default:
+				options = get_request_options (TRUE);
 			}
 		} else
 			options = get_request_options (TRUE);
@@ -1520,7 +1526,7 @@
 		write_error_html (itip, _("The message contains only unsupported requests."));
 	}
 
-	find_my_address (itip, priv->ical_comp);
+	find_my_address (itip, priv->ical_comp, NULL);
 
 	g_object_unref (itip);
 }
@@ -2169,7 +2175,7 @@
 		vtype = e_cal_component_get_vtype (comp);
 		
 		if (priv->my_address == NULL)
-			find_my_address (itip, priv->ical_comp);
+			find_my_address (itip, priv->ical_comp, NULL);
 		g_assert (priv->my_address != NULL);
 		
 		ical_comp = e_cal_component_get_icalcomponent (comp);


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