[evolution-patches] Exchange : fix for #311152
- From: Sarfraaz Ahmed <asarfraaz novell com>
- To: Patches List <evolution-patches lists ximian com>
- Subject: [evolution-patches] Exchange : fix for #311152
- Date: Fri, 29 Jul 2005 17:13:07 +0530
Hi,
This fixes the favorite folder handling for exchange.
Thanks
-- Sarfraaz
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.363
diff -u -p -u -p -r1.363 ChangeLog
--- ChangeLog 28 Jul 2005 06:00:00 -0000 1.363
+++ ChangeLog 29 Jul 2005 10:20:55 -0000
@@ -1,3 +1,15 @@
+2005-07-29 Sarfraaz Ahmed <asarfraaz novell com>
+
+ * mail/mail-stub-exchange.c (get_folder_info) : Fetch only mail type
+ of folders for the mail component. Also cleaned up the logic for
+ identifying public and favorite folders. We should now be setting the
+ folder as inbox based on its uri, since a rescan on the account is
+ always changing the pointers.
+ (unsubscribe_folder) : Change the path for the public folder to a
+ favorite folder manually in the backend, since the UI can only support
+ a list of public folders.
+ (is_subscribed_folder) : Similar
+
2005-07-28 Sarfraaz Ahmed <asarfraaz novell com>
* calendar/e-cal-backend-exchange.c
Index: mail/mail-stub-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/mail/mail-stub-exchange.c,v
retrieving revision 1.18
diff -u -p -u -p -r1.18 mail-stub-exchange.c
--- mail/mail-stub-exchange.c 25 Jul 2005 11:03:17 -0000 1.18
+++ mail/mail-stub-exchange.c 29 Jul 2005 10:20:55 -0000
@@ -2148,7 +2148,7 @@ get_folder_info (MailStub *stub, const c
GArray *unread, *flags;
ExchangeHierarchy *hier;
EFolder *folder;
- const char *type, *name, *uri, *path;
+ const char *type, *name, *uri, *path, *inbox_uri;
int unread_count, i, toplen = top ? strlen (top) : 0;
guint32 folder_flags;
gboolean recursive, subscribed;
@@ -2169,8 +2169,12 @@ get_folder_info (MailStub *stub, const c
folder = exchange_account_get_folder (mse->account, full_path);
g_free (full_path);
if (folder) {
- folders = g_ptr_array_new ();
- g_ptr_array_add (folders, folder);
+ type = e_folder_get_type_string (folder);
+ if ((!strcmp (type, "mail")) ||
+ (!strcmp (type, "mail/public"))) {
+ folders = g_ptr_array_new ();
+ g_ptr_array_add (folders, folder);
+ }
}
} else {
folders = exchange_account_get_folders (mse->account);
@@ -2180,7 +2184,7 @@ get_folder_info (MailStub *stub, const c
uris = g_ptr_array_new ();
unread = g_array_new (FALSE, FALSE, sizeof (int));
flags = g_array_new (FALSE, FALSE, sizeof (int));
- //flags = g_byte_array_new ();
+ inbox_uri = e_folder_get_physical_uri (mse->inbox);
if (folders) {
for (i = 0; i < folders->len; i++) {
@@ -2208,11 +2212,8 @@ get_folder_info (MailStub *stub, const c
name = e_folder_get_name (folder);
uri = e_folder_get_physical_uri (folder);
d(printf ("folder type is : %s\n", type));
- if ((!strcmp (type, "mail")) ||
- (!strcmp (type, "mail/public")) ||
- (!strcmp (type, "calendar/public")) ||
- (!strcmp (type, "tasks/public")) ||
- (!strcmp (type, "contacts/public"))) {
+ if (hier->type == EXCHANGE_HIERARCHY_FAVORITES ||
+ hier->type == EXCHANGE_HIERARCHY_PUBLIC) {
unread_count = e_folder_get_unread_count (folder);
if (exchange_account_is_favorite_folder (mse->account, folder)) {
folder_flags |= CAMEL_STUB_FOLDER_SUBSCRIBED;
@@ -2220,11 +2221,16 @@ get_folder_info (MailStub *stub, const c
}
else
folder_flags = 0;
- } else {
- unread_count = 0;
- folder_flags = CAMEL_STUB_FOLDER_NOSELECT;
+ } else {
+ if (!strcmp (type, "mail")) {
+ unread_count = e_folder_get_unread_count (folder);
+ folder_flags = 0;
+ } else {
+ unread_count = 0;
+ folder_flags = CAMEL_STUB_FOLDER_NOSELECT;
+ }
}
- if (folder == mse->inbox)
+ if (!strcmp (uri, inbox_uri))
folder_flags |= CAMEL_STUB_FOLDER_SYSTEM|CAMEL_STUB_FOLDER_TYPE_INBOX;
g_ptr_array_add (names, (char *)name);
@@ -2516,10 +2522,11 @@ unsubscribe_folder (MailStub *stub, cons
MailStubExchange *mse = MAIL_STUB_EXCHANGE (stub);
ExchangeAccountFolderResult result;
EFolder *folder;
- char *path;
+ char *path, *pub_name;
const char *folder_type, *physical_uri;
- path = g_build_filename ("/", folder_name, NULL);
+ pub_name = strchr (folder_name, '/');
+ path = g_build_filename ("/favorites", pub_name, NULL);
folder = exchange_account_get_folder (mse->account, path);
if (!folder) {
mail_stub_return_error (stub, _("Folder doesn't exist"));
@@ -2548,40 +2555,6 @@ unsubscribe_folder (MailStub *stub, cons
}
- if (result == EXCHANGE_ACCOUNT_FOLDER_OK) {
- /* This is a dirty hack to remove the esources for favourite
- folders. ExchangeConfigListener depends on EAccountList
- which is present only in evolution, and so cannot be
- included as part of the servers code in e-d-s. So,
- ExchangeConfigListener had to be moved to evolution
- plugins and evolution-exchange. Ideally, this esource
- handling should have been done in the favorites code.
- The following code has been moved from
- exchanga-hierarchy-favorites.c:remove_folder
- */
- /* Temp Fix for remove fav folders. see #59168 */
- /* remove ESources */
- folder_type = e_folder_get_type_string (folder);
- physical_uri = e_folder_get_physical_uri (folder);
- d(printf ("removeing folder type : %s\n", folder_type));
- d(printf ("physical uri : %s \n", physical_uri));
-
- if (strcmp (folder_type, "calendar/public") == 0) {
- remove_folder_esource (mse->account,
- EXCHANGE_CALENDAR_FOLDER,
- physical_uri);
- }
- else if (strcmp (folder_type, "tasks/public") == 0) {
- remove_folder_esource (mse->account,
- EXCHANGE_TASKS_FOLDER,
- physical_uri);
- }
- else if (strcmp (folder_type, "contacts/public") == 0) {
- remove_folder_esource (mse->account,
- EXCHANGE_CONTACTS_FOLDER,
- physical_uri);
- }
- }
g_object_unref (folder);
mail_stub_return_ok (stub);
}
@@ -2592,10 +2565,11 @@ is_subscribed_folder (MailStub *stub, co
MailStubExchange *mse = MAIL_STUB_EXCHANGE (stub);
gboolean result;
EFolder *folder;
- char *path;
+ char *path, *pub_name;
guint32 is_subscribed = 0;
- path = g_build_filename ("/", folder_name, NULL);
+ pub_name = strchr (folder_name, '/');
+ path = g_build_filename ("/favorites", pub_name, NULL);
folder = exchange_account_get_folder (mse->account, path);
if (!folder) {
/* Dont ever return an exception from here as CamelException
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.22
diff -u -p -u -p -r1.22 ChangeLog
--- ChangeLog 28 Jul 2005 08:29:48 -0000 1.22
+++ ChangeLog 29 Jul 2005 10:05:07 -0000
@@ -1,3 +1,8 @@
+2005-07-29 Sarfraaz Ahmed <asarfraaz novell com>
+
+ * storage/exchange-hierarchy-favorites.c (remove_folder) : Remove
+ the esources only after we have removed the folder from the server.
+
2005-07-28 Sarfraaz Ahmed <asarfraaz novell com>
* storage/exchange-account.c (is_password_expired) : This should be
Index: storage/exchange-hierarchy-favorites.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-hierarchy-favorites.c,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 exchange-hierarchy-favorites.c
--- storage/exchange-hierarchy-favorites.c 21 Jul 2005 14:45:57 -0000 1.4
+++ storage/exchange-hierarchy-favorites.c 29 Jul 2005 10:05:07 -0000
@@ -214,27 +214,27 @@ remove_folder (ExchangeHierarchy *hier,
if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) {
g_hash_table_remove (hfav->priv->shortcuts, folder_uri);
exchange_hierarchy_removed_folder (hier, folder);
- }
- /* Temp Fix for remove fav folders. see #59168 */
- /* remove ESources */
- folder_type = e_folder_get_type_string (folder);
- physical_uri = e_folder_get_physical_uri (folder);
+ /* Temp Fix for remove fav folders. see #59168 */
+ /* remove ESources */
+ folder_type = e_folder_get_type_string (folder);
+ physical_uri = e_folder_get_physical_uri (folder);
- if (strcmp (folder_type, "calendar") == 0) {
- remove_folder_esource (hier->account,
- EXCHANGE_CALENDAR_FOLDER,
- physical_uri);
- }
- else if (strcmp (folder_type, "tasks") == 0) {
- remove_folder_esource (hier->account,
- EXCHANGE_TASKS_FOLDER,
- physical_uri);
- }
- else if (strcmp (folder_type, "contacts") == 0) {
- remove_folder_esource (hier->account,
- EXCHANGE_CONTACTS_FOLDER,
- physical_uri);
+ if (strcmp (folder_type, "calendar") == 0) {
+ remove_folder_esource (hier->account,
+ EXCHANGE_CALENDAR_FOLDER,
+ physical_uri);
+ }
+ else if (strcmp (folder_type, "tasks") == 0) {
+ remove_folder_esource (hier->account,
+ EXCHANGE_TASKS_FOLDER,
+ physical_uri);
+ }
+ else if (strcmp (folder_type, "contacts") == 0) {
+ remove_folder_esource (hier->account,
+ EXCHANGE_CONTACTS_FOLDER,
+ physical_uri);
+ }
}
return exchange_hierarchy_webdav_status_to_folder_result (status);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]