Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:pchenthill
evolution-data-server
fix-public-folder-eds.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-public-folder-eds.diff of Package evolution-data-server
Index: servers/exchange/storage exchange-hierarchy.h =================================================================== RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-hierarchy.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- servers/exchange/storage/exchange-hierarchy.h 2005/12/17 07:23:12 1.3 +++ servers/exchange/storage/exchange-hierarchy.h 2006/12/18 16:30:22 1.4 @@ -19,14 +19,6 @@ #define EXCHANGE_IS_HIERARCHY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY)) #define EXCHANGE_IS_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EXCHANGE_TYPE_HIERARCHY)) -typedef enum { - EXCHANGE_HIERARCHY_PERSONAL, - EXCHANGE_HIERARCHY_FAVORITES, - EXCHANGE_HIERARCHY_PUBLIC, - EXCHANGE_HIERARCHY_GAL, - EXCHANGE_HIERARCHY_FOREIGN -} ExchangeHierarchyType; - struct _ExchangeHierarchy { GObject parent; Index: servers/exchange/storage exchange-hierarchy-webdav.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-hierarchy-webdav.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- servers/exchange/storage/exchange-hierarchy-webdav.c 2006/12/13 17:47:40 1.13 +++ servers/exchange/storage/exchange-hierarchy-webdav.c 2006/12/18 16:30:22 1.14 @@ -685,6 +685,12 @@ }; static const int n_folder_props = sizeof (folder_props) / sizeof (folder_props[0]); +static const char *pub_folder_props[] = { + E2K_PR_DAV_DISPLAY_NAME, + E2K_PR_DAV_HAS_SUBS +}; +static const int n_pub_folder_props = sizeof (pub_folder_props) / sizeof (pub_folder_props[0]); + static ExchangeAccountFolderResult scan_subtree (ExchangeHierarchy *hier, EFolder *parent, int mode) { @@ -697,10 +703,19 @@ EFolder *folder, *tmp; GPtrArray *folders; int i; + static short level = 0; gdouble fsize_d; const char *name, *folder_size, *deleted_items_uri, *int_uri; gboolean personal = ( EXCHANGE_HIERARCHY (hwd)->type == EXCHANGE_HIERARCHY_PERSONAL ); + if (parent) { + if (!e_folder_exchange_get_rescan_tree (parent)) { + d(g_print ("%s(%d):%s: Donot RESCAN [%s] \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, + e_folder_get_name (parent))); + return EXCHANGE_ACCOUNT_FOLDER_OK; + } + } + if (mode == OFFLINE_MODE) { folders = g_ptr_array_new (); exchange_hierarchy_webdav_offline_scan_subtree (EXCHANGE_HIERARCHY (hier), add_folders, folders); @@ -711,6 +726,7 @@ return EXCHANGE_ACCOUNT_FOLDER_OK; } + if (!folders_rn) { folders_rn = e2k_restriction_andv ( @@ -721,9 +737,16 @@ NULL); } - iter = e_folder_exchange_search_start (parent, NULL, - folder_props, n_folder_props, - folders_rn, NULL, TRUE); + if (hier->type == EXCHANGE_HIERARCHY_PUBLIC) + iter = e_folder_exchange_search_start (parent, NULL, + pub_folder_props, + n_pub_folder_props, + folders_rn, NULL, TRUE); + else + iter = e_folder_exchange_search_start (parent, NULL, + folder_props, n_folder_props, + folders_rn, NULL, TRUE); + while ((result = e2k_result_iter_next (iter))) { folder = exchange_hierarchy_webdav_parse_folder (hwd, parent, result); if (!folder) @@ -738,20 +761,25 @@ //g_object_unref (folder); /* Check the folder size here */ - name = e2k_properties_get_prop (result->props, + if (hier->type != EXCHANGE_HIERARCHY_PUBLIC) { + name = e2k_properties_get_prop (result->props, E2K_PR_DAV_DISPLAY_NAME); - folder_size = e2k_properties_get_prop (result->props, - E2K_PR_EXCHANGE_FOLDER_SIZE); + folder_size = e2k_properties_get_prop (result->props, + E2K_PR_EXCHANGE_FOLDER_SIZE); + + /* FIXME : Find a better way of doing this */ + fsize_d = g_ascii_strtod (folder_size, NULL)/1024 ; + exchange_account_folder_size_add (hier->account, name, fsize_d); + } - /* FIXME : Find a better way of doing this */ - fsize_d = g_ascii_strtod (folder_size, NULL)/1024 ; - exchange_account_folder_size_add (hier->account, name, fsize_d); if (personal) { /* calculate mail box size only for personal folders */ hwd->priv->total_folder_size = hwd->priv->total_folder_size + fsize_d; } + } + status = e2k_result_iter_free (iter); deleted_items_uri = exchange_account_get_standard_uri (hier->account, "deleteditems"); @@ -766,6 +794,8 @@ scan_subtree (hier, folder, mode); } + e_folder_exchange_set_rescan_tree (parent, FALSE); + return exchange_hierarchy_webdav_status_to_folder_result (status); } Index: servers/exchange/storage exchange-account.h =================================================================== RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-account.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- servers/exchange/storage/exchange-account.h 2006/07/22 09:05:22 1.9 +++ servers/exchange/storage/exchange-account.h 2006/12/18 16:30:23 1.10 @@ -100,6 +100,11 @@ const char *path_or_uri); GPtrArray *exchange_account_get_folders (ExchangeAccount *acct); +GPtrArray *exchange_account_get_folder_tree (ExchangeAccount *account, char* path); + +ExchangeHierarchy *exchange_account_get_hierarchy (ExchangeAccount *acct, + ExchangeHierarchyType type); + void exchange_account_rescan_tree (ExchangeAccount *acct); char *exchange_account_get_password (ExchangeAccount *acct); Index: servers/exchange/storage exchange-account.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-account.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- servers/exchange/storage/exchange-account.c 2006/11/15 08:01:16 1.37 +++ servers/exchange/storage/exchange-account.c 2006/12/18 16:30:23 1.38 @@ -54,7 +54,7 @@ #include <stdlib.h> #include <string.h> -#define d(x) x +#define d(x) (x) #define ADS_UF_DONT_EXPIRE_PASSWORD 0x10000 #define ONE_HUNDRED_NANOSECOND 0.000000100 #define SECONDS_IN_DAY 86400 @@ -527,6 +527,8 @@ g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), EXCHANGE_ACCOUNT_FOLDER_GENERIC_ERROR); + d(g_print ("exchange_account_remove_folder: path=[%s]\n", path)); + if (!get_folder (account, path, &folder, &hier)) return EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST; @@ -783,6 +785,8 @@ g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), EXCHANGE_ACCOUNT_FOLDER_GENERIC_ERROR); + d(g_print ("exchange_account_remove_folder: path=[%s]\n", path)); + if (!get_folder (account, path, &folder, &hier)) return EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST; @@ -1791,11 +1795,20 @@ e_folder_exchange_get_path (*fb)); } +struct _folders_tree { + char *path; + GPtrArray *folders; +}; + + static void add_folder (gpointer key, gpointer value, gpointer folders) { EFolder *folder = value; + d(g_print ("%s(%d):%s: key=[%s]\t folder-path=[%s]\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, + key, e_folder_exchange_get_path (folder))); + /* Each folder appears under three different keys, but * we only want to add it to the results array once. So * we only add when we see the "path" key. @@ -1804,6 +1817,20 @@ g_ptr_array_add (folders, folder); } +static void +add_folder_tree (gpointer key, gpointer value, gpointer folders) +{ + EFolder *folder = value; + struct _folders_tree *fld_tree = (struct _folders_tree *) folders; + char *key1 = NULL; + + if (!fld_tree || !fld_tree->path) + return; + + if (g_str_has_prefix (key, fld_tree->path)) + add_folder (key, folder, fld_tree->folders); +} + /** * exchange_account_get_folders: * @account: an #ExchangeAccount @@ -1824,9 +1851,10 @@ g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), NULL); folders = g_ptr_array_new (); - if (account->priv->fresh_folders) + /* if (account->priv->fresh_folders) g_hash_table_foreach (account->priv->fresh_folders, add_folder, folders); else + */ g_hash_table_foreach (account->priv->folders, add_folder, folders); qsort (folders->pdata, folders->len, @@ -1836,6 +1864,53 @@ } /** + * exchange_account_get_folder_tree: + * @account: an #ExchangeAccount + * + * Return an array of folders (sorted such that parents will occur + * before children). If the caller wants to keep up to date with the + * list of folders, he should also listen to %new_folder and + * %removed_folder signals. + * + * Return value: an array of folders. The array should be freed with + * g_ptr_array_free(). + **/ +GPtrArray * +exchange_account_get_folder_tree (ExchangeAccount *account, char* path) +{ + GPtrArray *folders = NULL; + EFolder *folder = NULL; + ExchangeHierarchy *hier = NULL; + + struct _folders_tree *fld_tree = NULL; + + g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), NULL); + + if (!get_folder (account, path, &folder, &hier)) + return folders; + + exchange_hierarchy_scan_subtree (hier, folder, account->priv->account_online); + + folders = g_ptr_array_new (); + fld_tree = g_new0 (struct _folders_tree, 1); + fld_tree->path = path; + fld_tree->folders = folders; + + /* if (account->priv->fresh_folders) + g_hash_table_foreach (account->priv->fresh_folders, add_folder, folders); + else + */ + g_hash_table_foreach (account->priv->folders, add_folder_tree, fld_tree); + + qsort (folders->pdata, folders->len, + sizeof (EFolder *), folder_comparator); + + g_free (fld_tree); + + return folders; +} + +/** * exchange_account_get_quota_limit: * @account: an #ExchangeAccount * @@ -2146,3 +2221,18 @@ return account; } + +ExchangeHierarchy* +exchange_account_get_hierarchy (ExchangeAccount* acct, + ExchangeHierarchyType type) +{ + int i; + + g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (acct), NULL); + + for (i = 0; i < acct->priv->hierarchies->len; i++) { + if (EXCHANGE_HIERARCHY (acct->priv->hierarchies->pdata[i])->type == type) + return EXCHANGE_HIERARCHY (acct->priv->hierarchies->pdata[i]); + } + return NULL; +} Index: servers/exchange/storage e-folder-exchange.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/e-folder-exchange.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- servers/exchange/storage/e-folder-exchange.c 2006/12/13 17:47:40 1.12 +++ servers/exchange/storage/e-folder-exchange.c 2006/12/18 16:30:23 1.13 @@ -55,6 +55,7 @@ char *path; long long int folder_size; gboolean has_subfolders; + gboolean rescan_tree; }; #define PARENT_TYPE E_TYPE_FOLDER @@ -132,6 +133,7 @@ return new_path; } +#define d(x) /** * e_folder_exchange_new: @@ -368,6 +370,36 @@ } /** + * e_folder_exchange_get_rescan_tree: + * @folder: an #EFolderExchange + * + * Return value: whether or not to rescan @folder tree + **/ +gboolean +e_folder_exchange_get_rescan_tree (EFolder *folder) +{ + g_return_val_if_fail (E_IS_FOLDER_EXCHANGE (folder), FALSE); + + return E_FOLDER_EXCHANGE (folder)->priv->rescan_tree; +} + +/** + * e_folder_exchange_set_rescan_tree + * @folder: an #EFolderExchange + * @rescan_tree: whether or not @folder needs to be rescanned + * + * Sets @folder's has_subfolders flag. + **/ +void +e_folder_exchange_set_rescan_tree (EFolder *folder, + gboolean rescan_tree) +{ + g_return_if_fail (E_IS_FOLDER_EXCHANGE (folder)); + + E_FOLDER_EXCHANGE (folder)->priv->rescan_tree = rescan_tree; +} + +/** * e_folder_exchange_get_outlook_class: * @folder: an #EFolderExchange * Index: servers/exchange/storage e-folder-exchange.h =================================================================== RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/e-folder-exchange.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- servers/exchange/storage/e-folder-exchange.h 2005/06/10 10:51:09 1.2 +++ servers/exchange/storage/e-folder-exchange.h 2006/12/18 16:30:23 1.3 @@ -62,6 +62,10 @@ void e_folder_exchange_set_has_subfolders (EFolder *folder, gboolean has_subfolders); +gboolean e_folder_exchange_get_rescan_tree (EFolder *folder); +void e_folder_exchange_set_rescan_tree (EFolder *folder, + gboolean has_subfolders); + const char *e_folder_exchange_get_outlook_class (EFolder *folder); char *e_folder_exchange_get_storage_file (EFolder *folder, Index: servers/exchange/storage exchange-types.h =================================================================== RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-types.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- servers/exchange/storage/exchange-types.h 2005/06/10 10:51:09 1.2 +++ servers/exchange/storage/exchange-types.h 2006/12/18 17:12:53 1.3 @@ -53,6 +53,14 @@ typedef struct XCBackendViewPrivate XCBackendViewPrivate; typedef struct XCBackendViewClass XCBackendViewClass; +typedef enum { + EXCHANGE_HIERARCHY_PERSONAL, + EXCHANGE_HIERARCHY_FAVORITES, + EXCHANGE_HIERARCHY_PUBLIC, + EXCHANGE_HIERARCHY_GAL, + EXCHANGE_HIERARCHY_FOREIGN +} ExchangeHierarchyType; + #ifdef __cplusplus } #endif /* __cplusplus */ Index: servers/exchange/storage e-folder-exchange.c =================================================================== RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/e-folder-exchange.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- servers/exchange/storage/e-folder-exchange.c 2006/12/18 16:30:23 1.13 +++ servers/exchange/storage/e-folder-exchange.c 2006/12/18 18:46:50 1.14 @@ -82,6 +82,7 @@ EFolderExchange *folder = E_FOLDER_EXCHANGE (object); folder->priv = g_new0 (EFolderExchangePrivate, 1); + folder->priv->rescan_tree = TRUE; } static void
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor