diff options
Diffstat (limited to 'calendar/gui/itip-utils.c')
-rw-r--r-- | calendar/gui/itip-utils.c | 320 |
1 files changed, 160 insertions, 160 deletions
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 2cfd5244c3..63b0163ef9 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -93,7 +93,7 @@ itip_organizer_is_user (ECalComponent *comp, ECal *client) ECalComponentOrganizer organizer; const char *strip; gboolean user_org = FALSE; - + if (!e_cal_component_has_organizer (comp) || e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_ORGANIZER)) return FALSE; @@ -101,20 +101,20 @@ itip_organizer_is_user (ECalComponent *comp, ECal *client) if (organizer.value != NULL) { strip = itip_strip_mailto (organizer.value); - - if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) { + + if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) { char *email = NULL; - + if (e_cal_get_cal_address (client, &email, NULL) && !g_ascii_strcasecmp (email, strip)) { g_free (email); - + return TRUE; } - + g_free (email); return FALSE; } - + user_org = e_account_list_find(itip_addresses_get(), E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL; } @@ -127,7 +127,7 @@ itip_sentby_is_user (ECalComponent *comp) ECalComponentOrganizer organizer; const char *strip; gboolean user_sentby = FALSE; - + if (!e_cal_component_has_organizer (comp)) return FALSE; @@ -141,7 +141,7 @@ itip_sentby_is_user (ECalComponent *comp) } static ECalComponentAttendee * -get_attendee (GSList *attendees, char *address) +get_attendee (GSList *attendees, char *address) { GSList *l; @@ -152,15 +152,15 @@ get_attendee (GSList *attendees, char *address) ECalComponentAttendee *attendee = l->data; if (!g_ascii_strcasecmp (itip_strip_mailto (attendee->value), address)) { - return attendee; - } + return attendee; + } } return NULL; } static ECalComponentAttendee * -get_attendee_if_attendee_sentby_is_user (GSList *attendees, char *address) +get_attendee_if_attendee_sentby_is_user (GSList *attendees, char *address) { GSList *l; @@ -168,8 +168,8 @@ get_attendee_if_attendee_sentby_is_user (GSList *attendees, char *address) ECalComponentAttendee *attendee = l->data; if (attendee->sentby && g_str_equal (itip_strip_mailto (attendee->sentby), address)) { - return attendee; - } + return attendee; + } } return NULL; @@ -200,8 +200,8 @@ html_new_lines_for (char *string) html_string[index++] = *temp; temp++; } - temp++; - + temp++; + html_string[index++] = '<'; html_string[index++] = 'b'; html_string[index++] = 'r'; @@ -216,9 +216,9 @@ html_new_lines_for (char *string) html_string[index++] = *temp; temp++; } - + html_string[index] = '\0'; - + return html_string; } @@ -232,14 +232,14 @@ itip_get_comp_attendee (ECalComponent *comp, ECal *client) ECalComponentAttendee *attendee = NULL; char *address = NULL; - e_cal_component_get_attendee_list (comp, &attendees); + e_cal_component_get_attendee_list (comp, &attendees); al = itip_addresses_get (); - + if (client) e_cal_get_cal_address (client, &address, NULL); if (address && *address) { - attendee = get_attendee (attendees, address); + attendee = get_attendee (attendees, address); if (attendee) { char *user_email = g_strdup (itip_strip_mailto (attendee->value)); @@ -268,15 +268,15 @@ itip_get_comp_attendee (ECalComponent *comp, ECal *client) e_iterator_next(it)) { a = (EAccount *) e_iterator_get(it); - if (!a->enabled) + if (!a->enabled) continue; attendee = get_attendee (attendees, a->id->address); if (attendee) { char *user_email = g_strdup (itip_strip_mailto (attendee->value)); - + e_cal_component_free_attendee_list (attendees); - return user_email; + return user_email; } /* If the account was not found in the attendees list, then let's @@ -284,9 +284,9 @@ itip_get_comp_attendee (ECalComponent *comp, ECal *client) attendee = get_attendee_if_attendee_sentby_is_user (attendees, a->id->address); if (attendee) { char *user_email = g_strdup (itip_strip_mailto (attendee->sentby)); - + e_cal_component_free_attendee_list (attendees); - return user_email; + return user_email; } } @@ -295,17 +295,17 @@ itip_get_comp_attendee (ECalComponent *comp, ECal *client) /* FIXME do we have a better way ? */ a = itip_addresses_get_default (); address = g_strdup ((a != NULL) ? a->id->address : ""); - + e_cal_component_free_attendee_list (attendees); return address; } const gchar * -itip_strip_mailto (const gchar *address) +itip_strip_mailto (const gchar *address) { if (address == NULL) return NULL; - + if (!g_ascii_strncasecmp (address, "mailto:", 7)) address += 7; @@ -329,7 +329,7 @@ get_label (struct icaltimetype *tt) typedef struct { GHashTable *tzids; - icalcomponent *icomp; + icalcomponent *icomp; ECal *client; icalcomponent *zones; } ItipUtilTZData; @@ -338,7 +338,7 @@ typedef struct { static void foreach_tzid_callback (icalparameter *param, gpointer data) { - ItipUtilTZData *tz_data = data; + ItipUtilTZData *tz_data = data; const char *tzid; icaltimezone *zone = NULL; icalcomponent *vtimezone_comp; @@ -353,7 +353,7 @@ foreach_tzid_callback (icalparameter *param, gpointer data) 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) + if (zone == NULL && tz_data->client != NULL) e_cal_get_timezone (tz_data->client, tzid, &zone, NULL); if (zone == NULL) return; @@ -364,7 +364,7 @@ foreach_tzid_callback (icalparameter *param, gpointer data) return; icalcomponent_add_component (tz_data->icomp, icalcomponent_new_clone (vtimezone_comp)); - g_hash_table_insert (tz_data->tzids, (char *)tzid, (char *)tzid); + g_hash_table_insert (tz_data->tzids, (char *)tzid, (char *)tzid); } static icalcomponent * @@ -384,7 +384,7 @@ comp_toplevel_with_zones (ECalComponentItipMethod method, ECalComponent *comp, E icomp = e_cal_component_get_icalcomponent (comp); icomp = icalcomponent_new_clone (icomp); - + tz_data.tzids = g_hash_table_new (g_str_hash, g_str_equal); tz_data.icomp = top_level; tz_data.client = client; @@ -418,33 +418,33 @@ comp_from (ECalComponentItipMethod method, ECalComponent *comp) GSList *attendees; CORBA_char *str; char *sender = NULL; - + switch (method) { case E_CAL_COMPONENT_METHOD_PUBLISH: return CORBA_string_dup (""); - + case E_CAL_COMPONENT_METHOD_REQUEST: sender = itip_get_comp_attendee (comp, NULL); if (sender) { str = CORBA_string_dup (sender); g_free (sender); return str; - } - - case E_CAL_COMPONENT_METHOD_REPLY: + } + + case E_CAL_COMPONENT_METHOD_REPLY: sender = itip_get_comp_attendee (comp, NULL); if (sender) { str = CORBA_string_dup (sender); g_free (sender); return str; - } + } if (!e_cal_component_has_attendees (comp)) return CORBA_string_dup (""); case E_CAL_COMPONENT_METHOD_CANCEL: - case E_CAL_COMPONENT_METHOD_ADD: - + case E_CAL_COMPONENT_METHOD_ADD: + e_cal_component_get_organizer (comp, &organizer); if (organizer.value == NULL) { e_notice (NULL, GTK_MESSAGE_ERROR, @@ -453,7 +453,7 @@ comp_from (ECalComponentItipMethod method, ECalComponent *comp) } return CORBA_string_dup (itip_strip_mailto (organizer.value)); - + default: if (!e_cal_component_has_attendees (comp)) return CORBA_string_dup (""); @@ -488,7 +488,7 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, e_cal_component_free_attendee_list (attendees); return NULL; } - + to_list = GNOME_Evolution_Composer_RecipientList__alloc (); to_list->_maximum = len; to_list->_length = 0; @@ -526,7 +526,7 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, else recipient->name = CORBA_string_dup (""); recipient->address = CORBA_string_dup (itip_strip_mailto (att->value)); - + to_list->_length++; } g_free (sender); @@ -547,7 +547,7 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, e_cal_component_free_attendee_list (attendees); return to_list; } - + to_list = GNOME_Evolution_Composer_RecipientList__alloc (); to_list->_maximum = len; to_list->_length = 0; @@ -559,14 +559,14 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, for (l = attendees; l != NULL; l = l->next) { ECalComponentAttendee *att = l->data; - + recipient = &(to_list->_buffer[to_list->_length]); if (att->cn) recipient->name = CORBA_string_dup (att->cn); else recipient->name = CORBA_string_dup (""); recipient->address = CORBA_string_dup (itip_strip_mailto (att->value)); - + to_list->_length++; } @@ -581,7 +581,7 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, to_list->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (1); recipient = &(to_list->_buffer[to_list->_length]); - + e_cal_component_get_organizer (comp, &organizer); if (organizer.value) { recipient->name = CORBA_string_dup (""); @@ -591,11 +591,11 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, } else { recipient->address = CORBA_string_dup (""); recipient->name = CORBA_string_dup (""); - } + } } break; - - + + case E_CAL_COMPONENT_METHOD_ADD: case E_CAL_COMPONENT_METHOD_REFRESH: case E_CAL_COMPONENT_METHOD_COUNTER: @@ -606,7 +606,7 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, _("An organizer must be set.")); return NULL; } - + len = 2; to_list = GNOME_Evolution_Composer_RecipientList__alloc (); @@ -621,8 +621,8 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, else recipient->name = CORBA_string_dup (""); recipient->address = CORBA_string_dup (itip_strip_mailto (organizer.value)); - - /* send the status to delegatee to the delegate also*/ + + /* send the status to delegatee to the delegate also*/ e_cal_component_get_attendee_list (comp, &attendees); sender = itip_get_comp_attendee (comp, NULL); @@ -642,7 +642,7 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, } e_cal_component_free_attendee_list (attendees); - + break; case E_CAL_COMPONENT_METHOD_PUBLISH: if(users) { @@ -653,7 +653,7 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, to_list->_maximum = len; to_list->_length = 0; to_list->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (len); - + for (list = users; list != NULL; list = list->next) { recipient = &(to_list->_buffer[to_list->_length]); recipient->name = CORBA_string_dup (""); @@ -670,9 +670,9 @@ comp_to_list (ECalComponentItipMethod method, ECalComponent *comp, GList *users, } CORBA_sequence_set_release (to_list, TRUE); - return to_list; + return to_list; } - + static CORBA_char * comp_subject (ECalComponentItipMethod method, ECalComponent *comp) { @@ -684,7 +684,7 @@ comp_subject (ECalComponentItipMethod method, ECalComponent *comp) ECalComponentAttendee *a = NULL; e_cal_component_get_summary (comp, &caltext); - if (caltext.value != NULL) + if (caltext.value != NULL) description = caltext.value; else { switch (e_cal_component_get_vtype (comp)) { @@ -717,7 +717,7 @@ comp_subject (ECalComponentItipMethod method, ECalComponent *comp) for (l = alist; l != NULL ; l = l->next) { a = l->data; - if ((sender && *sender) && (g_ascii_strcasecmp (itip_strip_mailto (a->value), sender) || (a->sentby && g_ascii_strcasecmp (itip_strip_mailto (a->sentby), sender)))) + if ((sender && *sender) && (g_ascii_strcasecmp (itip_strip_mailto (a->value), sender) || (a->sentby && g_ascii_strcasecmp (itip_strip_mailto (a->sentby), sender)))) break; } g_free (sender); @@ -782,8 +782,8 @@ comp_subject (ECalComponentItipMethod method, ECalComponent *comp) static CORBA_char * comp_content_type (ECalComponent *comp, ECalComponentItipMethod method) { - char tmp[256]; - + char tmp[256]; + sprintf (tmp, "text/calendar; name=\"%s\"; charset=utf-8; METHOD=%s", e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_FREEBUSY ? "freebusy.ifb" : "calendar.ics", itip_methods[method]); @@ -845,20 +845,20 @@ comp_description (ECalComponent *comp) } static gboolean -comp_server_send (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, +comp_server_send (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, icalcomponent *zones, GList **users) { icalcomponent *top_level, *returned_icalcomp = NULL; gboolean retval = TRUE; GError *error = NULL; - + top_level = comp_toplevel_with_zones (method, comp, client, zones); if (!e_cal_send_objects (client, top_level, users, &returned_icalcomp, &error)) { /* FIXME Really need a book problem status code */ if (error->code != E_CALENDAR_STATUS_OK) { /* FIXME Better error message */ e_notice (NULL, GTK_MESSAGE_ERROR, "Unable to book"); - + retval = FALSE; } } @@ -873,7 +873,7 @@ comp_server_send (ECalComponentItipMethod method, ECalComponent *comp, ECal *cli } static gboolean -comp_limit_attendees (ECalComponent *comp) +comp_limit_attendees (ECalComponent *comp) { icalcomponent *icomp; icalproperty *prop; @@ -897,7 +897,7 @@ comp_limit_attendees (ECalComponent *comp) list = g_slist_prepend (list, prop); continue; } - + attendee = icalproperty_get_value_as_string (prop); if (!attendee) continue; @@ -918,7 +918,7 @@ comp_limit_attendees (ECalComponent *comp) g_free(attendee_text); g_free (attendee_sentby_text); - + if (!match) list = g_slist_prepend (list, prop); match = FALSE; @@ -941,7 +941,7 @@ comp_sentby (ECalComponent *comp, ECal *client) ECalComponentOrganizer organizer; GSList * attendees, *l; char *user = NULL; - + e_cal_component_get_organizer (comp, &organizer); if (!organizer.value) { EAccount *a = itip_addresses_get_default (); @@ -950,10 +950,10 @@ comp_sentby (ECalComponent *comp, ECal *client) organizer.sentby = NULL; organizer.cn = a->id->name; organizer.language = NULL; - + e_cal_component_set_organizer (comp, &organizer); g_free ((char *) organizer.value); - + return; } @@ -967,15 +967,15 @@ comp_sentby (ECalComponent *comp, ECal *client) return; } } - + if (!itip_organizer_is_user (comp, client) && !itip_sentby_is_user (comp)) { EAccount *a = itip_addresses_get_default (); - + organizer.value = g_strdup (organizer.value); organizer.sentby = g_strdup_printf ("MAILTO:%s", a->id->address); organizer.cn = g_strdup (organizer.cn); organizer.language = g_strdup (organizer.language); - + e_cal_component_set_organizer (comp, &organizer); g_free ((char *)organizer.value); @@ -995,13 +995,13 @@ comp_minimal (ECalComponent *comp, gboolean attendee) GSList *comments; struct icaltimetype itt; ECalComponentRange recur_id; - + clone = e_cal_component_new (); e_cal_component_set_new_vtype (clone, e_cal_component_get_vtype (comp)); if (attendee) { GSList *attendees; - + e_cal_component_get_attendee_list (comp, &attendees); e_cal_component_set_attendee_list (clone, attendees); @@ -1011,7 +1011,7 @@ comp_minimal (ECalComponent *comp, gboolean attendee) goto error; } } - + itt = icaltime_from_timet_with_zone (time (NULL), FALSE, icaltimezone_get_utc_timezone ()); e_cal_component_set_dtstamp (clone, &itt); @@ -1029,17 +1029,17 @@ comp_minimal (ECalComponent *comp, gboolean attendee) e_cal_component_set_comment_list (clone, comments); } else { GSList *l = comments; - + comments = g_slist_remove_link (comments, l); e_cal_component_set_comment_list (clone, l); e_cal_component_free_text_list (l); } e_cal_component_free_text_list (comments); - + e_cal_component_get_recurid (comp, &recur_id); if (recur_id.datetime.value != NULL) e_cal_component_set_recurid (clone, &recur_id); - + icomp = e_cal_component_get_icalcomponent (comp); icomp_clone = e_cal_component_get_icalcomponent (clone); for (prop = icalcomponent_get_first_property (icomp, ICAL_X_PROPERTY); @@ -1047,13 +1047,13 @@ comp_minimal (ECalComponent *comp, gboolean attendee) prop = icalcomponent_get_next_property (icomp, ICAL_X_PROPERTY)) { icalproperty *p; - + p = icalproperty_new_clone (prop); icalcomponent_add_property (icomp_clone, p); } e_cal_component_rescan (clone); - + return clone; error: @@ -1066,7 +1066,7 @@ comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *clien { ECalComponent *clone, *temp_clone; struct icaltimetype itt; - + clone = e_cal_component_clone (comp); itt = icaltime_from_timet_with_zone (time (NULL), FALSE, icaltimezone_get_utc_timezone ()); @@ -1077,14 +1077,14 @@ comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *clien && e_cal_component_has_simple_recurrence (clone)) { GSList *rrule_list; struct icalrecurrencetype *r; - + e_cal_component_get_rrule_list (clone, &rrule_list); r = rrule_list->data; if (!icaltime_is_null_time (r->until) && r->until.is_date) { ECalComponentDateTime dt; icaltimezone *from_zone = NULL, *to_zone; - + e_cal_component_get_dtstart (clone, &dt); if (dt.value->is_date) { @@ -1100,14 +1100,14 @@ comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *clien /* FIXME Error checking */ e_cal_get_timezone (client, dt.tzid, &from_zone, NULL); } - + to_zone = icaltimezone_get_utc_timezone (); r->until.hour = dt.value->hour; r->until.minute = dt.value->minute; r->until.second = dt.value->second; r->until.is_date = FALSE; - + icaltimezone_convert_time (&r->until, from_zone, to_zone); r->until.is_utc = TRUE; @@ -1117,13 +1117,13 @@ comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *clien e_cal_component_free_recur_list (rrule_list); } - + /* We delete incoming alarms anyhow, and this helps with outlook */ e_cal_component_remove_all_alarms (clone); /* Strip X-LIC-ERROR stuff */ e_cal_component_strip_errors (clone); - + /* Comply with itip spec */ switch (method) { case E_CAL_COMPONENT_METHOD_PUBLISH: @@ -1135,7 +1135,7 @@ comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *clien break; case E_CAL_COMPONENT_METHOD_CANCEL: comp_sentby (clone, client); - break; + break; case E_CAL_COMPONENT_METHOD_REPLY: break; case E_CAL_COMPONENT_METHOD_ADD: @@ -1176,14 +1176,14 @@ append_cal_attachments (GNOME_Evolution_Composer composer_server, ECalComponent for (l = attach_list; l ; l = l->next) { mime_attach = (struct CalMimeAttach *) l->data; - + filename = CORBA_string_dup (mime_attach->filename ? mime_attach->filename : ""); content_type = CORBA_string_dup (mime_attach->content_type); description = CORBA_string_dup (mime_attach->description); - + attach_data = GNOME_Evolution_Composer_AttachmentData__alloc (); attach_data->_length = mime_attach->length; - attach_data->_maximum = attach_data->_length; + attach_data->_maximum = attach_data->_length; attach_data->_buffer = CORBA_sequence_CORBA_char_allocbuf (attach_data->_length); memcpy (attach_data->_buffer, mime_attach->encoded_data, attach_data->_length); @@ -1212,7 +1212,7 @@ append_cal_attachments (GNOME_Evolution_Composer composer_server, ECalComponent g_free (mime_attach->description); g_free (mime_attach->encoded_data); } - + return retval; } @@ -1236,7 +1236,7 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp, /* check whether backend could handle sending requests/updates */ if (method != E_CAL_COMPONENT_METHOD_PUBLISH && e_cal_get_save_schedules (client)) return TRUE; - + CORBA_exception_init (&ev); /* Give the server a chance to manipulate the comp */ @@ -1244,7 +1244,7 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp, if (!comp_server_send (method, send_comp, client, zones, &users)) goto cleanup; } - + /* Tidy up the comp */ comp = comp_compliant (method, send_comp, client, zones); @@ -1269,10 +1269,10 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp, cc_list->_maximum = cc_list->_length = 0; bcc_list = GNOME_Evolution_Composer_RecipientList__alloc (); bcc_list->_maximum = bcc_list->_length = 0; - + /* Subject information */ subject = comp_subject (method, comp); - + /* From address */ from = comp_from (method, comp); @@ -1319,7 +1319,7 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp, attach_data = GNOME_Evolution_Composer_AttachmentData__alloc (); attach_data->_length = strlen (ical_string); - attach_data->_maximum = attach_data->_length; + attach_data->_maximum = attach_data->_length; attach_data->_buffer = CORBA_sequence_CORBA_char_allocbuf (attach_data->_length); memcpy (attach_data->_buffer, ical_string, attach_data->_length); @@ -1328,7 +1328,7 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp, TRUE, attach_data, &ev); } - + if (BONOBO_EX (&ev)) { g_warning ("Unable to place iTip message in composer"); goto cleanup; @@ -1345,14 +1345,14 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp, g_warning ("Unable to show the composer while sending iTip message"); else retval = TRUE; - } else { + } else { GNOME_Evolution_Composer_send (composer_server, &ev); if (BONOBO_EX (&ev)) g_warning ("Unable to send iTip message"); else retval = TRUE; } - + cleanup: CORBA_exception_free (&ev); @@ -1365,7 +1365,7 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp, g_list_foreach (users, (GFunc) g_free, NULL); g_list_free (users); } - + if (to_list != NULL) CORBA_free (to_list); if (cc_list != NULL) @@ -1425,10 +1425,10 @@ reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp cc_list->_maximum = cc_list->_length = 0; bcc_list = GNOME_Evolution_Composer_RecipientList__alloc (); bcc_list->_maximum = bcc_list->_length = 0; - + /* Subject information */ subject = comp_subject (method, comp); - + /* From address */ from = comp_from (method, comp); @@ -1457,7 +1457,7 @@ reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp ical_string = icalcomponent_as_ical_string (top_level); if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_EVENT){ - + GString *body; char *orig_from = NULL; char *description = NULL; @@ -1480,7 +1480,7 @@ reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp description = (char *)text.value; else description = ""; - } else { + } else { description = ""; } @@ -1496,12 +1496,12 @@ reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp if (organizer.value) orig_from = g_strdup (itip_strip_mailto (organizer.value)); - + e_cal_component_get_location (comp, &location); if (!location) location = "Unspecified"; - + e_cal_component_get_dtstart (comp, &dtstart); if (dtstart.value) { start_zone = icaltimezone_get_builtin_timezone_from_tzid (dtstart.tzid); @@ -1516,8 +1516,8 @@ reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp start = icaltime_as_timet_with_zone (*dtstart.value, start_zone); time = g_strdup (ctime (&start)); } - - + + body = g_string_new ("<br><br><hr><br><b>______ Original Appointment ______ </b><br><br><table>"); if (orig_from && *orig_from) @@ -1558,13 +1558,13 @@ reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp } - + GNOME_Evolution_Composer_show (composer_server, &ev); if (BONOBO_EX (&ev)) g_warning ("Unable to show the composer while sending iTip message"); else retval = TRUE; - + cleanup: CORBA_exception_free (&ev); @@ -1577,7 +1577,7 @@ reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp g_list_foreach (users, (GFunc) g_free, NULL); g_list_free (users); } - + if (to_list != NULL) CORBA_free (to_list); if (cc_list != NULL) @@ -1596,33 +1596,33 @@ reply_to_calendar_comp (ECalComponentItipMethod method, ECalComponent *send_comp } gboolean -itip_publish_begin (ECalComponent *pub_comp, ECal *client, +itip_publish_begin (ECalComponent *pub_comp, ECal *client, gboolean cloned, ECalComponent **clone) { icalcomponent *icomp =NULL, *icomp_clone = NULL; icalproperty *prop; - + if (e_cal_component_get_vtype (pub_comp) == E_CAL_COMPONENT_FREEBUSY) { - + if (!cloned) { *clone = e_cal_component_clone (pub_comp); cloned = TRUE; } else { - + icomp = e_cal_component_get_icalcomponent (pub_comp); icomp_clone = e_cal_component_get_icalcomponent (*clone); for (prop = icalcomponent_get_first_property (icomp, ICAL_FREEBUSY_PROPERTY); prop != NULL; - prop = icalcomponent_get_next_property (icomp, + prop = icalcomponent_get_next_property (icomp, ICAL_FREEBUSY_PROPERTY)) { icalproperty *p; - + p = icalproperty_new_clone (prop); icalcomponent_add_property (icomp_clone, p); } - } + } } return TRUE; @@ -1632,19 +1632,19 @@ static void fb_sort (struct icalperiodtype *ipt, int fb_count) { int i,j; - + if (ipt == NULL || fb_count == 0) return; - + for (i = 0; i < fb_count-1; i++) { for (j = i+1; j < fb_count; j++) { struct icalperiodtype temp; - + if (icaltime_compare (ipt[i].start, ipt[j].start) < 0) continue; - + if (icaltime_compare (ipt[i].start, ipt[j].start) == 0){ - if (icaltime_compare (ipt[i].end, + if (icaltime_compare (ipt[i].end, ipt[j].start) < 0) continue; } @@ -1664,48 +1664,48 @@ comp_fb_normalize (icalcomponent *icomp) struct icaltimetype itt; int fb_count, i = 0, j; struct icalperiodtype *ipt; - + iclone = icalcomponent_new (ICAL_VFREEBUSY_COMPONENT); - - prop = icalcomponent_get_first_property (icomp, + + prop = icalcomponent_get_first_property (icomp, ICAL_ORGANIZER_PROPERTY); if (prop) { p = icalproperty_new_clone (prop); icalcomponent_add_property (iclone, p); } - + itt = icalcomponent_get_dtstart (icomp); icalcomponent_set_dtstart (iclone, itt); - + itt = icalcomponent_get_dtend (icomp); icalcomponent_set_dtend (iclone, itt); - - fb_count = icalcomponent_count_properties (icomp, + + fb_count = icalcomponent_count_properties (icomp, ICAL_FREEBUSY_PROPERTY); ipt = g_new0 (struct icalperiodtype, fb_count+1); - - for (prop = icalcomponent_get_first_property (icomp, + + for (prop = icalcomponent_get_first_property (icomp, ICAL_FREEBUSY_PROPERTY); prop != NULL; - prop = icalcomponent_get_next_property (icomp, + prop = icalcomponent_get_next_property (icomp, ICAL_FREEBUSY_PROPERTY)) { ipt[i] = icalproperty_get_freebusy (prop); i++; } - + fb_sort (ipt, fb_count); - + for (j = 0; j <= fb_count-1; j++) { icalparameter *param; - + prop = icalproperty_new_freebusy (ipt[j]); param = icalparameter_new_fbtype (ICAL_FBTYPE_BUSY); icalproperty_add_parameter (prop, param); icalcomponent_add_property (iclone, prop); } g_free (ipt); - + /* Should I strip this RFC 2446 says there must not be a UID if the METHOD is PUBLISH?? */ uid = icalcomponent_get_uid (icomp); @@ -1714,14 +1714,14 @@ comp_fb_normalize (icalcomponent *icomp) itt = icaltime_from_timet_with_zone (time (NULL), FALSE, icaltimezone_get_utc_timezone ()); - icalcomponent_set_dtstamp (iclone, itt); - + icalcomponent_set_dtstamp (iclone, itt); + prop = icalcomponent_get_first_property (icomp, ICAL_URL_PROPERTY); if (prop) { p = icalproperty_new_clone (prop); icalcomponent_add_property (iclone, p); } - + comment = icalcomponent_get_comment (icomp); if (comment) icalcomponent_set_comment (iclone, comment); @@ -1729,11 +1729,11 @@ comp_fb_normalize (icalcomponent *icomp) for (prop = icalcomponent_get_first_property (icomp, ICAL_X_PROPERTY); prop != NULL; prop = icalcomponent_get_next_property (icomp, ICAL_X_PROPERTY)) - { + { p = icalproperty_new_clone (prop); icalcomponent_add_property (iclone, p); } - + return iclone; /* this will never be reached */ g_object_unref (iclone); @@ -1741,7 +1741,7 @@ comp_fb_normalize (icalcomponent *icomp) } gboolean -itip_publish_comp (ECal *client, gchar *uri, gchar *username, +itip_publish_comp (ECal *client, gchar *uri, gchar *username, gchar *password, ECalComponent **pub_comp) { icalcomponent *toplevel = NULL, *icalcomp = NULL; @@ -1750,15 +1750,15 @@ itip_publish_comp (ECal *client, gchar *uri, gchar *username, SoupMessage *msg; SoupUri *real_uri; char *ical_string; - + toplevel = e_cal_util_new_top_level (); icalcomponent_set_method (toplevel, ICAL_METHOD_PUBLISH); - + e_cal_component_set_url (*pub_comp, uri); - + icalcomp = e_cal_component_get_icalcomponent (*pub_comp); - - icomp = comp_fb_normalize (icalcomp); + + icomp = comp_fb_normalize (icalcomp); icalcomponent_add_component (toplevel, icomp); ical_string = icalcomponent_as_ical_string (toplevel); @@ -1772,10 +1772,10 @@ itip_publish_comp (ECal *client, gchar *uri, gchar *username, g_object_unref (session); return FALSE; } - + real_uri->user = g_strdup (username); real_uri->passwd = g_strdup (password); - + /* build the SOAP message */ msg = soup_message_new_from_uri (SOUP_METHOD_PUT, real_uri); if (!msg) { @@ -1783,23 +1783,23 @@ itip_publish_comp (ECal *client, gchar *uri, gchar *username, g_object_unref (session); return FALSE; } - soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT); + soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT); soup_message_set_request (msg, "text/calendar", SOUP_BUFFER_USER_OWNED, ical_string, strlen (ical_string)); - + /* send message to server */ soup_session_send_message (session, msg); if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) { - g_warning(G_STRLOC ": Could not publish Free/Busy: %d: %s", - msg->status_code, + g_warning(G_STRLOC ": Could not publish Free/Busy: %d: %s", + msg->status_code, soup_status_get_phrase (msg->status_code)); g_object_unref (session); return FALSE; } - + soup_uri_free (real_uri); g_object_unref (session); - + return TRUE; } |