From 843b04862e48093d3a718c701c0f95e22e4bdb3e Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 19 Feb 2002 16:26:25 +0000 Subject: pass extra itip_send_comp params (send_freebusy): ditto (ok_clicked_cb): 002-02-19 JP Rosevear * 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 * 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 --- calendar/gui/itip-utils.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'calendar/gui/itip-utils.c') diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 405240e9da..1f1a0a9883 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -84,6 +84,7 @@ get_address (long num) path = g_strdup_printf ("/Mail/Accounts/identity_address_%ld", num); a->address = bonobo_config_get_string (db, path, NULL); + a->address = g_strstrip (a->address); g_free (path); a->full = g_strdup_printf ("%s <%s>", a->name, a->address); @@ -183,13 +184,10 @@ itip_addresses_free (GList *addresses) const gchar * itip_strip_mailto (const gchar *address) { - const gchar *text; - if (address == NULL) return NULL; - text = e_strstrcase (address, "mailto:"); - if (text != NULL && strlen (address) > 7) + if (!g_strncasecmp (address, "mailto:", 7)) address += 7; return address; @@ -222,6 +220,8 @@ get_label (struct icaltimetype *tt) typedef struct { GHashTable *tzids; icalcomponent *icomp; + CalClient *client; + icalcomponent *zones; } ItipUtilTZData; static GNOME_Evolution_Composer_RecipientList * @@ -388,7 +388,7 @@ foreach_tzid_callback (icalparameter *param, gpointer data) { ItipUtilTZData *tz_data = data; const char *tzid; - icaltimezone *zone; + icaltimezone *zone = NULL; icalcomponent *vtimezone_comp; /* Get the TZID string from the parameter. */ @@ -396,9 +396,14 @@ foreach_tzid_callback (icalparameter *param, gpointer data) if (!tzid || g_hash_table_lookup (tz_data->tzids, tzid)) return; - /* Check if it is a builtin timezone. If it isn't, return. */ - zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); - if (!zone) + /* Look for the timezone */ + if (tz_data->zones != NULL) + zone = icalcomponent_get_timezone (tz_data->zones, tzid); + if (zone == NULL) + zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); + if (zone == NULL && tz_data->client != NULL) + cal_client_get_timezone (tz_data->client, tzid, &zone); + if (zone == NULL) return; /* Convert it to a string and add it to the hash. */ @@ -411,7 +416,7 @@ foreach_tzid_callback (icalparameter *param, gpointer data) } static char * -comp_string (CalComponentItipMethod method, CalComponent *comp) +comp_string (CalComponentItipMethod method, CalComponent *comp, CalClient *client, icalcomponent *zones) { icalcomponent *top_level, *icomp; icalproperty *prop; @@ -430,7 +435,9 @@ comp_string (CalComponentItipMethod method, CalComponent *comp) /* Add the timezones */ tz_data.tzids = g_hash_table_new (g_str_hash, g_str_equal); - tz_data.icomp = top_level; + tz_data.icomp = top_level; + tz_data.client = client; + tz_data.zones = zones; icalcomponent_foreach_tzid (icomp, foreach_tzid_callback, &tz_data); g_hash_table_destroy (tz_data.tzids); @@ -460,7 +467,8 @@ comp_limit_attendees (CalComponent *comp) prop = icalcomponent_get_next_property (icomp, ICAL_ATTENDEE_PROPERTY)) { icalvalue *value; - const char *attendee, *text; + const char *attendee; + char *text; GList *l; /* If we've already found something, just erase the rest */ @@ -475,14 +483,16 @@ comp_limit_attendees (CalComponent *comp) attendee = icalvalue_get_string (value); - text = itip_strip_mailto (attendee); + text = g_strdup (itip_strip_mailto (attendee)); + text = g_strstrip (text); for (l = addresses; l != NULL; l = l->next) { ItipAddress *a = l->data; - if (strstr (text, a->address)) + if (!g_strcasecmp (a->address, text)) found = match = TRUE; } - + g_free (text); + if (!match) list = g_slist_prepend (list, prop); match = FALSE; @@ -679,7 +689,8 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp) } void -itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp) +itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, + CalClient *client, icalcomponent *zones) { BonoboObjectClient *bonobo_server; GNOME_Evolution_Composer composer_server; @@ -740,7 +751,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp) description = comp_description (comp); show_inline = TRUE; - ical_string = comp_string (method, comp); + ical_string = comp_string (method, comp, client, zones); attach_data = GNOME_Evolution_Composer_AttachmentData__alloc (); attach_data->_length = strlen (ical_string) + 1; attach_data->_maximum = attach_data->_length; -- cgit v1.2.3