From 894f6a90c2d22d88c45c0226c898b16ed5110a67 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 13 Oct 2004 02:20:40 +0000 Subject: kill cast as lvalue warning. 2004-10-13 Not Zed * providers/imap4/camel-imap4-folder.c (camel_imap4_folder_new) (imap4_sync_changes, imap4_sync): * providers/imap4/camel-imap4-summary.c (untagged_fetch_all): kill cast as lvalue warning. * camel-string-utils.h: add prototype for camel_toupper. * providers/imap4/camel-imap4-utils.c: * providers/imap4/camel-imap4-summary.c: * providers/imap4/camel-imap4-folder.c: * providers/imap4/camel-imap4-engine.c: * providers/imap4/camel-imap4-command.c: * providers/imap4/camel-imap4-store.c: include camel-i18n.h. 2004-10-12 Not Zed ** See bug ??? * providers/nntp/camel-nntp-store.c (connect_to_server): if we have a username, try to authenticate before doing anything else. ** See bug #67895. * providers/nntp/camel-nntp-summary.c (add_range_xover) (add_range_head): use raw_command_auth since we might need auth here. * providers/nntp/camel-nntp-store.c (camel_nntp_raw_command_auth): new almost-raw command that also does auth. (xover_setup, connect_to_server, camel_nntp_command): use raw_command_auth since we might need auth here. 2004-10-12 Not Zed ** See bug #67898 and probably others. * providers/imapp/camel-imapp-store.c (connect_to_server): * providers/pop3/camel-pop3-store.c (connect_to_server_wrapper): * providers/imap4/camel-imap4-store.c (connect_to_server_wrapper): * providers/imap/camel-imap-store.c (connect_to_server_wrapper): * providers/nntp/camel-nntp-store.c (connect_to_server_wrapper): * providers/smtp/camel-smtp-transport.c (connect_to_server_wrapper): Fallback to hard-coded port number if the name lookup fails and no port was supplied. svn path=/trunk/; revision=27562 --- camel/providers/imap4/camel-imap4-store.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'camel/providers/imap4/camel-imap4-store.c') diff --git a/camel/providers/imap4/camel-imap4-store.c b/camel/providers/imap4/camel-imap4-store.c index 1e9e742f29..a4ca4c4e9e 100644 --- a/camel/providers/imap4/camel-imap4-store.c +++ b/camel/providers/imap4/camel-imap4-store.c @@ -34,6 +34,8 @@ #include +#include + #include "camel-imap4-store.h" #include "camel-imap4-engine.h" #include "camel-imap4-folder.h" @@ -275,13 +277,14 @@ connect_to_server (CamelIMAP4Engine *engine, struct addrinfo *ai, int ssl_mode, static struct { char *value; char *serv; + char *port; int mode; } ssl_options[] = { - { "", "imaps", MODE_SSL }, /* really old (1.x) */ - { "always", "imaps", MODE_SSL }, - { "when-possible", "imap", MODE_TLS }, - { "never", "imap", MODE_CLEAR }, - { NULL, "imap", MODE_CLEAR }, + { "", "imaps", "993", MODE_SSL }, /* really old (1.x) */ + { "always", "imaps", "993", MODE_SSL }, + { "when-possible", "imap", "143", MODE_TLS }, + { "never", "imap", "143", MODE_CLEAR }, + { NULL, "imap", "143", MODE_CLEAR }, }; static gboolean @@ -292,27 +295,36 @@ connect_to_server_wrapper (CamelIMAP4Engine *engine, CamelException *ex) const char *ssl_mode; int mode, ret, i; char *serv; - + const char *port; + if ((ssl_mode = camel_url_get_param (service->url, "use_ssl"))) { for (i = 0; ssl_options[i].value; i++) if (!strcmp (ssl_options[i].value, ssl_mode)) break; mode = ssl_options[i].mode; serv = ssl_options[i].serv; + port = ssl_options[i].port; } else { mode = MODE_CLEAR; serv = "imap"; + port = "143"; } if (service->url->port) { serv = g_alloca (16); sprintf (serv, "%d", service->url->port); + port = NULL; } memset (&hints, 0, sizeof (hints)); hints.ai_socktype = SOCK_STREAM; hints.ai_family = PF_UNSPEC; - if (!(ai = camel_getaddrinfo (service->url->host, serv, &hints, ex))) + ai = camel_getaddrinfo (service->url->host, serv, &hints, ex); + if (ai == NULL && port != NULL && camel_exception_get_id(ex) != CAMEL_EXCEPTION_USER_CANCEL) { + camel_exception_clear (ex); + ai = camel_getaddrinfo (service->url->host, port, &hints, ex); + } + if (ai == NULL) return FALSE; ret = connect_to_server (engine, ai, mode, ex); -- cgit