diff options
author | Sushma Rai <rsushma@src.gnome.org> | 2005-03-18 19:54:15 +0800 |
---|---|---|
committer | Sushma Rai <rsushma@src.gnome.org> | 2005-03-18 19:54:15 +0800 |
commit | 6c0fc1d201c48d0933c2114697463912126fcd75 (patch) | |
tree | 7279a7755c23ca197606152fadd267dd36bf1e1e /plugins | |
parent | 17727dffed055a4e407183459b0cc08ae8e78c0d (diff) | |
download | gsoc2013-evolution-6c0fc1d201c48d0933c2114697463912126fcd75.tar.gz gsoc2013-evolution-6c0fc1d201c48d0933c2114697463912126fcd75.tar.zst gsoc2013-evolution-6c0fc1d201c48d0933c2114697463912126fcd75.zip |
Forming and setting OWA URL when existing account doesn't contain
this value.
svn path=/trunk/; revision=29060
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/exchange-account-setup/ChangeLog | 9 | ||||
-rw-r--r-- | plugins/exchange-account-setup/exchange-account-setup.c | 49 |
2 files changed, 56 insertions, 2 deletions
diff --git a/plugins/exchange-account-setup/ChangeLog b/plugins/exchange-account-setup/ChangeLog index a3b6de03b6..ac7e8a5fe0 100644 --- a/plugins/exchange-account-setup/ChangeLog +++ b/plugins/exchange-account-setup/ChangeLog @@ -1,3 +1,12 @@ +2005-03-18 Sushma Rai <rsushma@novell.com> + + * exchange-account-setup.c (org_gnome_exchange_owa_url): When the + Exchange account doesn't contain OWA url parameter, setting the OWA + url value in the receive page and saving it. + (construct_owa_url): Forming OWA url, from the existing parameters for + hostname, ssl, OWA path and mailbox name. + see #73627 + 2005-03-17 Sushma Rai <rsushma@novell.com> * exchange-account-setup.c (exchange_authtype_changed): Setting the diff --git a/plugins/exchange-account-setup/exchange-account-setup.c b/plugins/exchange-account-setup/exchange-account-setup.c index f01f721d49..34679f326f 100644 --- a/plugins/exchange-account-setup/exchange-account-setup.c +++ b/plugins/exchange-account-setup/exchange-account-setup.c @@ -396,12 +396,39 @@ destroy_label(GtkWidget *old, GtkWidget *label) gtk_widget_destroy(label); } +static char * +construct_owa_url (CamelURL *url) +{ + const char *owa_path, *use_ssl = NULL; + const char *protocol = "http", *mailbox_name; + char *owa_url; + + use_ssl = camel_url_get_param (url, "use_ssl"); + if (use_ssl) { + if (!strcmp (use_ssl, "always")) + protocol = "https"; + } + + owa_path = camel_url_get_param (url, "owa_path"); + if (!owa_path) + owa_path = "/exchange"; + mailbox_name = camel_url_get_param (url, "mailbox"); + + if (mailbox_name) + owa_url = g_strdup_printf("%s://%s%s/%s", protocol, url->host, owa_path, mailbox_name); + else + owa_url = g_strdup_printf("%s://%s%s", protocol, url->host, owa_path ); + + return owa_url; +} + /* used by editor and druid - same code */ GtkWidget * org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) { EMConfigTargetAccount *target_account; - const char *source_url, *owa_url; + const char *source_url; + char *owa_url = NULL; GtkWidget *owa_entry; CamelURL *url; int row; @@ -430,7 +457,7 @@ org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) return data->old; } - owa_url = camel_url_get_param(url, "owa_url"); + owa_url = g_strdup (camel_url_get_param(url, "owa_url")); /* if the host is null, then user+other info is dropped silently, force it to be kept */ if (url->host == NULL) { @@ -449,6 +476,23 @@ org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) gtk_widget_show(label); owa_entry = gtk_entry_new(); + + if (!owa_url) { + if (url->host[0] != 0) { + char *uri; + + /* url has hostname but not owa_url. + * Account has been created using x-c-s or evo is upgraded to 2.2 + * When invoked from druid, 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); + uri = camel_url_to_string(url, 0); + e_account_set_string(target_account->account, E_ACCOUNT_SOURCE_URL, uri); + g_free(uri); + } + } if (owa_url) gtk_entry_set_text(GTK_ENTRY (owa_entry), owa_url); gtk_label_set_mnemonic_widget((GtkLabel *)label, owa_entry); @@ -470,6 +514,7 @@ org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) /* Track the authenticate label, so we can destroy it if e-config is to destroy the hbox */ g_object_set_data((GObject *)hbox, "authenticate-label", label); + g_free (owa_url); return hbox; } |