aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-02-06 03:55:54 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-02-06 03:55:54 +0800
commitddfc033633f5db2c7f2c1a4de179d9029cbf1a6f (patch)
tree65cffcdf719d71a55a351122afc51d7be6d465fa
parente582e23949ac7cb3e4d72ee50957a105ce30e1be (diff)
downloadgsoc2013-evolution-ddfc033633f5db2c7f2c1a4de179d9029cbf1a6f.tar.gz
gsoc2013-evolution-ddfc033633f5db2c7f2c1a4de179d9029cbf1a6f.tar.zst
gsoc2013-evolution-ddfc033633f5db2c7f2c1a4de179d9029cbf1a6f.zip
Updated.
2001-02-05 Jeffrey Stedfast <fejj@ximian.com> * providers/smtp/camel-smtp-transport.c (query_auth_types): Updated. * providers/nntp/camel-nntp-store.c (nntp_store_query_auth_types): Updated. * providers/pop3/camel-pop3-store.c (query_auth_types): Updated. * providers/imap/camel-imap-store.c (query_auth_types): Updated. * camel-service.c (camel_service_query_auth_types): Now takes a boolean value to specify whether or not to connect when constructing a supported authtype list. svn path=/trunk/; revision=7979
-rw-r--r--camel/ChangeLog15
-rw-r--r--camel/camel-service.c35
-rw-r--r--camel/camel-service.h2
-rw-r--r--camel/providers/imap/camel-imap-store.c25
-rw-r--r--camel/providers/nntp/camel-nntp-store.c4
-rw-r--r--camel/providers/pop3/camel-pop3-store.c88
-rw-r--r--camel/providers/sendmail/camel-sendmail-transport.c52
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c28
8 files changed, 140 insertions, 109 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 82a5445bcb..a08c80a34b 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,18 @@
+2001-02-05 Jeffrey Stedfast <fejj@ximian.com>
+
+ * providers/smtp/camel-smtp-transport.c (query_auth_types): Updated.
+
+ * providers/nntp/camel-nntp-store.c (nntp_store_query_auth_types):
+ Updated.
+
+ * providers/pop3/camel-pop3-store.c (query_auth_types): Updated.
+
+ * providers/imap/camel-imap-store.c (query_auth_types): Updated.
+
+ * camel-service.c (camel_service_query_auth_types): Now takes a
+ boolean value to specify whether or not to connect when
+ constructing a supported authtype list.
+
2001-02-05 Not Zed <NotZed@Ximian.com>
* camel-stream-filter.c (do_write): Revert jeff's earlier change,
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 46de098e7a..0eae1cd98a 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -42,7 +42,7 @@ static gboolean service_connect(CamelService *service, CamelException *ex);
static gboolean service_disconnect(CamelService *service, gboolean clean,
CamelException *ex);
/*static gboolean is_connected (CamelService *service);*/
-static GList * query_auth_types (CamelService *service, CamelException *ex);
+static GList * query_auth_types (CamelService *service, gboolean connect, CamelException *ex);
static void free_auth_types (CamelService *service, GList *authtypes);
static char * get_name (CamelService *service, gboolean brief);
static char * get_path (CamelService *service);
@@ -112,15 +112,16 @@ camel_service_get_type (void)
static CamelType camel_service_type = CAMEL_INVALID_TYPE;
if (camel_service_type == CAMEL_INVALID_TYPE) {
- camel_service_type = camel_type_register( CAMEL_OBJECT_TYPE, "CamelService",
- sizeof (CamelService),
- sizeof (CamelServiceClass),
- (CamelObjectClassInitFunc) camel_service_class_init,
- NULL,
- (CamelObjectInitFunc) camel_service_init,
- camel_service_finalize );
+ camel_service_type =
+ camel_type_register (CAMEL_OBJECT_TYPE, "CamelService",
+ sizeof (CamelService),
+ sizeof (CamelServiceClass),
+ (CamelObjectClassInitFunc) camel_service_class_init,
+ NULL,
+ (CamelObjectInitFunc) camel_service_init,
+ camel_service_finalize );
}
-
+
return camel_service_type;
}
@@ -428,8 +429,8 @@ camel_service_get_provider (CamelService *service)
return service->provider;
}
-GList *
-query_auth_types (CamelService *service, CamelException *ex)
+static GList *
+query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
{
return NULL;
}
@@ -437,6 +438,7 @@ query_auth_types (CamelService *service, CamelException *ex)
/**
* camel_service_query_auth_types:
* @service: a CamelService
+ * @connect: specifies whether or not to connect
* @ex: a CamelException
*
* This is used by the mail source wizard to get the list of
@@ -445,23 +447,24 @@ query_auth_types (CamelService *service, CamelException *ex)
*
* This may be called on a service with or without an associated URL.
* If there is no URL, the routine must return a generic answer. If
- * the service does have a URL, the routine SHOULD connect to the
- * server and query what authentication mechanisms it supports. If
- * it cannot do that for any reason, it should set @ex accordingly.
+ * the service does have a URL, the routine should connect to the
+ * server and query what authentication mechanisms it supports only if
+ * @connect is TRUE. If it cannot do that for any reason, it should
+ * set @ex accordingly.
*
* Return value: a list of CamelServiceAuthType records. The caller
* must free the list by calling camel_service_free_auth_types when
* it is done.
**/
GList *
-camel_service_query_auth_types (CamelService *service, CamelException *ex)
+camel_service_query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
{
GList *ret;
/* note that we get the connect lock here, which means the callee
must not call the connect functions itself */
CAMEL_SERVICE_LOCK(service, connect_lock);
- ret = CSERV_CLASS (service)->query_auth_types (service, ex);
+ ret = CSERV_CLASS (service)->query_auth_types (service, connect, ex);
CAMEL_SERVICE_UNLOCK(service, connect_lock);
return ret;
diff --git a/camel/camel-service.h b/camel/camel-service.h
index 397291baa5..728db6c4ce 100644
--- a/camel/camel-service.h
+++ b/camel/camel-service.h
@@ -68,6 +68,7 @@ typedef struct {
/*gboolean (*is_connected) (CamelService *service);*/
GList * (*query_auth_types) (CamelService *service,
+ gboolean connect,
CamelException *ex);
void (*free_auth_types) (CamelService *service,
GList *authtypes);
@@ -104,6 +105,7 @@ char * camel_service_get_path (CamelService *service);
CamelSession * camel_service_get_session (CamelService *service);
CamelProvider * camel_service_get_provider (CamelService *service);
GList * camel_service_query_auth_types (CamelService *service,
+ gboolean connect,
CamelException *ex);
void camel_service_free_auth_types (CamelService *service,
GList *authtypes);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index f36d5fa797..cd46d56226 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -59,7 +59,7 @@ static CamelRemoteStoreClass *remote_store_class = NULL;
static gboolean imap_connect (CamelService *service, CamelException *ex);
static gboolean imap_disconnect (CamelService *service, gboolean clean, CamelException *ex);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static GList *query_auth_types (CamelService *service, gboolean connect, CamelException *ex);
static CamelFolder *get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex);
static char *get_folder_name (CamelStore *store, const char *folder_name,
CamelException *ex);
@@ -268,19 +268,26 @@ static CamelServiceAuthType kerberos_v4_authtype = {
#endif
static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
{
GList *types;
-
- if (!connect_to_server (service, ex))
- return NULL;
-
- types = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types (service, ex);
+
+ types = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types (service, connect, ex);
+
+ if (connect) {
+ if (!connect_to_server (service, ex))
+ return NULL;
+#ifdef HAVE_KRB4
+ if (CAMEL_IMAP_STORE (service)->capabilities &
+ IMAP_CAPABILITY_AUTH_KERBEROS_V4)
+ types = g_list_prepend (types, &kerberos_v4_authtype);
+#endif
+ } else {
#ifdef HAVE_KRB4
- if (CAMEL_IMAP_STORE (service)->capabilities &
- IMAP_CAPABILITY_AUTH_KERBEROS_V4)
types = g_list_prepend (types, &kerberos_v4_authtype);
#endif
+ }
+
return g_list_prepend (types, &password_authtype);
}
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index 21de4fbdb1..8edf05e099 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -300,12 +300,12 @@ static CamelServiceAuthType password_authtype = {
};
static GList *
-nntp_store_query_auth_types (CamelService *service, CamelException *ex)
+nntp_store_query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
{
GList *prev;
g_warning ("nntp::query_auth_types: not implemented. Defaulting.");
- prev = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types (service, ex);
+ prev = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types (service, connect, ex);
return g_list_prepend (prev, &password_authtype);
}
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index be59964b74..aefabebfa4 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -70,7 +70,7 @@ static void finalize (CamelObject *object);
static gboolean pop3_connect (CamelService *service, CamelException *ex);
static gboolean pop3_disconnect (CamelService *service, gboolean clean, CamelException *ex);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static GList *query_auth_types (CamelService *service, gboolean connect, CamelException *ex);
static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
guint32 flags, CamelException *ex);
@@ -284,59 +284,63 @@ connect_to_server (CamelService *service, /*gboolean real, */CamelException *ex)
}
static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
{
CamelPop3Store *store = CAMEL_POP3_STORE (service);
- GList *ret = NULL;
+ GList *types = NULL;
gboolean passwd = TRUE, apop = TRUE;
#ifdef HAVE_KRB4
gboolean kpop = TRUE;
int saved_port;
#endif
-
- ret = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, ex);
-
- passwd = camel_service_connect (service, ex);
- /*ignore the exception here; the server may just not support passwd */
- /*if (camel_exception_is_set (ex) != CAMEL_EXCEPTION_NONE)*/
- /*return NULL;*/
- /* should we check apop too? */
- apop = store->apop_timestamp != NULL;
- if (passwd)
- camel_service_disconnect (service, TRUE, ex);
- camel_exception_clear (ex);
-
+ types = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, connect, ex);
+
+ if (connect) {
+ passwd = camel_service_connect (service, ex);
+ /*ignore the exception here; the server may just not support passwd */
+
+ /* should we check apop too? */
+ apop = store->apop_timestamp != NULL;
+ if (passwd)
+ camel_service_disconnect (service, TRUE, ex);
+ camel_exception_clear (ex);
+
#ifdef HAVE_KRB4
- saved_port = service->url->port;
- service->url->port = KPOP_PORT;
- kpop = camel_service_connect (service, ex);
- service->url->port = saved_port;
- /*ignore the exception here; the server may just not support kpop */
- /*if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)*/
- /*return NULL;*/
-
- if (kpop)
- camel_service_disconnect (service, TRUE, ex);
- camel_exception_clear (ex);
+ saved_port = service->url->port;
+ service->url->port = KPOP_PORT;
+ kpop = camel_service_connect (service, ex);
+ service->url->port = saved_port;
+ /*ignore the exception here; the server may just not support kpop */
+
+ if (kpop)
+ camel_service_disconnect (service, TRUE, ex);
+ camel_exception_clear (ex);
#endif
-
- if (passwd)
- ret = g_list_append (ret, &password_authtype);
- if (apop)
- ret = g_list_append (ret, &apop_authtype);
+
+ if (passwd)
+ types = g_list_append (types, &password_authtype);
+ if (apop)
+ types = g_list_append (types, &apop_authtype);
#ifdef HAVE_KRB4
- if (kpop)
- ret = g_list_append (ret, &kpop_authtype);
+ if (kpop)
+ types = g_list_append (types, &kpop_authtype);
#endif
-
- if (!ret) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not connect to POP server on "
- "%s."), service->url->host);
- }
-
- return ret;
+
+ if (!types) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ _("Could not connect to POP server on "
+ "%s."), service->url->host);
+ }
+ } else {
+ types = g_list_append (types, &password_authtype);
+ types = g_list_append (types, &apop_authtype);
+#ifdef HAVE_KRB4
+ types = g_list_append (types, &kpop_authtype);
+#endif
+ }
+
+ return types;
}
/**
diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c
index 137c1d32a9..d76edfeca9 100644
--- a/camel/providers/sendmail/camel-sendmail-transport.c
+++ b/camel/providers/sendmail/camel-sendmail-transport.c
@@ -3,8 +3,7 @@
/*
*
- * Author :
- * Dan Winship <danw@helixcode.com>
+ * Authors: Dan Winship <danw@helixcode.com>
*
* Copyright 2000 Helix Code, Inc. (http://www.helixcode.com)
*
@@ -41,11 +40,11 @@
static char *get_name (CamelService *service, gboolean brief);
-static gboolean _can_send (CamelTransport *transport, CamelMedium *message);
-static gboolean _send (CamelTransport *transport, CamelMedium *message,
- CamelException *ex);
-static gboolean _send_to (CamelTransport *transport, CamelMedium *message,
- GList *recipients, CamelException *ex);
+static gboolean sendmail_can_send (CamelTransport *transport, CamelMedium *message);
+static gboolean sendmail_send (CamelTransport *transport, CamelMedium *message,
+ CamelException *ex);
+static gboolean sendmail_send_to (CamelTransport *transport, CamelMedium *message,
+ GList *recipients, CamelException *ex);
static void
@@ -59,9 +58,9 @@ camel_sendmail_transport_class_init (CamelSendmailTransportClass *camel_sendmail
/* virtual method overload */
camel_service_class->get_name = get_name;
- camel_transport_class->can_send = _can_send;
- camel_transport_class->send = _send;
- camel_transport_class->send_to = _send_to;
+ camel_transport_class->can_send = sendmail_can_send;
+ camel_transport_class->send = sendmail_send;
+ camel_transport_class->send_to = sendmail_send_to;
}
CamelType
@@ -70,13 +69,14 @@ camel_sendmail_transport_get_type (void)
static CamelType camel_sendmail_transport_type = CAMEL_INVALID_TYPE;
if (camel_sendmail_transport_type == CAMEL_INVALID_TYPE) {
- camel_sendmail_transport_type = camel_type_register (CAMEL_TRANSPORT_TYPE, "CamelSendmailTransport",
- sizeof (CamelSendmailTransport),
- sizeof (CamelSendmailTransportClass),
- (CamelObjectClassInitFunc) camel_sendmail_transport_class_init,
- NULL,
- (CamelObjectInitFunc) NULL,
- NULL);
+ camel_sendmail_transport_type =
+ camel_type_register (CAMEL_TRANSPORT_TYPE, "CamelSendmailTransport",
+ sizeof (CamelSendmailTransport),
+ sizeof (CamelSendmailTransportClass),
+ (CamelObjectClassInitFunc) camel_sendmail_transport_class_init,
+ NULL,
+ (CamelObjectInitFunc) NULL,
+ NULL);
}
return camel_sendmail_transport_type;
@@ -84,14 +84,14 @@ camel_sendmail_transport_get_type (void)
static gboolean
-_can_send (CamelTransport *transport, CamelMedium *message)
+sendmail_can_send (CamelTransport *transport, CamelMedium *message)
{
return CAMEL_IS_MIME_MESSAGE (message);
}
static gboolean
-_send_internal (CamelMedium *message, char **argv, CamelException *ex)
+sendmail_send_internal (CamelMedium *message, char **argv, CamelException *ex)
{
int fd[2], nullfd, wstat;
sigset_t mask, omask;
@@ -181,8 +181,8 @@ _send_internal (CamelMedium *message, char **argv, CamelException *ex)
}
static gboolean
-_send_to (CamelTransport *transport, CamelMedium *message,
- GList *recipients, CamelException *ex)
+sendmail_send_to (CamelTransport *transport, CamelMedium *message,
+ GList *recipients, CamelException *ex)
{
GList *r;
char **argv;
@@ -198,19 +198,19 @@ _send_to (CamelTransport *transport, CamelMedium *message,
for (i = 1, r = recipients; i <= len; i++, r = r->next)
argv[i + 2] = r->data;
argv[i + 2] = NULL;
-
- status = _send_internal (message, argv, ex);
+
+ status = sendmail_send_internal (message, argv, ex);
g_free (argv);
return status;
}
static gboolean
-_send (CamelTransport *transport, CamelMedium *message,
+sendmail_send (CamelTransport *transport, CamelMedium *message,
CamelException *ex)
{
char *argv[4] = { "sendmail", "-t", "-i", NULL };
-
- return _send_internal (message, argv, ex);
+
+ return sendmail_send_internal (message, argv, ex);
}
static char *
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index b879eb75fc..1d7b4e5622 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -56,15 +56,15 @@
#define SMTP_PORT 25
/* camel smtp transport class prototypes */
-static gboolean _can_send (CamelTransport *transport, CamelMedium *message);
-static gboolean _send (CamelTransport *transport, CamelMedium *message, CamelException *ex);
-static gboolean _send_to (CamelTransport *transport, CamelMedium *message, GList *recipients, CamelException *ex);
+static gboolean smtp_can_send (CamelTransport *transport, CamelMedium *message);
+static gboolean smtp_send (CamelTransport *transport, CamelMedium *message, CamelException *ex);
+static gboolean smtp_send_to (CamelTransport *transport, CamelMedium *message, GList *recipients, CamelException *ex);
/* support prototypes */
static gboolean smtp_connect (CamelService *service, CamelException *ex);
static gboolean smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex);
-static GList *esmtp_get_authtypes(gchar *buffer);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static GList *esmtp_get_authtypes (gchar *buffer);
+static GList *query_auth_types (CamelService *service, gboolean connect, CamelException *ex);
static void free_auth_types (CamelService *service, GList *authtypes);
static char *get_name (CamelService *service, gboolean brief);
@@ -97,9 +97,9 @@ camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_c
camel_service_class->free_auth_types = free_auth_types;
camel_service_class->get_name = get_name;
- camel_transport_class->can_send = _can_send;
- camel_transport_class->send = _send;
- camel_transport_class->send_to = _send_to;
+ camel_transport_class->can_send = smtp_can_send;
+ camel_transport_class->send = smtp_send;
+ camel_transport_class->send_to = smtp_send_to;
}
static void
@@ -356,7 +356,7 @@ static CamelServiceAuthType cram_md5_authtype = {
#endif
static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
{
/* FIXME: Re-enable this when auth types are actually
* implemented.
@@ -383,14 +383,14 @@ get_name (CamelService *service, gboolean brief)
}
static gboolean
-_can_send (CamelTransport *transport, CamelMedium *message)
+smtp_can_send (CamelTransport *transport, CamelMedium *message)
{
return CAMEL_IS_MIME_MESSAGE (message);
}
static gboolean
-_send_to (CamelTransport *transport, CamelMedium *message,
- GList *recipients, CamelException *ex)
+smtp_send_to (CamelTransport *transport, CamelMedium *message,
+ GList *recipients, CamelException *ex)
{
CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT (transport);
const CamelInternetAddress *cia;
@@ -450,7 +450,7 @@ _send_to (CamelTransport *transport, CamelMedium *message,
}
static gboolean
-_send (CamelTransport *transport, CamelMedium *message, CamelException *ex)
+smtp_send (CamelTransport *transport, CamelMedium *message, CamelException *ex)
{
const CamelInternetAddress *to, *cc, *bcc;
GList *recipients = NULL;
@@ -487,7 +487,7 @@ _send (CamelTransport *transport, CamelMedium *message, CamelException *ex)
recipients = g_list_append (recipients, g_strdup (addr));
}
- return _send_to (transport, message, recipients, ex);
+ return smtp_send_to (transport, message, recipients, ex);
}
static gboolean