[evolution-patches] Exchange connector - patch for handling diff login name and mbox paths
- From: Sushma Rai <rsushma novell com>
- To: Evolution Patches List <evolution-patches lists ximian com>
- Cc: Sarfraaz Ahmed <asarfraaz novell com>
- Subject: [evolution-patches] Exchange connector - patch for handling diff login name and mbox paths
- Date: Mon, 14 Mar 2005 18:27:44 +0530
Hi,
This patch finds the mailbox name and owa path for a user.
This is needed when a user's login name and mailbox names
are different.
Please review.
Thanks,
Sushma.
Index: camel/camel-exchange-provider.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-provider.c,v
retrieving revision 1.16
diff -u -p -r1.16 camel-exchange-provider.c
--- camel/camel-exchange-provider.c 5 Mar 2005 09:57:01 -0000 1.16
+++ camel/camel-exchange-provider.c 14 Mar 2005 12:07:06 -0000
@@ -144,15 +144,22 @@ exchange_validate_user_cb (CamelURL *cam
gboolean *remember_password, CamelException *ex)
{
gboolean valid;
- char *host = NULL;
- char *ad_server = NULL;
+ ExchangeParams *exchange_params;
- valid = e2k_validate_user (owa_url, camel_url->user,
- &host, &ad_server, remember_password);
+ exchange_params = g_new0 (ExchangeParams, 1);
+ exchange_params->host = NULL;
+ exchange_params->ad_server = NULL;
+ exchange_params->mailbox = NULL;
+ exchange_params->owa_path = NULL;
- camel_url_set_host(camel_url, valid?host:"");
- camel_url_set_param(camel_url, "ad_server", valid?ad_server:NULL);
+ valid = e2k_validate_user (owa_url, camel_url->user,
+ exchange_params, remember_password);
+ camel_url_set_host(camel_url, valid?exchange_params->host:"");
+ camel_url_set_param(camel_url, "ad_server", valid?exchange_params->ad_server:NULL);
+ camel_url_set_param(camel_url, "mailbox", valid?exchange_params->mailbox:NULL);
+ camel_url_set_param(camel_url, "owa_path", valid?exchange_params->owa_path:NULL);
+ g_free (exchange_params);
return valid;
}
Index: lib/e2k-autoconfig.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/lib/e2k-autoconfig.c,v
retrieving revision 1.14
diff -u -p -r1.14 e2k-autoconfig.c
--- lib/e2k-autoconfig.c 28 Feb 2005 15:11:30 -0000 1.14
+++ lib/e2k-autoconfig.c 14 Mar 2005 12:07:40 -0000
@@ -1389,13 +1389,15 @@ e2k_autoconfig_lookup_option (const char
}
static gboolean
-validate (const char *owa_url, char *user, char *password, char **host, char **ad_server)
+validate (const char *owa_url, char *user, char *password, ExchangeParams *exchange_params)
{
E2kAutoconfig *ac;
E2kOperation op; /* FIXME */
E2kAutoconfigResult result;
+ E2kUri *euri;
gboolean valid = FALSE;
const char *old, *new;
+ char *path, *mailbox = NULL, *owa_path = NULL;
ac = e2k_autoconfig_new (owa_url, user, password,
E2K_AUTOCONFIG_USE_EITHER);
@@ -1408,6 +1410,19 @@ validate (const char *owa_url, char *use
if (result == E2K_AUTOCONFIG_OK) {
result = e2k_autoconfig_check_global_catalog (ac, &op);
e2k_operation_free (&op);
+
+ /* find mailbox and owa_path values */
+ euri = e2k_uri_new (ac->home_uri);
+ path = g_strdup (euri->path + 1);
+ e2k_uri_free (euri);
+ mailbox = strrchr (path, '/');
+ if (mailbox && !mailbox[1]) {
+ *mailbox = '\0';
+ mailbox = strrchr (path, '/');
+ }
+ if (mailbox)
+ *mailbox++ = '\0';
+ owa_path = path;
valid = TRUE;
}
else {
@@ -1504,16 +1519,18 @@ validate (const char *owa_url, char *use
}
}
- *host = ac->pf_server;
+ exchange_params->host = ac->pf_server;
if (ac->gc_server)
- *ad_server = ac->gc_server;
+ exchange_params->ad_server = ac->gc_server;
+ exchange_params->mailbox = mailbox;
+ exchange_params->owa_path = owa_path;
return valid;
}
gboolean
-e2k_validate_user (const char *owa_url, char *user, char **host,
- char **ad_server, gboolean *remember_password)
+e2k_validate_user (const char *owa_url, char *user,
+ ExchangeParams *exchange_params, gboolean *remember_password)
{
gboolean valid = FALSE, remember=FALSE;
char *key, *password, *prompt;
@@ -1527,7 +1544,7 @@ e2k_validate_user (const char *owa_url,
E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET,
&remember, NULL);
if (password) {
- valid = validate (owa_url, user, password, host, ad_server);
+ valid = validate (owa_url, user, password, exchange_params);
if (valid) {
/* generate the proper key once the host name
* is read and remember password temporarily,
@@ -1539,7 +1556,7 @@ e2k_validate_user (const char *owa_url,
*remember_password = remember;
g_free (key);
key = g_strdup_printf ("%s//%s %s",
- "exchange:", user, *host);
+ "exchange:", user, exchange_params->host);
e_passwords_add_password (key, password);
e_passwords_remember_password ("Exchange", key);
}
Index: lib/e2k-validate.h
===================================================================
RCS file: /cvs/gnome/evolution-exchange/lib/e2k-validate.h,v
retrieving revision 1.4
diff -u -p -r1.4 e2k-validate.h
--- lib/e2k-validate.h 10 Feb 2005 12:57:47 -0000 1.4
+++ lib/e2k-validate.h 14 Mar 2005 12:08:10 -0000
@@ -9,7 +9,14 @@ extern "C" {
#pragma }
#endif /* __cplusplus */
-gboolean e2k_validate_user (const char *owa_url, char *user, char **host, char **ad_server, gboolean *remember_password);
+typedef struct {
+ char *host;
+ char *ad_server;
+ char *mailbox;
+ char *owa_path;
+}ExchangeParams;
+
+gboolean e2k_validate_user (const char *owa_url, char *user, ExchangeParams *exchange_params, gboolean *remember_password);
#ifdef __cplusplus
}
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.297
diff -u -r1.297 ChangeLog
--- ChangeLog 14 Mar 2005 09:23:37 -0000 1.297
+++ ChangeLog 14 Mar 2005 12:45:37 -0000
@@ -1,3 +1,15 @@
+2005-03-14 Sushma Rai <rsushma novell com>
+
+ * camel/camel-exchange-provider.c (exchange_validate_user_cb): Using
+ ExchangeParams structure to store the parameters values to read from
+ server during user validation, and adding them to camel url.
+
+ * lib/e2k-autoconfig.c (e2k_validate_user): Using ExchangeParams.
+ (validate): If the user is validated finding "mailbox" and "owa_path"
+ values. Using ExchangeParams for returning the values.
+
+ * lib/e2k-validate.h: Defined ExchangeParams.
+
2005-03-11 Sarfraaz Ahmed <asarfraaz novell com>
* calendar/e-cal-backend-exchange-calendar.c (add_ical) : Make sure we
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]