Re: [evolution-patches] GroupWise Calendar: Moving out of getQM
- From: "Pasupathilingam Sankarasivasubramanian" <psankar novell com>
- To: "chenthill" <PChenthill novell com>
- Cc: evolution-patches lists ximian com, S Shreyas <SShreyas novell com>
- Subject: Re: [evolution-patches] GroupWise Calendar: Moving out of getQM
- Date: Thu, 07 Jul 2005 10:40:43 -0600
Thanks for the review. I have made all the changes suggested by you. But, I update the cache with the serverUTCTime during the loginResponse. However, the place where I did this earlier was wrong and so I have moved it to where it is appropriate (connect_to_server).
I have also defined a new cursor limit variable CURSOR_ICALID_LIMIT . I have given a heuristical value of 200 for it. Tell me a nice value if it appears minimal.
Thanks,
Sankar P
>>> chenthill <pchenthill novell com> 07/07/05 2:08 pm >>>
The patch has other changes, please send the patch with only your
changes. The time stamp should be written into the file once the second
getItemsResponse is received successfully. If the timestamp is
corrupted, the populated flag should not be removed, which would result
in getting all the items from the server and that function is not
needed.
char *http_uri;
+ int permissions, flag;
These variables should be declared inside the block of the code where
you use it. The timestamp from loginresponse should be set in cache only
once while loading all the calendar items.
thanks, chenthill.
Index: servers/groupwise/e-gw-connection.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v
retrieving revision 1.122
diff -u -p -r1.122 e-gw-connection.c
--- servers/groupwise/e-gw-connection.c 6 Jul 2005 09:33:18 -0000 1.122
+++ servers/groupwise/e-gw-connection.c 7 Jul 2005 16:30:33 -0000
@@ -36,7 +36,7 @@
static GObjectClass *parent_class = NULL;
-static GHashTable *loaded_connections = NULL;
+static GHashTable *loaded_connections_permissions = NULL;
struct _EGwConnectionPrivate {
SoupSession *soup_session;
@@ -221,16 +221,16 @@ e_gw_connection_dispose (GObject *object
printf ("gw connection dispose \n");
/* removed the connection from the hash table */
- if (loaded_connections != NULL) {
+ if (loaded_connections_permissions != NULL) {
hash_key = g_strdup_printf ("%s:%s %s",
priv->username ? priv->username : "",
priv->password ? priv->password : "",
priv->uri);
- if (g_hash_table_lookup_extended (loaded_connections, hash_key, &orig_key, &orig_value)) {
- g_hash_table_remove (loaded_connections, hash_key);
- if (g_hash_table_size (loaded_connections) == 0) {
- g_hash_table_destroy (loaded_connections);
- loaded_connections = NULL;
+ if (g_hash_table_lookup_extended (loaded_connections_permissions, hash_key, &orig_key, &orig_value)) {
+ g_hash_table_remove (loaded_connections_permissions, hash_key);
+ if (g_hash_table_size (loaded_connections_permissions) == 0) {
+ g_hash_table_destroy (loaded_connections_permissions);
+ loaded_connections_permissions = NULL;
}
g_free (orig_key);
@@ -418,12 +418,12 @@ e_gw_connection_new (const char *uri, co
g_static_mutex_lock (&connecting);
/* search the connection in our hash table */
- if (loaded_connections != NULL) {
+ if (loaded_connections_permissions != NULL) {
hash_key = g_strdup_printf ("%s:%s %s",
username ? username : "",
password ? password : "",
uri);
- cnc = g_hash_table_lookup (loaded_connections, hash_key);
+ cnc = g_hash_table_lookup (loaded_connections_permissions, hash_key);
g_free (hash_key);
if (E_IS_GW_CONNECTION (cnc)) {
@@ -527,14 +527,14 @@ e_gw_connection_new (const char *uri, co
if (param)
cnc->priv->server_time = soup_soap_parameter_get_string_value (param);
- /* add the connection to the loaded_connections hash table */
+ /* add the connection to the loaded_connections_permissions hash table */
hash_key = g_strdup_printf ("%s:%s %s",
cnc->priv->username ? cnc->priv->username : "",
cnc->priv->password ? cnc->priv->password : "",
cnc->priv->uri);
- if (loaded_connections == NULL)
- loaded_connections = g_hash_table_new (g_str_hash, g_str_equal);
- g_hash_table_insert (loaded_connections, hash_key, cnc);
+ if (loaded_connections_permissions == NULL)
+ loaded_connections_permissions = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (loaded_connections_permissions, hash_key, cnc);
/* free memory */
g_object_unref (response);
@@ -3350,3 +3350,76 @@ e_gw_connection_remove_junk_entry (EGwCo
return status;
}
+
+EGwConnectionStatus
+e_gw_connection_read_ical_ids (EGwConnection *cnc, const char *container, int cursor, gboolean forward, int count, const char *cursor_seek, GList **list)
+{
+ SoupSoapMessage *msg;
+ SoupSoapResponse *response;
+ EGwConnectionStatus status;
+ SoupSoapParameter *param, *subparam, *child;
+ const char *name, *value;
+ g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
+ g_return_val_if_fail ((container != NULL), E_GW_CONNECTION_STATUS_UNKNOWN);
+
+ msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "readCursorRequest");
+ e_gw_message_write_int_parameter (msg, "cursor", NULL, cursor);
+ /* there is problem in read curosr if you set this, uncomment after the problem
+ is fixed in server */
+ e_gw_message_write_string_parameter (msg, "position", NULL, cursor_seek);
+ e_gw_message_write_string_parameter (msg, "forward", NULL, forward ? "true": "false");
+ e_gw_message_write_string_parameter (msg, "container", NULL, container);
+ e_gw_message_write_int_parameter (msg, "count", NULL, count);
+
+ e_gw_message_write_footer (msg);
+
+ /* send message to server */
+ response = e_gw_connection_send_message (cnc, msg);
+ if (!response) {
+ g_object_unref (msg);
+ return E_GW_CONNECTION_STATUS_NO_RESPONSE;
+ }
+
+ status = e_gw_connection_parse_response_status (response);
+ if (status != E_GW_CONNECTION_STATUS_OK) {
+ if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+ reauthenticate (cnc);
+ g_object_unref (response);
+ g_object_unref (msg);
+ return status;
+ }
+
+ /* if status is OK - parse result. return the list */
+ param = soup_soap_response_get_first_parameter_by_name (response, "items");
+ if (!param) {
+ g_object_unref (response);
+ g_object_unref (msg);
+ return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
+ }
+
+ /* parse these parameters into ecalcomponents*/
+ for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
+ subparam != NULL;
+ subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
+
+ for (child = soup_soap_parameter_get_first_child (subparam);
+ child != NULL;
+ child = soup_soap_parameter_get_next_child (child)) {
+
+ name = soup_soap_parameter_get_name (child);
+
+ if (!g_ascii_strcasecmp (name, "iCalId")) {
+ value = NULL;
+ value = soup_soap_parameter_get_string_value (child);
+ if (value)
+ *list = g_list_append (*list, g_strdup(value));
+ }
+ }
+ }
+ /* free memory */
+ g_object_unref (response);
+ g_object_unref (msg);
+ return E_GW_CONNECTION_STATUS_OK;
+}
+
+
Index: servers/groupwise/e-gw-connection.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.h,v
retrieving revision 1.61
diff -u -p -r1.61 e-gw-connection.h
--- servers/groupwise/e-gw-connection.h 6 Jul 2005 09:33:18 -0000 1.61
+++ servers/groupwise/e-gw-connection.h 7 Jul 2005 16:30:33 -0000
@@ -26,6 +26,7 @@
#include <glib-object.h>
#include <libsoup/soup-soap-message.h>
+#include "e-gw-proxy.h"
#include "e-gw-container.h"
#include "e-gw-item.h"
#include "e-gw-filter.h"
@@ -163,6 +164,7 @@ EGwConnectionStatus e_gw_connection_get_
EGwConnectionStatus e_gw_connection_modify_junk_settings (EGwConnection *cnc, int use_junk, int use_block, int use_pab , int persistence);
EGwConnectionStatus e_gw_connection_get_junk_entries (EGwConnection *cnc, GList **entries);
EGwConnectionStatus e_gw_connection_remove_junk_entry (EGwConnection *cnc, const char *id);
+EGwConnectionStatus e_gw_connection_read_ical_ids (EGwConnection *cnc, const char *container, int cursor, gboolean forward, int count, const char *cursor_seek, GList **list);
G_END_DECLS
#endif
Index: servers/groupwise/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.147
diff -u -p -r1.147 ChangeLog
--- servers/groupwise/ChangeLog 6 Jul 2005 09:33:18 -0000 1.147
+++ servers/groupwise/ChangeLog 7 Jul 2005 16:30:33 -0000
@@ -1,3 +1,10 @@
+2005-07-07 Sankar P <psankar novell com>
+
+ * e-gw-connection.[ch] :
+ (e_gw_connection_read_ical_ids): Added function which is necessary for
+ identifying deleted appointments, meetings and tasks. This is created as part of
+ the movement to getItems from getQuickMessages.
+
2005-07-06 Parthasarathi Susarla <sparthasarathi novell com>
* e-gw-connection.[ch] :
@@ -13,7 +20,6 @@
(add_attachment_to_soap_message):
set itemReference in case of forwarded mails.
-
2005-07-05 Harish Krishnaswamy <kharish novell com>
* e-gw-item.c: (e_gw_item_new_from_soap_parameter),
Index: calendar/backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.148
diff -u -p -r1.148 e-cal-backend-groupwise.c
--- calendar/backends/groupwise/e-cal-backend-groupwise.c 2 Jul 2005 10:04:58 -0000 1.148
+++ calendar/backends/groupwise/e-cal-backend-groupwise.c 7 Jul 2005 16:30:34 -0000
@@ -78,6 +78,7 @@ static ECalBackendClass *parent_class =
/* Time interval in milliseconds for obtaining changes from server and refresh the cache. */
#define CACHE_REFRESH_INTERVAL 600000
#define CURSOR_ITEM_LIMIT 100
+#define CURSOR_ICALID_LIMIT 200
EGwConnection *
e_cal_backend_groupwise_get_connection (ECalBackendGroupwise *cbgw) {
@@ -207,58 +208,89 @@ populate_cache (ECalBackendGroupwise *cb
static gboolean
get_deltas (gpointer handle)
{
- ECalBackendGroupwise *cbgw;
+ ECalBackendGroupwise *cbgw;
ECalBackendGroupwisePrivate *priv;
EGwConnection *cnc;
- ECalBackendCache *cache;
- EGwConnectionStatus status;
+ ECalBackendCache *cache;
+ EGwConnectionStatus status;
icalcomponent_kind kind;
- GSList *item_list, *cache_keys, *l;
+ GSList *cache_keys, *l;
+ GList *l1, *item_list;
char *comp_str;
+
char *time_string = NULL;
char t_str [100];
const char *serv_time;
- struct stat buf;
+ const char *position;
static GStaticMutex connecting = G_STATIC_MUTEX_INIT;
-
+ const char *time_interval_string;
+ const char *key = "attempts";
+ const char *attempts;
+
+ EGwFilter *filter;
+ gboolean done = FALSE;
+ int time_interval;
+ int cursor = 0;
+ icaltimetype temp;
+ struct tm *tm;
+ time_t current_time;
+
if (!handle)
return FALSE;
cbgw = (ECalBackendGroupwise *) handle;
priv= cbgw->priv;
kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbgw));
- cnc = priv->cnc;
- cache = priv->cache;
+ cnc = priv->cnc;
+ cache = priv->cache;
item_list = NULL;
-
+
if (priv->mode == CAL_MODE_LOCAL)
return FALSE;
+ attempts = e_cal_backend_cache_get_key_value (cache, key);
+
g_static_mutex_lock (&connecting);
serv_time = e_cal_backend_cache_get_server_utc_time (cache);
if (serv_time) {
g_strlcpy (t_str, e_cal_backend_cache_get_server_utc_time (cache), 100);
if (!*t_str || !strcmp (t_str, "")) {
- icaltimetype temp;
- time_t current_time;
- const struct tm *tm;
-
- g_warning (" Could not get the correct time stamp for using in getQuick Messages\n");
+ /* FIXME: Should think of something other than getting all items again */
+ g_warning ("\n\a Could not get the correct time stamp. \n\a");
temp = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
current_time = icaltime_as_timet_with_zone (temp, icaltimezone_get_utc_timezone ());
tm = gmtime (¤t_time);
strftime (t_str, 100, "%Y-%m-%dT%H:%M:%SZ", tm);
}
- time_string = g_strdup (t_str);
+ } else {
+ /* FIXME: Should think of something other than getting all items again */
+ g_warning ("\n\a Could not get the correct time stamp. \n\a");
+ temp = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+ current_time = icaltime_as_timet_with_zone (temp, icaltimezone_get_utc_timezone ());
+ tm = gmtime (¤t_time);
+ strftime (t_str, 100, "%Y-%m-%dT%H:%M:%SZ", tm);
}
+ time_string = g_strdup (t_str);
+ filter = e_gw_filter_new ();
- status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id, "attachments recipients message recipientStatus default peek", &time_string, "New", "CalendarItem", NULL, -1, &item_list);
-
+ //NewItems created after the time-stamp
+ e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_GREATERTHAN, "created", time_string);
+
+ status = e_gw_connection_get_items (cnc, cbgw->priv->container_id, "attachments recipients message recipientStatus default peek", filter, &item_list);
if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
- status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id, "attachments recipients message recipientStatus default peek", &time_string, "New", "CalendarItem", NULL, -1, &item_list);
-
+ status = e_gw_connection_get_items (cnc, cbgw->priv->container_id, "attachments recipients message recipientStatus default peek", filter, &item_list);
+
+ g_object_unref (filter);
+
if (status != E_GW_CONNECTION_STATUS_OK) {
-
+ if (!attempts) {
+ e_cal_backend_cache_put_key_value (cache, key, "2");
+ } else {
+ int failures;
+ failures = g_ascii_strtod(attempts, NULL) + 1;
+ e_cal_backend_cache_put_key_value (cache, key, GINT_TO_POINTER (failures));
+ }
+
if (status == E_GW_CONNECTION_STATUS_NO_RESPONSE) {
g_static_mutex_unlock (&connecting);
return TRUE;
@@ -268,15 +300,14 @@ get_deltas (gpointer handle)
g_static_mutex_unlock (&connecting);
return TRUE;
}
- /* store the timestamp in the cache */
- e_cal_backend_cache_put_server_utc_time (cache, time_string);
- g_free (time_string), time_string = NULL;
-
e_file_cache_freeze_changes (E_FILE_CACHE (cache));
- for (; item_list != NULL; item_list = g_slist_next(item_list)) {
- EGwItem *item = E_GW_ITEM(item_list->data);
- ECalComponent *comp = e_gw_item_to_cal_component (item, cbgw);
-
+ for (; item_list != NULL; item_list = g_list_next(item_list)) {
+ EGwItem *item = NULL;
+ ECalComponent *comp = NULL;
+
+ item = E_GW_ITEM(item_list->data);
+ comp = e_gw_item_to_cal_component (item, cbgw);
+
e_cal_component_commit_sequence (comp);
if (comp) {
@@ -285,8 +316,11 @@ get_deltas (gpointer handle)
else {
if (kind == icalcomponent_isa (e_cal_component_get_icalcomponent (comp))) {
comp_str = e_cal_component_get_as_string (comp);
- e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), comp_str);
- g_free (comp_str);
+ if (comp_str) {
+ e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), comp_str);
+ g_free (comp_str);
+ comp_str = NULL;
+ }
}
}
}
@@ -297,22 +331,30 @@ get_deltas (gpointer handle)
g_object_unref (item);
}
if (item_list) {
- g_slist_free (item_list);
+ g_list_free (item_list);
item_list = NULL;
}
e_file_cache_thaw_changes (E_FILE_CACHE (cache));
-
- /* We must use the same timestamp used for getQm call with message list New */
- time_string = g_strdup (t_str);
- status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id,"attachments recipients message recipientStatus default", &time_string, "Modified", "CalendarItem", NULL, -1, &item_list);
-
+ filter = e_gw_filter_new ();
+ //Items modified after the time-stamp
+ e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_GREATERTHAN, "modified", time_string);
+
+ status = e_gw_connection_get_items (cnc, cbgw->priv->container_id, "attachments recipients message recipientStatus default peek", filter, &item_list);
if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
- status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id,"recipients message recipientStatus default", &time_string, "Modified", "CalendarItem", NULL, -1, &item_list);
+ status = e_gw_connection_get_items (cnc, cbgw->priv->container_id, "attachments recipients message recipientStatus default peek", filter, &item_list);
+ g_object_unref (filter);
-
- g_free (time_string);
if (status != E_GW_CONNECTION_STATUS_OK) {
+
+ if (!attempts) {
+ e_cal_backend_cache_put_key_value (cache, key, "2");
+ } else {
+ int failures;
+ failures = g_ascii_strtod(attempts, NULL) + 1;
+ e_cal_backend_cache_put_key_value (cache, key, GINT_TO_POINTER (failures));
+ }
+
if (status == E_GW_CONNECTION_STATUS_NO_RESPONSE) {
g_static_mutex_unlock (&connecting);
return TRUE;
@@ -323,14 +365,15 @@ get_deltas (gpointer handle)
return TRUE;
}
-
e_file_cache_freeze_changes (E_FILE_CACHE (cache));
-
- for (; item_list != NULL; item_list = g_slist_next(item_list)) {
- EGwItem *item = E_GW_ITEM(item_list->data);
- ECalComponent *modified_comp, *cache_comp;
- char *cache_comp_str;
-
+
+ for (; item_list != NULL; item_list = g_list_next(item_list)) {
+ EGwItem *item = NULL;
+ item = E_GW_ITEM(item_list->data);
+ ECalComponent *modified_comp = NULL, *cache_comp = NULL;
+ char *cache_comp_str = NULL;
+
+
modified_comp = e_gw_item_to_cal_component (item, cbgw);
if (!modified_comp) {
g_message ("Invalid component returned in update");
@@ -344,6 +387,7 @@ get_deltas (gpointer handle)
cache_comp_str = e_cal_component_get_as_string (cache_comp);
e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), cache_comp_str, e_cal_component_get_as_string (modified_comp));
g_free (cache_comp_str);
+ cache_comp_str = NULL;
}
e_cal_backend_cache_put_component (cache, modified_comp);
g_object_unref (item);
@@ -351,15 +395,37 @@ get_deltas (gpointer handle)
}
e_file_cache_thaw_changes (E_FILE_CACHE (cache));
+ temp = icaltime_from_string (time_string);
+ current_time = icaltime_as_timet_with_zone (temp, icaltimezone_get_utc_timezone ());
+ tm = gmtime (¤t_time);
+
+ time_interval = (CACHE_REFRESH_INTERVAL / 60000);
+ time_interval_string = g_getenv ("GETQM_TIME_INTERVAL");
+ if (time_interval_string) {
+ time_interval = g_ascii_strtod (time_interval_string, NULL);
+ }
+ if (attempts) {
+ tm->tm_min += (time_interval * g_ascii_strtod (attempts, NULL));
+ e_cal_backend_cache_put_key_value (cache, key, NULL);
+ } else {
+ tm->tm_min += time_interval;
+ }
+ strftime (t_str, 100, "%Y-%m-%dT%H:%M:%SZ", tm);
+ time_string = g_strdup (t_str);
+
+ e_cal_backend_cache_put_server_utc_time (cache, time_string);
+
+ g_free (time_string);
+ time_string = NULL;
+
if (item_list) {
- g_slist_free (item_list);
+ g_list_free (item_list);
item_list = NULL;
}
-
- status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id, "iCalId", NULL, "All", "CalendarItem", NULL, -1, &item_list);
- if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
- status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id, "iCalId", NULL, "All", "CalendarItem", NULL, -1, &item_list);
+ position = E_GW_CURSOR_POSITION_END;
+ cursor = 0;
+ status = e_gw_connection_create_cursor (cnc, cbgw->priv->container_id, "iCalId", NULL, &cursor);
if (status != E_GW_CONNECTION_STATUS_OK) {
if (status == E_GW_CONNECTION_STATUS_NO_RESPONSE) {
@@ -374,23 +440,49 @@ get_deltas (gpointer handle)
/* handle deleted items here by going over the entire cache and
* checking for deleted items.*/
-
+
cache_keys = e_cal_backend_cache_get_keys (cache);
- for (l = item_list; l; l = g_slist_next (l)) {
- /* this works assuming rid is null*/
- cache_keys = g_slist_delete_link (cache_keys,
- g_slist_find_custom (cache_keys, l->data, (GCompareFunc) strcmp));
- g_free (l->data);
- }
+ done = FALSE;
+ while (!done) {
+ status = e_gw_connection_read_ical_ids (cnc, cbgw->priv->container_id, cursor, FALSE, CURSOR_ICALID_LIMIT, position, &item_list);
+ if (status != E_GW_CONNECTION_STATUS_OK) {
+ if (status == E_GW_CONNECTION_STATUS_NO_RESPONSE) {
+ g_static_mutex_unlock (&connecting);
+ return TRUE;
+ }
+ e_cal_backend_groupwise_notify_error_code (cbgw, status);
+ g_static_mutex_unlock (&connecting);
+ return TRUE;
+ }
+ /* handle deleted items here by going over the entire cache and
+ * checking for deleted items.*/
+ for (l1 = item_list; l1; l1 = g_list_next (l1)) {
+ char *icalid;
+ icalid = (char *)(l1->data);
+ cache_keys = g_slist_delete_link (cache_keys,
+ g_slist_find_custom (cache_keys, icalid, (GCompareFunc) strcmp));
+ if (l1->data)
+ g_free (l1->data);
+ }
+ if (!item_list || g_list_length (item_list) == 0)
+ done = TRUE;
+ if (item_list) {
+ g_list_free (item_list);
+ item_list = NULL;
+ }
+ position = E_GW_CURSOR_POSITION_CURRENT;
+ }
+ e_gw_connection_destroy_cursor (cnc, cbgw->priv->container_id, cursor);
e_file_cache_freeze_changes (E_FILE_CACHE (cache));
+
for (l = cache_keys; l ; l = g_slist_next (l)) {
/* assumes rid is null - which works for now */
ECalComponent *comp = NULL;
ECalComponentVType vtype;
comp = e_cal_backend_cache_get_component (cache, (const char *) l->data, NULL);
-
+
if (!comp)
continue;
@@ -399,7 +491,7 @@ get_deltas (gpointer handle)
(vtype == E_CAL_COMPONENT_TODO)) {
comp_str = e_cal_component_get_as_string (comp);
e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw),
- (char *) l->data, comp_str, NULL);
+ (char *) l->data, comp_str, NULL);
e_cal_backend_cache_remove_component (cache, (const char *) l->data, NULL);
g_free (comp_str);
}
@@ -408,17 +500,17 @@ get_deltas (gpointer handle)
e_file_cache_thaw_changes (E_FILE_CACHE (cache));
if (item_list) {
- g_slist_free (item_list);
+ g_list_free (item_list);
item_list = NULL;
}
if (cache_keys) {
g_slist_free (cache_keys);
item_list = NULL;
}
-
+
g_static_mutex_unlock (&connecting);
-
- return TRUE;
+
+ return TRUE;
}
static gboolean
@@ -654,6 +746,7 @@ connect_to_server (ECalBackendGroupwise
cbgw->priv->read_only = FALSE;
if (priv->cnc && priv->cache && priv->container_id) {
+ char *utc_str;
priv->mode = CAL_MODE_REMOTE;
if (priv->mode_changed && !priv->timeout_id && (e_cal_backend_get_kind (E_CAL_BACKEND (cbgw)) == ICAL_VEVENT_COMPONENT)) {
GThread *thread1;
@@ -668,9 +761,10 @@ connect_to_server (ECalBackendGroupwise
return GNOME_Evolution_Calendar_OtherError;
}
priv->timeout_id = g_timeout_add (CACHE_REFRESH_INTERVAL, (GSourceFunc) get_deltas_timeout, (gpointer)cbgw);
-
}
-
+ utc_str = (char *) e_gw_connection_get_server_time (priv->cnc);
+ e_cal_backend_cache_put_server_utc_time (priv->cache, utc_str);
+
return GNOME_Evolution_Calendar_Success;
}
priv->mode_changed = FALSE;
Index: calendar/libedata-cal/e-cal-backend-cache.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-cache.c,v
retrieving revision 1.22
diff -u -p -r1.22 e-cal-backend-cache.c
--- calendar/libedata-cal/e-cal-backend-cache.c 9 May 2005 12:24:35 -0000 1.22
+++ calendar/libedata-cal/e-cal-backend-cache.c 7 Jul 2005 16:30:34 -0000
@@ -753,3 +753,50 @@ e_cal_backend_cache_get_server_utc_time
return e_file_cache_get_object (E_FILE_CACHE (cache), "server_utc_time");
}
+
+/**
+ * e_cal_backend_cache_put_key_value:
+ * @cache: An #ECalBackendCache object.
+ * @keyp: The Key parameter to identify uniquely.
+ * @valuep: The value for the keyp parameter.
+ *
+ * Return value: TRUE if the operation was successful, FALSE otherwise.
+ */
+gboolean
+e_cal_backend_cache_put_key_value (ECalBackendCache *cache, const char *keyp, const char *valuep)
+{
+ char *value, *key;
+ gboolean ret_val = FALSE;
+
+ g_return_val_if_fail (E_IS_CAL_BACKEND_CACHE (cache), FALSE);
+
+ key = g_strdup (keyp);
+ if (valuep) {
+ e_file_cache_remove_object (E_FILE_CACHE (cache), key);
+ return TRUE;
+ }
+
+ value = g_strdup (valuep);
+
+ if (!(ret_val = e_file_cache_add_object (E_FILE_CACHE (cache), key, value)))
+ ret_val = e_file_cache_replace_object (E_FILE_CACHE (cache), key, value);
+
+ g_free (value);
+
+ return ret_val;
+}
+
+/**
+ * e_cal_backend_cache_get_key_value:
+ * @cache: An #ECalBackendCache object.
+ *
+ * Return value: The value.
+ */
+const char *
+e_cal_backend_cache_get_key_value (ECalBackendCache *cache, const char *key)
+{
+
+ g_return_val_if_fail (E_IS_CAL_BACKEND_CACHE (cache), NULL);
+
+ return e_file_cache_get_object (E_FILE_CACHE (cache), key);
+}
Index: calendar/libedata-cal/e-cal-backend-cache.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-cache.h,v
retrieving revision 1.13
diff -u -p -r1.13 e-cal-backend-cache.h
--- calendar/libedata-cal/e-cal-backend-cache.h 25 Feb 2005 06:36:51 -0000 1.13
+++ calendar/libedata-cal/e-cal-backend-cache.h 7 Jul 2005 16:30:34 -0000
@@ -72,6 +72,9 @@ void e_cal_backend_cache_
gboolean e_cal_backend_cache_put_server_utc_time (ECalBackendCache *cache, char *utc_str);
const char * e_cal_backend_cache_get_server_utc_time (ECalBackendCache *cache);
+gboolean e_cal_backend_cache_put_key_value (ECalBackendCache *cache, const char *keyp, const char *valuep);
+const char * e_cal_backend_cache_get_key_value (ECalBackendCache *cache, const char *key);
+
G_END_DECLS
#endif
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.473
diff -u -p -r1.473 ChangeLog
--- calendar/ChangeLog 2 Jul 2005 10:04:58 -0000 1.473
+++ calendar/ChangeLog 7 Jul 2005 16:30:36 -0000
@@ -1,3 +1,13 @@
+2005-07-05 Sankar P <psankar novell com>
+
+ * backends/groupwise/e-cal-backend-groupwise.c: (get_deltas)
+ Moved from getQuickMessages to combination of getItems and readCursor,
+ due to the problems in getQuickMessages.
+ * libedata-cal/e-cal-backend-cache.[ch]:
+ (e_cal_backend_cache_get_key_value)
+ (e_cal_backend_cache_put_key_value):
+ Added functions so as to put/get strings onto cache
+
2005-07-02 Chenthill Palanisamy <pchenthill novell com>
* backends/groupwise/e-cal-backend-groupwise-utils.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]