Re: [evolution-patches] (groupwise provider) change in modification time



Attached is the revised patch.
The modification time now would be got from the summary file itself, so
'stat'ing of the summary file is required each time. 
No more static variable
Thanks 
-partha
On Thu, 2005-02-17 at 08:06 +0800, Not Zed wrote:
>
>Please use time(0) rather than g_get_current_time().
>
>Also, rather than using a static variable which wont be thread-safe,
>just call time(0) before calling gmtime().
>
>This code then seems redundant  (its stating of the summary doesn't
>seem that useful anyway).
>
>if (!mod_time) {
>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) ;
>
>On Wed, 2005-02-16 at 15:55 +0530, Parthasarathi Susarla wrote: 
>>Hi,
>>this patch updates the modification time that is sent with each
>>getQuickMessage request.
>>
>>thanks,
>>partha
Index: camel-groupwise-store.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-store.c,v
retrieving revision 1.30
diff -u -p -r1.30 camel-groupwise-store.c
--- camel-groupwise-store.c	16 Feb 2005 16:19:40 -0000	1.30
+++ camel-groupwise-store.c	17 Feb 2005 05:01:56 -0000
@@ -534,17 +534,17 @@ groupwise_get_folder (CamelStore *store,
 	summary_count = camel_folder_summary_count (folder->summary) ;
 	if(summary_count) {
 		char *cache_file_name ;
-		time_t mod_time = 0 ;
+		time_t mod_time = time (0) ;
 		char time_string[100] = {0} ;
 		const struct tm *tm ;
 		struct stat buf;
 		
 		
-		if (!mod_time) {
-			cache_file_name = g_strdup (folder->summary->summary_path) ;
-			printf ("%s %d\n", cache_file_name, stat (cache_file_name, &buf));
-			mod_time = buf.st_mtime;
-		}
+		
+		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"));
@@ -556,7 +556,6 @@ groupwise_get_folder (CamelStore *store,
 			//camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
 			CAMEL_SERVICE_UNLOCK (gw_store, connect_lock) ;
 			camel_operation_end (NULL);
-			g_free (cache_file_name) ;
 			g_free (container_id) ;
 			gw_store->current_folder = folder ;
 			camel_object_ref (folder) ;
@@ -579,7 +578,6 @@ groupwise_get_folder (CamelStore *store,
 			//camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
 			CAMEL_SERVICE_UNLOCK (gw_store, connect_lock) ;
 			camel_operation_end (NULL);
-			g_free (cache_file_name) ;
 			g_free (container_id) ;
 			gw_store->current_folder = folder ;
 			camel_object_ref (folder) ;
Index: camel-groupwise-folder.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-folder.c,v
retrieving revision 1.25
diff -u -p -r1.25 camel-groupwise-folder.c
--- camel-groupwise-folder.c	16 Feb 2005 16:19:40 -0000	1.25
+++ camel-groupwise-folder.c	17 Feb 2005 05:01:57 -0000
@@ -606,7 +606,7 @@ groupwise_refresh_info(CamelFolder *fold
 	GSList *slist = NULL, *sl ;
 	char *container_id = NULL ;
 	char *cache_file_name ;
-	time_t mod_time = 0 ;
+	time_t mod_time = time (0) ;
 	char time_string[100] = {0} ;
 	const struct tm *tm ;
 	struct stat buf ;
@@ -626,12 +626,10 @@ groupwise_refresh_info(CamelFolder *fold
 		gw_folder->need_refresh = TRUE ;
 	}
 
-	if (!mod_time) {
-		cache_file_name = g_strdup (folder->summary->summary_path) ;
-		stat (cache_file_name, &buf) ;
-		mod_time = buf.st_mtime ;
-		g_free (cache_file_name) ;
-	}
+	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) ;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]