diff options
author | Dan Winship <danw@src.gnome.org> | 2001-03-27 13:22:44 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-03-27 13:22:44 +0800 |
commit | 4c42c93dc6a2a1ed4c0b758ffff790fe74e7dffa (patch) | |
tree | c9779ab81d453b73b821985670116a353186f440 /camel/providers/smtp | |
parent | 26b82892c72f977aa4602ddef20cca2cc4743e05 (diff) | |
download | gsoc2013-evolution-4c42c93dc6a2a1ed4c0b758ffff790fe74e7dffa.tar.gz gsoc2013-evolution-4c42c93dc6a2a1ed4c0b758ffff790fe74e7dffa.tar.zst gsoc2013-evolution-4c42c93dc6a2a1ed4c0b758ffff790fe74e7dffa.zip |
Add an "extra_conf" field to CamelProvider with structures and defines and
* camel-provider.h: Add an "extra_conf" field to CamelProvider
with structures and defines and stuff, for providers to specify
additional configuration options that they want. Also add a
"supports ssl" flag to the provider flags.
* camel-remote-store.c: add a "default_ssl_port" field.
(remote_construct): If the URL has the "use_ssl" parameter, set
the store's use_ssl flag.
(remote_connect): If using SSL and no port specified, use the
default_ssl_port rather than the default_port.
* providers/smtp/camel-smtp-provider.c (smtp_provider): add
CAMEL_PROVIDER_SUPPORTS_SSL and CAMEL_URL_ALLOW_USER. (The config
gui code knows that the ALLOW_USER and ALLOW_AUTH go together.)
(ssmtp_provider): gone
* providers/smtp/camel-smtp-transport.c (smtp_construct): Set a
flag if "use_ssl" param is set.
(smtp_connect): Check the CamelSmtpTransport use_ssl flag rather
than checking if this is smtp or ssmtp.
* providers/imap/camel-imap-provider.c (imap_conf_entries): Add a
bunch of IMAP-specific configuration options, like "check for new
mail in all folders" (default TRUE), "show only subscribed
folders" (default TRUE), "ignore server-supplied namespace", and
"apply filters to INBOX" (not yet implemented).
(imap_provider): We support SSL and we no longer allow a path in
the URL. (namespace is handled via extra_conf)
(simap_provider): Gone
* providers/imap/camel-imap-store.c (camel_imap_store_init): Set
default_ssl_port, don't set CAMEL_STORE_SUBSCRIPTIONS here
(construct): remove simap stuff, deal with "use_lsub",
"namespace", "check_all", and "filter" parameters. Set base_url
to not include params.
(imap_store_setup_online): Don't ask for the namespace if it was
set explicitly. Don't get subscribed folders if !use_lsub.
(imap_concat): Fix a bug.
(get_folder_info): Support for not checking all folders.
* providers/pop3/camel-pop3-provider.c (pop3_conf_entries): "keep
on server" (currently still implemented by the mailer code, not
here), "delete after N days" (not yet implemented).
(pop3_provider): we support SSL
(spop_provider): gone
* providers/pop3/camel-pop3-store.c (camel_pop3_store_init): Set
default_ssl_port
(pop3_connect): Remove spop code
svn path=/trunk/; revision=8968
Diffstat (limited to 'camel/providers/smtp')
-rw-r--r-- | camel/providers/smtp/camel-smtp-provider.c | 31 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 31 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.h | 2 | ||||
-rw-r--r-- | camel/providers/smtp/libcamelsmtp.urls | 1 |
4 files changed, 26 insertions, 39 deletions
diff --git a/camel/providers/smtp/camel-smtp-provider.c b/camel/providers/smtp/camel-smtp-provider.c index a3905daa02..bcdc1bc3e0 100644 --- a/camel/providers/smtp/camel-smtp-provider.c +++ b/camel/providers/smtp/camel-smtp-provider.c @@ -39,31 +39,13 @@ static CamelProvider smtp_provider = { "mail", - CAMEL_PROVIDER_IS_REMOTE, + CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_SUPPORTS_SSL, - CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH, + CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH | CAMEL_URL_ALLOW_USER, /* ... */ }; -#if defined (HAVE_NSS) || defined (HAVE_OPENSSL) -static CamelProvider ssmtp_provider = { - "ssmtp", - N_("Secure SMTP"), - - N_("For delivering mail by connecting to a remote mailhub " - "using SMTP over an SSL connection.\n"), - - "mail", - - CAMEL_PROVIDER_IS_REMOTE, - - CAMEL_URL_NEED_HOST | CAMEL_URL_ALLOW_AUTH, - - /* ... */ -}; -#endif - void camel_provider_module_init (CamelSession *session) { @@ -73,15 +55,6 @@ camel_provider_module_init (CamelSession *session) smtp_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal); camel_session_register_provider (session, &smtp_provider); - -#if defined (HAVE_NSS) || defined (HAVE_OPENSSL) - ssmtp_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = - camel_smtp_transport_get_type (); - ssmtp_provider.authtypes = camel_sasl_authtype_list (); - ssmtp_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal); - - camel_session_register_provider (session, &ssmtp_provider); -#endif } diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 9a6ae102bf..1e345e3371 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -67,6 +67,9 @@ static gboolean smtp_send (CamelTransport *transport, CamelMedium *message, Came static gboolean smtp_send_to (CamelTransport *transport, CamelMedium *message, GList *recipients, CamelException *ex); /* support prototypes */ +static void smtp_construct (CamelService *service, CamelSession *session, + CamelProvider *provider, CamelURL *url, + CamelException *ex); static gboolean smtp_connect (CamelService *service, CamelException *ex); static gboolean smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex); static GHashTable *esmtp_get_authtypes (gchar *buffer); @@ -84,7 +87,7 @@ static gboolean smtp_rset (CamelSmtpTransport *transport, CamelException *ex); static gboolean smtp_quit (CamelSmtpTransport *transport, CamelException *ex); /* private data members */ -static CamelServiceClass *service_class = NULL; +static CamelTransportClass *parent_class = NULL; static void camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_class) @@ -94,9 +97,10 @@ camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_c CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS (camel_smtp_transport_class); - service_class = CAMEL_SERVICE_CLASS (camel_type_get_global_classfuncs (camel_service_get_type ())); + parent_class = CAMEL_TRANSPORT_CLASS (camel_type_get_global_classfuncs (camel_transport_get_type ())); /* virtual method overload */ + camel_service_class->construct = smtp_construct; camel_service_class->connect = smtp_connect; camel_service_class->disconnect = smtp_disconnect; camel_service_class->query_auth_types = query_auth_types; @@ -134,6 +138,19 @@ camel_smtp_transport_get_type (void) return camel_smtp_transport_type; } +static void +smtp_construct (CamelService *service, CamelSession *session, + CamelProvider *provider, CamelURL *url, + CamelException *ex) +{ + CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT (service); + + CAMEL_SERVICE_CLASS (parent_class)->construct (service, session, provider, url, ex); + + if (camel_url_get_param (url, "use_ssl")) + smtp_transport->use_ssl = TRUE; +} + static const char * get_smtp_error_string (int error) { @@ -206,12 +223,11 @@ smtp_connect (CamelService *service, CamelException *ex) CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service); CamelStream *tcp_stream; gchar *respbuf = NULL; - gboolean use_ssl = FALSE; struct hostent *h; guint32 addrlen; int port, ret; - if (!service_class->connect (service, ex)) + if (!CAMEL_SERVICE_CLASS (parent_class)->connect (service, ex)) return FALSE; h = camel_service_gethost (service, ex); @@ -226,8 +242,7 @@ smtp_connect (CamelService *service, CamelException *ex) port = service->url->port ? service->url->port : SMTP_PORT; #ifdef HAVE_NSS - if (!g_strcasecmp (service->url->protocol, "ssmtp")) { - use_ssl = TRUE; + if (transport->use_ssl) { port = service->url->port ? service->url->port : 465; tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host); } else { @@ -250,7 +265,7 @@ smtp_connect (CamelService *service, CamelException *ex) /* get the localaddr - needed later by smtp_helo */ addrlen = sizeof (transport->localaddr); #ifdef HAVE_NSS - if (use_ssl) { + if (transport->use_ssl) { PRFileDesc *sockfd = camel_tcp_stream_get_socket (CAMEL_TCP_STREAM (tcp_stream)); PRNetAddr addr; char hname[1024]; @@ -416,7 +431,7 @@ smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex) smtp_quit (transport, ex); } - if (!service_class->disconnect (service, clean, ex)) + if (!CAMEL_SERVICE_CLASS (parent_class)->disconnect (service, clean, ex)) return FALSE; if (transport->authtypes) { diff --git a/camel/providers/smtp/camel-smtp-transport.h b/camel/providers/smtp/camel-smtp-transport.h index b15f0319df..4515fe1f07 100644 --- a/camel/providers/smtp/camel-smtp-transport.h +++ b/camel/providers/smtp/camel-smtp-transport.h @@ -53,7 +53,7 @@ typedef struct { CamelStream *istream, *ostream; - gboolean is_esmtp; + gboolean use_ssl, is_esmtp; struct sockaddr_in localaddr; diff --git a/camel/providers/smtp/libcamelsmtp.urls b/camel/providers/smtp/libcamelsmtp.urls index d786e01295..ec2fc0fc16 100644 --- a/camel/providers/smtp/libcamelsmtp.urls +++ b/camel/providers/smtp/libcamelsmtp.urls @@ -1,2 +1 @@ smtp -ssmtp |