[evolution-mapi] Connect to the server in mapi_account_added when not connected yet



commit 0634674f13fda66eed675a5e2f41b6ce5ddb0b94
Author: Milan Crha <mcrha redhat com>
Date:   Mon Apr 12 13:28:43 2010 +0200

    Connect to the server in mapi_account_added when not connected yet

 .../exchange-mapi-account-listener.c               |   18 +++++++++++-------
 src/camel/camel-mapi-provider.c                    |    3 ---
 2 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/account-setup-eplugin/exchange-mapi-account-listener.c b/src/account-setup-eplugin/exchange-mapi-account-listener.c
index 4581298..f5b3aad 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-listener.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-listener.c
@@ -37,11 +37,6 @@
 #include <libedataserver/e-source.h>
 #include <libedataserver/e-source-list.h>
 
-#include <libmapi/libmapi.h>
-
-/* FIXME: The mapi should not be needed in the include statement.
-LIMBAPI_CFLAGS or something is going wrong */
-
 #include <exchange-mapi-folder.h>
 #include <exchange-mapi-connection.h>
 #include <exchange-mapi-utils.h>
@@ -50,6 +45,8 @@ LIMBAPI_CFLAGS or something is going wrong */
 
 G_DEFINE_TYPE (ExchangeMAPIAccountListener, exchange_mapi_account_listener, G_TYPE_OBJECT)
 
+static gboolean create_profile_entry (CamelURL *url, EAccount *account);
+
 struct _ExchangeMAPIAccountListenerPrivate {
 	GConfClient *gconf_client;
 	/* we get notification about mail account changes from this object */
@@ -533,13 +530,20 @@ mapi_account_added (EAccountList *account_listener, EAccount *account)
 		g_return_if_fail (url != NULL);
 
 		conn = exchange_mapi_connection_find (camel_url_get_param (url, "profile"));
+		if (!conn) {
+			/* connect to the server when not connected yet */
+			if (!create_profile_entry (url, account)) {
+				camel_url_free (url);
+				return;
+			}
+
+			conn = exchange_mapi_connection_find (camel_url_get_param (url, "profile"));
+		}
 		camel_url_free (url);
 		g_return_if_fail (conn != NULL);
 
 		folders_list = exchange_mapi_connection_peek_folders_list (conn);
 
-		printf ("%s: %d\n", __FUNCTION__, g_slist_length (folders_list));
-
 		add_addressbook_sources (account, folders_list);
 		add_calendar_sources (account, folders_list);
 
diff --git a/src/camel/camel-mapi-provider.c b/src/camel/camel-mapi-provider.c
index 6ca87b1..6d7ea9f 100644
--- a/src/camel/camel-mapi-provider.c
+++ b/src/camel/camel-mapi-provider.c
@@ -34,8 +34,6 @@
 #include "camel-mapi-store.h"
 #include "camel-mapi-transport.h"
 
-#define d(x) x
-
 static void add_hash (guint *, gchar *);
 static guint mapi_url_hash (gconstpointer);
 static gint check_equal (gchar *, gchar *);
@@ -93,7 +91,6 @@ CamelServiceAuthType camel_mapi_password_authtype = {
 static gint
 mapi_auto_detect_cb(CamelURL *url, GHashTable **auto_detected, CamelException *ex)
 {
-        d (printf("mapi_auto_detect_cb\n"));
 	*auto_detected = g_hash_table_new (g_str_hash, g_str_equal);
 	g_hash_table_insert (*auto_detected, g_strdup ("poa"), g_strdup (url->host));
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]