From 51012e60d827b73a7bfd42b921760b0835dc7b66 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 7 Aug 2002 19:34:07 +0000 Subject: just return the object untouched since we don't send anything 2002-08-07 JP Rosevear * 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 --- calendar/cal-client/cal-client.c | 56 ++++++++++++++++++++++++++++++++++++++++ calendar/cal-client/cal-client.h | 11 ++++++++ 2 files changed, 67 insertions(+) (limited to 'calendar/cal-client') 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. */ -- cgit v1.2.3