Thanks -- Sarfraaz Ahmed <asarfraaz novell com> |
Index: calendar/e-cal-backend-exchange.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange.c,v retrieving revision 1.28 diff -u -p -u -r1.28 e-cal-backend-exchange.c --- calendar/e-cal-backend-exchange.c 4 Feb 2005 11:29:44 -0000 1.28 +++ calendar/e-cal-backend-exchange.c 23 Feb 2005 07:00:51 -0000 @@ -1022,14 +1022,6 @@ set_mode (ECalBackend *backend, CalMode case CAL_MODE_REMOTE: /* Change status to be online now */ -#if 0 - if (exchange_account_set_online (cbex->account)) { printf ("mode set to online\n"); - priv->mode = CAL_MODE_REMOTE; - } - else { printf ("failed to set mode to online\n"); - break; - } -#endif /* Should we check for access rights before setting this ? */ d(printf ("set mode to online\n")); uristr = e_cal_backend_get_uri (E_CAL_BACKEND (backend)); @@ -1040,6 +1032,7 @@ set_mode (ECalBackend *backend, CalMode /* FIXME : Test if available for read already */ priv->read_only = TRUE; exchange_account_set_online (account); + priv->mode = CAL_MODE_REMOTE; e_cal_backend_notify_mode (backend, GNOME_Evolution_Calendar_CalListener_MODE_SET, GNOME_Evolution_Calendar_MODE_REMOTE); @@ -1048,7 +1041,6 @@ set_mode (ECalBackend *backend, CalMode break; case CAL_MODE_LOCAL: - /* FIXME : Update the cache before closing the connection */ d(printf ("set mode to offline\n")); uristr = e_cal_backend_get_uri (E_CAL_BACKEND (backend)); account = exchange_component_get_account_for_uri (global_exchange_component, uristr); @@ -1056,7 +1048,6 @@ set_mode (ECalBackend *backend, CalMode return; cbex->folder = exchange_account_get_folder (account, uristr); priv->mode = CAL_MODE_LOCAL; - /* FIXME : Set connection to NULL and become offline */ exchange_account_set_offline (account); e_cal_backend_notify_mode (backend, GNOME_Evolution_Calendar_CalListener_MODE_SET, @@ -1306,6 +1297,11 @@ static icaltimezone * internal_get_default_timezone (ECalBackend *backend) { ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend); + + /* FIXME : This should never happen. Sometimes gets triggered while moving + between online and offline. */ + if (!cbex->account) + return NULL; if (!cbex->priv->default_timezone && cbex->account->default_timezone) { Index: camel/camel-exchange-folder.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-folder.c,v retrieving revision 1.13 diff -u -p -u -r1.13 camel-exchange-folder.c --- camel/camel-exchange-folder.c 8 Feb 2005 13:18:41 -0000 1.13 +++ camel/camel-exchange-folder.c 23 Feb 2005 07:00:52 -0000 @@ -399,6 +399,7 @@ get_message (CamelFolder *folder, const ba = get_message_data (folder, uid, ex); if (!ba) return NULL; + stream = camel_stream_mem_new_with_byte_array (ba); crlffilter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_DECODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY); @@ -896,6 +897,7 @@ camel_exchange_folder_update_message_tag * @name: the full name of the folder * @camel_flags: the folder flags passed to camel_store_get_folder(). * @folder_dir: local directory this folder can cache data into + * @offline_state : offline status * @stub: the #CamelStub. * @ex: a #CamelException * @@ -907,7 +909,7 @@ camel_exchange_folder_update_message_tag gboolean camel_exchange_folder_construct (CamelFolder *folder, CamelStore *parent, const char *name, guint32 camel_flags, - const char *folder_dir, + const char *folder_dir, int offline_state, CamelStub *stub, CamelException *ex) { CamelExchangeFolder *exch = (CamelExchangeFolder *)folder; @@ -1019,6 +1021,8 @@ camel_exchange_folder_construct (CamelFo camel_exchange_summary_set_readonly (folder->summary, folder_flags & CAMEL_STUB_FOLDER_READONLY); + if (offline_state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL ) + return TRUE; camel_operation_start (NULL, _("Fetching summary information for new messages")); ok = camel_stub_send (exch->stub, ex, CAMEL_STUB_CMD_REFRESH_FOLDER, CAMEL_STUB_ARG_FOLDER, folder->full_name, Index: camel/camel-exchange-folder.h =================================================================== RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-folder.h,v retrieving revision 1.6 diff -u -p -u -r1.6 camel-exchange-folder.h --- camel/camel-exchange-folder.h 11 Jan 2005 11:05:45 -0000 1.6 +++ camel/camel-exchange-folder.h 23 Feb 2005 07:00:54 -0000 @@ -50,6 +50,7 @@ gboolean camel_exchange_folder_construct const char *name, guint32 camel_flags, const char *folder_dir, + int offline_state, CamelStub *stub, CamelException *ex); Index: camel/camel-exchange-store.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-store.c,v retrieving revision 1.12 diff -u -p -u -r1.12 camel-exchange-store.c --- camel/camel-exchange-store.c 4 Feb 2005 11:29:45 -0000 1.12 +++ camel/camel-exchange-store.c 23 Feb 2005 07:00:54 -0000 @@ -289,7 +289,7 @@ exchange_connect (CamelService *service, store->stub = camel_stub_new (socket_path, _("Evolution Exchange backend process"), ex); g_free (socket_path); - if (!store->stub) + if (!store->stub) return FALSE; /* Initialize the stub connection */ @@ -306,7 +306,7 @@ exchange_connect (CamelService *service, camel_object_hook_event (CAMEL_OBJECT (store->stub), "notification", stub_notification, store); - + return TRUE; } @@ -342,12 +342,9 @@ exchange_get_folder (CamelStore *store, folder_dir = exchange_path_to_physical (exch->storage_path, folder_name); - printf ("folder_name : %s\n", folder_name ); - if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { if (!folder_dir || access (folder_dir, F_OK) != 0) { g_free (folder_dir); - printf ("no folder_dir or no write access\n"); camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, _("No such folder %s"), folder_name); return NULL; @@ -371,7 +368,7 @@ exchange_get_folder (CamelStore *store, g_mutex_unlock (exch->folders_lock); if (!camel_exchange_folder_construct (folder, store, folder_name, - flags, folder_dir, + flags, folder_dir, ((CamelOfflineStore *) store)->state, exch->stub, ex)) { g_free (folder_dir); camel_object_unref (CAMEL_OBJECT (folder)); @@ -538,11 +535,12 @@ exchange_create_folder (CamelStore *stor guint32 unread_count, flags; CamelFolderInfo *info; +/* if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot create folder in offline mode.")); return NULL; } - +*/ if (!camel_stub_send (exch->stub, ex, CAMEL_STUB_CMD_CREATE_FOLDER, CAMEL_STUB_ARG_FOLDER, parent_name, CAMEL_STUB_ARG_STRING, folder_name, Index: mail/mail-stub-exchange.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/mail/mail-stub-exchange.c,v retrieving revision 1.12 diff -u -p -u -r1.12 mail-stub-exchange.c --- mail/mail-stub-exchange.c 4 Feb 2005 11:29:45 -0000 1.12 +++ mail/mail-stub-exchange.c 23 Feb 2005 07:00:54 -0000 @@ -537,7 +537,7 @@ get_folder (MailStub *stub, const char * E2kResult *result; const char *prop, *uid; guint32 article_num, camel_flags; - int i, m, total = -1; + int i, m, total = -1, mode; ExchangeHierarchy *hier; path = g_strdup_printf ("/%s", name); @@ -591,7 +591,8 @@ get_folder (MailStub *stub, const char * if (!(mmsg->flags & MAIL_STUB_MESSAGE_SEEN)) mfld->unread_count++; } - if (!exchange_account_is_offline (mse->account)) { + exchange_account_is_offline (mse->account, &mode); + if (mode == ONLINE_MODE) { mfld->changed_messages = g_ptr_array_new (); status = e_folder_exchange_propfind (mfld->folder, NULL, @@ -812,7 +813,7 @@ sync_deletions (MailStubExchange *mse, M E2kResult *results; int nresults; const char *prop; - int deleted_count = -1, new_deleted_count, visible_count = -1; + int deleted_count = -1, new_deleted_count, visible_count = -1, mode; E2kRestriction *rn; E2kResultIter *iter; E2kResult *result; @@ -820,7 +821,8 @@ sync_deletions (MailStubExchange *mse, M MailStubExchangeMessage *mmsg, *my_mmsg; gboolean changes = FALSE; - if (exchange_account_is_offline (mse->account)) + exchange_account_is_offline (mse->account, &mode); + if (mode != ONLINE_MODE) return; status = e_folder_exchange_propfind (mfld->folder, NULL, @@ -990,16 +992,25 @@ refresh_folder_internal (MailStub *stub, char *prop, *uid, *href; struct refresh_message rm, *rmp; E2kHTTPStatus status; - int got, total, i, n; + int got, total, i, n, mode; gpointer key, value; MailStubExchangeMessage *mmsg; MailStubExchange *mse = MAIL_STUB_EXCHANGE (stub); - if (exchange_account_is_offline (mse->account)) - return; g_object_ref (stub); + exchange_account_is_offline (mse->account, &mode); + if (mode == OFFLINE_MODE) { + if (background) + mail_stub_push_changes (stub); + else + mail_stub_return_ok (stub); + + g_object_unref (stub); /* Is this needed ? */ + return; + } + messages = g_array_new (FALSE, FALSE, sizeof (struct refresh_message)); mapi_message_hash = g_hash_table_new (g_str_hash, g_str_equal); mapi_hrefs = g_ptr_array_new (); @@ -1841,7 +1852,7 @@ get_message (MailStub *stub, const char MailStubExchangeMessage *mmsg; E2kHTTPStatus status; char *body = NULL, *content_type = NULL; - int len; + int len = 0, mode; mfld = folder_from_name (mse, folder_name, MAPI_ACCESS_READ, FALSE); if (!mfld) @@ -1856,6 +1867,15 @@ get_message (MailStub *stub, const char mail_stub_return_error (stub, _("No such message")); return; } + + exchange_account_is_offline (mse->account, &mode); + if (mode != ONLINE_MODE) { + mail_stub_return_data (stub, CAMEL_STUB_RETVAL_RESPONSE, + CAMEL_STUB_ARG_BYTEARRAY, body, len, + CAMEL_STUB_ARG_END); + mail_stub_return_ok (stub); + return; + } if (mfld->type == MAIL_STUB_EXCHANGE_FOLDER_NOTES) { status = get_stickynote (mse->ctx, NULL, mmsg->href, @@ -2439,13 +2459,15 @@ mail_stub_exchange_new (ExchangeAccount MailStubExchange *mse; MailStub *stub; const char *uri; + int mode; stub = g_object_new (MAIL_TYPE_STUB_EXCHANGE, NULL); mail_stub_construct (stub, cmd_fd, status_fd); + exchange_account_is_offline (account, &mode); mse = (MailStubExchange *)stub; mse->account = account; - if (!exchange_account_is_offline (account)) { + if (mode == ONLINE_MODE) { mse->ctx = exchange_account_get_context (account); g_object_ref (mse->ctx); Index: storage/exchange-account.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/storage/exchange-account.c,v retrieving revision 1.33 diff -u -p -u -r1.33 exchange-account.c --- storage/exchange-account.c 21 Feb 2005 05:50:58 -0000 1.33 +++ storage/exchange-account.c 23 Feb 2005 07:00:54 -0000 @@ -32,7 +32,6 @@ #include "exchange-hierarchy-favorites.h" #include "exchange-hierarchy-foreign.h" #include "exchange-hierarchy-gal.h" -#include "exchange-offline-listener.h" #include "e-folder-exchange.h" #include "e2k-autoconfig.h" #include "e2k-encoding-utils.h" @@ -710,7 +709,7 @@ exchange_account_open_folder (ExchangeAc { ExchangeHierarchy *hier; EFolder *folder; - gboolean offline = exchange_account_is_offline (account); + int offline; g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), EXCHANGE_ACCOUNT_FOLDER_GENERIC_ERROR); @@ -718,7 +717,8 @@ exchange_account_open_folder (ExchangeAc if (!get_folder (account, path, &folder, &hier)) return EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST; - if (!offline && !account->priv->connected && + exchange_account_is_offline (account, &offline); + if (offline == ONLINE_MODE && !account->priv->connected && hier == (ExchangeHierarchy *)account->priv->hierarchies->pdata[0] && folder == hier->toplevel) { /* The shell is asking us to open the personal folders @@ -727,8 +727,11 @@ exchange_account_open_folder (ExchangeAc */ return EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST; } + + if (offline == UNSUPPORTED_MODE) + return EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST; - return exchange_hierarchy_scan_subtree (hier, folder, offline); + return exchange_hierarchy_scan_subtree (hier, folder, (offline == OFFLINE_MODE)); } ExchangeAccountFolderResult @@ -1099,15 +1102,18 @@ exchange_account_set_offline (ExchangeAc gboolean exchange_account_set_online (ExchangeAccount *account) { - g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), FALSE); - account->priv->account_online = TRUE; + if (!account->priv->account_online) { + account->priv->account_online = TRUE; - if (exchange_account_connect (account)) + if (exchange_account_connect (account)) + return TRUE; + else + return FALSE; + } else { return TRUE; - else - return FALSE; + } } /** @@ -1116,10 +1122,14 @@ exchange_account_set_online (ExchangeAcc * * Return value: Returns TRUE if account is offline **/ -gboolean -exchange_account_is_offline (ExchangeAccount *account) +void +exchange_account_is_offline (ExchangeAccount *account, int *state) { - return exchange_component_is_offline (global_exchange_component); + *state = UNSUPPORTED_MODE; + + g_return_if_fail (EXCHANGE_IS_ACCOUNT (account)); + + exchange_component_is_offline (global_exchange_component, state); } @@ -1131,7 +1141,12 @@ setup_account_hierarchies (ExchangeAccou char *phys_uri_prefix, *dir; DIR *d; struct dirent *dent; - gboolean offline = exchange_account_is_offline (account); + int offline; + + exchange_account_is_offline (account, &offline); + + if (offline == UNSUPPORTED_MODE) + return FALSE; /* Set up Personal Folders hierarchy */ phys_uri_prefix = g_strdup_printf ("exchange://%s/personal", @@ -1213,7 +1228,7 @@ setup_account_hierarchies (ExchangeAccou */ fresult = exchange_hierarchy_scan_subtree (personal_hier, personal_hier->toplevel, - offline); + (offline == OFFLINE_MODE)); if (fresult != EXCHANGE_ACCOUNT_FOLDER_OK) { account->priv->connecting = FALSE; return FALSE; @@ -1222,7 +1237,7 @@ setup_account_hierarchies (ExchangeAccou fresult = exchange_hierarchy_scan_subtree ( account->priv->favorites_hierarchy, account->priv->favorites_hierarchy->toplevel, - offline); + (offline == OFFLINE_MODE)); if (fresult != EXCHANGE_ACCOUNT_FOLDER_OK) { account->priv->connecting = FALSE; return FALSE; @@ -1260,15 +1275,16 @@ exchange_account_connect (ExchangeAccoun E2kOperation gcop; const char *quota_msg = NULL; char *user_name = NULL; - int offline = exchange_component_is_offline (global_exchange_component); + int offline; g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), NULL); + exchange_account_is_offline (account, &offline); g_mutex_lock (account->priv->connect_lock); - //if ((account->priv->connecting) || (!account->priv->account_online)){ - if ((account->priv->connecting) || offline){ + + if ((account->priv->connecting) || (offline == OFFLINE_MODE)){ g_mutex_unlock (account->priv->connect_lock); - if (offline) { + if (offline == OFFLINE_MODE) { setup_account_hierarchies (account); e_notice (NULL, GTK_MESSAGE_ERROR, _("Exchange Account is offline. Cannot display folders\n")); } @@ -1451,6 +1467,9 @@ exchange_account_connect (ExchangeAccoun account->default_timezone = g_strdup (timezone); } + if (!setup_account_hierarchies (account)) + return NULL; + /* Find the password expiery peripod and display warning */ find_passwd_exp_period(account, entry); @@ -1477,9 +1496,6 @@ exchange_account_connect (ExchangeAccoun e_notice (NULL, GTK_MESSAGE_INFO, quota_msg); } - if (!setup_account_hierarchies (account)) - return NULL; - account->priv->connected = TRUE; account->priv->account_online = TRUE; account->priv->connecting = FALSE; @@ -1500,7 +1516,7 @@ exchange_account_connect (ExchangeAccoun gboolean exchange_account_is_offline_sync_set (ExchangeAccount *account) { - g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), NULL); + g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), FALSE); return account->priv->offline_sync; } Index: storage/exchange-account.h =================================================================== RCS file: /cvs/gnome/evolution-exchange/storage/exchange-account.h,v retrieving revision 1.10 diff -u -p -u -r1.10 exchange-account.h --- storage/exchange-account.h 20 Feb 2005 06:43:31 -0000 1.10 +++ storage/exchange-account.h 23 Feb 2005 07:00:54 -0000 @@ -10,6 +10,7 @@ #include "e2k-global-catalog.h" #include "e2k-security-descriptor.h" #include "e-folder.h" +#include "exchange-offline-listener.h" #include <e-util/e-account-list.h> #ifdef __cplusplus @@ -84,7 +85,7 @@ gboolean exchange_account_set_offline gboolean exchange_account_set_online (ExchangeAccount *account); -gboolean exchange_account_is_offline (ExchangeAccount *account); +void exchange_account_is_offline (ExchangeAccount *account, int *mode); gboolean exchange_account_is_offline_sync_set (ExchangeAccount *account); Index: storage/exchange-component.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/storage/exchange-component.c,v retrieving revision 1.5 diff -u -p -u -r1.5 exchange-component.c --- storage/exchange-component.c 4 Feb 2005 11:29:45 -0000 1.5 +++ storage/exchange-component.c 23 Feb 2005 07:00:54 -0000 @@ -248,10 +248,12 @@ new_connection (MailStubListener *listen { MailStub *mse; ExchangeAccount *account = baccount->account; + int mode; g_object_ref (account); - if (exchange_account_is_offline (account)) { + exchange_account_is_offline (account, &mode); + if (mode != ONLINE_MODE) { mse = mail_stub_exchange_new (account, cmd_fd, status_fd); goto end; } @@ -421,24 +423,22 @@ exchange_component_get_account_for_uri ( baccount = acc->data; /* Kludge for while we don't support multiple accounts */ - //if (!exchange_is_offline (priv->offline_listener)) { - if (!uri) - return baccount->account; - - if (exchange_account_get_folder (baccount->account, uri)) - return baccount->account; - //} else { - ///* FIXME : Handle multiple accounts */ - //return baccount->account; - //} + if (!uri) + return baccount->account; + + if (exchange_account_get_folder (baccount->account, uri)) + return baccount->account; + /* FIXME : Handle multiple accounts */ } return NULL; } -gboolean -exchange_component_is_offline (ExchangeComponent *component) +void +exchange_component_is_offline (ExchangeComponent *component, int *state) { - return exchange_is_offline (component->priv->offline_listener); + g_return_if_fail (EXCHANGE_IS_COMPONENT (component)); + + exchange_is_offline (component->priv->offline_listener, state); } gboolean Index: storage/exchange-component.h =================================================================== RCS file: /cvs/gnome/evolution-exchange/storage/exchange-component.h,v retrieving revision 1.5 diff -u -p -u -r1.5 exchange-component.h --- storage/exchange-component.h 4 Feb 2005 11:29:45 -0000 1.5 +++ storage/exchange-component.h 23 Feb 2005 07:00:54 -0000 @@ -44,7 +44,7 @@ ExchangeComponent *exchange_component_ne ExchangeAccount *exchange_component_get_account_for_uri (ExchangeComponent *component, const char *uri); gboolean exchange_component_is_interactive (ExchangeComponent *component); -gboolean exchange_component_is_offline (ExchangeComponent *component); +void exchange_component_is_offline (ExchangeComponent *component, int *state); void exchange_component_set_offline_listener (ExchangeComponent *component, ExchangeOfflineListener *listener); Index: storage/exchange-hierarchy-favorites.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/storage/exchange-hierarchy-favorites.c,v retrieving revision 1.13 diff -u -p -u -r1.13 exchange-hierarchy-favorites.c --- storage/exchange-hierarchy-favorites.c 4 Feb 2005 11:29:45 -0000 1.13 +++ storage/exchange-hierarchy-favorites.c 23 Feb 2005 07:00:54 -0000 @@ -121,11 +121,12 @@ get_hrefs (ExchangeHierarchySomeDAV *hsd GByteArray *source_key; const char *prop = E2K_PR_DAV_HREF, *shortcut_uri; char *perm_url, *folder_uri; - int i, nresults; + int i, nresults, mode; hrefs = g_ptr_array_new (); - if (exchange_account_is_offline (hier->account)) { + exchange_account_is_offline (hier->account, &mode); + if (mode != ONLINE_MODE) { exchange_hierarchy_webdav_offline_scan_subtree (EXCHANGE_HIERARCHY (hfav), add_hrefs, hrefs); return hrefs; } Index: storage/exchange-hierarchy-somedav.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/storage/exchange-hierarchy-somedav.c,v retrieving revision 1.6 diff -u -p -u -r1.6 exchange-hierarchy-somedav.c --- storage/exchange-hierarchy-somedav.c 4 Feb 2005 11:29:45 -0000 1.6 +++ storage/exchange-hierarchy-somedav.c 23 Feb 2005 07:00:54 -0000 @@ -128,7 +128,7 @@ scan_subtree (ExchangeHierarchy *hier, E GPtrArray *hrefs; E2kResultIter *iter; E2kResult *result; - int folders_returned=0, folders_added=0, i; + int folders_returned=0, folders_added=0, i, mode; E2kHTTPStatus status; ExchangeAccountFolderResult folder_result; EFolder *iter_folder = NULL; @@ -145,7 +145,8 @@ scan_subtree (ExchangeHierarchy *hier, E return EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST; } /*FIXME : Not sure if this is the right place for this */ - if (exchange_account_is_offline (hier->account)) + exchange_account_is_offline (hier->account, &mode); + if (mode != ONLINE_MODE) return EXCHANGE_ACCOUNT_FOLDER_OK; iter = e_folder_exchange_bpropfind_start (hier->toplevel, NULL, Index: storage/exchange-hierarchy-webdav.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/storage/exchange-hierarchy-webdav.c,v retrieving revision 1.22 diff -u -p -u -r1.22 exchange-hierarchy-webdav.c --- storage/exchange-hierarchy-webdav.c 4 Feb 2005 11:29:45 -0000 1.22 +++ storage/exchange-hierarchy-webdav.c 23 Feb 2005 07:00:54 -0000 @@ -297,10 +297,11 @@ create_folder (ExchangeHierarchy *hier, E2kProperties *props; E2kHTTPStatus status; char *permanent_url = NULL; - int i; + int i, mode; - if (exchange_account_is_offline (hier->account)) - return EXCHANGE_ACCOUNT_FOLDER_OFFLINE; + exchange_account_is_offline (hier->account, &mode); + if (mode != ONLINE_MODE) + return EXCHANGE_ACCOUNT_FOLDER_OFFLINE; for (i = 0; folder_types[i].component; i++) { if (!strcmp (folder_types[i].component, type)) @@ -344,9 +345,12 @@ static ExchangeAccountFolderResult remove_folder (ExchangeHierarchy *hier, EFolder *folder) { E2kHTTPStatus status; + int mode; - if (exchange_account_is_offline (hier->account)) - return EXCHANGE_ACCOUNT_FOLDER_OFFLINE; + exchange_account_is_offline (hier->account, &mode); + + if (mode != ONLINE_MODE) + return EXCHANGE_ACCOUNT_FOLDER_OFFLINE; if (folder == hier->toplevel) return EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED; @@ -370,11 +374,11 @@ xfer_folder (ExchangeHierarchy *hier, EF ESourceList *cal_source_list, *task_source_list, *cont_source_list; const char *folder_type = NULL; ExchangeAccountFolderResult ret_code; - gboolean offline; - - offline = exchange_account_is_offline (hier->account); - if (offline) - return EXCHANGE_ACCOUNT_FOLDER_OFFLINE; + int offline; + + exchange_account_is_offline (hier->account, &offline); + if (offline != ONLINE_MODE) + return EXCHANGE_ACCOUNT_FOLDER_OFFLINE; if (source == hier->toplevel) return EXCHANGE_ACCOUNT_FOLDER_GENERIC_ERROR; @@ -396,7 +400,7 @@ xfer_folder (ExchangeHierarchy *hier, EF if (remove_source) exchange_hierarchy_removed_folder (hier, source); exchange_hierarchy_new_folder (hier, dest); - scan_subtree (hier, dest, offline); + scan_subtree (hier, dest, (offline == OFFLINE_MODE)); physical_uri = (char *) e_folder_get_physical_uri (source); g_object_unref (dest); ret_code = EXCHANGE_ACCOUNT_FOLDER_OK; @@ -482,11 +486,12 @@ rescan (ExchangeHierarchy *hier) E2kResultIter *iter; E2kResult *result; EFolder *folder; - int unread; + int unread, offline; - if ( exchange_account_is_offline (hier->account) || - hier->type == EXCHANGE_HIERARCHY_PUBLIC) - return; + exchange_account_is_offline (hier->account, &offline); + if ( (offline != ONLINE_MODE) || + hier->type == EXCHANGE_HIERARCHY_PUBLIC) + return; hrefs = g_ptr_array_new (); g_hash_table_foreach (hwd->priv->folders_by_internal_path, @@ -606,7 +611,7 @@ exchange_hierarchy_webdav_parse_folder ( e_folder_exchange_set_has_subfolders (folder, TRUE); if (permanenturl) { e_folder_exchange_set_permanent_uri (folder, permanenturl); - exchange_folder_size_update (hwd->priv->foldersize, permanenturl, name, folder_size); + //exchange_folder_size_update (hwd->priv->foldersize, permanenturl, name, folder_size); } return folder; Index: storage/exchange-offline-listener.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/storage/exchange-offline-listener.c,v retrieving revision 1.5 diff -u -p -u -r1.5 exchange-offline-listener.c --- storage/exchange-offline-listener.c 20 Jan 2005 09:23:58 -0000 1.5 +++ storage/exchange-offline-listener.c 23 Feb 2005 07:00:54 -0000 @@ -30,11 +30,6 @@ #include <libedata-cal/e-data-cal-factory.h> #include <gconf/gconf-client.h> -enum { - OFFLINE_MODE=1, - ONLINE_MODE -}; - static GObjectClass *parent_class = NULL; struct _ExchangeOfflineListenerPrivate @@ -120,16 +115,19 @@ exchange_offline_listener_new (EDataBook } /* This returns TRUE if exchange is set offline */ -gboolean -exchange_is_offline (ExchangeOfflineListener *ex_offline_listener) +void +exchange_is_offline (ExchangeOfflineListener *ex_offline_listener, int *state) { ExchangeOfflineListenerPrivate * priv; - g_return_val_if_fail (EXCHANGE_IS_OFFLINE_LISTENER (ex_offline_listener), FALSE); + g_return_if_fail (EXCHANGE_IS_OFFLINE_LISTENER (ex_offline_listener)); priv = ex_offline_listener->priv; - return priv->offline; + if (priv->offline) + *state = OFFLINE_MODE; + else + *state = ONLINE_MODE; } static void Index: storage/exchange-offline-listener.h =================================================================== RCS file: /cvs/gnome/evolution-exchange/storage/exchange-offline-listener.h,v retrieving revision 1.2 diff -u -p -u -r1.2 exchange-offline-listener.h --- storage/exchange-offline-listener.h 9 Dec 2004 10:55:45 -0000 1.2 +++ storage/exchange-offline-listener.h 23 Feb 2005 07:00:54 -0000 @@ -40,6 +40,11 @@ G_BEGIN_DECLS #define EXCHANGE_IS_OFFLINE_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_OFFLINE_TYPE_LISTENER)) #define EXCHANGE_IS_OFFLINE_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_OFFLINE_TYPE_LISTENER) +enum { + UNSUPPORTED_MODE = 0, + OFFLINE_MODE, + ONLINE_MODE +}; typedef struct _ExchangeOfflineListener ExchangeOfflineListener; typedef struct _ExchangeOfflineListenerPrivate ExchangeOfflineListenerPrivate; @@ -59,7 +64,7 @@ GType exchange_offline_listener_get_type ExchangeOfflineListener *exchange_offline_listener_new (EDataBookFactory *book_factory, EDataCalFactory *cal_factory); -gboolean exchange_is_offline (ExchangeOfflineListener *offline_listener); +void exchange_is_offline (ExchangeOfflineListener *offline_listener, int *state); G_END_DECLS