[evolution-exchange] Add CamelExchangeSettings.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-exchange] Add CamelExchangeSettings.
- Date: Mon, 15 Aug 2011 16:05:51 +0000 (UTC)
commit 70ee76825086b46c300628b5bee5c90bd964bec8
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Aug 11 20:29:34 2011 -0400
Add CamelExchangeSettings.
CamelExchangeSettings replaces the various URL parameters used in
CamelExchangeStore with equivalent GObject properties.
Adapt the exchange module to use CamelSettings.
camel/camel-exchange-provider.c | 49 ++-
camel/camel-exchange-store.c | 24 +-
camel/camel-exchange-utils.c | 19 +-
configure.ac | 3 +-
eplugin/exchange-account-setup.c | 266 +++++-------
eplugin/exchange-config-listener.c | 11 +-
glib-gen.mak | 42 ++
server/lib/Makefile.am | 23 +-
server/lib/camel-exchange-settings.c | 803 ++++++++++++++++++++++++++++++++
server/lib/camel-exchange-settings.h | 135 ++++++
server/lib/e2k-autoconfig.c | 50 ++-
server/lib/e2k-enums.h | 39 ++
server/lib/e2k-validate.h | 31 +-
server/lib/urltest.c | 56 ---
server/storage/exchange-account.c | 302 ++++++-------
server/storage/exchange-account.h | 6 +-
server/storage/exchange-esource.c | 61 ++-
tools/exchange-share-config-listener.c | 11 +-
18 files changed, 1452 insertions(+), 479 deletions(-)
---
diff --git a/camel/camel-exchange-provider.c b/camel/camel-exchange-provider.c
index 436652c..3e13656 100644
--- a/camel/camel-exchange-provider.c
+++ b/camel/camel-exchange-provider.c
@@ -58,7 +58,7 @@ static const gchar *auth_types[] = {
CamelProviderConfEntry exchange_conf_entries[] = {
{ CAMEL_PROVIDER_CONF_SECTION_START, "mailcheck", NULL,
N_("Checking for New Mail") },
- { CAMEL_PROVIDER_CONF_CHECKBOX, "check_all", NULL,
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "check-all", NULL,
N_("C_heck for new messages in all folders"), "1" },
{ CAMEL_PROVIDER_CONF_SECTION_END },
@@ -73,31 +73,34 @@ CamelProviderConfEntry exchange_conf_entries[] = {
{ CAMEL_PROVIDER_CONF_SECTION_START, "activedirectory", NULL,
/* i18n: GAL is an Outlookism, AD is a Windowsism */
N_("Global Address List/Active Directory") },
- { CAMEL_PROVIDER_CONF_ENTRY, "ad_server", NULL,
+ { CAMEL_PROVIDER_CONF_ENTRY, "gc-server-name", NULL,
/* i18n: "Global Catalog" is a Windowsism, but it's a
technical term and may not have translations? */
N_("_Global Catalog server name:") },
- { CAMEL_PROVIDER_CONF_CHECKSPIN, "ad_limit", NULL,
+ { CAMEL_PROVIDER_CONF_CHECKSPIN, "gc-results-limit", NULL,
N_("_Limit number of GAL responses: %s"), "y:1:500:10000" },
- { CAMEL_PROVIDER_CONF_OPTIONS, "ad_auth", NULL,
- N_("Authentication _Type:"), "default:Secure or Plaintext Password:basic:Plaintext Password:ntlm:Secure Password" },
- { CAMEL_PROVIDER_CONF_CHECKBOX, "ad_browse", NULL,
+ { CAMEL_PROVIDER_CONF_OPTIONS, "gc-auth-method", NULL,
+ N_("Authentication _Type:"),
+ "default:Secure or Plaintext Password:"
+ "basic:Plaintext Password:"
+ "ntlm:Secure Password" },
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "gc-allow-browse", NULL,
N_("Allow _browsing of the GAL until download limit is reached"), "0" },
- { CAMEL_PROVIDER_CONF_CHECKBOX, "ad_expand_groups", NULL,
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "gc-expand-groups", NULL,
N_("_Expand groups of contacts in GAL to contact lists"), "0" },
{ CAMEL_PROVIDER_CONF_SECTION_END },
{ CAMEL_PROVIDER_CONF_SECTION_START, "generals", NULL,
N_("Options") },
- { CAMEL_PROVIDER_CONF_CHECKSPIN, "passwd_exp_warn_period", NULL,
+ { CAMEL_PROVIDER_CONF_CHECKSPIN, "passwd-exp-warn-period", NULL,
N_("_Password Expiry Warning period: %s"), "y:1:7:90" },
- { CAMEL_PROVIDER_CONF_CHECKBOX, "sync_offline", NULL,
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "stay-synchronized", NULL,
N_("Automatically synchroni_ze account locally"), "0" },
- { CAMEL_PROVIDER_CONF_CHECKBOX, "filter", NULL,
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-inbox", NULL,
/* i18n: copy from evolution:camel-imap-provider.c */
N_("_Apply filters to new messages in Inbox on this server"), "0" },
- { CAMEL_PROVIDER_CONF_CHECKBOX, "filter_junk", NULL,
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-junk", NULL,
N_("Check new messages for _Junk contents"), "0" },
- { CAMEL_PROVIDER_CONF_CHECKBOX, "filter_junk_inbox", "filter_junk",
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "filter-junk-inbox", "filter-junk",
N_("Only check for Junk messag_es in the Inbox folder"), "0" },
{ CAMEL_PROVIDER_CONF_HIDDEN, "auth-domain", NULL,
NULL, "Exchange" },
@@ -148,17 +151,23 @@ CamelServiceAuthType camel_exchange_password_authtype = {
};
static gint
-exchange_auto_detect_cb (CamelURL *url, GHashTable **auto_detected,
- GError **error)
+exchange_auto_detect_cb (CamelURL *url,
+ GHashTable **auto_detected,
+ GError **error)
{
*auto_detected = g_hash_table_new (g_str_hash, g_str_equal);
- g_hash_table_insert (*auto_detected, g_strdup ("mailbox"),
- g_strdup (url->user));
- g_hash_table_insert (*auto_detected, g_strdup ("pf_server"),
- g_strdup (url->host));
- g_hash_table_insert (*auto_detected, g_strdup ("ad_server"),
- g_strdup (camel_url_get_param (url, "ad_server")));
+ g_hash_table_insert (
+ *auto_detected,
+ g_strdup ("mailbox"), g_strdup (url->user));
+ g_hash_table_insert (
+ *auto_detected,
+ g_strdup ("pf-server"),
+ g_strdup (url->host));
+ g_hash_table_insert (
+ *auto_detected,
+ g_strdup ("gc-server-name"),
+ g_strdup (camel_url_get_param (url, "gc-server-name")));
return 0;
}
diff --git a/camel/camel-exchange-store.c b/camel/camel-exchange-store.c
index 146f734..15fd362 100644
--- a/camel/camel-exchange-store.c
+++ b/camel/camel-exchange-store.c
@@ -29,8 +29,9 @@
#include <libedataserver/e-data-server-util.h>
-#include "camel-exchange-store.h"
#include "camel-exchange-folder.h"
+#include "camel-exchange-settings.h"
+#include "camel-exchange-store.h"
#include "camel-exchange-summary.h"
#include "camel-exchange-utils.h"
@@ -43,7 +44,7 @@
/* Even if we are disconnected, we need to exchange_store_connect()
to get the offline data */
#define RETURN_VAL_IF_NOT_CONNECTED(store, cancellable, ex, val)\
- if (!camel_exchange_store_connected (store, cancellable, ex) && \
+ if (!camel_exchange_store_connected (store, cancellable, NULL) && \
!exchange_store_connect_sync (CAMEL_SERVICE (store), cancellable, ex)) \
return val;
@@ -401,17 +402,21 @@ exchange_store_can_refresh_folder (CamelStore *store,
GError **error)
{
CamelStoreClass *store_class;
- CamelURL *url;
- gboolean res;
+ CamelService *service;
+ CamelSettings *settings;
+ gboolean can_refresh;
+ gboolean check_all;
- store_class = CAMEL_STORE_CLASS (camel_exchange_store_parent_class);
+ service = CAMEL_SERVICE (store);
+ settings = camel_service_get_settings (service);
- url = camel_service_get_camel_url (CAMEL_SERVICE (store));
+ check_all = camel_exchange_settings_get_check_all (
+ CAMEL_EXCHANGE_SETTINGS (settings));
- res = store_class->can_refresh_folder (store, info, error) ||
- (camel_url_get_param (url, "check_all") != NULL);
+ store_class = CAMEL_STORE_CLASS (camel_exchange_store_parent_class);
+ can_refresh = store_class->can_refresh_folder (store, info, error);
- return res;
+ return can_refresh || check_all;
}
static gboolean
@@ -780,6 +785,7 @@ camel_exchange_store_class_init (CamelExchangeStoreClass *class)
object_class->constructed = exchange_store_constructed;
service_class = CAMEL_SERVICE_CLASS (class);
+ service_class->settings_type = CAMEL_TYPE_EXCHANGE_SETTINGS;
service_class->get_name = exchange_store_get_name;
service_class->connect_sync = exchange_store_connect_sync;
service_class->disconnect_sync = exchange_store_disconnect_sync;
diff --git a/camel/camel-exchange-utils.c b/camel/camel-exchange-utils.c
index 4d712f1..3b6b4a7 100644
--- a/camel/camel-exchange-utils.c
+++ b/camel/camel-exchange-utils.c
@@ -2258,6 +2258,7 @@ camel_exchange_utils_get_folder (CamelService *service,
gboolean *readonly, /* out */
GError **error)
{
+ CamelSettings *settings;
ExchangeData *ed = get_data_for_service (service);
ExchangeFolder *mfld;
ExchangeMessage *mmsg;
@@ -2267,12 +2268,24 @@ camel_exchange_utils_get_folder (CamelService *service,
guint32 camel_flags;
gint i;
ExchangeHierarchy *hier;
+ gboolean filter_inbox;
+ gboolean filter_junk;
+ gboolean filter_junk_inbox;
g_return_val_if_fail (ed != NULL, FALSE);
g_return_val_if_fail (folder_flags != NULL, FALSE);
g_return_val_if_fail (folder_uri != NULL, FALSE);
g_return_val_if_fail (readonly != NULL, FALSE);
+ settings = camel_service_get_settings (service);
+
+ g_object_get (
+ settings,
+ "filter-inbox", &filter_inbox,
+ "filter-junk", &filter_junk,
+ "filter-junk-inbox", &filter_junk_inbox,
+ NULL);
+
path = g_strdup_printf ("/%s", name);
folder = exchange_account_get_folder (ed->account, path);
if (!folder && !create) {
@@ -2345,12 +2358,12 @@ camel_exchange_utils_get_folder (CamelService *service,
*readonly = ((mfld->access & (MAPI_ACCESS_MODIFY | MAPI_ACCESS_CREATE_CONTENTS)) == 0);
camel_flags = 0;
- if (ed->account->filter_inbox && (mfld->folder == ed->inbox))
+ if (filter_inbox && (mfld->folder == ed->inbox))
camel_flags |= CAMEL_FOLDER_FILTER_RECENT;
- if (ed->account->filter_junk) {
+ if (filter_junk) {
if ((mfld->folder != ed->deleted_items) &&
((mfld->folder == ed->inbox) ||
- !ed->account->filter_junk_inbox_only))
+ !filter_junk_inbox))
camel_flags |= CAMEL_FOLDER_FILTER_JUNK;
}
diff --git a/configure.ac b/configure.ac
index b59db55..c9b3114 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,7 +147,8 @@ PKG_CHECK_MODULES(GNOME_PLATFORM,
libsoup-2.4 >= libsoup_minimum_version])
PKG_CHECK_MODULES(EVOLUTION_DATA_SERVER,
- [libebook-1.2 >= eds_minimum_version
+ [camel-provider-1.2 >= eds_minimum_version
+ libebook-1.2 >= eds_minimum_version
libecal-1.2 >= eds_minimum_version
libedataserver-1.2 >= eds_minimum_version
libedataserverui-3.0 >= eds_minimum_version
diff --git a/eplugin/exchange-account-setup.c b/eplugin/exchange-account-setup.c
index 99c7155..b34e2d0 100644
--- a/eplugin/exchange-account-setup.c
+++ b/eplugin/exchange-account-setup.c
@@ -431,20 +431,9 @@ print_error (GtkWidget *parent, const gchar *owa_url, E2kAutoconfigResult result
e_alert_run_dialog_for_args (GTK_WINDOW (parent), err_msg, NULL);
}
-static const gchar *
-gal_auth_to_string (E2kAutoconfigGalAuthPref ad_auth)
-{
- switch (ad_auth) {
- case E2K_AUTOCONFIG_USE_GAL_DEFAULT: return "default";
- case E2K_AUTOCONFIG_USE_GAL_BASIC: return "basic";
- case E2K_AUTOCONFIG_USE_GAL_NTLM: return "ntlm";
- }
-
- return "default";
-}
-
static void
-owa_authenticate_user (GtkWidget *button, EConfig *config)
+owa_authenticate_user (GtkWidget *button,
+ EConfig *config)
{
EMConfigTargetAccount *target_account = (EMConfigTargetAccount *) config->target;
E2kAutoconfigResult result;
@@ -455,18 +444,15 @@ owa_authenticate_user (GtkWidget *button, EConfig *config)
gchar *at, *user;
gboolean valid = FALSE;
ExchangeParams *exchange_params;
- GtkWidget *mailbox_entry = g_object_get_data (G_OBJECT (button), "mailbox-entry");
EAccount *account;
+ CamelExchangeSettings *settings;
exchange_params = g_new0 (ExchangeParams, 1);
exchange_params->host = NULL;
- exchange_params->ad_server = NULL;
- exchange_params->ad_auth = E2K_AUTOCONFIG_USE_GAL_DEFAULT;
- exchange_params->mailbox = NULL;
- exchange_params->owa_path = NULL;
exchange_params->is_ntlm = TRUE;
account = target_account->modified_account;
+ settings = CAMEL_EXCHANGE_SETTINGS (target_account->settings);
source_url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL);
@@ -490,23 +476,26 @@ owa_authenticate_user (GtkWidget *button, EConfig *config)
It must use camel_session_ask_password, and it should return an exception for any problem,
which should then be shown using e-alert */
- owa_url = camel_url_get_param (url, "owa_url");
+ /* Note we're not referencing CamelSettings here. */
+ exchange_params->settings = settings;
+
+ owa_url = camel_exchange_settings_get_owa_url (settings);
+
if (camel_url_get_param (url, "authmech"))
exchange_params->is_ntlm = TRUE;
else
exchange_params->is_ntlm = FALSE;
camel_url_set_authmech (url, exchange_params->is_ntlm ? "NTLM" : "Basic");
- key = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS);
+ key = camel_url_to_string (
+ url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS);
/* Supress the trailing slash */
key[strlen (key) -1] = 0;
- /* set the mailbox before function call to let it use our, not create one */
- exchange_params->mailbox = g_strdup (camel_url_get_param (url, "mailbox"));
-
- valid = e2k_validate_user (owa_url, key, &url->user, exchange_params,
- &remember_password, &result,
- GTK_WINDOW (gtk_widget_get_toplevel (button)));
+ valid = e2k_validate_user (
+ owa_url, key, &url->user, exchange_params,
+ &remember_password, &result,
+ GTK_WINDOW (gtk_widget_get_toplevel (button)));
g_free (key);
if (!valid && result != E2K_AUTOCONFIG_CANCELLED)
@@ -515,28 +504,22 @@ owa_authenticate_user (GtkWidget *button, EConfig *config)
camel_url_set_host (url, valid ? exchange_params->host : "");
if (valid) {
- camel_url_set_param (url, "save-passwd", NULL);
if (account && account->source && account->transport) {
account->source->save_passwd = remember_password;
account->transport->save_passwd = remember_password;
}
}
- camel_url_set_param (url, "ad_server", valid ? exchange_params->ad_server: NULL);
- camel_url_set_param (url, "mailbox", valid ? exchange_params->mailbox : NULL);
- camel_url_set_param (url, "owa_path", valid ? exchange_params->owa_path : NULL);
- camel_url_set_param (url, "ad_auth", valid ? gal_auth_to_string (exchange_params->ad_auth) : NULL);
-
- if (mailbox_entry) {
- const gchar *par = camel_url_get_param (url, "mailbox");
+ if (!valid)
+ g_object_set (
+ settings,
+ "gc-auth-method", E2K_AUTOCONFIG_USE_GAL_DEFAULT,
+ "gc-server-name", NULL,
+ "mailbox", NULL,
+ "owa-path", NULL,
+ NULL);
- gtk_entry_set_text (GTK_ENTRY (mailbox_entry), par ? par : "");
- }
-
- g_free (exchange_params->owa_path);
- g_free (exchange_params->mailbox);
g_free (exchange_params->host);
- g_free (exchange_params->ad_server);
g_free (exchange_params);
if (valid) {
@@ -546,152 +529,95 @@ owa_authenticate_user (GtkWidget *button, EConfig *config)
e_account_set_bool (account, E_ACCOUNT_SOURCE_SAVE_PASSWD, remember_password);
g_free (url_string);
}
+
camel_url_free (url);
}
static void
owa_editor_entry_changed (GtkWidget *entry, EConfig *config)
{
- const gchar *ssl = NULL;
- CamelURL *url, *owaurl = NULL;
- gchar *url_string, *uri;
+ CamelURL *owaurl = NULL;
+ gchar *uri;
+ CamelNetworkSecurityMethod security_method;
EMConfigTargetAccount *target = (EMConfigTargetAccount *) config->target;
GtkWidget *button = g_object_get_data((GObject *)entry, "authenticate-button");
- EAccount *account;
gint active = FALSE;
/* NB: we set the button active only if we have a parsable uri entered */
- const gchar *target_url;
-
- account = target->modified_account;
- target_url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL);
- if (target_url && target_url[0] != '\0')
- url = camel_url_new (target_url, NULL);
- else url = NULL;
uri = g_strdup (gtk_entry_get_text ((GtkEntry *) entry));
g_strstrip (uri);
+ security_method = CAMEL_NETWORK_SECURITY_METHOD_NONE;
+
if (uri && uri[0]) {
- camel_url_set_param(url, "owa_url", uri);
owaurl = camel_url_new (uri, NULL);
if (owaurl) {
active = TRUE;
/* Reading the owa url and setting use_ssl paramemter */
- if (!strcmp(owaurl->protocol, "https"))
- ssl = "always";
+ if (strcmp (owaurl->protocol, "https") == 0)
+ security_method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT;
camel_url_free (owaurl);
}
- } else {
- camel_url_set_param(url, "owa_url", NULL);
}
- camel_url_set_param(url, "use_ssl", ssl);
+ camel_network_settings_set_security_method (
+ CAMEL_NETWORK_SETTINGS (target->settings), security_method);
+
gtk_widget_set_sensitive (button, active);
- url_string = camel_url_to_string (url, 0);
- e_account_set_string (account, E_ACCOUNT_SOURCE_URL, url_string);
- g_free (url_string);
- camel_url_free (url);
g_free (uri);
}
static void
-update_mailbox_param_in_url (EAccount *account, e_account_item_t item, const gchar *mailbox)
-{
- CamelURL *url;
- gchar *url_string;
- const gchar *target_url;
-
- if (!account)
- return;
-
- target_url = e_account_get_string (account, item);
- if (target_url && target_url[0] != '\0')
- url = camel_url_new (target_url, NULL);
- else
- return;
-
- if (mailbox && *mailbox)
- camel_url_set_param (url, "mailbox", mailbox);
- else
- camel_url_set_param (url, "mailbox", NULL);
-
- url_string = camel_url_to_string (url, 0);
- e_account_set_string (account, item, url_string);
- g_free (url_string);
- camel_url_free (url);
-}
-
-static void
-mailbox_editor_entry_changed (GtkWidget *entry, EConfig *config)
+want_mailbox_toggled (GtkToggleButton *toggle,
+ EConfig *config)
{
EMConfigTargetAccount *target;
- EAccount *account;
- gchar *mailbox;
-
- target = (EMConfigTargetAccount *) config->target;
- mailbox = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
-
- g_strstrip (mailbox);
-
- account = target->modified_account;
- update_mailbox_param_in_url (account, E_ACCOUNT_SOURCE_URL, mailbox);
- update_mailbox_param_in_url (account, E_ACCOUNT_TRANSPORT_URL, mailbox);
-
- g_free (mailbox);
-}
-
-static void
-want_mailbox_toggled (GtkWidget *toggle, EConfig *config)
-{
- GtkWidget *entry;
+ CamelExchangeSettings *settings;
g_return_if_fail (toggle != NULL);
g_return_if_fail (config != NULL);
- entry = g_object_get_data (G_OBJECT (toggle), "mailbox-entry");
- if (entry) {
- gboolean is_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle));
- EMConfigTargetAccount *target;
- EAccount *account;
- const gchar *mailbox;
-
- gtk_widget_set_sensitive (entry, is_active);
-
- target = (EMConfigTargetAccount *) config->target;
- mailbox = gtk_entry_get_text (GTK_ENTRY (entry));
+ target = (EMConfigTargetAccount *) config->target;
+ settings = CAMEL_EXCHANGE_SETTINGS (target->settings);
- account = target->modified_account;
- update_mailbox_param_in_url (account, E_ACCOUNT_SOURCE_URL, is_active ? mailbox : NULL);
- update_mailbox_param_in_url (account, E_ACCOUNT_TRANSPORT_URL, is_active ? mailbox : NULL);
- }
+ if (!gtk_toggle_button_get_active (toggle))
+ camel_exchange_settings_set_mailbox (settings, NULL);
}
static gchar *
-construct_owa_url (CamelURL *url)
+construct_owa_url (CamelURL *url,
+ CamelSettings *settings)
{
- const gchar *owa_path, *use_ssl = NULL;
- const gchar *protocol = "http", *mailbox_name;
+ CamelNetworkSecurityMethod security_method;
+ const gchar *scheme;
+ const gchar *mailbox;
+ const gchar *owa_path;
gchar *owa_url;
- use_ssl = camel_url_get_param (url, "use_ssl");
- if (use_ssl) {
- if (!strcmp (use_ssl, "always"))
- protocol = "https";
- }
+ security_method = camel_network_settings_get_security_method (
+ CAMEL_NETWORK_SETTINGS (settings));
+
+ mailbox = camel_exchange_settings_get_mailbox (
+ CAMEL_EXCHANGE_SETTINGS (settings));
+
+ owa_path = camel_exchange_settings_get_mailbox (
+ CAMEL_EXCHANGE_SETTINGS (settings));
- owa_path = camel_url_get_param (url, "owa_path");
- if (!owa_path)
- owa_path = "/exchange";
- mailbox_name = camel_url_get_param (url, "mailbox");
+ if (security_method == CAMEL_NETWORK_SECURITY_METHOD_NONE)
+ scheme = "http";
+ else
+ scheme = "https";
- if (mailbox_name)
- owa_url = g_strdup_printf("%s://%s%s/%s", protocol, url->host, owa_path, mailbox_name);
+ if (mailbox != NULL)
+ owa_url = g_strdup_printf (
+ "%s://%s%s/%s", scheme, url->host, owa_path, mailbox);
else
- owa_url = g_strdup_printf("%s://%s%s", protocol, url->host, owa_path );
+ owa_url = g_strdup_printf (
+ "%s://%s%s", scheme, url->host, owa_path);
return owa_url;
}
@@ -702,8 +628,9 @@ org_gnome_exchange_owa_url (EPlugin *epl, EConfigHookItemFactoryData *data)
{
EMConfigTargetAccount *target_account;
const gchar *source_url;
- gchar *owa_url = NULL, *mailbox_name, *username;
+ gchar *owa_url = NULL, *mailbox, *username;
GtkWidget *owa_entry, *mailbox_entry, *want_mailbox_check;
+ CamelSettings *settings;
EAccount *account;
CamelURL *url;
gint row;
@@ -711,6 +638,7 @@ org_gnome_exchange_owa_url (EPlugin *epl, EConfigHookItemFactoryData *data)
target_account = (EMConfigTargetAccount *) data->config->target;
account = target_account->modified_account;
+ settings = target_account->settings;
source_url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL);
if (source_url && source_url[0] != '\0')
@@ -737,17 +665,21 @@ org_gnome_exchange_owa_url (EPlugin *epl, EConfigHookItemFactoryData *data)
return data->old;
}
- owa_url = g_strdup (camel_url_get_param(url, "owa_url"));
- mailbox_name = g_strdup (camel_url_get_param (url, "mailbox"));
+ g_object_get (
+ settings,
+ "owa-url", &owa_url,
+ "mailbox", &mailbox,
+ NULL);
+
username = g_strdup (url->user);
/* if the host is null, then user+other info is dropped silently, force it to be kept */
if (url->host == NULL) {
gchar *uri;
- camel_url_set_host(url, "");
+ camel_url_set_host (url, "");
uri = camel_url_to_string (url, 0);
- e_account_set_string (account, E_ACCOUNT_SOURCE_URL, uri);
+ e_account_set_string (account, E_ACCOUNT_SOURCE_URL, uri);
g_free (uri);
}
@@ -768,16 +700,26 @@ org_gnome_exchange_owa_url (EPlugin *epl, EConfigHookItemFactoryData *data)
* When invoked from assistant, hostname will get set after validation,
* so this condition will never be true during account creation.
*/
- owa_url = construct_owa_url (url);
- camel_url_set_param (url, "owa_url", owa_url);
+ owa_url = construct_owa_url (url, settings);
+ camel_exchange_settings_set_owa_url (
+ CAMEL_EXCHANGE_SETTINGS (settings), owa_url);
+
+ camel_settings_save_to_url (settings, url);
+
uri = camel_url_to_string (url, 0);
e_account_set_string (account, E_ACCOUNT_SOURCE_URL, uri);
g_free (uri);
}
}
+
+ g_object_bind_property (
+ settings, "owa-url",
+ owa_entry, "text",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
camel_url_free (url);
- if (owa_url)
- gtk_entry_set_text (GTK_ENTRY (owa_entry), owa_url);
+
gtk_label_set_mnemonic_widget ((GtkLabel *) label, owa_entry);
button = gtk_button_new_with_mnemonic (_("A_uthenticate"));
@@ -805,14 +747,17 @@ org_gnome_exchange_owa_url (EPlugin *epl, EConfigHookItemFactoryData *data)
_("Mailbox name is _different from username"));
gtk_widget_show (want_mailbox_check);
gtk_table_attach (GTK_TABLE (data->parent), want_mailbox_check, 1, 2, row, row+1, GTK_FILL, GTK_FILL, 0, 0);
- if (!username || !*username || !mailbox_name || !*mailbox_name ||
- g_ascii_strcasecmp (username, mailbox_name) == 0 ||
- (strchr (username, '/') && g_ascii_strcasecmp (strchr (username, '/') + 1, mailbox_name) == 0)) {
+ if (!username || !*username || !mailbox || !*mailbox ||
+ g_ascii_strcasecmp (username, mailbox) == 0 ||
+ (strchr (username, '/') && g_ascii_strcasecmp (strchr (username, '/') + 1, mailbox) == 0)) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (want_mailbox_check), FALSE);
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (want_mailbox_check), TRUE);
}
- g_signal_connect (want_mailbox_check, "toggled", G_CALLBACK (want_mailbox_toggled), data->config);
+
+ g_signal_connect (
+ want_mailbox_check, "toggled",
+ G_CALLBACK (want_mailbox_toggled), data->config);
row++;
label = gtk_label_new_with_mnemonic (_("_Mailbox:"));
@@ -820,22 +765,27 @@ org_gnome_exchange_owa_url (EPlugin *epl, EConfigHookItemFactoryData *data)
mailbox_entry = gtk_entry_new ();
gtk_widget_show (mailbox_entry);
- if (mailbox_name)
- gtk_entry_set_text (GTK_ENTRY (mailbox_entry), mailbox_name);
+
+ g_object_bind_property (
+ settings, "mailbox",
+ mailbox_entry, "text",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ want_mailbox_check, "active",
+ mailbox_entry, "sensitive",
+ G_BINDING_SYNC_CREATE);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), mailbox_entry);
gtk_widget_set_sensitive (mailbox_entry, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (want_mailbox_check)));
- g_signal_connect (mailbox_entry, "changed", G_CALLBACK (mailbox_editor_entry_changed), data->config);
- g_object_set_data (G_OBJECT (button), "mailbox-entry", mailbox_entry);
- g_object_set_data (G_OBJECT (want_mailbox_check), "mailbox-entry", mailbox_entry);
-
gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row+1, 0, 0, 0, 0);
gtk_table_attach (GTK_TABLE (data->parent), mailbox_entry, 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
g_free (owa_url);
- g_free (mailbox_name);
+ g_free (mailbox);
g_free (username);
return hbox;
diff --git a/eplugin/exchange-config-listener.c b/eplugin/exchange-config-listener.c
index 3d1fbe2..e0d3d0e 100644
--- a/eplugin/exchange-config-listener.c
+++ b/eplugin/exchange-config-listener.c
@@ -1003,7 +1003,10 @@ requires_relogin (gchar *current_url, gchar *new_url)
{
E2kUri *current_uri, *new_uri;
const gchar *current_param_val, *new_param_val;
- const gchar *params [] = { "owa_url", "ad_server", "use_ssl" };
+ const gchar *params [] = {
+ "owa-url",
+ "gc-server-name",
+ "security-method" };
const gint n_params = G_N_ELEMENTS (params);
gint i;
gboolean relogin = FALSE;
@@ -1393,10 +1396,10 @@ exchange_camel_urls_is_equal (const gchar *url1, const gchar *url2)
gchar *param1, *param2;
const gchar *params[] = {
"auth",
- "owa_url",
- "owa_path",
+ "owa-url",
+ "owa-path",
"mailbox",
- "ad_server",
+ "gc-server-name",
};
const gint n_params = 5;
gint i;
diff --git a/glib-gen.mak b/glib-gen.mak
new file mode 100644
index 0000000..4e2a7d6
--- /dev/null
+++ b/glib-gen.mak
@@ -0,0 +1,42 @@
+# these are the variables your Makefile.am should set
+# the example is based on the colorbalance interface
+
+#glib_enum_headers=$(colorbalance_headers)
+#glib_enum_define=GST_COLOR_BALANCE
+#glib_enum_prefix=gst_color_balance
+
+# these are all the rules generating the relevant files
+%-marshal.h: %-marshal.list
+ $(AM_V_GEN) glib-genmarshal --header --prefix=$(glib_enum_prefix)_marshal $^ > $*-marshal.h.tmp && \
+ mv $*-marshal.h.tmp $*-marshal.h
+
+%-marshal.c: %-marshal.list
+ $(AM_V_GEN) echo "#include \"$*-marshal.h\"" >> $*-marshal.c.tmp && \
+ glib-genmarshal --body --prefix=$(glib_enum_prefix)_marshal $^ >> $*-marshal.c.tmp && \
+ mv $*-marshal.c.tmp $*-marshal.c
+
+%-enumtypes.h: $(glib_enum_headers)
+ $(AM_V_GEN) glib-mkenums \
+ --fhead "#ifndef __$(glib_enum_define)_ENUM_TYPES_H__\n#define __$(glib_enum_define)_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+ --fprod "/* enumerations from \"@filename \" */\n" \
+ --vhead "GType @enum_name _get_type (void);\n#define E_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
+ --ftail "G_END_DECLS\n\n#endif /* __$(glib_enum_define)_ENUM_TYPES_H__ */" \
+ $^ > $@
+
+%-enumtypes.c: $(glib_enum_headers)
+ @if test "x$(glib_enum_headers)" == "x"; then echo "ERROR: glib_enum_headers is empty, please fix Makefile"; exit 1; fi && \
+ $(AM_V_GEN) glib-mkenums \
+ --fhead "#include \"$*-enumtypes.h\"" \
+ --fprod "\n/* enumerations from \"@filename \" */" \
+ --vhead "GType\n enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G Type@Value values[] = {" \
+ --vprod " { @valuenum@, \"@VALUENAME \", \"@valuenick \" }," \
+ --vtail " { 0, NULL, NULL }\n };\n etype = g_ type@_register_static (\"@EnumName \", values);\n }\n return etype;\n}\n" \
+ $^ > $@
+
+# a hack rule to make sure .Plo files exist because they get include'd
+# from Makefile's
+.deps/%-marshal.Plo:
+ touch $@
+
+.deps/%-enumtypes.Plo:
+ touch $@
diff --git a/server/lib/Makefile.am b/server/lib/Makefile.am
index 5c441fc..d0a2d6f 100644
--- a/server/lib/Makefile.am
+++ b/server/lib/Makefile.am
@@ -29,11 +29,12 @@ e2k-proptags.h: $(e2k_proptags_h_in) $(mapi_properties)
awk '{if (tail) { print; }} /^ AUTOGENERATE@/ {tail=1;}' $(e2k_proptags_h_in) ) \
> $@
-BUILT_SOURCES = $(PROP_GENERATED)
-NODIST_FILES = $(PROP_GENERATED)
-CLEANFILES = $(PROP_GENERATED)
+include $(top_srcdir)/glib-gen.mak
+glib_enum_headers=e2k-enums.h
+glib_enum_define=E2k
+glib_enum_prefix=e2k
-MARSHAL_GENERATED = e2k-marshal.c e2k-marshal.h
+ENUM_GENERATED = e2k-enumtypes.h e2k-enumtypes.c
e2k-marshal.h: e2k-marshal.list
( @GLIB_GENMARSHAL@ --prefix=e2k_marshal $(srcdir)/e2k-marshal.list --header > e2k-marshal.tmp \
@@ -45,9 +46,14 @@ e2k-marshal.c: e2k-marshal.h
&& mv e2k-marshal.tmp e2k-marshal.c ) \
|| ( rm -f e2k-marshal.tmp && exit 1 )
-BUILT_SOURCES += $(MARSHAL_GENERATED)
-NODIST_FILES += $(MARSHAL_GENERATED)
-CLEANFILES += $(MARSHAL_GENERATED)
+MARSHAL_GENERATED = e2k-marshal.h e2k-marshal.c
+
+BUILT_SOURCES = \
+ $(ENUM_GENERATED) \
+ $(MARSHAL_GENERATED) \
+ $(PROP_GENERATED)
+
+CLEANFILES = $(BUILT_SOURCES)
if ENABLE_KRB5
KERBEROS_FILES = \
@@ -79,7 +85,10 @@ libexchange_la_LIBADD = \
$(LDAP_LIBS)
libexchange_la_SOURCES = \
+ $(ENUM_GENERATED) \
$(MARSHAL_GENERATED) \
+ camel-exchange-settings.c \
+ camel-exchange-settings.h \
e2k-propnames.h \
e2k-proptags.h \
e2k-action.c \
diff --git a/server/lib/camel-exchange-settings.c b/server/lib/camel-exchange-settings.c
new file mode 100644
index 0000000..201128e
--- /dev/null
+++ b/server/lib/camel-exchange-settings.c
@@ -0,0 +1,803 @@
+/*
+ * camel-exchange-settings.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "camel-exchange-settings.h"
+
+#include "e2k-enumtypes.h"
+
+#define CAMEL_EXCHANGE_SETTINGS_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), CAMEL_TYPE_EXCHANGE_SETTINGS, CamelExchangeSettingsPrivate))
+
+#define GC_RESULTS_LIMIT_MIN 1
+#define GC_RESULTS_LIMIT_MAX 10000
+
+#define PASSWD_EXP_WARN_PERIOD_MIN 1
+#define PASSWD_EXP_WARN_PERIOD_MAX 90
+
+struct _CamelExchangeSettingsPrivate {
+ gchar *mailbox;
+ gchar *owa_path;
+ gchar *owa_url;
+
+ gboolean check_all;
+ gboolean filter_junk;
+ gboolean filter_junk_inbox;
+ gboolean use_passwd_exp_warn_period;
+
+ guint passwd_exp_warn_period;
+
+ /* Global Catalog settings */
+ gboolean gc_allow_browse;
+ E2kAutoconfigGalAuthPref gc_auth_method;
+ gboolean gc_expand_groups;
+ guint gc_results_limit;
+ gchar *gc_server_name;
+ gboolean use_gc_results_limit;
+};
+
+enum {
+ PROP_0,
+ PROP_CHECK_ALL,
+ PROP_FILTER_JUNK,
+ PROP_FILTER_JUNK_INBOX,
+ PROP_GC_ALLOW_BROWSE,
+ PROP_GC_AUTH_METHOD,
+ PROP_GC_EXPAND_GROUPS,
+ PROP_GC_RESULTS_LIMIT,
+ PROP_GC_SERVER_NAME,
+ PROP_MAILBOX,
+ PROP_OWA_PATH,
+ PROP_OWA_URL,
+ PROP_PASSWD_EXP_WARN_PERIOD,
+ PROP_SECURITY_METHOD,
+ PROP_USE_GC_RESULTS_LIMIT,
+ PROP_USE_PASSWD_EXP_WARN_PERIOD
+};
+
+G_DEFINE_TYPE_WITH_CODE (
+ CamelExchangeSettings,
+ camel_exchange_settings,
+ CAMEL_TYPE_OFFLINE_SETTINGS,
+ G_IMPLEMENT_INTERFACE (
+ CAMEL_TYPE_NETWORK_SETTINGS, NULL))
+
+static void
+exchange_settings_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CHECK_ALL:
+ camel_exchange_settings_set_check_all (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_FILTER_JUNK:
+ camel_exchange_settings_set_filter_junk (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_FILTER_JUNK_INBOX:
+ camel_exchange_settings_set_filter_junk_inbox (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_GC_ALLOW_BROWSE:
+ camel_exchange_settings_set_gc_allow_browse (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_GC_AUTH_METHOD:
+ camel_exchange_settings_set_gc_auth_method (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_enum (value));
+ return;
+
+ case PROP_GC_EXPAND_GROUPS:
+ camel_exchange_settings_set_gc_expand_groups (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_GC_RESULTS_LIMIT:
+ camel_exchange_settings_set_gc_results_limit (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_uint (value));
+ return;
+
+ case PROP_GC_SERVER_NAME:
+ camel_exchange_settings_set_gc_server_name (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_MAILBOX:
+ camel_exchange_settings_set_mailbox (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_OWA_PATH:
+ camel_exchange_settings_set_owa_path (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_OWA_URL:
+ camel_exchange_settings_set_owa_url (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_PASSWD_EXP_WARN_PERIOD:
+ camel_exchange_settings_set_passwd_exp_warn_period (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_uint (value));
+ return;
+
+ case PROP_SECURITY_METHOD:
+ camel_network_settings_set_security_method (
+ CAMEL_NETWORK_SETTINGS (object),
+ g_value_get_enum (value));
+ return;
+
+ case PROP_USE_GC_RESULTS_LIMIT:
+ camel_exchange_settings_set_use_gc_results_limit (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_USE_PASSWD_EXP_WARN_PERIOD:
+ camel_exchange_settings_set_use_passwd_exp_warn_period (
+ CAMEL_EXCHANGE_SETTINGS (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+exchange_settings_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CHECK_ALL:
+ g_value_set_boolean (
+ value,
+ camel_exchange_settings_get_check_all (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_FILTER_JUNK:
+ g_value_set_boolean (
+ value,
+ camel_exchange_settings_get_filter_junk (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_FILTER_JUNK_INBOX:
+ g_value_set_boolean (
+ value,
+ camel_exchange_settings_get_filter_junk_inbox (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_GC_ALLOW_BROWSE:
+ g_value_set_boolean (
+ value,
+ camel_exchange_settings_get_gc_allow_browse (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_GC_AUTH_METHOD:
+ g_value_set_enum (
+ value,
+ camel_exchange_settings_get_gc_auth_method (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_GC_EXPAND_GROUPS:
+ g_value_set_boolean (
+ value,
+ camel_exchange_settings_get_gc_expand_groups (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_GC_RESULTS_LIMIT:
+ g_value_set_uint (
+ value,
+ camel_exchange_settings_get_gc_results_limit (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_GC_SERVER_NAME:
+ g_value_set_string (
+ value,
+ camel_exchange_settings_get_gc_server_name (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_MAILBOX:
+ g_value_set_string (
+ value,
+ camel_exchange_settings_get_mailbox (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_OWA_PATH:
+ g_value_set_string (
+ value,
+ camel_exchange_settings_get_owa_path (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_OWA_URL:
+ g_value_set_string (
+ value,
+ camel_exchange_settings_get_owa_url (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_PASSWD_EXP_WARN_PERIOD:
+ g_value_set_uint (
+ value,
+ camel_exchange_settings_get_passwd_exp_warn_period (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_SECURITY_METHOD:
+ g_value_set_enum (
+ value,
+ camel_network_settings_get_security_method (
+ CAMEL_NETWORK_SETTINGS (object)));
+ return;
+
+ case PROP_USE_GC_RESULTS_LIMIT:
+ g_value_set_boolean (
+ value,
+ camel_exchange_settings_get_use_gc_results_limit (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+
+ case PROP_USE_PASSWD_EXP_WARN_PERIOD:
+ g_value_set_boolean (
+ value,
+ camel_exchange_settings_get_use_passwd_exp_warn_period (
+ CAMEL_EXCHANGE_SETTINGS (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+exchange_settings_finalize (GObject *object)
+{
+ CamelExchangeSettingsPrivate *priv;
+
+ priv = CAMEL_EXCHANGE_SETTINGS_GET_PRIVATE (object);
+
+ g_free (priv->gc_server_name);
+ g_free (priv->mailbox);
+ g_free (priv->owa_path);
+ g_free (priv->owa_url);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (camel_exchange_settings_parent_class)->finalize (object);
+}
+
+static void
+camel_exchange_settings_class_init (CamelExchangeSettingsClass *class)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (class, sizeof (CamelExchangeSettingsPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = exchange_settings_set_property;
+ object_class->get_property = exchange_settings_get_property;
+ object_class->finalize = exchange_settings_finalize;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CHECK_ALL,
+ g_param_spec_boolean (
+ "check-all",
+ "Check All",
+ "Check all folders for new messages",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILTER_JUNK,
+ g_param_spec_boolean (
+ "filter-junk",
+ "Filter Junk",
+ "Whether to filter junk from all folders",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILTER_JUNK_INBOX,
+ g_param_spec_boolean (
+ "filter-junk-inbox",
+ "Filter Junk Inbox",
+ "Whether to filter junk from Inbox only",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_GC_ALLOW_BROWSE,
+ g_param_spec_boolean (
+ "gc-allow-browse",
+ "Global Catalog Allow Browse",
+ "Allow browsing until results limit is reached",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_GC_AUTH_METHOD,
+ g_param_spec_enum (
+ "gc-auth-method",
+ "Global Catalog Auth Method",
+ "Global Catalog authentication method",
+ E_TYPE_2K_AUTOCONFIG_GAL_AUTH_PREF,
+ E2K_AUTOCONFIG_USE_GAL_DEFAULT,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_GC_EXPAND_GROUPS,
+ g_param_spec_boolean (
+ "gc-expand-groups",
+ "Global Catalog Expand Groups",
+ "Expand groups of contacts in GC to contact lists",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_GC_RESULTS_LIMIT,
+ g_param_spec_uint (
+ "gc-results-limit",
+ "Global Catalog Results Limit",
+ "Limit for Global Catalog query results",
+ GC_RESULTS_LIMIT_MIN,
+ GC_RESULTS_LIMIT_MAX,
+ 500,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_GC_SERVER_NAME,
+ g_param_spec_string (
+ "gc-server-name",
+ "Global Catalog Server Name",
+ "Global Catalog server name",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MAILBOX,
+ g_param_spec_string (
+ "mailbox",
+ "Mailbox",
+ "Exchange mailbox name",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_OWA_PATH,
+ g_param_spec_string (
+ "owa-path",
+ "OWA Path",
+ "URL path to Outlook Web Access",
+ "/exchange",
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_OWA_URL,
+ g_param_spec_string (
+ "owa-url",
+ "OWA URL",
+ "URL to Outlook Web Access",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PASSWD_EXP_WARN_PERIOD,
+ g_param_spec_uint (
+ "passwd-exp-warn-period",
+ "Password Exp Warn Period",
+ "Password expiry warning period",
+ PASSWD_EXP_WARN_PERIOD_MIN,
+ PASSWD_EXP_WARN_PERIOD_MAX,
+ 7,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ /* Inherited from CamelNetworkSettings. */
+ g_object_class_override_property (
+ object_class,
+ PROP_SECURITY_METHOD,
+ "security-method");
+
+ g_object_class_install_property (
+ object_class,
+ PROP_USE_GC_RESULTS_LIMIT,
+ g_param_spec_boolean (
+ "use-gc-results-limit",
+ "Use Global Catalog Results Limit",
+ "Whether to impose a limit on GC query results",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_USE_PASSWD_EXP_WARN_PERIOD,
+ g_param_spec_boolean (
+ "use-passwd-exp-warn-period",
+ "Use Password Exp Warn Period",
+ "Whether to warn in advance of expiring passwords",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+}
+
+static void
+camel_exchange_settings_init (CamelExchangeSettings *settings)
+{
+ settings->priv = CAMEL_EXCHANGE_SETTINGS_GET_PRIVATE (settings);
+}
+
+gboolean
+camel_exchange_settings_get_check_all (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), FALSE);
+
+ return settings->priv->check_all;
+}
+
+void
+camel_exchange_settings_set_check_all (CamelExchangeSettings *settings,
+ gboolean check_all)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ settings->priv->check_all = check_all;
+
+ g_object_notify (G_OBJECT (settings), "check-all");
+}
+
+gboolean
+camel_exchange_settings_get_filter_junk (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), FALSE);
+
+ return settings->priv->filter_junk;
+}
+
+void
+camel_exchange_settings_set_filter_junk (CamelExchangeSettings *settings,
+ gboolean filter_junk)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ settings->priv->filter_junk = filter_junk;
+
+ g_object_notify (G_OBJECT (settings), "filter-junk");
+}
+
+gboolean
+camel_exchange_settings_get_filter_junk_inbox (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), FALSE);
+
+ return settings->priv->filter_junk_inbox;
+}
+
+void
+camel_exchange_settings_set_filter_junk_inbox (CamelExchangeSettings *settings,
+ gboolean filter_junk_inbox)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ settings->priv->filter_junk_inbox = filter_junk_inbox;
+
+ g_object_notify (G_OBJECT (settings), "filter-junk-inbox");
+}
+
+gboolean
+camel_exchange_settings_get_gc_allow_browse (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), FALSE);
+
+ return settings->priv->gc_allow_browse;
+}
+
+void
+camel_exchange_settings_set_gc_allow_browse (CamelExchangeSettings *settings,
+ gboolean gc_allow_browse)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ settings->priv->gc_allow_browse = gc_allow_browse;
+
+ g_object_notify (G_OBJECT (settings), "gc-allow-browse");
+}
+
+E2kAutoconfigGalAuthPref
+camel_exchange_settings_get_gc_auth_method (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (
+ CAMEL_IS_EXCHANGE_SETTINGS (settings),
+ E2K_AUTOCONFIG_USE_GAL_DEFAULT);
+
+ return settings->priv->gc_auth_method;
+}
+
+void
+camel_exchange_settings_set_gc_auth_method (CamelExchangeSettings *settings,
+ E2kAutoconfigGalAuthPref gc_auth_method)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ settings->priv->gc_auth_method = gc_auth_method;
+
+ g_object_notify (G_OBJECT (settings), "gc-auth-method");
+}
+
+gboolean
+camel_exchange_settings_get_gc_expand_groups (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), FALSE);
+
+ return settings->priv->gc_expand_groups;
+}
+
+void
+camel_exchange_settings_set_gc_expand_groups (CamelExchangeSettings *settings,
+ gboolean gc_expand_groups)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ settings->priv->gc_expand_groups = gc_expand_groups;
+
+ g_object_notify (G_OBJECT (settings), "gc-expand-groups");
+}
+
+guint
+camel_exchange_settings_get_gc_results_limit (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), 0);
+
+ return settings->priv->gc_results_limit;
+}
+
+void
+camel_exchange_settings_set_gc_results_limit (CamelExchangeSettings *settings,
+ guint gc_results_limit)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ settings->priv->gc_results_limit = CLAMP (
+ gc_results_limit,
+ GC_RESULTS_LIMIT_MIN,
+ GC_RESULTS_LIMIT_MAX);
+
+ g_object_notify (G_OBJECT (settings), "gc-results-limit");
+}
+
+const gchar *
+camel_exchange_settings_get_gc_server_name (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), NULL);
+
+ return settings->priv->gc_server_name;
+}
+
+void
+camel_exchange_settings_set_gc_server_name (CamelExchangeSettings *settings,
+ const gchar *gc_server_name)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ /* The value should never be NULL. */
+ if (gc_server_name == NULL)
+ gc_server_name = "";
+
+ g_free (settings->priv->gc_server_name);
+ settings->priv->gc_server_name = g_strdup (gc_server_name);
+
+ g_object_notify (G_OBJECT (settings), "gc-server-name");
+}
+
+const gchar *
+camel_exchange_settings_get_mailbox (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), NULL);
+
+ return settings->priv->mailbox;
+}
+
+void
+camel_exchange_settings_set_mailbox (CamelExchangeSettings *settings,
+ const gchar *mailbox)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ /* The value should never be NULL. */
+ if (mailbox == NULL)
+ mailbox = "";
+
+ g_free (settings->priv->mailbox);
+ settings->priv->mailbox = g_strdup (mailbox);
+
+ g_object_notify (G_OBJECT (settings), "mailbox");
+}
+
+const gchar *
+camel_exchange_settings_get_owa_path (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), NULL);
+
+ return settings->priv->owa_path;
+}
+
+void
+camel_exchange_settings_set_owa_path (CamelExchangeSettings *settings,
+ const gchar *owa_path)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ /* The value should never be NULL. */
+ if (owa_path == NULL)
+ owa_path = "";
+
+ g_free (settings->priv->owa_path);
+ settings->priv->owa_path = g_strdup (owa_path);
+
+ g_object_notify (G_OBJECT (settings), "owa-path");
+}
+
+const gchar *
+camel_exchange_settings_get_owa_url (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), NULL);
+
+ return settings->priv->owa_url;
+}
+
+void
+camel_exchange_settings_set_owa_url (CamelExchangeSettings *settings,
+ const gchar *owa_url)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ /* The value should never be NULL. */
+ if (owa_url == NULL)
+ owa_url = "";
+
+ g_free (settings->priv->owa_url);
+ settings->priv->owa_url = g_strdup (owa_url);
+
+ g_object_notify (G_OBJECT (settings), "owa-url");
+}
+
+guint
+camel_exchange_settings_get_passwd_exp_warn_period (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), 0);
+
+ return settings->priv->passwd_exp_warn_period;
+}
+
+void
+camel_exchange_settings_set_passwd_exp_warn_period (CamelExchangeSettings *settings,
+ guint passwd_exp_warn_period)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ settings->priv->passwd_exp_warn_period = CLAMP (
+ passwd_exp_warn_period,
+ PASSWD_EXP_WARN_PERIOD_MIN,
+ PASSWD_EXP_WARN_PERIOD_MAX);
+
+ g_object_notify (G_OBJECT (settings), "passwd-exp-warn-period");
+}
+
+gboolean
+camel_exchange_settings_get_use_gc_results_limit (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), FALSE);
+
+ return settings->priv->use_gc_results_limit;
+}
+
+void
+camel_exchange_settings_set_use_gc_results_limit (CamelExchangeSettings *settings,
+ gboolean use_gc_results_limit)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ settings->priv->use_gc_results_limit = use_gc_results_limit;
+
+ g_object_notify (G_OBJECT (settings), "use-gc-results-limit");
+}
+
+gboolean
+camel_exchange_settings_get_use_passwd_exp_warn_period (CamelExchangeSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings), FALSE);
+
+ return settings->priv->use_passwd_exp_warn_period;
+}
+
+void
+camel_exchange_settings_set_use_passwd_exp_warn_period (CamelExchangeSettings *settings,
+ gboolean use_passwd_exp_warn_period)
+{
+ g_return_if_fail (CAMEL_IS_EXCHANGE_SETTINGS (settings));
+
+ settings->priv->use_passwd_exp_warn_period = use_passwd_exp_warn_period;
+
+ g_object_notify (G_OBJECT (settings), "use-passwd-exp-warn-period");
+}
diff --git a/server/lib/camel-exchange-settings.h b/server/lib/camel-exchange-settings.h
new file mode 100644
index 0000000..1c4dd40
--- /dev/null
+++ b/server/lib/camel-exchange-settings.h
@@ -0,0 +1,135 @@
+/*
+ * camel-exchange-settings.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef CAMEL_EXCHANGE_SETTINGS_H
+#define CAMEL_EXCHANGE_SETTINGS_H
+
+#include <camel/camel.h>
+#include "e2k-enums.h"
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_EXCHANGE_SETTINGS \
+ (camel_exchange_settings_get_type ())
+#define CAMEL_EXCHANGE_SETTINGS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_EXCHANGE_SETTINGS, CamelExchangeSettings))
+#define CAMEL_EXCHANGE_SETTINGS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_EXCHANGE_SETTINGS, CamelExchangeSettingsClass))
+#define CAMEL_IS_EXCHANGE_SETTINGS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_EXCHANGE_SETTINGS))
+#define CAMEL_IS_EXCHANGE_SETTINGS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_EXCHANGE_SETTINGS))
+#define CAMEL_EXCHANGE_SETTINGS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_EXCHANGE_SETTINGS, CamelExchangeSettingsClass))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelExchangeSettings CamelExchangeSettings;
+typedef struct _CamelExchangeSettingsClass CamelExchangeSettingsClass;
+typedef struct _CamelExchangeSettingsPrivate CamelExchangeSettingsPrivate;
+
+struct _CamelExchangeSettings {
+ CamelOfflineSettings parent;
+ CamelExchangeSettingsPrivate *priv;
+};
+
+struct _CamelExchangeSettingsClass {
+ CamelOfflineSettingsClass parent_class;
+};
+
+GType camel_exchange_settings_get_type
+ (void) G_GNUC_CONST;
+gboolean camel_exchange_settings_get_check_all
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_check_all
+ (CamelExchangeSettings *settings,
+ gboolean check_all);
+gboolean camel_exchange_settings_get_filter_junk
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_filter_junk
+ (CamelExchangeSettings *settings,
+ gboolean filter_junk);
+gboolean camel_exchange_settings_get_filter_junk_inbox
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_filter_junk_inbox
+ (CamelExchangeSettings *settings,
+ gboolean filter_junk_inbox);
+gboolean camel_exchange_settings_get_gc_allow_browse
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_gc_allow_browse
+ (CamelExchangeSettings *settings,
+ gboolean gc_allow_browse);
+E2kAutoconfigGalAuthPref
+ camel_exchange_settings_get_gc_auth_method
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_gc_auth_method
+ (CamelExchangeSettings *settings,
+ E2kAutoconfigGalAuthPref gc_auth_method);
+gboolean camel_exchange_settings_get_gc_expand_groups
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_gc_expand_groups
+ (CamelExchangeSettings *settings,
+ gboolean gc_expand_groups);
+guint camel_exchange_settings_get_gc_results_limit
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_gc_results_limit
+ (CamelExchangeSettings *settings,
+ guint gc_results_limit);
+const gchar * camel_exchange_settings_get_gc_server_name
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_gc_server_name
+ (CamelExchangeSettings *settings,
+ const gchar *gc_server_name);
+const gchar * camel_exchange_settings_get_mailbox
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_mailbox
+ (CamelExchangeSettings *settings,
+ const gchar *mailbox);
+const gchar * camel_exchange_settings_get_owa_path
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_owa_path
+ (CamelExchangeSettings *settings,
+ const gchar *owa_path);
+const gchar * camel_exchange_settings_get_owa_url
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_owa_url
+ (CamelExchangeSettings *settings,
+ const gchar *owa_url);
+guint camel_exchange_settings_get_passwd_exp_warn_period
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_passwd_exp_warn_period
+ (CamelExchangeSettings *settings,
+ guint passwd_exp_warn_period);
+gboolean camel_exchange_settings_get_use_gc_results_limit
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_use_gc_results_limit
+ (CamelExchangeSettings *settings,
+ gboolean use_gc_results_limit);
+gboolean camel_exchange_settings_get_use_passwd_exp_warn_period
+ (CamelExchangeSettings *settings);
+void camel_exchange_settings_set_use_passwd_exp_warn_period
+ (CamelExchangeSettings *settings,
+ gboolean use_passwd_exp_warn_period);
+
+G_END_DECLS
+
+#endif /* CAMEL_EXCHANGE_SETTINGS_H */
diff --git a/server/lib/e2k-autoconfig.c b/server/lib/e2k-autoconfig.c
index 616124e..b68e936 100644
--- a/server/lib/e2k-autoconfig.c
+++ b/server/lib/e2k-autoconfig.c
@@ -998,11 +998,11 @@ set_account_uri_string (E2kAutoconfig *ac)
g_string_append_c (uri, '/');
if (!strcmp (owa_uri->protocol, "https"))
- g_string_append (uri, ";use_ssl=always");
- g_string_append (uri, ";ad_server=");
+ g_string_append (uri, ";security-method=ssl-on-alternate-port");
+ g_string_append (uri, ";gc-server-name=");
e2k_uri_append_encoded (uri, ac->gc_server, FALSE, ";?");
if (ac->gal_limit != -1)
- g_string_append_printf (uri, ";ad_limit=%d", ac->gal_limit);
+ g_string_append_printf (uri, ";gc-results-limit=%d", ac->gal_limit);
if (ac->gal_auth != E2K_AUTOCONFIG_USE_GAL_DEFAULT) {
const gchar *value = NULL;
@@ -1013,7 +1013,7 @@ set_account_uri_string (E2kAutoconfig *ac)
}
if (value)
- g_string_append_printf (uri, ";ad_auth=%s", value);
+ g_string_append_printf (uri, ";gc-auth-method=%s", value);
}
path = g_strdup (home_uri->path + 1);
@@ -1027,7 +1027,7 @@ set_account_uri_string (E2kAutoconfig *ac)
g_string_append (uri, ";mailbox=");
e2k_uri_append_encoded (uri, mailbox, FALSE, ";?");
}
- g_string_append (uri, ";owa_path=/");
+ g_string_append (uri, ";owa-path=/");
e2k_uri_append_encoded (uri, path, FALSE, ";?");
g_free (path);
@@ -1480,7 +1480,7 @@ validate (const gchar *owa_url, gchar *user, gchar *password, ExchangeParams *ex
E2kUri *euri;
gboolean valid = FALSE;
/* const gchar *old, *new; */
- gchar *path, *mailbox;
+ gchar *path;
ac = e2k_autoconfig_new (owa_url, user, password,
E2K_AUTOCONFIG_USE_EITHER);
@@ -1511,6 +1511,8 @@ validate (const gchar *owa_url, gchar *user, gchar *password, ExchangeParams *ex
}
if (*result == E2K_AUTOCONFIG_OK) {
+ const gchar *mailbox;
+ gchar *owa_path;
gint len;
*result = e2k_autoconfig_check_global_catalog (ac, &op);
@@ -1528,18 +1530,24 @@ validate (const gchar *owa_url, gchar *user, gchar *password, ExchangeParams *ex
len--;
}
+ mailbox = camel_exchange_settings_get_mailbox (
+ exchange_params->settings);
+
/* change a mailbox only if not set by the caller */
- if (!exchange_params->mailbox || !*exchange_params->mailbox) {
- mailbox = strrchr (path, '/');
- if (mailbox && !mailbox[1]) {
- *mailbox = '\0';
- mailbox = strrchr (path, '/');
+ if (mailbox == NULL || *mailbox == '\0') {
+ gchar *derived_mailbox;
+
+ derived_mailbox = strrchr (path, '/');
+ if (derived_mailbox != NULL && *derived_mailbox == '\0') {
+ *derived_mailbox = '\0';
+ derived_mailbox = strrchr (path, '/');
}
- if (mailbox)
- *mailbox++ = '\0';
+ if (derived_mailbox != NULL)
+ *derived_mailbox++ = '\0';
- g_free (exchange_params->mailbox);
- exchange_params->mailbox = g_strdup (mailbox);
+ camel_exchange_settings_set_mailbox (
+ exchange_params->settings,
+ derived_mailbox);
} else {
/* always strip the mailbox part from the path */
gchar *slash = strrchr (path, '/');
@@ -1548,11 +1556,17 @@ validate (const gchar *owa_url, gchar *user, gchar *password, ExchangeParams *ex
*slash = '\0';
}
- exchange_params->owa_path = g_strdup_printf ("%s%s", "/", path);
+ owa_path = g_strconcat ("/", path, NULL);
+ camel_exchange_settings_set_owa_path (
+ exchange_params->settings, owa_path);
+ g_free (owa_path);
+
g_free (path);
+
exchange_params->host = g_strdup (ac->pf_server);
- if (ac->gc_server)
- exchange_params->ad_server = g_strdup (ac->gc_server);
+ if (ac->gc_server != NULL)
+ camel_exchange_settings_set_gc_server_name (
+ exchange_params->settings, ac->gc_server);
exchange_params->is_ntlm = ac->saw_ntlm;
valid = TRUE;
diff --git a/server/lib/e2k-enums.h b/server/lib/e2k-enums.h
new file mode 100644
index 0000000..30c4c75
--- /dev/null
+++ b/server/lib/e2k-enums.h
@@ -0,0 +1,39 @@
+/*
+ * e2k-enums.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E2K_ENUMS_H
+#define E2K_ENUMS_H
+
+/**
+ * E2kAutoconfigGalAuthPref:
+ * E2K_AUTOCONFIG_USE_GAL_DEFAULT:
+ * Try NTLM first if available, then fall back to Basic.
+ * E2K_AUTOCONFIG_USE_GAL_BASIC:
+ * Plaintext password authentication.
+ * E2K_AUTOCONFIG_USE_GAL_NTLM:
+ * NTLM (NT LAN Manager) authentication.
+ *
+ * Authentication method for the Global Address List server.
+ **/
+typedef enum {
+ E2K_AUTOCONFIG_USE_GAL_DEFAULT,
+ E2K_AUTOCONFIG_USE_GAL_BASIC,
+ E2K_AUTOCONFIG_USE_GAL_NTLM
+} E2kAutoconfigGalAuthPref;
+
+#endif /* E2K_ENUMS_H */
diff --git a/server/lib/e2k-validate.h b/server/lib/e2k-validate.h
index e0b5c7d..3618448 100644
--- a/server/lib/e2k-validate.h
+++ b/server/lib/e2k-validate.h
@@ -5,25 +5,16 @@
#define __E2K_VALIDATE_H_
#include <gtk/gtk.h>
+#include "camel-exchange-settings.h"
+#include "e2k-enums.h"
G_BEGIN_DECLS
-typedef enum {
- E2K_AUTOCONFIG_USE_GAL_DEFAULT, /* try ntlm if available and then basic if not or failed */
-
- E2K_AUTOCONFIG_USE_GAL_BASIC,
- /*E2K_AUTOCONFIG_USE_GAL_SASL,*/
- E2K_AUTOCONFIG_USE_GAL_NTLM
-} E2kAutoconfigGalAuthPref;
-
typedef struct {
- gchar *host;
- gchar *ad_server;
- E2kAutoconfigGalAuthPref ad_auth;
- gchar *mailbox;
- gchar *owa_path;
+ gchar *host;
+ CamelExchangeSettings *settings;
gboolean is_ntlm;
-}ExchangeParams;
+} ExchangeParams;
typedef enum {
E2K_AUTOCONFIG_OK,
@@ -44,11 +35,13 @@ typedef enum {
E2K_AUTOCONFIG_FAILED
} E2kAutoconfigResult;
-gboolean e2k_validate_user (const gchar *owa_url, gchar *key, gchar **user,
- ExchangeParams *exchange_params,
- gboolean *remember_password,
- E2kAutoconfigResult *result,
- GtkWindow *parent);
+gboolean e2k_validate_user (const gchar *owa_url,
+ gchar *key,
+ gchar **user,
+ ExchangeParams *exchange_params,
+ gboolean *remember_password,
+ E2kAutoconfigResult *result,
+ GtkWindow *parent);
G_END_DECLS
diff --git a/server/lib/urltest.c b/server/lib/urltest.c
index 5e13fa9..c500a2d 100644
--- a/server/lib/urltest.c
+++ b/server/lib/urltest.c
@@ -74,62 +74,6 @@ dump_uri (E2kUri *euri) {
printf("Path : %s \n", euri->path);
else
printf ("Path : NULL \n");
- if (euri->params) {
- printf("\nParams : \n");
- temp = e2k_uri_get_param (euri, "ad_server");
- if (temp) printf ("\tAd server = %s\n", temp);
- else printf ("\tAd server = NULL \n");
-
- temp = e2k_uri_get_param (euri, "ad_limit");
- if (temp) printf ("\tAd Limit = %s\n", temp);
- else printf ("\tAd Limit = NULL\n");
-
- temp = e2k_uri_get_param (euri, "passwd_exp_warn_period");
- if (temp) printf ("\tPasswd expiry warn period = %s\n", temp);
- else printf ("\tPasswd expiry warn period = NULL \n");
-
- temp = e2k_uri_get_param (euri, "offline_sync");
- if (temp) printf ("\tOffline Sync = %s\n", temp);
- else printf ("\tOffline Sync = NULL \n");
-
- temp = e2k_uri_get_param (euri, "owa_path");
- if (temp) printf ("\tOwa path = %s\n", temp);
- else printf ("\tOwa path = NULL \n");
-
- temp = e2k_uri_get_param (euri, "pf_server");
- if (temp) printf ("\tPf server = %s\n", temp);
- else printf ("\tPf server = NULL \n");
-
- temp = e2k_uri_get_param (euri, "use_ssl");
- if (temp) printf ("\tSSL = %s\n", temp);
- else printf ("\tSSL = NULL\n");
-
- temp = e2k_uri_get_param (euri, "mailbox");
- if (temp) printf ("\tMailbox = %s\n", temp);
- else printf ("\tMailbox = NULL \n");
-
- temp = e2k_uri_get_param (euri, "filter");
- if (temp) printf ("\tFilter = %s\n", temp);
- else printf ("\tFilter = NULL \n");
-
- temp = e2k_uri_get_param (euri, "filter_junk");
- if (temp) printf ("\tFilter junk = %s\n", temp);
- else printf ("\tFilter junk = NULL \n");
-
- temp = e2k_uri_get_param (euri, "filter_junk_inbox");
- if (temp) printf ("\tFilter junk inbox = %s\n", temp);
- else printf ("\tFilter junk inbox = NULL \n");
-
- temp = e2k_uri_get_param (euri, "owa_protocol");
- if (temp) printf ("\tOwa protocol = %s\n", temp);
- else printf ("\tOwa protocol = NULL \n");
-
- temp = e2k_uri_get_param (euri, "owa_url");
- if (temp) printf ("\tOwa url = %s\n", temp);
- else printf ("\tOwa url = NULL \n");
- }
- else
- printf ("Params : NULL \n");
if (euri->query)
printf("Query : %s \n", euri->query);
else
diff --git a/server/storage/exchange-account.c b/server/storage/exchange-account.c
index 0fb3454..33f0ec6 100644
--- a/server/storage/exchange-account.c
+++ b/server/storage/exchange-account.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif
+#include "camel-exchange-settings.h"
#include "exchange-account.h"
#include "exchange-hierarchy-webdav.h"
#include "exchange-hierarchy-favorites.h"
@@ -54,6 +55,10 @@
#define ONE_HUNDRED_NANOSECOND 0.000000100
#define SECONDS_IN_DAY 86400
+#define EXCHANGE_ACCOUNT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EXCHANGE_TYPE_ACCOUNT, ExchangeAccountPrivate))
+
struct _ExchangeAccountPrivate {
E2kContext *ctx;
E2kGlobalCatalog *gc;
@@ -70,17 +75,16 @@ struct _ExchangeAccountPrivate {
GHashTable *folders;
GStaticRecMutex folders_lock;
gchar *uri_authority, *http_uri_schema;
- gboolean uris_use_email, offline_sync;
+ gboolean uris_use_email;
gchar *identity_name, *identity_email, *source_uri, *password_key;
- gchar *username, *password, *windows_domain, *nt_domain, *ad_server;
- gchar *owa_url;
+ gchar *username, *password, *windows_domain, *nt_domain;
E2kAutoconfigAuthPref auth_pref;
- gint ad_limit, passwd_exp_warn_period, quota_limit;
- E2kAutoconfigGalAuthPref ad_auth;
+ gint quota_limit;
EAccountList *account_list;
EAccount *account;
+ CamelSettings *settings;
GMutex *discover_data_lock;
GList *discover_datas;
@@ -109,6 +113,8 @@ exchange_account_class_init (ExchangeAccountClass *class)
{
GObjectClass *object_class;
+ g_type_class_add_private (class, sizeof (ExchangeAccountPrivate));
+
object_class = G_OBJECT_CLASS (class);
object_class->dispose = dispose;
object_class->finalize = finalize;
@@ -146,7 +152,7 @@ exchange_account_class_init (ExchangeAccountClass *class)
static void
exchange_account_init (ExchangeAccount *account)
{
- account->priv = g_new0 (ExchangeAccountPrivate, 1);
+ account->priv = EXCHANGE_ACCOUNT_GET_PRIVATE (account);
account->priv->connect_lock = g_mutex_new ();
account->priv->hierarchies = g_ptr_array_new ();
account->priv->hierarchies_by_folder = g_hash_table_new (NULL, NULL);
@@ -174,56 +180,63 @@ free_folder (gpointer key, gpointer folder, gpointer data)
static void
dispose (GObject *object)
{
- ExchangeAccount *account = EXCHANGE_ACCOUNT (object);
+ ExchangeAccountPrivate *priv;
gint i;
- if (account->priv->account) {
- g_object_unref (account->priv->account);
- account->priv->account = NULL;
+ priv = EXCHANGE_ACCOUNT_GET_PRIVATE (object);
+
+ if (priv->account) {
+ g_object_unref (priv->account);
+ priv->account = NULL;
}
- if (account->priv->account_list) {
- g_object_unref (account->priv->account_list);
- account->priv->account_list = NULL;
+ if (priv->account_list) {
+ g_object_unref (priv->account_list);
+ priv->account_list = NULL;
}
- if (account->priv->ctx) {
- g_object_unref (account->priv->ctx);
- account->priv->ctx = NULL;
+ if (priv->settings) {
+ g_object_unref (priv->settings);
+ priv->settings = NULL;
}
- if (account->priv->gc) {
- g_object_unref (account->priv->gc);
- account->priv->gc = NULL;
+ if (priv->ctx) {
+ g_object_unref (priv->ctx);
+ priv->ctx = NULL;
}
- if (account->priv->hierarchies) {
- for (i = 0; i < account->priv->hierarchies->len; i++)
- g_object_unref (account->priv->hierarchies->pdata[i]);
- g_ptr_array_free (account->priv->hierarchies, TRUE);
- account->priv->hierarchies = NULL;
+ if (priv->gc) {
+ g_object_unref (priv->gc);
+ priv->gc = NULL;
}
- if (account->priv->foreign_hierarchies) {
- g_hash_table_foreach (account->priv->foreign_hierarchies, free_name, NULL);
- g_hash_table_destroy (account->priv->foreign_hierarchies);
- account->priv->foreign_hierarchies = NULL;
+ if (priv->hierarchies) {
+ for (i = 0; i < priv->hierarchies->len; i++)
+ g_object_unref (priv->hierarchies->pdata[i]);
+ g_ptr_array_free (priv->hierarchies, TRUE);
+ priv->hierarchies = NULL;
}
- g_static_rec_mutex_lock (&account->priv->folders_lock);
+ if (priv->foreign_hierarchies) {
+ g_hash_table_foreach (priv->foreign_hierarchies, free_name, NULL);
+ g_hash_table_destroy (priv->foreign_hierarchies);
+ priv->foreign_hierarchies = NULL;
+ }
+
+ g_static_rec_mutex_lock (&priv->folders_lock);
- if (account->priv->hierarchies_by_folder) {
- g_hash_table_destroy (account->priv->hierarchies_by_folder);
- account->priv->hierarchies_by_folder = NULL;
+ if (priv->hierarchies_by_folder) {
+ g_hash_table_destroy (priv->hierarchies_by_folder);
+ priv->hierarchies_by_folder = NULL;
}
- if (account->priv->folders) {
- g_hash_table_foreach (account->priv->folders, free_folder, NULL);
- g_hash_table_destroy (account->priv->folders);
- account->priv->folders = NULL;
+ if (priv->folders) {
+ g_hash_table_foreach (priv->folders, free_folder, NULL);
+ g_hash_table_destroy (priv->folders);
+ priv->folders = NULL;
}
- g_static_rec_mutex_unlock (&account->priv->folders_lock);
+ g_static_rec_mutex_unlock (&priv->folders_lock);
G_OBJECT_CLASS (exchange_account_parent_class)->dispose (object);
}
@@ -288,12 +301,6 @@ finalize (GObject *object)
if (account->priv->nt_domain)
g_free (account->priv->nt_domain);
- if (account->priv->ad_server)
- g_free (account->priv->ad_server);
-
- if (account->priv->owa_url)
- g_free (account->priv->owa_url);
-
if (account->priv->connect_lock)
g_mutex_free (account->priv->connect_lock);
@@ -302,8 +309,6 @@ finalize (GObject *object)
g_static_rec_mutex_free (&account->priv->folders_lock);
- g_free (account->priv);
-
G_OBJECT_CLASS (exchange_account_parent_class)->finalize (object);
}
@@ -1036,15 +1041,27 @@ is_password_expired (ExchangeAccount *account, E2kAutoconfig *ac)
#endif
static gint
-find_passwd_exp_period (ExchangeAccount *account, E2kGlobalCatalogEntry *entry)
+find_passwd_exp_period (ExchangeAccount *account,
+ E2kGlobalCatalogEntry *entry)
{
gdouble max_pwd_age = 0;
gint max_pwd_age_days;
E2kOperation gcop;
+ CamelSettings *settings;
E2kGlobalCatalogStatus gcstatus;
+ gboolean use_passwd_exp_warn_period;
+ guint passwd_exp_warn_period;
+
+ settings = exchange_account_get_settings (account);
+
+ g_object_get (
+ settings,
+ "passwd-exp-warn-period", &passwd_exp_warn_period,
+ "use-passwd-exp-warn-period", &use_passwd_exp_warn_period,
+ NULL);
/* If user has not selected password expiry warning option, return */
- if (account->priv->passwd_exp_warn_period == -1)
+ if (!use_passwd_exp_warn_period)
return -1;
/* Check for password expiry period */
@@ -1054,19 +1071,19 @@ find_passwd_exp_period (ExchangeAccount *account, E2kGlobalCatalogEntry *entry)
/* Check for account control value for a user */
e2k_operation_init (&gcop);
- gcstatus = e2k_global_catalog_lookup (account->priv->gc,
- &gcop,
- E2K_GLOBAL_CATALOG_LOOKUP_BY_EMAIL,
- account->priv->identity_email,
- E2K_GLOBAL_CATALOG_LOOKUP_ACCOUNT_CONTROL,
- &entry);
+ gcstatus = e2k_global_catalog_lookup (
+ account->priv->gc, &gcop,
+ E2K_GLOBAL_CATALOG_LOOKUP_BY_EMAIL,
+ account->priv->identity_email,
+ E2K_GLOBAL_CATALOG_LOOKUP_ACCOUNT_CONTROL,
+ &entry);
e2k_operation_free (&gcop);
+
if (gcstatus != E2K_GLOBAL_CATALOG_OK)
return -1;
- if (entry->user_account_control & ADS_UF_DONT_EXPIRE_PASSWORD) {
+ if (entry->user_account_control & ADS_UF_DONT_EXPIRE_PASSWORD)
return -1; /* Password is not set to expire */
- }
/* Here we don't check not setting the password and expired password */
/* Check for the maximum password age set */
@@ -1078,12 +1095,12 @@ find_passwd_exp_period (ExchangeAccount *account, E2kGlobalCatalogEntry *entry)
if (max_pwd_age > 0) {
/* Calculate password expiry period */
max_pwd_age_days =
- ( max_pwd_age * ONE_HUNDRED_NANOSECOND ) / SECONDS_IN_DAY;
+ (max_pwd_age * ONE_HUNDRED_NANOSECOND) / SECONDS_IN_DAY;
- if (max_pwd_age_days <= account->priv->passwd_exp_warn_period) {
+ if (max_pwd_age_days <= passwd_exp_warn_period)
return max_pwd_age_days;
- }
}
+
return -1;
}
@@ -1384,6 +1401,10 @@ exchange_account_connect (ExchangeAccount *account, const gchar *pword,
E2kOperation gcop;
gchar *user_name = NULL;
gboolean tried_ntlm = FALSE, tried_basic = FALSE;
+ gchar *gc_server_name;
+ gint gc_results_limit;
+ gboolean use_gc_results_limit;
+ E2kAutoconfigGalAuthPref gc_auth_method;
*info_result = EXCHANGE_ACCOUNT_UNKNOWN_ERROR;
g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), NULL);
@@ -1428,8 +1449,21 @@ exchange_account_connect (ExchangeAccount *account, const gchar *pword,
account->priv->auth_pref);
g_free (user_name);
- e2k_autoconfig_set_gc_server (ac, account->priv->ad_server,
- account->priv->ad_limit, account->priv->ad_auth);
+ g_object_get (
+ account->priv->settings,
+ "gc-auth-method", &gc_auth_method,
+ "gc-results-limit", &gc_results_limit,
+ "gc-server-name", &gc_server_name,
+ "use-gc-results-limit", &use_gc_results_limit,
+ NULL);
+
+ if (!use_gc_results_limit)
+ gc_results_limit = -1; /* unlimited */
+
+ e2k_autoconfig_set_gc_server (
+ ac, gc_server_name, gc_results_limit, gc_auth_method);
+
+ g_free (gc_server_name);
if (!pword) {
account->priv->connecting = FALSE;
@@ -1641,14 +1675,18 @@ skip_quota:
void
exchange_account_is_offline_sync_set (ExchangeAccount *account, gint *mode)
{
+ CamelSettings *settings;
+ gboolean stay_synchronized;
*mode = UNSUPPORTED_MODE;
g_return_if_fail (EXCHANGE_IS_ACCOUNT (account));
- if (account->priv->offline_sync)
- *mode = OFFLINE_MODE;
- else
- *mode = ONLINE_MODE;
+ settings = exchange_account_get_settings (account);
+
+ stay_synchronized = camel_offline_settings_get_stay_synchronized (
+ CAMEL_OFFLINE_SETTINGS (settings));
+
+ *mode = stay_synchronized ? OFFLINE_MODE : ONLINE_MODE;
}
/**
@@ -1682,49 +1720,33 @@ exchange_account_get_global_catalog (ExchangeAccount *account)
}
/**
- * exchange_account_fetch:
- * @acct: an #ExchangeAccount
+ * exchange_account_get_settings:
+ * @account: an #ExchangeAccount
*
- * Return value: @account's #EAccount, if it is connected and
- * online, or %NULL if not.
+ * Return value: @account's #CamelSettings, created from the #EAccount
+ * given in exchange_account_new().
**/
-EAccount *
-exchange_account_fetch (ExchangeAccount *acct)
+CamelSettings *
+exchange_account_get_settings (ExchangeAccount *account)
{
- g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (acct), NULL);
+ g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), NULL);
- return acct->priv->account;
+ return account->priv->settings;
}
/**
- * exchange_account_get_account_uri_param:
- * @acct: and #ExchangeAccount
- * @param: uri param name to get
+ * exchange_account_fetch:
+ * @acct: an #ExchangeAccount
*
- * Reads the parameter #param from the source url of the underlying EAccount.
- * Returns the value or NULL. Returned value should be freed with g_free.
+ * Return value: @account's #EAccount, if it is connected and
+ * online, or %NULL if not.
**/
-gchar *
-exchange_account_get_account_uri_param (ExchangeAccount *acct, const gchar *param)
+EAccount *
+exchange_account_fetch (ExchangeAccount *acct)
{
- EAccount *account;
- E2kUri *uri;
- gchar *res;
-
g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (acct), NULL);
- g_return_val_if_fail (param != NULL, NULL);
-
- account = exchange_account_fetch (acct);
- g_return_val_if_fail (account != NULL, NULL);
- uri = e2k_uri_new (e_account_get_string (account, E_ACCOUNT_SOURCE_URL));
- g_return_val_if_fail (uri != NULL, NULL);
-
- res = g_strdup (e2k_uri_get_param (uri, param));
-
- e2k_uri_free (uri);
-
- return res;
+ return acct->priv->account;
}
/**
@@ -2257,10 +2279,11 @@ exchange_account_new (EAccountList *account_list, EAccount *adata)
{
ExchangeAccount *account;
gchar *enc_user, *mailbox;
- const gchar *param, *proto="http", *owa_path, *pf_server, *owa_url;
- const gchar *passwd_exp_warn_period, *offline_sync;
+ const gchar *param, *proto="http", *owa_path, *owa_url;
const gchar *user_data_dir;
gchar *user_at_host;
+ CamelSettings *settings;
+ CamelURL camel_url;
E2kUri *uri;
uri = e2k_uri_new (adata->source->url);
@@ -2278,6 +2301,17 @@ exchange_account_new (EAccountList *account_list, EAccount *adata)
account->priv->account = adata;
g_object_ref (adata);
+ /* XXX A E2kUri struct is just a CamelURL struct plus a domain
+ * field. Otherwise they're identical. For the purpose of
+ * populating the CamelSettings, we just need to allocate a
+ * mock CamelURL struct and point its "params" field to the
+ * E2kUri's "params" field. */
+ memset (&camel_url, 0, sizeof (CamelURL));
+ camel_url.params = uri->params;
+ settings = g_object_new (CAMEL_TYPE_EXCHANGE_SETTINGS, NULL);
+ camel_settings_load_from_url (settings, &camel_url);
+ account->priv->settings = settings;
+
account->account_name = g_strdup (adata->name);
user_data_dir = e_get_user_data_dir ();
@@ -2327,55 +2361,18 @@ exchange_account_new (EAccountList *account_list, EAccount *adata)
account->priv->auth_pref = E2K_AUTOCONFIG_USE_BASIC;
else
account->priv->auth_pref = E2K_AUTOCONFIG_USE_NTLM;
- param = e2k_uri_get_param (uri, "ad_server");
- if (param && *param) {
- account->priv->ad_server = g_strdup (param);
- param = e2k_uri_get_param (uri, "ad_limit");
- if (param)
- account->priv->ad_limit = atoi (param);
- param = e2k_uri_get_param (uri, "ad_auth");
- if (!param || g_ascii_strcasecmp (param, "default") == 0)
- account->priv->ad_auth = E2K_AUTOCONFIG_USE_GAL_DEFAULT;
- else if (g_ascii_strcasecmp (param, "basic") == 0)
- account->priv->ad_auth = E2K_AUTOCONFIG_USE_GAL_BASIC;
- else if (g_ascii_strcasecmp (param, "ntlm") == 0)
- account->priv->ad_auth = E2K_AUTOCONFIG_USE_GAL_NTLM;
- else
- account->priv->ad_auth = E2K_AUTOCONFIG_USE_GAL_DEFAULT;
- }
- passwd_exp_warn_period = e2k_uri_get_param (uri, "passwd_exp_warn_period");
- if (!passwd_exp_warn_period || !*passwd_exp_warn_period)
- account->priv->passwd_exp_warn_period = -1;
- else
- account->priv->passwd_exp_warn_period = atoi (passwd_exp_warn_period);
-
- offline_sync = e2k_uri_get_param (uri, "offline_sync");
- if (!offline_sync)
- account->priv->offline_sync = FALSE;
- else
- account->priv->offline_sync = TRUE;
-
- owa_path = e2k_uri_get_param (uri, "owa_path");
- if (!owa_path || !*owa_path)
+ owa_path = camel_exchange_settings_get_owa_path (
+ CAMEL_EXCHANGE_SETTINGS (settings));
+ if (owa_path == NULL)
owa_path = "exchange";
else if (*owa_path == '/')
owa_path++;
- pf_server = e2k_uri_get_param (uri, "pf_server");
- if (!pf_server || !*pf_server)
- pf_server = uri->host;
-
- /* We set protocol reading owa_url, instead of having use_ssl parameter
- * because we don't have SSL section anymore in the account creation
- * druid and account editor
- */
- /* proto = e2k_uri_get_param (uri, "use_ssl") ? "https" : "http"; */
-
- owa_url = e2k_uri_get_param (uri, "owa_url");
- if (owa_url) {
- account->priv->owa_url = g_strdup (owa_url);
- if (!strncmp (owa_url, "https:", 6))
+ owa_url = camel_exchange_settings_get_owa_url (
+ CAMEL_EXCHANGE_SETTINGS (settings));
+ if (owa_url != NULL) {
+ if (strncmp (owa_url, "https:", 6) == 0)
proto = "https";
}
@@ -2385,34 +2382,25 @@ exchange_account_new (EAccountList *account_list, EAccount *adata)
proto, uri->port, owa_path);
account->public_uri =
g_strdup_printf ("%s://%s:%d/public",
- proto, pf_server, uri->port);
+ proto, uri->host, uri->port);
} else {
account->priv->http_uri_schema =
g_strdup_printf ("%s://%%s/%s/%%s/", proto, owa_path);
account->public_uri =
- g_strdup_printf ("%s://%s/public", proto, pf_server);
+ g_strdup_printf ("%s://%s/public", proto, uri->host);
}
- param = e2k_uri_get_param (uri, "mailbox");
- if (!param || !*param)
+ param = camel_exchange_settings_get_mailbox (
+ CAMEL_EXCHANGE_SETTINGS (settings));
+ if (param == NULL)
param = uri->user;
else if (!g_ascii_strncasecmp (param, account->priv->identity_email, strlen (param)))
account->priv->uris_use_email = TRUE;
mailbox = e2k_uri_encode (param, TRUE, "/");
- account->home_uri = g_strdup_printf (account->priv->http_uri_schema,
- uri->host, mailbox);
+ account->home_uri = g_strdup_printf (
+ account->priv->http_uri_schema, uri->host, mailbox);
g_free (mailbox);
- param = e2k_uri_get_param (uri, "filter");
- if (param)
- account->filter_inbox = TRUE;
- param = e2k_uri_get_param (uri, "filter_junk");
- if (param)
- account->filter_junk = TRUE;
- param = e2k_uri_get_param (uri, "filter_junk_inbox");
- if (param)
- account->filter_junk_inbox_only = TRUE;
-
e2k_uri_free (uri);
return account;
diff --git a/server/storage/exchange-account.h b/server/storage/exchange-account.h
index b40b10e..5a5fb47 100644
--- a/server/storage/exchange-account.h
+++ b/server/storage/exchange-account.h
@@ -4,6 +4,7 @@
#ifndef __EXCHANGE_ACCOUNT_H__
#define __EXCHANGE_ACCOUNT_H__
+#include <camel/camel.h>
#include <exchange-types.h>
#include <exchange-constants.h>
#include "e2k-autoconfig.h"
@@ -35,7 +36,6 @@ struct _ExchangeAccount {
gchar *exchange_server, *home_uri, *public_uri;
gchar *legacy_exchange_dn, *default_timezone;
- gboolean filter_inbox, filter_junk, filter_junk_inbox_only;
gdouble mbox_size;
};
@@ -81,10 +81,8 @@ E2kContext * exchange_account_get_context (ExchangeAccount *account);
E2kGlobalCatalog
*exchange_account_get_global_catalog
(ExchangeAccount *account);
+CamelSettings * exchange_account_get_settings (ExchangeAccount *account);
EAccount * exchange_account_fetch (ExchangeAccount *account);
-gchar * exchange_account_get_account_uri_param
- (ExchangeAccount *account,
- const gchar *param);
const gchar * exchange_account_get_standard_uri
(ExchangeAccount *account,
const gchar *item);
diff --git a/server/storage/exchange-esource.c b/server/storage/exchange-esource.c
index 5654cc9..ec10e33 100644
--- a/server/storage/exchange-esource.c
+++ b/server/storage/exchange-esource.c
@@ -149,16 +149,23 @@ add_folder_esource (ExchangeAccount *account,
e_source_group_set_property (source_group, "account-uid", exchange_account_fetch (account)->uid);
if (is_contacts_folder && g_str_has_prefix (physical_uri, "gal://")) {
- gchar *browse = exchange_account_get_account_uri_param (account, "ad_browse");
- gchar *expand_groups = exchange_account_get_account_uri_param (account, "ad_expand_groups");
+ CamelSettings *settings;
+ gboolean allow_browse;
+ gboolean expand_groups;
+
+ settings = exchange_account_get_settings (account);
+
+ g_object_get (
+ settings,
+ "gc-allow-browse", &allow_browse,
+ "gc-expand-groups", &expand_groups,
+ NULL);
source = e_source_new_with_absolute_uri (folder_name,
physical_uri);
e_source_set_property (source, "completion", "true");
- e_source_set_property (source, "can-browse", browse ? "1" : NULL);
+ e_source_set_property (source, "can-browse", allow_browse ? "1" : NULL);
e_source_set_property (source, "expand-groups", expand_groups ? "1" : NULL);
- g_free (expand_groups);
- g_free (browse);
}
else {
source = e_source_new (folder_name, relative_uri);
@@ -198,16 +205,23 @@ add_folder_esource (ExchangeAccount *account,
if ((source = e_source_group_peek_source_by_name (source_group,
folder_name)) == NULL) {
if (is_contacts_folder && g_str_has_prefix (physical_uri, "gal://")) {
- gchar *browse = exchange_account_get_account_uri_param (account, "ad_browse");
- gchar *expand_groups = exchange_account_get_account_uri_param (account, "ad_expand_groups");
+ CamelSettings *settings;
+ gboolean allow_browse;
+ gboolean expand_groups;
+
+ settings = exchange_account_get_settings (account);
+
+ g_object_get (
+ settings,
+ "gc-allow-browse", &allow_browse,
+ "gc-expand-groups", &expand_groups,
+ NULL);
source = e_source_new_with_absolute_uri (
folder_name, physical_uri);
e_source_set_property (source, "completion", "true");
- e_source_set_property (source, "can-browse", browse ? "1" : NULL);
+ e_source_set_property (source, "can-browse", allow_browse ? "1" : NULL);
e_source_set_property (source, "expand-groups", expand_groups ? "1" : NULL);
- g_free (expand_groups);
- g_free (browse);
}
else {
source = e_source_new (folder_name, relative_uri);
@@ -253,21 +267,30 @@ add_folder_esource (ExchangeAccount *account,
}
if (is_contacts_folder && g_str_has_prefix (physical_uri, "gal://")) {
- gchar *browse = exchange_account_get_account_uri_param (account, "ad_browse");
- const gchar *old_browse = e_source_get_property (source, "can-browse");
- gchar *expand_groups = exchange_account_get_account_uri_param (account, "ad_expand_groups");
- const gchar *old_expand_groups = e_source_get_property (source, "expand-groups");
+ CamelSettings *settings;
+ gboolean allow_browse;
+ gboolean expand_groups;
+ const gchar *old_allow_browse;
+ const gchar *old_expand_groups;
- if ((old_browse || browse) && (!old_browse || !browse)) {
- e_source_set_property (source, "can-browse", browse ? "1" : NULL);
+ settings = exchange_account_get_settings (account);
+
+ g_object_get (
+ settings,
+ "gc-allow-browse", &allow_browse,
+ "gc-expand-groups", &expand_groups,
+ NULL);
+
+ old_allow_browse = e_source_get_property (source, "can-browse");
+ old_expand_groups = e_source_get_property (source, "expand-groups");
+
+ if ((old_allow_browse || allow_browse) && (!old_allow_browse || !allow_browse)) {
+ e_source_set_property (source, "can-browse", allow_browse ? "1" : NULL);
}
if ((old_expand_groups || expand_groups) && (!old_expand_groups || !expand_groups)) {
e_source_set_property (source, "expand-groups", expand_groups ? "1" : NULL);
}
-
- g_free (expand_groups);
- g_free (browse);
}
if ((!old_delete && !can_delete) || (old_delete && ((g_str_equal (old_delete, "no") && can_delete) || (!g_str_equal (old_delete, "no") && !can_delete)))) {
diff --git a/tools/exchange-share-config-listener.c b/tools/exchange-share-config-listener.c
index 6558da2..bcab709 100644
--- a/tools/exchange-share-config-listener.c
+++ b/tools/exchange-share-config-listener.c
@@ -416,7 +416,10 @@ requires_relogin (gchar *current_url, gchar *new_url)
{
E2kUri *current_uri, *new_uri;
const gchar *current_param_val, *new_param_val;
- const gchar *params [] = { "owa_url", "ad_server", "use_ssl" };
+ const gchar *params [] = {
+ "owa-url",
+ "gc-server-name",
+ "security-method" };
const gint n_params = G_N_ELEMENTS (params);
gint i;
gboolean relogin = FALSE;
@@ -640,10 +643,10 @@ exchange_camel_urls_is_equal (const gchar *url1, const gchar *url2)
const gchar *param1, *param2;
const gchar *params[] = {
"auth",
- "owa_url",
- "owa_path",
+ "owa-url",
+ "owa-path",
"mailbox",
- "ad_server",
+ "gc-server-name",
};
const gint n_params = 5;
gint i;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]