diff options
author | JP Rosevear <jpr@ximian.com> | 2002-08-08 03:34:07 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-08-08 03:34:07 +0800 |
commit | 51012e60d827b73a7bfd42b921760b0835dc7b66 (patch) | |
tree | a2a99d0306ad84d22226541cd3199e379e7692af /calendar | |
parent | 1c34dc5138579c3c7855622ae0e0880c55c62f68 (diff) | |
download | gsoc2013-evolution-51012e60d827b73a7bfd42b921760b0835dc7b66.tar gsoc2013-evolution-51012e60d827b73a7bfd42b921760b0835dc7b66.tar.gz gsoc2013-evolution-51012e60d827b73a7bfd42b921760b0835dc7b66.tar.bz2 gsoc2013-evolution-51012e60d827b73a7bfd42b921760b0835dc7b66.tar.lz gsoc2013-evolution-51012e60d827b73a7bfd42b921760b0835dc7b66.tar.xz gsoc2013-evolution-51012e60d827b73a7bfd42b921760b0835dc7b66.tar.zst gsoc2013-evolution-51012e60d827b73a7bfd42b921760b0835dc7b66.zip |
just return the object untouched since we don't send anything
2002-08-07 JP Rosevear <jpr@ximian.com>
* pcs/cal-backend-file.c (cal_backend_file_send_object): just
return the object untouched since we don't send anything
* pcs/cal-backend.c (cal_backend_remove_object): call virtual method
* pcs/cal-backend.h: add send result codes, new proto
* pcs/cal.c (impl_Cal_send_object): implement sendObject corba call
(cal_class_init): add to epv
* gui/itip-utils.c (comp_toplevel_with_zones): utility function to
create icalcomponent with necessary timezone info
(comp_has_attendee): see if attendee is in the attendee list
(comp_server_send): use above and remove attendees if the server
sends them
* gui/e-itip-control.c (show_current_todo): remove unused var
* idl/evolution-calendar.idl: add Busy exception and
* cal-client/cal-client.c (cal_client_send_object): send object
via the server (if the server can)
* cal-client/cal-client.h: add send results and new proto
svn path=/trunk/; revision=17734
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 27 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.c | 56 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.h | 11 | ||||
-rw-r--r-- | calendar/gui/e-itip-control.c | 1 | ||||
-rw-r--r-- | calendar/gui/itip-utils.c | 243 | ||||
-rw-r--r-- | calendar/idl/evolution-calendar.idl | 5 | ||||
-rw-r--r-- | calendar/pcs/cal-backend-file.c | 16 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.c | 13 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.h | 14 | ||||
-rw-r--r-- | calendar/pcs/cal.c | 44 |
10 files changed, 343 insertions, 87 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 706e698106..d00487219d 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,30 @@ +2002-08-07 JP Rosevear <jpr@ximian.com> + + * pcs/cal-backend-file.c (cal_backend_file_send_object): just + return the object untouched since we don't send anything + + * pcs/cal-backend.c (cal_backend_remove_object): call virtual method + + * pcs/cal-backend.h: add send result codes, new proto + + * pcs/cal.c (impl_Cal_send_object): implement sendObject corba call + (cal_class_init): add to epv + + * gui/itip-utils.c (comp_toplevel_with_zones): utility function to + create icalcomponent with necessary timezone info + (comp_has_attendee): see if attendee is in the attendee list + (comp_server_send): use above and remove attendees if the server + sends them + + * gui/e-itip-control.c (show_current_todo): remove unused var + + * idl/evolution-calendar.idl: add Busy exception and + + * cal-client/cal-client.c (cal_client_send_object): send object + via the server (if the server can) + + * cal-client/cal-client.h: add send results and new proto + 2002-08-05 Rodrigo Moya <rodrigo@ximian.com> * pcs/query-backend.[ch] (query_backend_get_object_component): new diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 1f220117e8..992f0bf157 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -2406,6 +2406,62 @@ cal_client_remove_object (CalClient *client, const char *uid) return retval; } +CalClientResult +cal_client_send_object (CalClient *client, icalcomponent *icalcomp, + icalcomponent **new_icalcomp, GList **users) +{ + CalClientPrivate *priv; + CORBA_Environment ev; + CalClientResult retval; + GNOME_Evolution_Calendar_UserList *user_list; + char *obj_string; + int i; + + g_return_val_if_fail (client != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT); + g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_RESULT_INVALID_OBJECT); + + priv = client->priv; + g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, + CAL_CLIENT_RESULT_INVALID_OBJECT); + + g_return_val_if_fail (icalcomp != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT); + + /* Libical owns this memory, using one of its temporary buffers. */ + obj_string = icalcomponent_as_ical_string (icalcomp); + + CORBA_exception_init (&ev); + obj_string = GNOME_Evolution_Calendar_Cal_sendObject (priv->cal, obj_string, &user_list, &ev); + + if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject)) + retval = CAL_CLIENT_SEND_INVALID_OBJECT; + else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_Busy)) + retval = CAL_CLIENT_SEND_BUSY; + else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied)) + retval = CAL_CLIENT_SEND_PERMISSION_DENIED; + else if (BONOBO_EX (&ev)) { + g_message ("cal_client_update_objects(): could not send the objects"); + retval = CAL_CLIENT_SEND_CORBA_ERROR; + } else { + retval = CAL_CLIENT_RESULT_SUCCESS; + + *new_icalcomp = icalparser_parse_string (obj_string); + CORBA_free (obj_string); + + if (*new_icalcomp == NULL) { + retval = CAL_CLIENT_RESULT_INVALID_OBJECT; + } else { + *users = NULL; + for (i = 0; i < user_list->_length; i++) + *users = g_list_append (*users, g_strdup (user_list->_buffer[i])); + CORBA_free (user_list); + } + } + + CORBA_exception_free (&ev); + + return retval; +} + /** * cal_client_get_query: * @client: A calendar client. diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index 578edd4ee9..68bef1e96c 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -74,6 +74,14 @@ typedef enum { CAL_CLIENT_RESULT_PERMISSION_DENIED } CalClientResult; +typedef enum { + CAL_CLIENT_SEND_SUCCESS, + CAL_CLIENT_SEND_CORBA_ERROR, + CAL_CLIENT_SEND_INVALID_OBJECT, + CAL_CLIENT_SEND_BUSY, + CAL_CLIENT_SEND_PERMISSION_DENIED +} CalClientSendResult; + /* Whether the client is not loaded, is being loaded, or is already loaded */ typedef enum { CAL_CLIENT_LOAD_NOT_LOADED, @@ -175,6 +183,9 @@ CalClientResult cal_client_update_objects (CalClient *client, icalcomponent *ica CalClientResult cal_client_remove_object (CalClient *client, const char *uid); +CalClientSendResult cal_client_send_object (CalClient *client, icalcomponent *icalcomp, + icalcomponent **new_icalcomp, GList **users); + CalQuery *cal_client_get_query (CalClient *client, const char *sexp); /* Resolves TZIDs for the recurrence generator. */ diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 87f4124f19..e758a9f853 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -1199,7 +1199,6 @@ static void show_current_todo (EItipControl *itip) { EItipControlPrivate *priv; - CalComponent *comp; const gchar *itip_title, *itip_desc; char *options; diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index e90ff24c13..4e166efbf2 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -261,6 +261,121 @@ typedef struct { icalcomponent *zones; } ItipUtilTZData; + +static void +foreach_tzid_callback (icalparameter *param, gpointer data) +{ + ItipUtilTZData *tz_data = data; + const char *tzid; + icaltimezone *zone = NULL; + icalcomponent *vtimezone_comp; + + /* Get the TZID string from the parameter. */ + tzid = icalparameter_get_tzid (param); + if (!tzid || g_hash_table_lookup (tz_data->tzids, tzid)) + return; + + /* 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. */ + vtimezone_comp = icaltimezone_get_component (zone); + if (!vtimezone_comp) + return; + + icalcomponent_add_component (tz_data->icomp, icalcomponent_new_clone (vtimezone_comp)); + g_hash_table_insert (tz_data->tzids, (char *)tzid, (char *)tzid); +} + +static icalcomponent * +comp_toplevel_with_zones (CalComponentItipMethod method, CalComponent *comp, CalClient *client, icalcomponent *zones) +{ + icalcomponent *top_level, *icomp; + icalproperty *prop; + icalvalue *value; + ItipUtilTZData tz_data; + + top_level = cal_util_new_top_level (); + + prop = icalproperty_new (ICAL_METHOD_PROPERTY); + value = icalvalue_new_method (itip_methods_enum[method]); + icalproperty_set_value (prop, value); + icalcomponent_add_property (top_level, prop); + + icomp = cal_component_get_icalcomponent (comp); + + if (method == CAL_COMPONENT_METHOD_REPLY) { + struct icaltimetype dtstamp; + gboolean add_it = FALSE; + + /* workaround for Outlook expecting a X-MICROSOFT-CDO-REPLYTIME + on every METHOD=REPLY message. If the component has any of + the X-MICROSOFT-* properties, we add the REPLYTIME one */ + prop = icalcomponent_get_first_property (icomp, ICAL_X_PROPERTY); + while (prop) { + const char *x_name; + + x_name = icalproperty_get_x_name (prop); + if (!strncmp (x_name, "X-MICROSOFT-", strlen ("X-MICROSOFT-"))) { + add_it = TRUE; + break; + } + prop = icalcomponent_get_next_property (icomp, ICAL_X_PROPERTY); + } + + if (add_it) { + dtstamp = icaltime_from_timet_with_zone ( + time (NULL), 0, icaltimezone_get_utc_timezone ()); + prop = icalproperty_new_x (icaltime_as_ical_string (dtstamp)); + icalproperty_set_x_name (prop, "X-MICROSOFT-CDO-REPLYTIME"); + icalcomponent_add_property (icomp, prop); + } + } + + tz_data.tzids = g_hash_table_new (g_str_hash, g_str_equal); + 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); + + icalcomponent_add_component (top_level, icomp); + + return top_level; +} + +static icalproperty * +comp_has_attendee (icalcomponent *ical_comp, const char *address) +{ + icalproperty *prop; + + for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY); + prop != NULL; + prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY)) + { + icalvalue *value; + const char *attendee; + + value = icalproperty_get_value (prop); + if (!value) + continue; + + attendee = icalvalue_get_string (value); + + if (!g_strcasecmp (address, attendee)) + break; + } + + return prop; +} + static GNOME_Evolution_Composer_RecipientList * comp_to_list (CalComponentItipMethod method, CalComponent *comp) { @@ -440,99 +555,46 @@ comp_content_type (CalComponent *comp, CalComponentItipMethod method) } -static void -foreach_tzid_callback (icalparameter *param, gpointer data) +static icalcomponent * +comp_server_send (CalComponentItipMethod method, CalComponent *comp, CalClient *client, icalcomponent *zones) { - ItipUtilTZData *tz_data = data; - const char *tzid; - icaltimezone *zone = NULL; - icalcomponent *vtimezone_comp; - - /* Get the TZID string from the parameter. */ - tzid = icalparameter_get_tzid (param); - if (!tzid || g_hash_table_lookup (tz_data->tzids, tzid)) - return; - - /* 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. */ - vtimezone_comp = icaltimezone_get_component (zone); - if (!vtimezone_comp) - return; - - icalcomponent_add_component (tz_data->icomp, icalcomponent_new_clone (vtimezone_comp)); - g_hash_table_insert (tz_data->tzids, (char *)tzid, (char *)tzid); -} + CalClientResult result; + icalcomponent *top_level, *new_top_level = NULL; + GList *users; + + top_level = comp_toplevel_with_zones (method, comp, client, zones); + result = cal_client_send_object (client, top_level, &new_top_level, &users); -static char * -comp_string (CalComponentItipMethod method, CalComponent *comp, CalClient *client, icalcomponent *zones) -{ - icalcomponent *top_level, *icomp; - icalproperty *prop; - icalvalue *value; - gchar *ical_string; - ItipUtilTZData tz_data; + if (result == CAL_CLIENT_SEND_SUCCESS) { + icalcomponent *ical_comp, *clone; + icalproperty *prop; + GList *l; - top_level = cal_util_new_top_level (); - - prop = icalproperty_new (ICAL_METHOD_PROPERTY); - value = icalvalue_new_method (itip_methods_enum[method]); - icalproperty_set_value (prop, value); - icalcomponent_add_property (top_level, prop); - - icomp = cal_component_get_icalcomponent (comp); - - if (method == CAL_COMPONENT_METHOD_REPLY) { - struct icaltimetype dtstamp; - gboolean add_it = FALSE; - - /* workaround for Outlook expecting a X-MICROSOFT-CDO-REPLYTIME - on every METHOD=REPLY message. If the component has any of - the X-MICROSOFT-* properties, we add the REPLYTIME one */ - prop = icalcomponent_get_first_property (icomp, ICAL_X_PROPERTY); - while (prop) { - const char *x_name; - - x_name = icalproperty_get_x_name (prop); - if (!strncmp (x_name, "X-MICROSOFT-", strlen ("X-MICROSOFT-"))) { - add_it = TRUE; - break; - } - prop = icalcomponent_get_next_property (icomp, ICAL_X_PROPERTY); + ical_comp = icalcomponent_get_inner (new_top_level); + clone = icalcomponent_new_clone (ical_comp); + + for (l = users; l != NULL; l = l->next) { + prop = comp_has_attendee (ical_comp, l->data); + if (prop != NULL) + icalcomponent_remove_property (ical_comp, prop); } - if (add_it) { - dtstamp = icaltime_from_timet_with_zone ( - time (NULL), 0, icaltimezone_get_utc_timezone ()); - prop = icalproperty_new_x (icaltime_as_ical_string (dtstamp)); - icalproperty_set_x_name (prop, "X-MICROSOFT-CDO-REPLYTIME"); - icalcomponent_add_property (icomp, prop); + cal_component_set_icalcomponent (comp, clone); + + if (icalcomponent_count_properties (ical_comp, ICAL_ATTENDEE_PROPERTY) == 0) { + icalcomponent_free (new_top_level); + icalcomponent_free (top_level); + return NULL; } } - - /* Add the timezones */ - tz_data.tzids = g_hash_table_new (g_str_hash, g_str_equal); - 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); - icalcomponent_add_component (top_level, icomp); - ical_string = icalcomponent_as_ical_string (top_level); - icalcomponent_remove_component (top_level, icomp); - + /* Just return what was sent if something broke */ + if (new_top_level == NULL) + return top_level; + icalcomponent_free (top_level); - - return ical_string; + + return new_top_level; } static gboolean @@ -776,6 +838,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, BonoboObjectClient *bonobo_server; GNOME_Evolution_Composer composer_server; CalComponent *comp = NULL; + icalcomponent *top_level = NULL; GNOME_Evolution_Composer_RecipientList *to_list = NULL; GNOME_Evolution_Composer_RecipientList *cc_list = NULL; GNOME_Evolution_Composer_RecipientList *bcc_list = NULL; @@ -796,6 +859,12 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, if (comp == NULL) goto cleanup; + /* Give the server a chance to manipulate the comp */ + top_level = comp_server_send (method, comp, client, zones); + if (top_level == NULL) + goto cleanup; + + /* Recipients */ to_list = comp_to_list (method, comp); if (to_list == NULL) goto cleanup; @@ -818,7 +887,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, /* Content type */ content_type = comp_content_type (comp, method); - ical_string = comp_string (method, comp, client, zones); + ical_string = icalcomponent_as_ical_string (top_level); attach_data = GNOME_Evolution_Composer_AttachmentData__alloc (); attach_data->_length = strlen (ical_string) + 1; attach_data->_maximum = attach_data->_length; @@ -847,7 +916,9 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, if (comp != NULL) gtk_object_unref (GTK_OBJECT (comp)); - + if (top_level != NULL) + icalcomponent_free (top_level); + if (to_list != NULL) CORBA_free (to_list); if (cc_list != NULL) diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl index 9a7b0929dd..1153b5307d 100644 --- a/calendar/idl/evolution-calendar.idl +++ b/calendar/idl/evolution-calendar.idl @@ -132,6 +132,7 @@ module Calendar { exception InvalidObject {}; exception CouldNotCreate {}; exception PermissionDenied {}; + exception Busy {}; /* A calendar is identified by its URI */ readonly attribute string uri; @@ -206,6 +207,10 @@ module Calendar { void removeObject (in CalObjUID uid) raises (NotFound, PermissionDenied); + /* Sends a component */ + CalObj sendObject (in CalObj calobj, out UserList users) + raises (InvalidObject, PermissionDenied, Busy); + /* Initiates a live query of the calendar. Returns a handle * to the live query itself; changes to components that are * present in the query are notified to the listener. diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index ad15d0433c..9b531412e8 100644 --- a/calendar/pcs/cal-backend-file.c +++ b/calendar/pcs/cal-backend-file.c @@ -124,6 +124,10 @@ static CalBackendResult cal_backend_file_update_objects (CalBackend *backend, const char *calobj); static CalBackendResult cal_backend_file_remove_object (CalBackend *backend, const char *uid); +static CalBackendSendResult cal_backend_file_send_object (CalBackend *backend, + const char *calobj, gchar **new_calobj, + GNOME_Evolution_Calendar_UserList **user_list); + static icaltimezone* cal_backend_file_get_timezone (CalBackend *backend, const char *tzid); static icaltimezone* cal_backend_file_get_default_timezone (CalBackend *backend); static gboolean cal_backend_file_set_default_timezone (CalBackend *backend, @@ -199,6 +203,7 @@ cal_backend_file_class_init (CalBackendFileClass *class) backend_class->get_alarms_for_object = cal_backend_file_get_alarms_for_object; backend_class->update_objects = cal_backend_file_update_objects; backend_class->remove_object = cal_backend_file_remove_object; + backend_class->send_object = cal_backend_file_send_object; backend_class->get_timezone = cal_backend_file_get_timezone; backend_class->get_default_timezone = cal_backend_file_get_default_timezone; @@ -1897,6 +1902,17 @@ cal_backend_file_remove_object (CalBackend *backend, const char *uid) return CAL_BACKEND_RESULT_SUCCESS; } +static CalBackendSendResult +cal_backend_file_send_object (CalBackend *backend, const char *calobj, char **new_calobj, + GNOME_Evolution_Calendar_UserList **user_list) +{ + *new_calobj = g_strdup (calobj); + + *user_list = GNOME_Evolution_Calendar_UserList__alloc (); + (*user_list)->_length = 0; + + return CAL_BACKEND_SEND_SUCCESS; +} static icaltimezone* cal_backend_file_get_timezone (CalBackend *backend, const char *tzid) diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 50aeb148e2..02254f07c5 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -158,6 +158,7 @@ cal_backend_class_init (CalBackendClass *class) class->get_alarms_for_object = NULL; class->update_objects = NULL; class->remove_object = NULL; + class->send_object = NULL; } @@ -709,6 +710,18 @@ cal_backend_remove_object (CalBackend *backend, const char *uid) return (* CLASS (backend)->remove_object) (backend, uid); } +CalBackendSendResult +cal_backend_send_object (CalBackend *backend, const char *calobj, char **new_calobj, + GNOME_Evolution_Calendar_UserList **user_list) +{ + g_return_val_if_fail (backend != NULL, CAL_BACKEND_SEND_INVALID_OBJECT); + g_return_val_if_fail (IS_CAL_BACKEND (backend), CAL_BACKEND_SEND_INVALID_OBJECT); + g_return_val_if_fail (calobj != NULL, CAL_BACKEND_SEND_INVALID_OBJECT); + + g_assert (CLASS (backend)->send_object != NULL); + return (* CLASS (backend)->send_object) (backend, calobj, new_calobj, user_list); +} + /** * cal_backend_last_client_gone: * @backend: A calendar backend. diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h index b3647d9720..69efb86c1a 100644 --- a/calendar/pcs/cal-backend.h +++ b/calendar/pcs/cal-backend.h @@ -59,6 +59,14 @@ typedef enum { CAL_BACKEND_RESULT_PERMISSION_DENIED } CalBackendResult; +/* Send result values */ +typedef enum { + CAL_BACKEND_SEND_SUCCESS, + CAL_BACKEND_SEND_INVALID_OBJECT, + CAL_BACKEND_SEND_BUSY, + CAL_BACKEND_SEND_PERMISSION_DENIED, +} CalBackendSendResult; + /* Result codes for ::get_alarms_in_range() */ typedef enum { CAL_BACKEND_GET_ALARMS_SUCCESS, @@ -124,6 +132,9 @@ struct _CalBackendClass { CalBackendResult (* update_objects) (CalBackend *backend, const char *calobj); CalBackendResult (* remove_object) (CalBackend *backend, const char *uid); + CalBackendSendResult (* send_object) (CalBackend *backend, const char *calobj, char **new_calobj, + GNOME_Evolution_Calendar_UserList **user_list); + /* Timezone related virtual methods */ icaltimezone *(* get_timezone) (CalBackend *backend, const char *tzid); icaltimezone *(* get_default_timezone) (CalBackend *backend); @@ -183,6 +194,9 @@ CalBackendResult cal_backend_update_objects (CalBackend *backend, const char *ca CalBackendResult cal_backend_remove_object (CalBackend *backend, const char *uid); +CalBackendSendResult cal_backend_send_object (CalBackend *backend, const char *calobj, char **new_calobj, + GNOME_Evolution_Calendar_UserList **user_list); + icaltimezone* cal_backend_get_timezone (CalBackend *backend, const char *tzid); icaltimezone* cal_backend_get_default_timezone (CalBackend *backend); diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index 26ed90de76..4f8ff173f0 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -441,6 +441,49 @@ impl_Cal_remove_object (PortableServer_Servant servant, } } +/* Cal::send_object method */ +static GNOME_Evolution_Calendar_CalObj +impl_Cal_send_object (PortableServer_Servant servant, + const GNOME_Evolution_Calendar_CalObj calobj, + GNOME_Evolution_Calendar_UserList **user_list, + CORBA_Environment *ev) +{ + Cal *cal; + CalPrivate *priv; + CORBA_char *calobj_copy; + char *new_calobj; + CalBackendSendResult result; + + cal = CAL (bonobo_object_from_servant (servant)); + priv = cal->priv; + + result = cal_backend_send_object (priv->backend, calobj, &new_calobj, user_list); + switch (result) { + case CAL_BACKEND_SEND_SUCCESS: + calobj_copy = CORBA_string_dup (calobj); + g_free (new_calobj); + + return calobj_copy; + + case CAL_BACKEND_SEND_INVALID_OBJECT: + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject); + break; + + case CAL_BACKEND_SEND_BUSY: + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_Busy); + break; + + case CAL_BACKEND_SEND_PERMISSION_DENIED: + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied); + break; + + default : + g_assert_not_reached (); + } + + return NULL; +} + /* Cal::getQuery implementation */ static GNOME_Evolution_Calendar_Query impl_Cal_get_query (PortableServer_Servant servant, @@ -671,6 +714,7 @@ cal_class_init (CalClass *klass) epv->getAlarmsForObject = impl_Cal_get_alarms_for_object; epv->updateObjects = impl_Cal_update_objects; epv->removeObject = impl_Cal_remove_object; + epv->sendObject = impl_Cal_send_object; epv->getQuery = impl_Cal_get_query; } |