943
931
CamelStoreInfo *si = NULL;
946
if (!priv->cnc && ((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL) {
947
if (((CamelService *)store)->status == CAMEL_SERVICE_DISCONNECTED) {
948
((CamelService *)store)->status = CAMEL_SERVICE_CONNECTING;
949
groupwise_connect ((CamelService *)store, ex);
953
934
status = e_gw_connection_get_container_list (priv->cnc, "folders", &folder_list);
954
935
if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
955
936
status = e_gw_connection_get_container_list (priv->cnc, "folders", &folder_list);
1140
1121
groupwise_get_folder_info (CamelStore *store, const gchar *top, guint32 flags, CamelException *ex)
1142
1123
CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
1143
CamelGroupwiseStorePrivate *priv = groupwise_store->priv;
1144
1124
CamelFolderInfo *info = NULL;
1145
gchar *top_folder = NULL;
1148
top_folder = g_hash_table_lookup (priv->name_hash, top);
1149
/* 'top' is a valid path, but doesnt have a container id
1151
/* if (!top_folder) {
1152
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
1153
_("You must be working online to complete this operation"));
1158
if (top && groupwise_is_system_folder (top))
1159
return groupwise_build_folder_info (groupwise_store, NULL, top );
1162
* Thanks to Michael, for his cached folders implementation in IMAP
1163
* is used as is here.
1165
if (camel_store_summary_count ((CamelStoreSummary *)groupwise_store->summary) == 0) {
1166
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
1167
if (groupwise_store->list_loaded == 3) {
1168
groupwise_folders_sync (groupwise_store, ex);
1169
groupwise_store->list_loaded -= 1;
1171
if (camel_exception_is_set (ex)) {
1172
camel_store_summary_save ((CamelStoreSummary *) groupwise_store->summary);
1173
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
1126
/* Do not call groupwise_store_connected function as it would internall call folders_sync
1127
to populate the hash table which is used for mapping container id */
1128
if (!(((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL
1129
&& camel_service_connect ((CamelService *)store, ex)))
1132
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
1134
groupwise_folders_sync (groupwise_store, ex);
1135
if (camel_exception_is_set (ex)) {
1176
1136
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
1177
camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
1181
if ((camel_store_summary_count((CamelStoreSummary *)groupwise_store->summary) > 0) && (groupwise_store->list_loaded > 1)) {
1183
groupwise_store->list_loaded -= 1;
1187
CAMEL_SERVICE_REC_LOCK (store, connect_lock);
1188
if ((groupwise_store->list_loaded == 1) && check_for_connection((CamelService *)store, ex)) {
1190
if (groupwise_connect ((CamelService *)store, ex)) {
1191
g_warning ("Could connect!!!\n");
1193
g_warning ("Could not connect..failure connecting\n");
1195
if (camel_groupwise_store_connected (groupwise_store, ex)) {
1196
if (groupwise_store->current_folder)
1197
CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS (groupwise_store->current_folder))->sync(groupwise_store->current_folder, FALSE, ex);
1198
groupwise_folders_sync (groupwise_store, ex);
1199
if (camel_exception_is_set (ex)) {
1200
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
1203
camel_store_summary_touch ((CamelStoreSummary *)groupwise_store->summary);
1204
camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
1140
camel_store_summary_touch ((CamelStoreSummary *)groupwise_store->summary);
1141
camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary);
1207
1143
CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
1209
/*camel_exception_clear (ex);*/
1211
1146
info = groupwise_get_folder_info_offline (store, top, flags, ex);