diff options
| author | Parthasarathi Susarla <sparthasarathi@novell.com> | 2006-07-05 10:15:09 +0000 |
|---|---|---|
| committer | Parthasarathi Susarla <saps@src.gnome.org> | 2006-07-05 10:15:09 +0000 |
| commit | 0c1f5fbbc8cd8b19b0abb382c148e9c6005ba62f (patch) | |
| tree | e7b83c66813997ae47252dcd0cf1ff1f4d44e75c /camel | |
| parent | 71a0d5bef5d00d53ead29cf8378c08034bc25e9b (diff) | |
| download | evolution-data-server-0c1f5fbbc8cd8b19b0abb382c148e9c6005ba62f.tar.gz | |
Fixes bug #165728 on novell bugzilla initialize list loaded to 3
2006-07-05 Parthasarathi Susarla <sparthasarathi@novell.com>
Fixes bug #165728 on novell bugzilla
* camel-groupwise-store.[ch]:
(groupwise_store_construct): initialize list loaded to 3
(groupwise_get_folder_info): update only once from the server
and from then on - just use the cache.
Diffstat (limited to 'camel')
| -rw-r--r-- | camel/providers/groupwise/ChangeLog | 8 | ||||
| -rw-r--r-- | camel/providers/groupwise/camel-groupwise-store.c | 63 | ||||
| -rw-r--r-- | camel/providers/groupwise/camel-groupwise-store.h | 2 |
3 files changed, 36 insertions, 37 deletions
diff --git a/camel/providers/groupwise/ChangeLog b/camel/providers/groupwise/ChangeLog index e8a617535..b8c28b6cc 100644 --- a/camel/providers/groupwise/ChangeLog +++ b/camel/providers/groupwise/ChangeLog @@ -1,5 +1,13 @@ 2006-07-05 Parthasarathi Susarla <sparthasarathi@novell.com> + Fixes bug #165728 on novell bugzilla + * camel-groupwise-store.[ch]: + (groupwise_store_construct): initialize list loaded to 3 + (groupwise_get_folder_info): update only once from the server + and from then on - just use the cache. + +2006-07-05 Parthasarathi Susarla <sparthasarathi@novell.com> + Fixes bug #165922 on novell bugzilla. * camel-groupwise-folder.[ch]: (groupwise_folder_item_to_msg): use Mime.822 whenever it is available diff --git a/camel/providers/groupwise/camel-groupwise-store.c b/camel/providers/groupwise/camel-groupwise-store.c index 3fc7d5331..2b4e47aaa 100644 --- a/camel/providers/groupwise/camel-groupwise-store.c +++ b/camel/providers/groupwise/camel-groupwise-store.c @@ -103,7 +103,12 @@ groupwise_store_construct (CamelService *service, CamelSession *session, _("Host or user not available in url")); } - groupwise_store->list_loaded = FALSE; + /*XXX: The number 3 assigned to the list_loaded variable denotes + * the number of times the get_folder_info is called during startup. + * We are just trying to minimize the call. + * This is a dirty hack. But it *WORKS* + */ + groupwise_store->list_loaded = 3; /*storage path*/ priv->storage_path = camel_session_get_storage_path (session, service, ex); @@ -310,14 +315,6 @@ groupwise_connect (CamelService *service, CamelException *ex) camel_groupwise_store_summary_namespace_set (store->summary, ns); if (camel_store_summary_count ((CamelStoreSummary *)store->summary) == 0) { - /*XXX: Have to sync up folders here*/ - groupwise_folders_sync (store, ex); - if (camel_exception_is_set (ex)) { - camel_store_summary_save ((CamelStoreSummary *) store->summary); - CAMEL_SERVICE_UNLOCK (service, connect_lock); - camel_service_disconnect (service, TRUE, NULL); - return FALSE; - } /*Settting the refresh stamp to the current time*/ store->refresh_stamp = time (0); } @@ -1130,40 +1127,34 @@ groupwise_get_folder_info (CamelStore *store, const char *top, guint32 flags, Ca if (top && groupwise_is_system_folder (top)) return groupwise_build_folder_info (groupwise_store, NULL, top ); - /* * Thanks to Michael, for his cached folders implementation in IMAP * is used as is here. */ - if ((groupwise_store->list_loaded == TRUE) && camel_store_summary_count((CamelStoreSummary *)groupwise_store->summary) > 0) { - /*Load from cache*/ - /* - time_t now; - int ref; - - now = time (0); - ref = now > groupwise_store->refresh_stamp+60*60*1; - if (ref) { - CAMEL_SERVICE_LOCK (store, connect_lock); - ref = now > groupwise_store->refresh_stamp+60*60*1; - if (ref) { - struct _store_refresh_msg *m; - groupwise_store->refresh_stamp = now; - m = camel_session_thread_msg_new (((CamelService *)store)->session, &store_refresh_ops, sizeof(*m)); - m->store = store; - camel_object_ref (store); - camel_exception_init (&m->ex); - camel_session_thread_queue (((CamelService *)store)->session, &m->msg, 0); - } + if (camel_store_summary_count ((CamelStoreSummary *)groupwise_store->summary) == 0) { + CAMEL_SERVICE_LOCK (store, connect_lock); + if (groupwise_store->list_loaded == 3) { + groupwise_folders_sync (groupwise_store, ex); + groupwise_store->list_loaded -= 1; + } + if (camel_exception_is_set (ex)) { + camel_store_summary_save ((CamelStoreSummary *) groupwise_store->summary); CAMEL_SERVICE_UNLOCK (store, connect_lock); - }*/ - if (groupwise_store->current_folder) - CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS (groupwise_store->current_folder))->sync(groupwise_store->current_folder, FALSE, ex); - groupwise_folders_sync (groupwise_store, ex); + return NULL; + } + CAMEL_SERVICE_UNLOCK (store, connect_lock); + camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary); + goto end_r; + } + + if ((camel_store_summary_count((CamelStoreSummary *)groupwise_store->summary) > 0) && (groupwise_store->list_loaded > 1)) { + /*Load from cache*/ + groupwise_store->list_loaded -= 1; + goto end_r; } CAMEL_SERVICE_LOCK (store, connect_lock); - if ((groupwise_store->list_loaded == FALSE) && check_for_connection((CamelService *)store, ex)) { + if ((groupwise_store->list_loaded == 1) && check_for_connection((CamelService *)store, ex)) { if (!priv->cnc) { if (groupwise_connect ((CamelService *)store, ex)) { g_warning ("Could connect!!!\n"); @@ -1171,7 +1162,6 @@ groupwise_get_folder_info (CamelStore *store, const char *top, guint32 flags, Ca g_warning ("Could not connect..failure connecting\n"); } if (camel_groupwise_store_connected ((CamelGroupwiseStore *)store, ex)) { - groupwise_store->list_loaded = TRUE; if (groupwise_store->current_folder) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS (groupwise_store->current_folder))->sync(groupwise_store->current_folder, FALSE, ex); groupwise_folders_sync (groupwise_store, ex); @@ -1186,6 +1176,7 @@ groupwise_get_folder_info (CamelStore *store, const char *top, guint32 flags, Ca CAMEL_SERVICE_UNLOCK (store, connect_lock); /*camel_exception_clear (ex);*/ +end_r: info = groupwise_get_folder_info_offline (store, top, flags, ex); return info; } diff --git a/camel/providers/groupwise/camel-groupwise-store.h b/camel/providers/groupwise/camel-groupwise-store.h index ceb52c3a0..9d6ff6960 100644 --- a/camel/providers/groupwise/camel-groupwise-store.h +++ b/camel/providers/groupwise/camel-groupwise-store.h @@ -61,7 +61,7 @@ struct _CamelGroupwiseStore { /* the parameters field is not to be included not. probably for 2.6*/ /*guint32 parameters;*/ time_t refresh_stamp; - guint list_loaded:1; + guint list_loaded; }; |
