aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-itip-control.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-02-20 00:26:25 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-02-20 00:26:25 +0800
commit843b04862e48093d3a718c701c0f95e22e4bdb3e (patch)
tree7d3ed9c0f2a72415973b6b83c1ed373be098aa0b /calendar/gui/e-itip-control.c
parente17651e6354f0519cbf8c74a205b311e99d55748 (diff)
downloadgsoc2013-evolution-843b04862e48093d3a718c701c0f95e22e4bdb3e.tar.gz
gsoc2013-evolution-843b04862e48093d3a718c701c0f95e22e4bdb3e.tar.zst
gsoc2013-evolution-843b04862e48093d3a718c701c0f95e22e4bdb3e.zip
pass extra itip_send_comp params (send_freebusy): ditto (ok_clicked_cb):
002-02-19 JP Rosevear <jpr@ximian.com> * gui/e-itip-control.c (send_item): pass extra itip_send_comp params (send_freebusy): ditto (ok_clicked_cb): ditto, including the timezones culled from the component * gui/e-week-view.c: pass extra itip_send_comp params * gui/calendar-commands.c: ditto * gui/e-day-view.c: ditto * gui/dialogs/task-editor.c: ditto * gui/dialogs/event-editor.c: ditto * gui/dialogs/comp-editor.c: ditto * gui/itip-utils.h (itip_send_comp): update proto * gui/itip-utils.c (foreach_tzid_callback): check the passed in zones, then the builtin time zones then the client 2002-02-19 JP Rosevear <jpr@ximian.com> * gui/e-itip-control.c (find_my_address): strip the ical value and do a case insensitive compare (find_attendee): ditto (change_status): put the error message here (ok_clicked_cb): don't update the item or rsvp unless change_status was successful, trip the ical value and do a case insensitive compare * gui/itip-utils.c (get_address): strip the incoming address (itip_strip_mailto): use g_strncasecmp (comp_limit_attendees): strip the ical value and do a case insensitive compare svn path=/trunk/; revision=15763
Diffstat (limited to 'calendar/gui/e-itip-control.c')
-rw-r--r--calendar/gui/e-itip-control.c119
1 files changed, 85 insertions, 34 deletions
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 12ed92e93e..cac16500cf 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -341,7 +341,8 @@ find_my_address (EItipControl *itip, icalcomponent *ical_comp)
{
EItipControlPrivate *priv;
icalproperty *prop;
- const char *attendee, *text;
+ const char *attendee;
+ char *text;
icalvalue *value;
priv = itip->priv;
@@ -358,15 +359,17 @@ find_my_address (EItipControl *itip, icalcomponent *ical_comp)
attendee = icalvalue_get_string (value);
- text = itip_strip_mailto (attendee);
+ text = g_strdup (itip_strip_mailto (attendee));
+ text = g_strstrip (text);
for (l = priv->addresses; l != NULL; l = l->next) {
ItipAddress *a = l->data;
- if (!strcmp (a->address, text)) {
+ if (!g_strcasecmp (a->address, text)) {
priv->my_address = a->address;
return;
}
}
+ g_free (text);
}
}
@@ -374,24 +377,31 @@ static icalproperty *
find_attendee (icalcomponent *ical_comp, const char *address)
{
icalproperty *prop;
- const char *attendee, *text;
+ const char *attendee;
icalvalue *value;
- g_return_val_if_fail (address != NULL, NULL);
+ if (address == NULL)
+ return NULL;
for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
prop != NULL;
prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY))
{
+ char *text;
+
value = icalproperty_get_value (prop);
if (!value)
continue;
attendee = icalvalue_get_string (value);
- text = itip_strip_mailto (attendee);
- if (strstr (text, address))
+ text = g_strdup (itip_strip_mailto (attendee));
+ text = g_strstrip (text);
+ if (!g_strcasecmp (address, text)) {
+ g_free (text);
break;
+ }
+ g_free (text);
}
return prop;
@@ -1310,7 +1320,7 @@ e_itip_control_get_from_address (EItipControl *itip)
}
-static void
+static gboolean
change_status (icalcomponent *ical_comp, const char *address, icalparameter_partstat status)
{
icalproperty *prop;
@@ -1322,7 +1332,17 @@ change_status (icalcomponent *ical_comp, const char *address, icalparameter_part
icalproperty_remove_parameter (prop, ICAL_PARTSTAT_PARAMETER);
param = icalparameter_new_partstat (status);
icalproperty_add_parameter (prop, param);
+ } else {
+ GtkWidget *dialog;
+
+ dialog = gnome_warning_dialog (_("Unable to find any of your identities "
+ "in the attendees list!\n"));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
+ return FALSE;
}
+
+ return TRUE;
}
static void
@@ -1443,14 +1463,25 @@ send_item (EItipControl *itip)
{
EItipControlPrivate *priv;
CalComponent *comp;
+ CalComponentVType vtype;
GtkWidget *dialog;
priv = itip->priv;
comp = get_real_item (itip);
-
+ vtype = cal_component_get_vtype (comp);
+
if (comp != NULL) {
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp);
+ switch (vtype) {
+ case CAL_COMPONENT_EVENT:
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, priv->event_client, NULL);
+ break;
+ case CAL_COMPONENT_TODO:
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, priv->task_client, NULL);
+ break;
+ default:
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, NULL, NULL);
+ }
gtk_object_unref (GTK_OBJECT (comp));
dialog = gnome_ok_dialog (_("Item sent!\n"));
} else {
@@ -1498,7 +1529,7 @@ send_freebusy (EItipControl *itip)
for (l = comp_list; l; l = l->next) {
CalComponent *comp = CAL_COMPONENT (l->data);
- itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp);
+ itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp, priv->event_client, NULL);
gtk_object_unref (GTK_OBJECT (comp));
}
@@ -1578,7 +1609,7 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
EItipControl *itip = E_ITIP_CONTROL (data);
EItipControlPrivate *priv;
gchar **fields;
- gboolean rsvp = FALSE;
+ gboolean rsvp = FALSE, status = FALSE;
int i;
priv = itip->priv;
@@ -1598,19 +1629,28 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
update_item (itip);
break;
case 'A':
- change_status (priv->ical_comp, priv->my_address, ICAL_PARTSTAT_ACCEPTED);
- cal_component_rescan (priv->comp);
- update_item (itip);
+ status = change_status (priv->ical_comp, priv->my_address,
+ ICAL_PARTSTAT_ACCEPTED);
+ if (status) {
+ cal_component_rescan (priv->comp);
+ update_item (itip);
+ }
break;
case 'T':
- change_status (priv->ical_comp, priv->my_address, ICAL_PARTSTAT_TENTATIVE);
- cal_component_rescan (priv->comp);
- update_item (itip);
+ status = change_status (priv->ical_comp, priv->my_address,
+ ICAL_PARTSTAT_TENTATIVE);
+ if (status) {
+ cal_component_rescan (priv->comp);
+ update_item (itip);
+ }
break;
case 'D':
- change_status (priv->ical_comp, priv->my_address, ICAL_PARTSTAT_DECLINED);
- cal_component_rescan (priv->comp);
- remove_item (itip);
+ status = change_status (priv->ical_comp, priv->my_address,
+ ICAL_PARTSTAT_DECLINED);
+ if (status) {
+ cal_component_rescan (priv->comp);
+ remove_item (itip);
+ }
break;
case 'F':
send_freebusy (itip);
@@ -1636,18 +1676,20 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
}
g_strfreev (fields);
- if (rsvp) {
+ if (rsvp && status) {
CalComponent *comp = NULL;
-
+ CalComponentVType vtype;
+
comp = cal_component_clone (priv->comp);
if (comp == NULL)
return;
-
+ vtype = cal_component_get_vtype (comp);
+
if (priv->my_address != NULL) {
icalcomponent *ical_comp;
icalproperty *prop;
icalvalue *value;
- const char *attendee, *text;
+ const char *attendee;
GSList *l, *list = NULL;
ical_comp = cal_component_get_icalcomponent (comp);
@@ -1656,15 +1698,19 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
prop != NULL;
prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY))
{
+ char *text;
+
value = icalproperty_get_value (prop);
if (!value)
continue;
attendee = icalvalue_get_string (value);
- text = itip_strip_mailto (attendee);
- if (!strstr (text, priv->my_address))
+ text = g_strdup (itip_strip_mailto (attendee));
+ text = g_strstrip (text);
+ if (g_strcasecmp (priv->my_address, text))
list = g_slist_prepend (list, prop);
+ g_free (text);
}
for (l = list; l; l = l->next) {
@@ -1675,13 +1721,18 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
g_slist_free (list);
cal_component_rescan (comp);
- itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp);
- } else {
- GtkWidget *dialog;
-
- dialog = gnome_warning_dialog (_("Unable to find any of your identities "
- "in the attendees list!\n"));
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+ switch (vtype) {
+ case CAL_COMPONENT_EVENT:
+ itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp,
+ priv->event_client, priv->top_level);
+ break;
+ case CAL_COMPONENT_TODO:
+ itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp,
+ priv->task_client, priv->top_level);
+ break;
+ default:
+ itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp, NULL, NULL);
+ }
}
gtk_object_unref (GTK_OBJECT (comp));
}