aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2004-08-09 20:57:15 +0800
committerJP Rosevear <jpr@src.gnome.org>2004-08-09 20:57:15 +0800
commit55d077cca4326e3cb1591bb8011992cf71d43cc9 (patch)
treed02fc58dbe10f80c418ee328f22415f0ec746332
parent6c764b418cc7ebe28faa13f09231fbca5ee07cc3 (diff)
downloadgsoc2013-evolution-55d077cca4326e3cb1591bb8011992cf71d43cc9.tar
gsoc2013-evolution-55d077cca4326e3cb1591bb8011992cf71d43cc9.tar.gz
gsoc2013-evolution-55d077cca4326e3cb1591bb8011992cf71d43cc9.tar.bz2
gsoc2013-evolution-55d077cca4326e3cb1591bb8011992cf71d43cc9.tar.lz
gsoc2013-evolution-55d077cca4326e3cb1591bb8011992cf71d43cc9.tar.xz
gsoc2013-evolution-55d077cca4326e3cb1591bb8011992cf71d43cc9.tar.zst
gsoc2013-evolution-55d077cca4326e3cb1591bb8011992cf71d43cc9.zip
Fixes #62452
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 svn path=/trunk/; revision=26856
-rw-r--r--calendar/ChangeLog12
-rw-r--r--calendar/gui/e-itip-control.c120
2 files changed, 76 insertions, 56 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 06aff579ad..f3d8cc9184 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,17 @@
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-06 JP Rosevear <jpr@ximian.com>
+
Fixes #62021
* gui/dialogs/event-page.c (source_changed_cb): set the default
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 9454961661..23ca5f9301 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -371,20 +371,13 @@ e_itip_control_new (void)
}
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;
@@ -415,34 +408,62 @@ find_my_address (EItipControl *itip, icalcomponent *ical_comp)
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 (delegator_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 = param ? icalparameter_get_partstat (param) : ICAL_PARTSTAT_NEEDSACTION;
+ }
+ }
+
+ g_free (delegator_clean);
+ } 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 = param ? icalparameter_get_partstat (param) : ICAL_PARTSTAT_NEEDSACTION;
+ }
+ 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 *
@@ -1222,33 +1243,20 @@ show_current_event (EItipControl *itip)
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);
@@ -1524,7 +1532,7 @@ show_current (EItipControl *itip)
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);
}
@@ -2173,7 +2181,7 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
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);