diff options
author | Seth Alves <alves@src.gnome.org> | 2000-06-29 21:23:44 +0800 |
---|---|---|
committer | Seth Alves <alves@src.gnome.org> | 2000-06-29 21:23:44 +0800 |
commit | 70c974e7d9d44db682cd9cc447485f292ad2aa54 (patch) | |
tree | 83d68fc016f555e36e8fa010d1f8b2367307fff3 /calendar/pcs/cal-backend-imc.c | |
parent | fe1bb9d0b60ab6a1b8a8c525d28d0b09d2d74641 (diff) | |
download | gsoc2013-evolution-70c974e7d9d44db682cd9cc447485f292ad2aa54.tar.gz gsoc2013-evolution-70c974e7d9d44db682cd9cc447485f292ad2aa54.tar.zst gsoc2013-evolution-70c974e7d9d44db682cd9cc447485f292ad2aa54.zip |
server code to service these:
* pcs/cal.c (Cal_get_uid_by_pilot_id):
(Cal_update_pilot_id):
* pcs/cal-backend-imc.c (cal_backend_imc_update_pilot_id):
(cal_backend_imc_get_uid_by_pilot_id):
* pcs/cal-backend.c (cal_backend_get_uid_by_pilot_id):
(cal_backend_update_pilot_id): server code to service these:
* gui/calendar-pilot-sync.c: updated to make use of cal-client.
also uses dirty bits on both sides to aid in syncing.
* cal-client/cal-client.c (cal_client_get_uid_by_pilot_id): new
function -- ask the cal server to return uid given an object's
pilot id.
(cal_client_update_pilot_id): new function -- inform the
cal server of an objects pilot id and pilot dirty-flag.
svn path=/trunk/; revision=3789
Diffstat (limited to 'calendar/pcs/cal-backend-imc.c')
-rw-r--r-- | calendar/pcs/cal-backend-imc.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/calendar/pcs/cal-backend-imc.c b/calendar/pcs/cal-backend-imc.c index 7999d97d6e..3e079218cf 100644 --- a/calendar/pcs/cal-backend-imc.c +++ b/calendar/pcs/cal-backend-imc.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* Evolution calendar - Internet Mail Consortium formats backend * * Copyright (C) 2000 Helix Code, Inc. @@ -86,6 +87,12 @@ static gboolean cal_backend_imc_get_alarms_for_object (CalBackend *backend, cons static gboolean cal_backend_imc_update_object (CalBackend *backend, const char *uid, const char *calobj); static gboolean cal_backend_imc_remove_object (CalBackend *backend, const char *uid); +static char *cal_backend_imc_get_uid_by_pilot_id (CalBackend *backend, unsigned long int pilot_id); +static void cal_backend_imc_update_pilot_id (CalBackend *backend, + const char *uid, + unsigned long int pilot_id, + unsigned long int pilot_status); + static CalBackendClass *parent_class; @@ -147,6 +154,8 @@ cal_backend_imc_class_init (CalBackendIMCClass *class) backend_class->get_alarms_for_object = cal_backend_imc_get_alarms_for_object; backend_class->update_object = cal_backend_imc_update_object; backend_class->remove_object = cal_backend_imc_remove_object; + backend_class->get_uid_by_pilot_id = cal_backend_imc_get_uid_by_pilot_id; + backend_class->update_pilot_id = cal_backend_imc_update_pilot_id; object_class->destroy = cal_backend_imc_destroy; } @@ -969,6 +978,65 @@ cal_backend_imc_get_uids (CalBackend *backend, CalObjType type) return c.uid_list; } + + +static char * +cal_backend_imc_get_uid_by_pilot_id (CalBackend *backend, + unsigned long int pilot_id) +{ + CalBackendIMC *cbimc; + IMCPrivate *priv; + GList *l; + iCalObject *obj = NULL; + + g_return_val_if_fail (backend != NULL, NULL); + cbimc = CAL_BACKEND_IMC (backend); + priv = cbimc->priv; + g_return_val_if_fail (priv->loaded, NULL); + + for (l = priv->events; l; l = l->next){ + obj = l->data; + if (obj->pilot_id == pilot_id) + goto done; + } + + for (l = priv->todos; l; l = l->next){ + obj = l->data; + if (obj->pilot_id == pilot_id) + goto done; + } + + done: + if (!obj || obj->pilot_id != pilot_id) + return NULL; + + return g_strdup (obj->uid); +} + + +void +cal_backend_imc_update_pilot_id (CalBackend *backend, + const char *uid, + unsigned long int pilot_id, + unsigned long int pilot_status) +{ + CalBackendIMC *cbimc; + IMCPrivate *priv; + iCalObject *obj; + + g_return_if_fail (backend != NULL); + cbimc = CAL_BACKEND_IMC (backend); + priv = cbimc->priv; + g_return_if_fail (priv->loaded); + + obj = lookup_object (cbimc, uid); + + obj->pilot_id = pilot_id; + obj->pilot_status = pilot_status; +} + + + /* Allocates and fills in a new CalObjInstance structure */ static CalObjInstance * build_cal_obj_instance (iCalObject *ico, time_t start, time_t end) @@ -1310,6 +1378,7 @@ cal_backend_imc_update_object (CalBackend *backend, const char *uid, const char remove_object (cbimc, ico); add_object (cbimc, new_ico); + new_ico->pilot_status = ICAL_PILOT_SYNC_MOD; save (cbimc); /* FIXME: do the notification asynchronously */ |