aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorPeter Williams <peterw@src.gnome.org>2000-08-23 04:09:11 +0800
committerPeter Williams <peterw@src.gnome.org>2000-08-23 04:09:11 +0800
commit130bb0e5710983ce14d1151f2611beaff6891379 (patch)
treeb54b0a4141379ea553cdad8b7ac6d80a5fba2acb /camel/providers
parentdcc47cc15f6ff1e1cb866495625006e5481f85a6 (diff)
downloadgsoc2013-evolution-130bb0e5710983ce14d1151f2611beaff6891379.tar
gsoc2013-evolution-130bb0e5710983ce14d1151f2611beaff6891379.tar.gz
gsoc2013-evolution-130bb0e5710983ce14d1151f2611beaff6891379.tar.bz2
gsoc2013-evolution-130bb0e5710983ce14d1151f2611beaff6891379.tar.lz
gsoc2013-evolution-130bb0e5710983ce14d1151f2611beaff6891379.tar.xz
gsoc2013-evolution-130bb0e5710983ce14d1151f2611beaff6891379.tar.zst
gsoc2013-evolution-130bb0e5710983ce14d1151f2611beaff6891379.zip
Automatically connect services when given a valid URL (should hopefully disconnect, too); remove the old movemail folder correctly.
svn path=/trunk/; revision=4965
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-store.c44
-rw-r--r--camel/providers/nntp/camel-nntp-store.c17
-rw-r--r--camel/providers/pop3/camel-pop3-store.c61
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c23
4 files changed, 100 insertions, 45 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 0a2be4f326..f7662ade84 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -60,7 +60,8 @@ static void finalize (CamelObject *object);
static gboolean imap_create (CamelFolder *folder, CamelException *ex);
static gboolean imap_connect (CamelService *service, CamelException *ex);
static gboolean imap_disconnect (CamelService *service, CamelException *ex);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static GList *query_auth_types_generic (CamelService *service, CamelException *ex);
+static GList *query_auth_types_connected (CamelService *service, CamelException *ex);
static void free_auth_types (CamelService *service, GList *authtypes);
static char *get_name (CamelService *service, gboolean brief);
static CamelFolder *get_folder (CamelStore *store, const char *folder_name, gboolean create,
@@ -84,7 +85,8 @@ camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class)
/* virtual method overload */
camel_service_class->connect = imap_connect;
camel_service_class->disconnect = imap_disconnect;
- camel_service_class->query_auth_types = query_auth_types;
+ camel_service_class->query_auth_types_generic = query_auth_types_generic;
+ camel_service_class->query_auth_types_connected = query_auth_types_connected;
camel_service_class->free_auth_types = free_auth_types;
camel_service_class->get_name = get_name;
@@ -129,11 +131,14 @@ camel_imap_store_get_type (void)
static void
finalize (CamelObject *object)
{
- CamelException ex;
-
- camel_exception_init (&ex);
- imap_disconnect (CAMEL_SERVICE (object), &ex);
- camel_exception_clear (&ex);
+ /* Done for us now */
+ /*
+ *CamelException ex;
+ *
+ *camel_exception_init (&ex);
+ *imap_disconnect (CAMEL_SERVICE (object), &ex);
+ *camel_exception_clear (&ex);
+ */
}
static CamelServiceAuthType password_authtype = {
@@ -178,17 +183,18 @@ try_connect (CamelService *service, CamelException *ex)
#endif
static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types_connected (CamelService *service, CamelException *ex)
{
+#if 0
GList *ret = NULL;
gboolean passwd = TRUE;
-#if 0
+
if (service->url) {
passwd = try_connect (service, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)
return NULL;
}
-#endif
+
if (passwd)
ret = g_list_append (ret, &password_authtype);
@@ -200,6 +206,16 @@ query_auth_types (CamelService *service, CamelException *ex)
}
return ret;
+#else
+ g_warning ("imap::query_auth_types_connected: not implemented. Defaulting.");
+ return query_auth_types_generic (service, ex);
+#endif
+}
+
+static GList *
+query_auth_types_generic (CamelService *service, CamelException *ex)
+{
+ return g_list_append (NULL, &password_authtype);
}
static void
@@ -408,9 +424,11 @@ imap_disconnect (CamelService *service, CamelException *ex)
char *result;
int status;
- if (!service->connected)
- return TRUE;
-
+
+ /*if (!service->connected)
+ * return TRUE;
+ */
+
/* send the logout command */
status = camel_imap_command_extended (CAMEL_IMAP_STORE (service), NULL, &result, "LOGOUT");
if (status != CAMEL_IMAP_OK) {
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index 74952015a4..c412c0f6a3 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -123,8 +123,9 @@ nntp_store_disconnect (CamelService *service, CamelException *ex)
{
CamelNNTPStore *store = CAMEL_NNTP_STORE (service);
- if (!service->connected)
- return TRUE;
+ /*if (!service->connected)
+ * return TRUE;
+ */
camel_nntp_command (store, NULL, "QUIT");
@@ -188,11 +189,13 @@ nntp_store_get_folder_name (CamelStore *store, const char *folder_name,
static void
finalize (CamelObject *object)
{
- CamelException ex;
-
- camel_exception_init (&ex);
- nntp_store_disconnect (CAMEL_SERVICE (object), &ex);
- camel_exception_clear (&ex);
+ /* Done for us now */
+ /*CamelException ex;
+ *
+ *camel_exception_init (&ex);
+ *nntp_store_disconnect (CAMEL_SERVICE (object), &ex);
+ *camel_exception_clear (&ex);
+ */
}
static void
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 78d7d106e5..c140ffd57a 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -62,7 +62,8 @@ static void finalize (CamelObject *object);
static gboolean pop3_connect (CamelService *service, CamelException *ex);
static gboolean pop3_disconnect (CamelService *service, CamelException *ex);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static GList *query_auth_types_connected (CamelService *service, CamelException *ex);
+static GList *query_auth_types_generic (CamelService *service, CamelException *ex);
static void free_auth_types (CamelService *service, GList *authtypes);
static char *get_name (CamelService *service, gboolean brief);
@@ -88,7 +89,8 @@ camel_pop3_store_class_init (CamelPop3StoreClass *camel_pop3_store_class)
/* virtual method overload */
camel_service_class->connect = pop3_connect;
camel_service_class->disconnect = pop3_disconnect;
- camel_service_class->query_auth_types = query_auth_types;
+ camel_service_class->query_auth_types_connected = query_auth_types_connected;
+ camel_service_class->query_auth_types_generic = query_auth_types_generic;
camel_service_class->free_auth_types = free_auth_types;
camel_service_class->get_name = get_name;
@@ -129,11 +131,12 @@ static void
finalize (CamelObject *object)
{
CamelPop3Store *pop3_store = CAMEL_POP3_STORE (object);
- CamelException ex;
+ /*CamelException ex;*/
- camel_exception_init (&ex);
- pop3_disconnect (CAMEL_SERVICE (object), &ex);
- camel_exception_clear (&ex);
+ /*camel_exception_init (&ex);
+ *pop3_disconnect (CAMEL_SERVICE (object), &ex);
+ *camel_exception_clear (&ex);
+ */
if (pop3_store->apop_timestamp)
g_free (pop3_store->apop_timestamp);
@@ -315,7 +318,7 @@ connect_to_server (CamelService *service, gboolean real, CamelException *ex)
}
static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types_connected (CamelService *service, CamelException *ex)
{
CamelPop3Store *store = CAMEL_POP3_STORE (service);
GList *ret = NULL;
@@ -362,6 +365,20 @@ query_auth_types (CamelService *service, CamelException *ex)
return ret;
}
+static GList *
+query_auth_types_generic (CamelService *service, CamelException *ex)
+{
+ GList *ret;
+
+ ret = g_list_append (NULL, &password_authtype);
+ ret = g_list_append (ret, &apop_authtype);
+#ifdef HAVE_KRB4
+ ret = g_list_append (ret, &kpop_authtype);
+#endif
+
+ return ret;
+}
+
static void
free_auth_types (CamelService *service, GList *authtypes)
{
@@ -556,10 +573,12 @@ get_folder (CamelStore *store, const char *folder_name,
{
CamelService *service = CAMEL_SERVICE (store);
- if (!camel_service_is_connected (service)) {
- if (!camel_service_connect (service, ex))
- return NULL;
- }
+ /* if (!camel_service_is_connected (service)) {
+ * if (!camel_service_connect (service, ex))
+ * return NULL;
+ *}
+ */
+
return camel_pop3_folder_new (store, ex);
}
@@ -610,15 +629,17 @@ camel_pop3_command (CamelPop3Store *store, char **ret, char *fmt, ...)
va_list ap;
if (!store->ostream) {
- CamelException ex;
-
- camel_exception_init (&ex);
- if (!camel_service_connect (CAMEL_SERVICE (store), &ex)) {
- if (ret)
- *ret = g_strdup (camel_exception_get_description (&ex));
- camel_exception_clear (&ex);
- return CAMEL_POP3_FAIL;
- }
+ /*CamelException ex;
+ *
+ *camel_exception_init (&ex);
+ *if (!camel_service_connect (CAMEL_SERVICE (store), &ex)) {
+ * if (ret)
+ * *ret = g_strdup (camel_exception_get_description (&ex));
+ * camel_exception_clear (&ex);
+ */
+
+ return CAMEL_POP3_FAIL;
+ /*}*/
}
va_start (ap, fmt);
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 0486e4da75..19668a30fa 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -61,7 +61,8 @@ static gboolean _send_to (CamelTransport *transport, CamelMedium *message, GList
static gboolean smtp_connect (CamelService *service, CamelException *ex);
static gboolean smtp_disconnect (CamelService *service, CamelException *ex);
static GList *esmtp_get_authtypes(gchar *buffer);
-static GList *query_auth_types (CamelService *service, CamelException *ex);
+static GList *query_auth_types_connected (CamelService *service, CamelException *ex);
+static GList *query_auth_types_generic (CamelService *service, CamelException *ex);
static void free_auth_types (CamelService *service, GList *authtypes);
static char *get_name (CamelService *service, gboolean brief);
static gchar *smtp_get_email_addr_from_text (gchar *text);
@@ -88,7 +89,8 @@ camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_c
/* virtual method overload */
camel_service_class->connect = smtp_connect;
camel_service_class->disconnect = smtp_disconnect;
- camel_service_class->query_auth_types = query_auth_types;
+ camel_service_class->query_auth_types_generic = query_auth_types_generic;
+ camel_service_class->query_auth_types_connected = query_auth_types_connected;
camel_service_class->free_auth_types = free_auth_types;
camel_service_class->get_name = get_name;
@@ -224,8 +226,9 @@ smtp_disconnect (CamelService *service, CamelException *ex)
{
CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
- if (!service->connected)
- return TRUE;
+ /*if (!service->connected)
+ * return TRUE;
+ */
/* send the QUIT command to the SMTP server */
smtp_quit(transport, ex);
@@ -290,7 +293,17 @@ static CamelServiceAuthType cram_md5_authtype = {
#endif
static GList *
-query_auth_types (CamelService *service, CamelException *ex)
+query_auth_types_connected (CamelService *service, CamelException *ex)
+{
+ /* FIXME: Re-enable this when auth types are actually
+ * implemented.
+ */
+
+ return NULL;
+}
+
+static GList *
+query_auth_types_generic (CamelService *service, CamelException *ex)
{
/* FIXME: Re-enable this when auth types are actually
* implemented.