[evolution-patches] Exchange: patch for bug #313310
- From: shakti <shprasad novell com>
- To: evolution-patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] Exchange: patch for bug #313310
- Date: Mon, 22 Aug 2005 17:05:13 +0530
Hi,
I have attached a patch for bug #313310. Please review the patch.
Thanks,
Shakti
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/ChangeLog,v
retrieving revision 1.44
diff -u -p -r1.44 ChangeLog
--- ChangeLog 16 Aug 2005 12:30:40 -0000 1.44
+++ ChangeLog 22 Aug 2005 11:33:57 -0000
@@ -1,3 +1,11 @@
+2005-08-22 Shakti Sen <shprasad novell com>
+
+ * exchange-folder.c (exchange_refresh_folder_tree, exchange_get_folder,
+ org_gnome_exchange_folder_inbox_unsubscribe): Added support for
+ Unsubscribe to other user's Inbox.
+
+ Fixes bug #313310.
+
2005-09-12 Praveen Kumar <kpraveen novell com>
* exchange-config-listener.c
Index: exchange-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-folder.c,v
retrieving revision 1.9
diff -u -p -r1.9 exchange-folder.c
--- exchange-folder.c 3 Aug 2005 09:58:28 -0000 1.9
+++ exchange-folder.c 22 Aug 2005 11:33:57 -0000
@@ -34,6 +34,13 @@
#include <mail/em-menu.h>
#include <libedataserverui/e-source-selector.h>
#include <e-util/e-error.h>
+#include <camel/camel-store.h>
+#include <camel/camel-folder.h>
+#include <mail/em-folder-tree.h>
+#include <mail/mail-mt.h>
+#include <mail/mail-config.h>
+#include <mail/mail-ops.h>
+#include <mail/mail-component.h>
#include "exchange-operations.h"
#include "addressbook/gui/widgets/eab-popup.h"
@@ -49,6 +56,8 @@ void org_gnome_exchange_folder_inbox_uns
void popup_free (EPopup *ep, GSList *items, void *data);
void popup_inbox_free (EPopup *ep, GSList *items, void *data);
void popup_ab_free (EPopup *ep, GSList *items, void *data);
+static void exchange_refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store);
+static void exchange_get_folder (char *uri, CamelFolder *folder, void *data);
#define CONF_KEY_SELECTED_CAL_SOURCES "/apps/evolution/calendar/display/selected_calendars"
@@ -63,10 +72,98 @@ popup_inbox_free (EPopup *ep, GSList *it
g_slist_free (items);
}
+static void
+exchange_refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store)
+{
+ char *uri;
+ EAccount *account;
+ CamelException ex;
+ CamelProvider *provider;
+
+ uri = camel_url_to_string (((CamelService *) store)->url, CAMEL_URL_HIDE_ALL);
+ account = (EAccount *)mail_config_get_account_by_source_url (uri);
+ uri = account->source->url;
+ em_folder_tree_model_remove_store (model, store);
+
+ camel_exception_init (&ex);
+ if (!(provider = camel_provider_get (uri, &ex))) {
+ camel_exception_clear (&ex);
+ return;
+ }
+ if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
+ return;
+ em_folder_tree_model_add_store (model, store, account->name);
+
+}
+
void
org_gnome_exchange_folder_inbox_unsubscribe (EPopup *ep, EPopupItem *p, void *data)
{
- // To be done:
+ ExchangeAccount *account = NULL;
+ EMPopupTargetFolder *target = data;
+ gchar *path = NULL;
+ gchar *stored_path = NULL;
+ gchar *inbox_path = NULL;
+ ExchangeAccountFolderResult result;
+
+ account = exchange_operations_get_exchange_account ();
+
+ if (!account)
+ return;
+
+ path = target->uri + strlen ("exchange://") + strlen (account->account_filename);
+ /* User will be able to unsubscribe by doing a right click on
+ any one of this two-<other user's>Inbox or the
+ <other user's folder> tree.
+ */
+ stored_path = strrchr (path + 1, '/');
+
+ if (stored_path)
+ path[stored_path - path] = '\0';
+
+ result = exchange_account_remove_shared_folder (account, path);
+ switch (result) {
+ case EXCHANGE_ACCOUNT_FOLDER_OK:
+ break;
+ case EXCHANGE_ACCOUNT_FOLDER_ALREADY_EXISTS:
+ e_error_run (NULL, ERROR_DOMAIN ":folder-exists-error", NULL);
+ return;
+ case EXCHANGE_ACCOUNT_FOLDER_DOES_NOT_EXIST:
+ e_error_run (NULL, ERROR_DOMAIN ":folder-doesnt-exist-error", NULL);
+ return;
+ case EXCHANGE_ACCOUNT_FOLDER_UNKNOWN_TYPE:
+ e_error_run (NULL, ERROR_DOMAIN ":folder-unknown-type", NULL);
+ return;
+ case EXCHANGE_ACCOUNT_FOLDER_PERMISSION_DENIED:
+ e_error_run (NULL, ERROR_DOMAIN ":folder-perm-error", NULL);
+ return;
+ case EXCHANGE_ACCOUNT_FOLDER_OFFLINE:
+ e_error_run (NULL, ERROR_DOMAIN ":folder-offline-error", NULL);
+ return;
+ case EXCHANGE_ACCOUNT_FOLDER_UNSUPPORTED_OPERATION:
+ e_error_run (NULL, ERROR_DOMAIN ":folder-unsupported-error", NULL);
+ return;
+ case EXCHANGE_ACCOUNT_FOLDER_GENERIC_ERROR:
+ e_error_run (NULL, ERROR_DOMAIN ":folder-generic-error", NULL);
+ return;
+ }
+
+ inbox_path = g_strdup_printf ("exchange://%s/%s", account->account_filename, "personal/Inbox");
+ mail_get_folder (inbox_path, 0, exchange_get_folder, NULL, mail_thread_new);
+ g_free (inbox_path);
+}
+
+static void
+exchange_get_folder (char *uri, CamelFolder *folder, void *data)
+{
+ CamelStore *store;
+ CamelException ex;
+ EMFolderTreeModel *model;
+
+ camel_exception_init (&ex);
+ store = camel_folder_get_parent_store (folder);
+ model = mail_component_peek_tree_model (mail_component_peek ());
+ exchange_refresh_folder_tree (model, store);
}
void
@@ -86,6 +183,8 @@ org_gnome_exchange_check_inbox_subscribe
path = g_strdup_printf (target->uri + strlen ("exchange://") + strlen (account->account_filename));
sub_folder = strchr (path, '@');
+ g_free (path);
+
if (!sub_folder)
return;
@@ -93,7 +192,6 @@ org_gnome_exchange_check_inbox_subscribe
menus = g_slist_prepend (menus, &popup_inbox_items[i]);
e_popup_add_items (target->target.popup, menus, NULL, popup_inbox_free, target);
- g_free (path);
}
static EPopupItem popup_items[] = {
@@ -454,6 +552,8 @@ org_gnome_exchange_folder_subscription (
result = exchange_account_discover_shared_folder (account, user_email_address, folder_name, &folder);
switch (result) {
+ case EXCHANGE_ACCOUNT_FOLDER_OK:
+ break;
case EXCHANGE_ACCOUNT_FOLDER_ALREADY_EXISTS:
e_error_run (NULL, ERROR_DOMAIN ":folder-exists-error", NULL);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]