aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-02-06 04:13:59 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-02-06 04:13:59 +0800
commit7301749d713555c513029cab6c957c7ce4f63306 (patch)
tree8696f254e19e2193fe74f91d7f3976db90776364
parent5df96e40dc8ec64173e7a008d50bd08a731a3f04 (diff)
downloadgsoc2013-evolution-7301749d713555c513029cab6c957c7ce4f63306.tar.gz
gsoc2013-evolution-7301749d713555c513029cab6c957c7ce4f63306.tar.zst
gsoc2013-evolution-7301749d713555c513029cab6c957c7ce4f63306.zip
Updated to not connect when getting a list of authtypes. (transport_next):
2001-02-05 Jeffrey Stedfast <fejj@ximian.com> * mail-config-druid.c (incoming_next): Updated to not connect when getting a list of authtypes. (transport_next): No longer connects - again, this is useless. Read the apply_changes argument for the reason why. * mail-account-editor.c (apply_changes): Updated. Set the 'connect' argument to FALSE for now, this basically means that the call is worthless tho so it may be best to either get rid of the checks altogether or else make it connect. (source_auth_init): Don't connect here, it's just plain annoying. (transport_construct_authmenu): Same here. * mail-config.c (mail_config_check_service): Now takes a connect argument. svn path=/trunk/; revision=7981
-rw-r--r--mail/ChangeLog17
-rw-r--r--mail/mail-account-editor.c8
-rw-r--r--mail/mail-config-druid.c4
-rw-r--r--mail/mail-config.c34
-rw-r--r--mail/mail-config.h2
5 files changed, 50 insertions, 15 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index add8de5393..bc327f4be9 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,20 @@
+2001-02-05 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-config-druid.c (incoming_next): Updated to not connect when
+ getting a list of authtypes.
+ (transport_next): No longer connects - again, this is
+ useless. Read the apply_changes argument for the reason why.
+
+ * mail-account-editor.c (apply_changes): Updated. Set the
+ 'connect' argument to FALSE for now, this basically means that the
+ call is worthless tho so it may be best to either get rid of the
+ checks altogether or else make it connect.
+ (source_auth_init): Don't connect here, it's just plain annoying.
+ (transport_construct_authmenu): Same here.
+
+ * mail-config.c (mail_config_check_service): Now takes a connect
+ argument.
+
2001-02-03 Michael Meeks <michael@helixcode.com>
* mail-local.c (load_metainfo): Fix dodgy libxml allocation
diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c
index 339d6cc737..4d73acb009 100644
--- a/mail/mail-account-editor.c
+++ b/mail/mail-account-editor.c
@@ -221,7 +221,7 @@ apply_changes (MailAccountEditor *editor)
/* check to make sure the source works */
if (source_url) {
- if (mail_config_check_service (source_url, CAMEL_PROVIDER_STORE, NULL)) {
+ if (mail_config_check_service (source_url, CAMEL_PROVIDER_STORE, FALSE, NULL)) {
/* save the password if we were requested to do so */
if (account->source->save_passwd && source_url->passwd) {
mail_session_set_password (account->source->url, source_url->passwd);
@@ -234,7 +234,7 @@ apply_changes (MailAccountEditor *editor)
}
/* check to make sure the transport works */
- if (!mail_config_check_service (transport_url, CAMEL_PROVIDER_TRANSPORT, NULL))
+ if (!mail_config_check_service (transport_url, CAMEL_PROVIDER_TRANSPORT, FALSE, NULL))
retval = FALSE;
camel_url_free (transport_url);
@@ -321,7 +321,7 @@ source_auth_init (MailAccountEditor *editor, CamelURL *url)
menu = gtk_menu_new ();
gtk_option_menu_remove_menu (editor->source_auth);
- if (!url || !mail_config_check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) {
+ if (!url || !mail_config_check_service (url, CAMEL_PROVIDER_STORE, FALSE, &authtypes)) {
gtk_option_menu_set_menu (editor->source_auth, menu);
return;
@@ -385,7 +385,7 @@ transport_construct_authmenu (MailAccountEditor *editor, CamelURL *url)
menu = gtk_menu_new ();
gtk_option_menu_remove_menu (editor->transport_auth);
- if (!url || !mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, &authtypes)) {
+ if (!url || !mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, FALSE, &authtypes)) {
gtk_option_menu_set_menu (editor->transport_auth, menu);
return;
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index fdb2ddb448..5547f8791a 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -354,7 +354,7 @@ incoming_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
g_free (source_url);
/* If we can't connect, warn them and continue on to the Transport page. */
- if (!mail_config_check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) {
+ if (!mail_config_check_service (url, CAMEL_PROVIDER_STORE, FALSE, &authtypes)) {
GtkWidget *dialog;
char *source, *warning;
@@ -635,7 +635,7 @@ transport_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
g_free (xport_url);
/* If we can't connect, don't let them continue. */
- if (!mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, NULL)) {
+ if (!mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, FALSE, NULL)) {
GtkWidget *dialog;
char *transport, *warning;
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 269088962f..7eeae83df2 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -788,6 +788,7 @@ mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
typedef struct {
char *url;
CamelProviderType type;
+ gboolean connect;
GList **authtypes;
gboolean success;
} check_service_input_t;
@@ -805,17 +806,15 @@ static void
do_check_service (gpointer in_data, gpointer op_data, CamelException *ex)
{
check_service_input_t *input = in_data;
- CamelService *service;
+ CamelService *service = NULL;
if (input->authtypes) {
- service = camel_session_get_service (
- session, input->url, input->type, ex);
+ service = camel_session_get_service (session, input->url, input->type, ex);
if (!service)
return;
- *input->authtypes = camel_service_query_auth_types (service, ex);
- } else {
- service = camel_session_get_service_connected (
- session, input->url, input->type, ex);
+ *input->authtypes = camel_service_query_auth_types (service, input->connect, ex);
+ } else if (input->connect) {
+ service = camel_session_get_service_connected (session, input->url, input->type, ex);
}
if (service)
camel_object_unref (CAMEL_OBJECT (service));
@@ -831,13 +830,32 @@ static const mail_operation_spec op_check_service = {
NULL
};
+
+/**
+ * mail_config_check_service:
+ * @url: service url
+ * @type: provider type
+ * @connect: whether or not the check service should connect
+ * @authtypes: list of auth types gathered by this method
+ *
+ * Checks the service for validity. If @connect is TRUE then a
+ * connection with the server is attempted and if successful will fill
+ * in the @authtypes list. If @connect is FALSE then @authtypes will
+ * be generated without a connection and thus will not necessarily
+ * reflect what the server supports.
+ *
+ * Returns TRUE on success or FALSE on error.
+ *
+ **/
+
gboolean
-mail_config_check_service (CamelURL *url, CamelProviderType type, GList **authtypes)
+mail_config_check_service (CamelURL *url, CamelProviderType type, gboolean connect, GList **authtypes)
{
check_service_input_t input;
input.url = camel_url_to_string (url, TRUE);
input.type = type;
+ input.connect = connect;
input.authtypes = authtypes;
input.success = FALSE;
diff --git a/mail/mail-config.h b/mail/mail-config.h
index a08e8aa137..5a3cda5c42 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -123,7 +123,7 @@ GSList *mail_config_get_sources (void);
/* static utility functions */
char *mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix);
-gboolean mail_config_check_service (CamelURL *url, CamelProviderType type, GList **authtypes);
+gboolean mail_config_check_service (CamelURL *url, CamelProviderType type, gboolean connect, GList **authtypes);
#ifdef __cplusplus
}