[evolution-patches] Exchange : Fix for 309420
- From: Sarfraaz Ahmed <asarfraaz novell com>
- To: Patches List <evolution-patches lists ximian com>
- Subject: [evolution-patches] Exchange : Fix for 309420
- Date: Sat, 20 Aug 2005 17:50:06 +0530
Hi,
These 3 patches are one each for evolution/plugins, e-d-s and exchange.
Please review.
Thanks
-- Sarfraaz
Index: storage/exchange-account.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-account.c,v
retrieving revision 1.12
diff -u -p -u -p -r1.12 exchange-account.c
--- storage/exchange-account.c 17 Aug 2005 11:39:40 -0000 1.12
+++ storage/exchange-account.c 20 Aug 2005 12:12:19 -0000
@@ -907,6 +907,7 @@ get_password (ExchangeAccount *account,
// SURF : if (exchange_component_is_interactive (global_exchange_component)) {
if (!password) {
+ /*
char *prompt;
prompt = g_strdup_printf (_("Enter password for %s"),
@@ -925,6 +926,7 @@ get_password (ExchangeAccount *account,
account->priv->account->source->save_passwd = remember;
}
g_free (prompt);
+ */
}
else if (!account->priv->account->source->save_passwd) {
/* get_password returns the password cached but user has not
@@ -1415,7 +1417,7 @@ exchange_account_connect (ExchangeAccoun
}
account->priv->connecting = TRUE;
- g_mutex_unlock (account->priv->connect_lock);
+ //g_mutex_unlock (account->priv->connect_lock);
if (account->priv->windows_domain)
user_name = g_strdup_printf ("%s\\%s", account->priv->windows_domain, account->priv->username);
@@ -1431,12 +1433,19 @@ exchange_account_connect (ExchangeAccoun
e2k_autoconfig_set_gc_server (ac, account->priv->ad_server,
account->priv->ad_limit);
+ if (!pword)
+ return NULL;
try_password_again:
if (!pword) {
+ //e2k_autoconfig_set_password (ac, g_strdup ("Novell123"));
+/*
if (!get_password (account, ac, *info_result)) {
account->priv->connecting = FALSE;
return NULL;
}
+*/
+ } else {
+ e2k_autoconfig_set_password (ac, g_strdup (pword));
}
try_connect_again:
@@ -1632,6 +1641,7 @@ exchange_account_connect (ExchangeAccoun
G_CALLBACK (context_redirect), account);
g_signal_emit (account, signals[CONNECTED], 0, account->priv->ctx);
+ g_mutex_unlock (account->priv->connect_lock);
return account->priv->ctx;
}
Index: storage/exchange-esource.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-esource.c,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 exchange-esource.c
--- storage/exchange-esource.c 16 Aug 2005 12:28:39 -0000 1.4
+++ storage/exchange-esource.c 20 Aug 2005 12:12:19 -0000
@@ -45,12 +45,12 @@ add_folder_esource (ExchangeAccount *acc
GConfClient *client;
gboolean is_contacts_folder = TRUE, group_new = FALSE, source_new = FALSE;
const char *offline = NULL;
+ char *username;
int mode;
ESourceList *source_list = NULL;
gboolean offline_flag;
client = gconf_client_get_default ();
- offline_flag = is_offline ();
if (folder_type == EXCHANGE_CONTACTS_FOLDER) {
source_list = e_source_list_new_for_gconf ( client,
@@ -74,6 +74,7 @@ add_folder_esource (ExchangeAccount *acc
}
exchange_account_is_offline_sync_set (account, &mode);
+ username = exchange_account_get_username (account);
if ((source_group = e_source_list_peek_group_by_name (source_list,
account->account_name)) == NULL) {
@@ -98,6 +99,12 @@ add_folder_esource (ExchangeAccount *acc
*/
e_source_set_property (source, "offline_sync", "1");
}
+ e_source_set_property (source, "username", username);
+ e_source_set_property (source, "auth-domain", "Exchange");
+ if (is_contacts_folder)
+ e_source_set_property (source, "auth", "plain/password");
+ else
+ e_source_set_property (source, "auth", "1");
e_source_group_add_source (source_group, source, -1);
e_source_list_sync (source_list, NULL);
group_new = source_new = TRUE;
@@ -116,6 +123,12 @@ add_folder_esource (ExchangeAccount *acc
if (mode == OFFLINE_MODE)
e_source_set_property (source, "offline_sync", "1");
+ e_source_set_property (source, "username", username);
+ e_source_set_property (source, "auth-domain", "Exchange");
+ if (is_contacts_folder)
+ e_source_set_property (source, "auth", "plain/password");
+ else
+ e_source_set_property (source, "auth", "1");
e_source_group_add_source (source_group, source, -1);
source_new = TRUE;
e_source_list_sync (source_list, NULL);
@@ -130,6 +143,7 @@ add_folder_esource (ExchangeAccount *acc
}
}
+ offline_flag = is_offline ();
if (source && !is_contacts_folder) {
/* Select the folder created */
Index: plugins/exchange-operations/exchange-config-listener.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-operations/exchange-config-listener.c,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 exchange-config-listener.c
--- plugins/exchange-operations/exchange-config-listener.c 16 Aug 2005 12:30:41 -0000 1.11
+++ plugins/exchange-operations/exchange-config-listener.c 20 Aug 2005 12:08:24 -0000
@@ -92,7 +92,6 @@ static gboolean exchange_camel_urls_is_e
const gchar *url2);
static void remove_selected_non_offline_esources (ExchangeAccount *account,
const char *gconf_key);
-
static void
class_init (GObjectClass *object_class)
{
@@ -290,6 +289,8 @@ add_account_esources (ExchangeAccount *a
e_source_set_property (source, "offline_sync", "1");
if (username)
e_source_set_property (source, "username", username);
+ e_source_set_property (source, "auth", "1");
+ e_source_set_property (source, "auth-domain", "Exchange");
e_source_group_add_source (contacts_source_group,
source, -1);
g_object_unref (source);
@@ -302,6 +303,8 @@ add_account_esources (ExchangeAccount *a
e_source_set_property (source, "offline_sync", "1");
if (username)
e_source_set_property (source, "username", username);
+ e_source_set_property (source, "auth", "1");
+ e_source_set_property (source, "auth-domain", "Exchange");
e_source_group_add_source (cal_source_group,
source, -1);
#if 0
@@ -329,6 +332,8 @@ add_account_esources (ExchangeAccount *a
e_source_set_property (source, "offline_sync", "1");
if (username)
e_source_set_property (source, "username", username);
+ e_source_set_property (source, "auth", "1");
+ e_source_set_property (source, "auth-domain", "Exchange");
e_source_group_add_source (tasks_source_group,
source, -1);
#if 0
@@ -468,6 +473,58 @@ add_sources (ExchangeAccount *account)
}
static void
+migrate_account_esource (ExchangeAccount *account,
+ FolderType folder_type)
+{
+ ESourceGroup *group;
+ ESource *source = NULL;
+ GSList *groups;
+ GSList *sources;
+ gboolean found_group;
+ const char *user_name = exchange_account_get_username (account);
+ GConfClient *client;
+ ESourceList *source_list = NULL;
+
+ if (!user_name)
+ return;
+
+ client = gconf_client_get_default ();
+
+ if (folder_type == EXCHANGE_CONTACTS_FOLDER)
+ source_list = e_source_list_new_for_gconf ( client,
+ CONF_KEY_CONTACTS);
+ else if (folder_type == EXCHANGE_CALENDAR_FOLDER)
+ source_list = e_source_list_new_for_gconf ( client,
+ CONF_KEY_CAL);
+ else if (folder_type == EXCHANGE_TASKS_FOLDER)
+ source_list = e_source_list_new_for_gconf ( client,
+ CONF_KEY_TASKS);
+
+ groups = e_source_list_peek_groups (source_list);
+ found_group = FALSE;
+
+ for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) {
+ group = E_SOURCE_GROUP (groups->data);
+
+ if (strcmp (e_source_group_peek_name (group), account->account_name) == 0
+ &&
+ strcmp (e_source_group_peek_base_uri (group), EXCHANGE_URI_PREFIX) == 0) {
+ sources = e_source_group_peek_sources (group);
+
+ for( ; sources != NULL; sources = g_slist_next (sources)) {
+ source = E_SOURCE (sources->data);
+
+ e_source_set_property (source, "username", user_name);
+ e_source_list_sync (source_list, NULL);
+ found_group = TRUE;
+ break;
+ }
+ }
+ }
+ g_object_unref (source_list);
+ g_object_unref (client);
+}
+static void
remove_account_esource (ExchangeAccount *account,
FolderType folder_type)
{
@@ -565,6 +622,14 @@ remove_account_esource (ExchangeAccount
}
static void
+migrate_account_esources (ExchangeAccount *account)
+{
+ migrate_account_esource (account, EXCHANGE_CALENDAR_FOLDER);
+ migrate_account_esource (account, EXCHANGE_TASKS_FOLDER);
+ migrate_account_esource (account, EXCHANGE_CONTACTS_FOLDER);
+}
+
+static void
remove_account_esources (ExchangeAccount *account)
{
/* Remove ESources for all the folders in all the components */
@@ -617,6 +682,7 @@ account_added (EAccountList *account_lis
g_signal_emit (config_listener, signals[EXCHANGE_ACCOUNT_CREATED], 0,
exchange_account);
+ migrate_account_esources (exchange_account);
/* add_sources (exchange_account); */
exchange_config_listener_get_offline_status (config_listener, &is_offline);
Index: addressbook/e-book-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/addressbook/e-book-backend-exchange.c,v
retrieving revision 1.38
diff -u -p -u -p -r1.38 e-book-backend-exchange.c
--- addressbook/e-book-backend-exchange.c 19 Aug 2005 07:25:38 -0000 1.38
+++ addressbook/e-book-backend-exchange.c 20 Aug 2005 12:04:17 -0000
@@ -770,15 +770,18 @@ proppatch_categories (PropMapping *prop_
GPtrArray *prop_array = NULL;
categories_list = e_contact_get (new_contact, E_CONTACT_CATEGORY_LIST);
+
+ /* Dont sent a NULL array to the server */
+ if (!categories_list)
+ return;
+
prop_array = g_ptr_array_new ();
for (l = categories_list; l; l = g_list_next (l)) {
g_ptr_array_add (prop_array, g_strdup (l->data));
}
- if (categories_list) {
- e2k_properties_set_string_array (props, prop_mapping->prop_name, prop_array);
- }
+ e2k_properties_set_string_array (props, prop_mapping->prop_name, prop_array);
}
static void
@@ -2099,7 +2102,7 @@ e_book_backend_exchange_get_contact (EBo
static EBookBackendSyncStatus
-e_book_backend_exchange_authenticate_user (EBookBackendSync *backend,
+e_book_backend_exchange_authenticate_user (EBookBackend *backend,
EDataBook *book,
guint32 opid,
const char *user,
@@ -2108,6 +2111,8 @@ e_book_backend_exchange_authenticate_use
{
EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
EBookBackendExchangePrivate *bepriv = be->priv;
+ ExchangeAccountResult result;
+ ExchangeAccount *account;
d(printf("ebbe_authenticate_user(%p, %p, %s, %s, %s)\n", backend, book, user, password, auth_method));
@@ -2120,7 +2125,12 @@ e_book_backend_exchange_authenticate_use
return GNOME_Evolution_Addressbook_Success;
case GNOME_Evolution_Addressbook_MODE_REMOTE:
-
+
+ account = exchange_component_get_account_for_uri (global_exchange_component, NULL);
+ if (exchange_account_get_context (account))
+ exchange_account_connect (account, password, &result);
+ if (!bepriv->connected);
+ e_book_backend_exchange_connect (be);
if (e_book_backend_cache_is_populated (bepriv->cache)) {
if (bepriv->is_writable)
g_thread_create ((GThreadFunc) update_cache,
@@ -2130,14 +2140,35 @@ e_book_backend_exchange_authenticate_use
/* for personal books we always cache*/
g_thread_create ((GThreadFunc) build_cache, be, FALSE, NULL);
}
+ e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_Success);
return GNOME_Evolution_Addressbook_Success;
default:
break;
}
+ e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_Success);
return GNOME_Evolution_Addressbook_Success;
}
+static void
+e_book_backend_exchange_get_supported_auth_methods (EBookBackend *backend,
+ EDataBook *book,
+ guint32 opid)
+{
+ GList *auth_methods = NULL;
+ char *auth_method;
+
+ d(printf ("ebbe_get_supported_auth_methods (%p, %p)\n", backend, book));
+
+ auth_method = g_strdup_printf ("plain/password");
+ auth_methods = g_list_append (auth_methods, auth_method);
+ e_data_book_respond_get_supported_auth_methods (book, opid,
+ GNOME_Evolution_Addressbook_Success,
+ auth_methods);
+
+ g_free (auth_method);
+ g_list_free (auth_methods);
+}
static EBookBackendSyncStatus
e_book_backend_exchange_get_supported_fields (EBookBackendSync *backend,
@@ -2236,9 +2267,7 @@ e_book_backend_exchange_load_source (EBo
return GNOME_Evolution_Addressbook_Success;
}
- status = e_book_backend_exchange_connect (be);
- if (status != GNOME_Evolution_Addressbook_Success)
- return status;
+ e_book_backend_set_is_loaded (E_BOOK_BACKEND (be), TRUE);
if (e_book_backend_cache_is_populated (bepriv->cache)) {
if (bepriv->is_writable)
@@ -2250,7 +2279,7 @@ e_book_backend_exchange_load_source (EBo
g_thread_create ((GThreadFunc) build_cache, be, FALSE, NULL);
}
- return status;
+ return GNOME_Evolution_Addressbook_Success;
}
static EBookBackendSyncStatus
@@ -2311,9 +2340,10 @@ e_book_backend_exchange_set_mode (EBookB
{
EBookBackendExchange *be = E_BOOK_BACKEND_EXCHANGE (backend);
EBookBackendExchangePrivate *bepriv = be->priv;
+ ExchangeAccount *account;
bepriv->mode = mode;
- if (e_book_backend_is_loaded (backend)) {
+ /* if (e_book_backend_is_loaded (backend)) { */
if (mode == GNOME_Evolution_Addressbook_MODE_LOCAL) {
e_book_backend_set_is_writable (backend, FALSE);
e_book_backend_notify_writable (backend, FALSE);
@@ -2323,10 +2353,11 @@ e_book_backend_exchange_set_mode (EBookB
e_book_backend_set_is_writable (backend, bepriv->is_writable);
e_book_backend_notify_writable (backend, bepriv->is_writable);
e_book_backend_notify_connection_status (backend, TRUE);
- /* FIXME :
- e_book_backend_notify_auth_required (backend); */
+ account = exchange_component_get_account_for_uri (global_exchange_component, NULL);
+ if (!exchange_account_get_context (account))
+ e_book_backend_notify_auth_required (backend);
}
- }
+/* } */
}
/**
@@ -2422,6 +2453,9 @@ e_book_backend_exchange_class_init (EBoo
backend_class->stop_book_view = e_book_backend_exchange_stop_book_view;
backend_class->cancel_operation = e_book_backend_exchange_cancel_operation;
backend_class->set_mode = e_book_backend_exchange_set_mode;
+ backend_class->get_supported_auth_methods = e_book_backend_exchange_get_supported_auth_methods;
+ backend_class->authenticate_user = e_book_backend_exchange_authenticate_user;
+
sync_class->remove_sync = e_book_backend_exchange_remove;
sync_class->create_contact_sync = e_book_backend_exchange_create_contact;
sync_class->remove_contacts_sync = e_book_backend_exchange_remove_contacts;
@@ -2429,7 +2463,6 @@ e_book_backend_exchange_class_init (EBoo
sync_class->get_contact_sync = e_book_backend_exchange_get_contact;
sync_class->get_contact_list_sync = e_book_backend_exchange_get_contact_list;
sync_class->get_changes_sync = e_book_backend_exchange_get_changes;
- sync_class->authenticate_user_sync = e_book_backend_exchange_authenticate_user;
sync_class->get_supported_fields_sync = e_book_backend_exchange_get_supported_fields;
sync_class->get_required_fields_sync = e_book_backend_exchange_get_required_fields;
Index: calendar/e-cal-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange.c,v
retrieving revision 1.39
diff -u -p -u -p -r1.39 e-cal-backend-exchange.c
--- calendar/e-cal-backend-exchange.c 17 Aug 2005 07:17:49 -0000 1.39
+++ calendar/e-cal-backend-exchange.c 20 Aug 2005 12:04:17 -0000
@@ -57,6 +57,8 @@ struct ECalBackendExchangePrivate {
char *lastmod;
char *local_attachment_store;
guint save_timeout_id;
+ GMutex *set_lock;
+ GMutex *open_lock;
/* Timezones */
GHashTable *timezones;
@@ -67,7 +69,7 @@ struct ECalBackendExchangePrivate {
#define PARENT_TYPE E_TYPE_CAL_BACKEND_SYNC
static GObjectClass *parent_class = NULL;
-#define d(x)
+#define d(x) (x)
static ECalBackendSyncStatus
is_read_only (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only)
@@ -285,6 +287,8 @@ open_calendar (ECalBackendSync *backend,
ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend);
const char *uristr;
ExchangeHierarchy *hier;
+ ExchangeAccount *act;
+ ExchangeAccountResult acresult;
const char *prop = PR_ACCESS;
E2kHTTPStatus status;
E2kResult *results;
@@ -296,6 +300,8 @@ open_calendar (ECalBackendSync *backend,
uristr = e_cal_backend_get_uri (E_CAL_BACKEND (backend));
+ g_mutex_lock (cbex->priv->open_lock);
+
if (cbex->priv->mode == CAL_MODE_LOCAL) {
ESource *source;
const char *display_contents = NULL;
@@ -307,27 +313,40 @@ open_calendar (ECalBackendSync *backend,
display_contents = e_source_get_property (source, "offline_sync");
if (!display_contents || !g_str_equal (display_contents, "1")) {
+ g_mutex_unlock (cbex->priv->open_lock);
return GNOME_Evolution_Calendar_RepositoryOffline;
}
euri = e2k_uri_new (uristr);
load_cache (cbex, euri);
e2k_uri_free (euri);
+ g_mutex_unlock (cbex->priv->open_lock);
return GNOME_Evolution_Calendar_Success;
}
/* Make sure we have an open connection */
+ /* This steals the ExchangeAccount from ExchangeComponent */
+ act = exchange_component_get_account_for_uri (global_exchange_component, NULL);
+ if (!exchange_account_get_context (act))
+ exchange_account_connect (act, password, &acresult);
+
cbex->account = exchange_component_get_account_for_uri (global_exchange_component, uristr);
- if (!cbex->account)
+ if (!cbex->account) {
+ g_mutex_unlock (cbex->priv->open_lock);
return GNOME_Evolution_Calendar_PermissionDenied;
- if (!exchange_account_get_context (cbex->account))
+ }
+
+ if (!exchange_account_get_context (cbex->account)) {
+ g_mutex_unlock (cbex->priv->open_lock);
return GNOME_Evolution_Calendar_RepositoryOffline;
+ }
cbex->folder = exchange_account_get_folder (cbex->account, uristr);
if (!cbex->folder) {
/* FIXME: theoretically we should create it if
* only_if_exists is FALSE.
*/
+ g_mutex_unlock (cbex->priv->open_lock);
return GNOME_Evolution_Calendar_NoSuchCal;
}
g_object_ref (cbex->folder);
@@ -349,13 +368,17 @@ open_calendar (ECalBackendSync *backend,
access = atoi (prop);
}
- if (!(access & MAPI_ACCESS_READ))
+ if (!(access & MAPI_ACCESS_READ)) {
+ g_mutex_unlock (cbex->priv->open_lock);
return GNOME_Evolution_Calendar_PermissionDenied;
+ }
cbex->priv->read_only = ((access & MAPI_ACCESS_CREATE_CONTENTS) == 0);
load_cache (cbex, euri);
+ g_mutex_unlock (cbex->priv->open_lock);
+
return GNOME_Evolution_Calendar_Success;
}
@@ -1056,24 +1079,32 @@ set_mode (ECalBackend *backend, CalMode
cal_mode_to_corba (mode));
}
+ g_mutex_lock (priv->set_lock);
+
switch (mode) {
case CAL_MODE_REMOTE:
/* Change status to be online now */
/* Should we check for access rights before setting this ? */
d(printf ("set mode to online\n"));
+ account = exchange_component_get_account_for_uri (global_exchange_component, NULL);
+ if (!exchange_account_get_context (account))
+ e_cal_backend_notify_auth_required(backend);
+ e_cal_backend_notify_mode (backend,
+ GNOME_Evolution_Calendar_CalListener_MODE_SET,
+ GNOME_Evolution_Calendar_MODE_REMOTE);
+
uristr = e_cal_backend_get_uri (E_CAL_BACKEND (backend));
account = exchange_component_get_account_for_uri (global_exchange_component, uristr);
- if (!account)
+ if (!account) {
+ g_mutex_unlock (priv->set_lock);
return;
+ }
cbex->folder = exchange_account_get_folder (account, uristr);
/* FIXME : Test if available for read already */
priv->read_only = FALSE;
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);
/* FIXME : Check if online and check if authentication
is needed */
break;
@@ -1082,8 +1113,10 @@ set_mode (ECalBackend *backend, CalMode
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);
- if (!account)
+ if (!account) {
+ g_mutex_unlock (priv->set_lock);
return;
+ }
cbex->folder = exchange_account_get_folder (account, uristr);
priv->mode = CAL_MODE_LOCAL;
priv->read_only = TRUE;
@@ -1098,6 +1131,7 @@ set_mode (ECalBackend *backend, CalMode
backend, GNOME_Evolution_Calendar_CalListener_MODE_NOT_SUPPORTED,
cal_mode_to_corba (mode));
}
+ g_mutex_unlock (priv->set_lock);
}
static ECalBackendSyncStatus
@@ -1624,6 +1658,11 @@ init (ECalBackendExchange *cbex)
cbex->priv->timezones = g_hash_table_new_full (
g_str_hash, g_str_equal,
g_free, (GDestroyNotify)icaltimezone_free);
+
+ cbex->priv->set_lock = g_mutex_new ();
+ cbex->priv->open_lock = g_mutex_new ();
+
+ e_cal_backend_sync_set_lock (E_CAL_BACKEND_SYNC (cbex), TRUE);
}
static void
@@ -1649,6 +1688,16 @@ finalize (GObject *object)
g_free (cbex->priv->lastmod);
g_hash_table_destroy (cbex->priv->timezones);
+
+ if (cbex->priv->set_lock) {
+ g_mutex_free (cbex->priv->set_lock);
+ cbex->priv->set_lock = NULL;
+ }
+
+ if (cbex->priv->open_lock) {
+ g_mutex_free (cbex->priv->open_lock);
+ cbex->priv->open_lock = NULL;
+ }
g_free (cbex->priv);
Index: camel/camel-exchange-provider.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-provider.c,v
retrieving revision 1.25
diff -u -p -u -p -r1.25 camel-exchange-provider.c
--- camel/camel-exchange-provider.c 17 Aug 2005 10:15:55 -0000 1.25
+++ camel/camel-exchange-provider.c 20 Aug 2005 12:04:17 -0000
@@ -67,6 +67,9 @@ CamelProviderConfEntry exchange_conf_ent
N_("Check new messages for Junk contents"), "0" },
{ CAMEL_PROVIDER_CONF_CHECKBOX, "filter_junk_inbox", "filter_junk",
N_("Only check for Junk messages in the Inbox folder"), "0" },
+ { CAMEL_PROVIDER_CONF_HIDDEN, "auth-domain", NULL,
+ NULL, "Exchange" },
+
{ CAMEL_PROVIDER_CONF_SECTION_END },
{ CAMEL_PROVIDER_CONF_END }
};
@@ -82,7 +85,7 @@ static CamelProvider exchange_provider =
CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE |
CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_IS_EXTERNAL,
- CAMEL_URL_NEED_USER | CAMEL_URL_HIDDEN_AUTH,
+ CAMEL_URL_NEED_USER | CAMEL_URL_HIDDEN_AUTH,
exchange_conf_entries
Index: camel/camel-exchange-store.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-store.c,v
retrieving revision 1.22
diff -u -p -u -p -r1.22 camel-exchange-store.c
--- camel/camel-exchange-store.c 19 Aug 2005 15:36:28 -0000 1.22
+++ camel/camel-exchange-store.c 20 Aug 2005 12:04:17 -0000
@@ -334,11 +334,28 @@ e_filename_make_safe (gchar *string)
}
}
+static void
+camel_exchange_get_password (CamelService *service, CamelException *ex)
+{
+ CamelSession *session = camel_service_get_session (service);
+ char *prompt;
+
+ if (!service->url->passwd) {
+ prompt = g_strdup_printf ("Enter password for %s %s", service->url->user, service->url->host);
+
+ service->url->passwd = camel_session_get_password (session,
+ service, "Exchange", prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
+ g_free (prompt);
+ }
+}
+
static gboolean
exchange_connect (CamelService *service, CamelException *ex)
{
CamelExchangeStore *exch = CAMEL_EXCHANGE_STORE (service);
char *real_user, *socket_path;
+ const char *camel_pass;
+ guint32 connect_status;
if (exch->stub)
return TRUE;
@@ -358,9 +375,12 @@ exchange_connect (CamelService *service,
if (!exch->stub)
return FALSE;
+ camel_exchange_get_password (service, ex);
/* Initialize the stub connection */
if (!camel_stub_send (exch->stub, NULL, CAMEL_STUB_CMD_CONNECT,
+ CAMEL_STUB_ARG_STRING, g_strdup (service->url->passwd),
CAMEL_STUB_ARG_RETURN,
+ CAMEL_STUB_ARG_UINT32, &connect_status,
CAMEL_STUB_ARG_END)) {
/* The user cancelled the connection attempt. */
camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
Index: mail/mail-stub-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/mail/mail-stub-exchange.c,v
retrieving revision 1.26
diff -u -p -u -p -r1.26 mail-stub-exchange.c
--- mail/mail-stub-exchange.c 19 Aug 2005 16:32:19 -0000 1.26
+++ mail/mail-stub-exchange.c 20 Aug 2005 12:04:18 -0000
@@ -48,6 +48,7 @@
#define PARENT_TYPE MAIL_TYPE_STUB
static MailStubClass *parent_class = NULL;
+/* FIXME : Have this as part of the appropriate class in 2.5 */
static gulong offline_listener_handler_id;
typedef struct {
@@ -88,7 +89,7 @@ typedef struct {
static void dispose (GObject *);
-static void stub_connect (MailStub *stub);
+static void stub_connect (MailStub *stub, char *pwd);
static void get_folder (MailStub *stub, const char *name, gboolean create,
GPtrArray *uids, GByteArray *flags);
static void get_trash_name (MailStub *stub);
@@ -213,6 +214,7 @@ static void
dispose (GObject *object)
{
MailStubExchange *mse = MAIL_STUB_EXCHANGE (object);
+ ExchangeOfflineListener *ex_offline_listener = NULL;
if (mse->folders_by_name) {
g_hash_table_destroy (mse->folders_by_name);
@@ -2758,8 +2760,45 @@ is_subscribed_folder (MailStub *stub, co
}
static void
-stub_connect (MailStub *stub)
+stub_connect (MailStub *stub, char *pwd)
{
+ MailStubExchange *mse = MAIL_STUB_EXCHANGE (stub);
+ ExchangeAccount *account;
+ ExchangeAccountResult result;
+ E2kContext *ctx;
+ guint32 retval = 0; /* 0 is a failure case */
+ const char *uri;
+ int mode;
+ struct connect_data *cd;
+
+ account = mse->account;
+ ctx = exchange_account_get_context (account);
+ if (!ctx) {
+ ctx = exchange_account_connect (account, pwd, &result);
+ }
+
+ if (ctx)
+ retval = 1;
+ else
+ goto end;
+
+ exchange_component_is_offline (global_exchange_component, &mode);
+
+ if (mode == ONLINE_MODE) {
+ mse->ctx = ctx;
+ g_object_ref (mse->ctx);
+
+ mse->mail_submission_uri = exchange_account_get_standard_uri (account, "sendmsg");
+ uri = exchange_account_get_standard_uri (account, "inbox");
+ mse->inbox = exchange_account_get_folder (account, uri);
+ uri = exchange_account_get_standard_uri (account, "deleteditems");
+ mse->deleted_items = exchange_account_get_folder (account, uri);
+ }
+end:
+ mail_stub_return_data (stub, CAMEL_STUB_RETVAL_RESPONSE,
+ CAMEL_STUB_ARG_UINT32, retval,
+ CAMEL_STUB_ARG_END);
+
mail_stub_return_ok (stub);
}
@@ -2828,6 +2867,7 @@ mail_stub_exchange_new (ExchangeAccount
const char *uri;
int mode;
+ printf ("mail_stub created\n");
stub = g_object_new (MAIL_TYPE_STUB_EXCHANGE, NULL);
g_object_ref (stub);
mail_stub_construct (stub, cmd_fd, status_fd);
@@ -2835,6 +2875,7 @@ mail_stub_exchange_new (ExchangeAccount
mse = (MailStubExchange *)stub;
mse->account = account;
+/*
if (mode == ONLINE_MODE) {
mse->ctx = exchange_account_get_context (account);
g_object_ref (mse->ctx);
@@ -2845,11 +2886,11 @@ mail_stub_exchange_new (ExchangeAccount
uri = exchange_account_get_standard_uri (account, "deleteditems");
mse->deleted_items = exchange_account_get_folder (account, uri);
}
+*/
offline_listener_handler_id = g_signal_connect (G_OBJECT (global_exchange_component),
"linestatus-changed",
G_CALLBACK (linestatus_listener), mse);
-
return stub;
}
Index: mail/mail-stub-listener.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/mail/mail-stub-listener.c,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 mail-stub-listener.c
--- mail/mail-stub-listener.c 14 Jun 2005 13:12:43 -0000 1.3
+++ mail/mail-stub-listener.c 20 Aug 2005 12:04:18 -0000
@@ -100,6 +100,7 @@ new_connection (GIOChannel *source, GIOC
return TRUE;
}
+ printf ("mail got a new connection from camel\n");
g_signal_emit (listener, signals[NEW_CONNECTION], 0,
listener->cmd_fd, fd);
listener->cmd_fd = -1;
Index: mail/mail-stub.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/mail/mail-stub.c,v
retrieving revision 1.9
diff -u -p -u -p -r1.9 mail-stub.c
--- mail/mail-stub.c 25 Jul 2005 11:03:17 -0000 1.9
+++ mail/mail-stub.c 20 Aug 2005 12:04:18 -0000
@@ -94,9 +94,15 @@ connection_handler (GIOChannel *source,
switch (command) {
case CAMEL_STUB_CMD_CONNECT:
{
+ char *pwd
d(printf("CONNECT\n"));
g_object_ref (stub);
- MS_CLASS (stub)->connect (stub);
+ if (!mail_stub_read_args (stub,
+ CAMEL_STUB_ARG_STRING, &pwd,
+ CAMEL_STUB_ARG_END))
+ goto comm_fail;
+ MS_CLASS (stub)->connect (stub, pwd);
+ g_free (pwd);
break;
}
Index: mail/mail-stub.h
===================================================================
RCS file: /cvs/gnome/evolution-exchange/mail/mail-stub.h,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 mail-stub.h
--- mail/mail-stub.h 28 Jun 2005 09:20:46 -0000 1.4
+++ mail/mail-stub.h 20 Aug 2005 12:04:18 -0000
@@ -34,7 +34,7 @@ struct _MailStubClass {
GObjectClass parent_class;
/* methods */
- void (*connect) (MailStub *);
+ void (*connect) (MailStub *, char *pwd);
void (*get_folder) (MailStub *, const char *name,
gboolean create, GPtrArray *uids,
GByteArray *flags);
Index: storage/exchange-component.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/storage/exchange-component.c,v
retrieving revision 1.16
diff -u -p -u -p -r1.16 exchange-component.c
--- storage/exchange-component.c 19 Aug 2005 16:32:20 -0000 1.16
+++ storage/exchange-component.c 20 Aug 2005 12:04:18 -0000
@@ -308,12 +308,15 @@ new_connection (MailStubListener *listen
goto end;
}
+ mse = mail_stub_exchange_new (account, cmd_fd, status_fd);
+/*
if (exchange_account_connect (account, NULL, &result))
mse = mail_stub_exchange_new (account, cmd_fd, status_fd);
else {
close (cmd_fd);
close (status_fd);
}
+*/
end:
g_object_unref (account);
}
Index: storage/exchange-config-listener.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/storage/exchange-config-listener.c,v
retrieving revision 1.28
diff -u -p -u -p -r1.28 exchange-config-listener.c
--- storage/exchange-config-listener.c 16 Aug 2005 12:34:04 -0000 1.28
+++ storage/exchange-config-listener.c 20 Aug 2005 12:04:18 -0000
@@ -373,7 +373,7 @@ account_added (EAccountList *account_lis
g_signal_emit (config_listener, signals[EXCHANGE_ACCOUNT_CREATED], 0,
exchange_account);
- exchange_account_connect (exchange_account, NULL, &result);
+ /* exchange_account_connect (exchange_account, NULL, &result); */
}
struct account_update_data {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]