[evolution-patches] Patch for mail/calendar using the timestamps sent by the server in getQM messages [Groupwise backend]
- From: Harish Krishnaswamy <harish krishnaswamy gmail com>
- To: evolution-patches lists ximian com, pchenthill novell com
- Subject: [evolution-patches] Patch for mail/calendar using the timestamps sent by the server in getQM messages [Groupwise backend]
- Date: Mon, 28 Feb 2005 10:04:05 +0530
hi,
Attached patch stores the time string retrieved from the server into
the camel summary and uses it to poll the server on the next getQM call.
[This patch leaves the gw summary version unchanged though it adds a new
property - as i have assumed that it can handle the absence of the
timestamp gracefully. fejj/partha - pl. confirm if this is safe].
The calendar portion contains a change to store the time_string after a
'New' poll - else we lose changes that have occured b/w the New and
Modified calls.
Also, it is incorrect to expect Modified calls to return a timestamp.
Fixed that too.
Kindly review the same.
Thanks,
harish
PS: still unable to send/receive mails from my regular account. would
use this id until then.. chen, do let me my patches in :-)
--
Pure in heart, like uncut jade,
he cleared the muddy water
by leaving it alone.
Index: camel/providers/groupwise/camel-groupwise-folder.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-folder.c,v
retrieving revision 1.30
diff -u -3 -p -u -p -r1.30 camel-groupwise-folder.c
--- camel/providers/groupwise/camel-groupwise-folder.c 25 Feb 2005 06:31:31 -0000 1.30
+++ camel/providers/groupwise/camel-groupwise-folder.c 27 Feb 2005 12:57:20 -0000
@@ -633,7 +633,7 @@ groupwise_refresh_info(CamelFolder *fold
char *container_id = NULL ;
char *cache_file_name ;
time_t mod_time = time (0) ;
- char time_string[100] = {0}, *t_str ;
+ char *time_string = NULL, *t_str = NULL ;
const struct tm *tm ;
struct stat buf ;
@@ -652,13 +652,7 @@ groupwise_refresh_info(CamelFolder *fold
gw_folder->need_refresh = TRUE ;
}
- cache_file_name = g_strdup (folder->summary->summary_path) ;
- stat (cache_file_name, &buf) ;
- mod_time = buf.st_mtime ;
- g_free (cache_file_name) ;
-
- tm = gmtime (&mod_time) ;
- strftime (time_string, 100, "%Y-%m-%dT%H:%M:%SZ", tm) ;
+ time_string = ((CamelGroupwiseSummary *) folder->summary)->time_string;
t_str = g_strdup (time_string);
CAMEL_SERVICE_LOCK (gw_store, connect_lock);
Index: camel/providers/groupwise/camel-groupwise-store.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-store.c,v
retrieving revision 1.36
diff -u -3 -p -u -p -r1.36 camel-groupwise-store.c
--- camel/providers/groupwise/camel-groupwise-store.c 25 Feb 2005 10:05:28 -0000 1.36
+++ camel/providers/groupwise/camel-groupwise-store.c 27 Feb 2005 12:57:20 -0000
@@ -479,6 +479,8 @@ groupwise_get_folder (CamelStore *store,
CamelGroupwiseStore *gw_store = CAMEL_GROUPWISE_STORE (store) ;
CamelGroupwiseStorePrivate *priv = gw_store->priv ;
CamelFolder *folder ;
+ CamelGroupwiseSummary *summary;
+ char *time_string = NULL;
char *storage_path, *folder_dir, *temp_str,*container_id ;
const char *temp_name;
EGwConnectionStatus status ;
@@ -531,31 +533,30 @@ groupwise_get_folder (CamelStore *store,
if (!mutex)
mutex = g_mutex_new () ;
+ summary = (CamelGroupwiseSummary *) folder->summary;
+ if (summary->time_string && *(summary->time_string))
+ time_string = summary->time_string;
+ else {
+ time_t mod_time = time (0) ;
+ const struct tm *tm;
+ /*TODO get current time here */
+ tm = gmtime (&mod_time);
+ strftime (time_string, 100, "%Y-%m-%dT%H:%M:%SZ", tm);
+ }
summary_count = camel_folder_summary_count (folder->summary) ;
if(summary_count) {
char *cache_file_name ;
time_t mod_time = time (0) ;
- char time_string[100] = {0}, *t_str;
+ char *t_str = NULL;
const struct tm *tm ;
struct stat buf;
-
-
- cache_file_name = g_strdup (folder->summary->summary_path) ;
- stat (cache_file_name, &buf) ;
- g_free (cache_file_name) ;
- mod_time = buf.st_mtime;
- tm = gmtime (&mod_time);
- strftime (time_string, 100, "%Y-%m-%dT%H:%M:%SZ", tm);
- camel_operation_start (NULL, _("Fetching summary information for new messages"));
t_str = g_strdup (time_string);
-
/* FIXME send the time stamp which the server sends */
status = e_gw_connection_get_quick_messages (priv->cnc, container_id,
"distribution attachments subject created",
&t_str, "New", "Mail", NULL, -1, &slist) ;
- g_free (t_str), t_str = NULL;
if (status != E_GW_CONNECTION_STATUS_OK) {
//camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
CAMEL_SERVICE_UNLOCK (gw_store, connect_lock) ;
@@ -568,7 +569,11 @@ groupwise_get_folder (CamelStore *store,
//return NULL ;
}
-
+ /* store t_str into the summary */
+ if (summary->time_string)
+ g_free (summary->time_string);
+ summary->time_string = g_strdup (t_str);
+ g_free (t_str), t_str = NULL;
for ( sl = slist ; sl != NULL; sl = sl->next) {
list = g_list_append (list, sl->data) ;
}
@@ -635,7 +640,10 @@ groupwise_get_folder (CamelStore *store,
temp = g_list_length (list) ;
count += temp ;
-
+
+ if (summary->time_string)
+ g_free (summary->time_string);
+ summary->time_string = g_strdup (e_gw_connection_get_server_time (priv->cnc));
gw_update_summary (folder, list, ex) ;
if (temp == count)
camel_operation_progress (NULL, 0) ;
Index: camel/providers/groupwise/camel-groupwise-summary.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-summary.c,v
retrieving revision 1.3
diff -u -3 -p -u -p -r1.3 camel-groupwise-summary.c
--- camel/providers/groupwise/camel-groupwise-summary.c 10 Jan 2005 16:32:49 -0000 1.3
+++ camel/providers/groupwise/camel-groupwise-summary.c 27 Feb 2005 12:57:20 -0000
@@ -161,6 +161,8 @@ gw_summary_header_load (CamelFolderSumma
|| camel_file_util_decode_fixed_int32(in, &ims->validity) == -1)
return -1;
+ if (camel_file_util_decode_string (in, &ims->time_string) == -1)
+ return -1;
return 0 ;
}
@@ -174,6 +176,7 @@ gw_summary_header_save (CamelFolderSumma
return -1;
camel_file_util_encode_fixed_int32(out, CAMEL_GW_SUMMARY_VERSION);
+ camel_file_util_encode_string (out, ims->time_string);
return camel_file_util_encode_fixed_int32(out, ims->validity);
Index: camel/providers/groupwise/camel-groupwise-summary.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-summary.h,v
retrieving revision 1.2
diff -u -3 -p -u -p -r1.2 camel-groupwise-summary.h
--- camel/providers/groupwise/camel-groupwise-summary.h 23 Dec 2004 10:00:44 -0000 1.2
+++ camel/providers/groupwise/camel-groupwise-summary.h 27 Feb 2005 12:57:20 -0000
@@ -52,6 +52,7 @@ struct _CamelGroupwiseMessageContentInfo
struct _CamelGroupwiseSummary {
CamelFolderSummary parent ;
+ char *time_string;
guint32 version ;
guint32 validity ;
} ;
Index: servers/groupwise/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.127
diff -u -3 -p -u -p -r1.127 ChangeLog
--- servers/groupwise/ChangeLog 25 Feb 2005 06:30:22 -0000 1.127
+++ servers/groupwise/ChangeLog 27 Feb 2005 12:57:20 -0000
@@ -1,3 +1,10 @@
+2005-02-27 Harish Krishnaswamy <kharish novell com>
+
+ * e-gw-connection.c: (e_gw_connection_get_quick_messages):
+ Look for the timestring only in the New getQM responses.
+ The server does not send it during the modified call and
+ hence do not flag an error.
+
2005-02-25 Chenthill Palanisamy <pchenthill novell com>
* e-gw-connection.c: (e_gw_connection_get_quick_messages):
Index: servers/groupwise/e-gw-connection.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v
retrieving revision 1.111
diff -u -3 -p -u -p -r1.111 e-gw-connection.c
--- servers/groupwise/e-gw-connection.c 25 Feb 2005 06:30:22 -0000 1.111
+++ servers/groupwise/e-gw-connection.c 27 Feb 2005 12:57:20 -0000
@@ -2171,7 +2171,7 @@ EGwConnectionStatus e_gw_connection_get_
return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
}
- if (start_date && *start_date) {
+ if (start_date && *start_date && !strcmp (message_list, "New")) {
subparam = soup_soap_response_get_first_parameter_by_name (response, "startDate");
if (subparam) {
char *date;
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.429
diff -u -3 -p -u -p -r1.429 ChangeLog
--- calendar/ChangeLog 25 Feb 2005 09:59:47 -0000 1.429
+++ calendar/ChangeLog 27 Feb 2005 12:57:21 -0000
@@ -1,3 +1,9 @@
+2005-02-27 Harish Krishnaswamy <kharish novell com>
+
+ * backends/groupwise/e-cal-backend-groupwise.c: (get_deltas):
+ store the time_string immediately after the 'New' call.
+ add missing view in the second getQM call - "attachments"
+
2005-02-25 Rodrigo Moya <rodrigo novell com>
* backends/weather/e-cal-backend-weather.c
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.133
diff -u -3 -p -u -p -r1.133 e-cal-backend-groupwise.c
--- calendar/backends/groupwise/e-cal-backend-groupwise.c 25 Feb 2005 09:12:44 -0000 1.133
+++ calendar/backends/groupwise/e-cal-backend-groupwise.c 27 Feb 2005 12:57:21 -0000
@@ -227,9 +227,8 @@ get_deltas (gpointer handle)
status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id, "attachments recipients message recipientStatus default", &time_string, "New", "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, "recipients message recipientStatus default", &time_string, "New", "CalendarItem", NULL, -1, &item_list);
+ status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id, "attachments recipients message recipientStatus default", &time_string, "New", "CalendarItem", NULL, -1, &item_list);
- g_free (time_string), time_string = NULL;
if (status != E_GW_CONNECTION_STATUS_OK) {
g_free (t_str), t_str = NULL;
@@ -239,6 +238,9 @@ get_deltas (gpointer handle)
e_cal_backend_groupwise_notify_error_code (cbgw, status);
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)) {
@@ -277,7 +279,7 @@ get_deltas (gpointer handle)
status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id,"recipients message recipientStatus default", &time_string, "Modified", "CalendarItem", NULL, -1, &item_list);
- g_free (t_str), t_str = NULL;
+ g_free (time_string);
if (status != E_GW_CONNECTION_STATUS_OK) {
if (status == E_GW_CONNECTION_STATUS_NO_RESPONSE)
return TRUE;
@@ -288,9 +290,6 @@ get_deltas (gpointer handle)
e_file_cache_freeze_changes (E_FILE_CACHE (cache));
- e_cal_backend_cache_put_server_utc_time (cache, time_string);
- t_str = time_string;
-
for (; item_list != NULL; item_list = g_slist_next(item_list)) {
EGwItem *item = E_GW_ITEM(item_list->data);
ECalComponent *modified_comp, *cache_comp;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]