diff options
-rw-r--r-- | capplet/settings/Makefile.am | 6 | ||||
-rw-r--r-- | capplet/settings/mail-account-view.c | 85 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | mail/Makefile.am | 4 | ||||
-rw-r--r-- | mail/em-account-editor.c | 102 |
5 files changed, 81 insertions, 118 deletions
diff --git a/capplet/settings/Makefile.am b/capplet/settings/Makefile.am index 9bd84db94b..1367fd5a75 100644 --- a/capplet/settings/Makefile.am +++ b/capplet/settings/Makefile.am @@ -1,5 +1,3 @@ -SUBDIRS = mail-autoconfig - privsolib_LTLIBRARIES = libevolution-mail-settings.la libevolution_mail_settings_la_CPPFLAGS = \ @@ -48,9 +46,7 @@ libevolution_mail_settings_la_SOURCES = \ mail-capplet-shell.c \ mail-capplet-shell.h \ anjal-mail-view.h \ - anjal-mail-view.c \ - mail-guess-servers.c \ - mail-guess-servers.h + anjal-mail-view.c libevolution_mail_settings_la_LIBADD = \ $(EVOLUTION_DATA_SERVER_LIBS) \ diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c index 3617c6a866..85afccd837 100644 --- a/capplet/settings/mail-account-view.c +++ b/capplet/settings/mail-account-view.c @@ -33,7 +33,6 @@ #include "mail-view.h" #include "e-util/e-config.h" #include "mail/e-mail-backend.h" -#include "mail-guess-servers.h" struct _MailAccountViewPrivate { GtkWidget *tab_str; @@ -962,89 +961,6 @@ mav_construct_page (MailAccountView *view, return (GtkWidget *) page; } -static ServerData * -emae_check_servers (const gchar *email) -{ - ServerData *sdata = g_new0 (ServerData, 1); - EmailProvider *provider = g_new0 (EmailProvider, 1); - gchar *dupe = g_strdup (email); - gchar *tmp; - - /* FIXME: Find a way to free the provider once given to account settings. */ - provider->email = (gchar *) email; - tmp = strchr (email, '@'); - tmp++; - provider->domain = tmp; - tmp = strchr (dupe, '@'); - *tmp = 0; - provider->username = (gchar *) g_quark_to_string (g_quark_from_string (dupe)); - g_free (dupe); - - if (!mail_guess_servers (provider)) { - g_free (provider); - g_free (sdata); - return NULL; - } - /*printf("Recv: %s\n%s(%s), %s by %s \n Send: %s\n%s(%s), %s by %s\n via %s to %s\n", - provider->recv_type, provider->recv_hostname, provider->recv_port, provider->recv_username, provider->recv_auth, - provider->send_type, provider->send_hostname, provider->send_port, provider->send_username, provider->send_auth, - provider->recv_socket_type, provider->send_socket_type); */ - - sdata->recv = provider->recv_hostname; - sdata->recv_port = provider->recv_port; - sdata->send = provider->send_hostname; - sdata->send_port = provider->send_port; - if (strcmp (provider->recv_type, "pop3") == 0) - sdata->proto = g_strdup ("pop"); - else if (strcmp (provider->recv_type, "imap") == 0) - sdata->proto = g_strdup ("imapx"); - else - sdata->proto = provider->recv_type; - if (provider->recv_socket_type) { - CamelNetworkSecurityMethod method; - - if (g_ascii_strcasecmp (provider->recv_socket_type, "SSL") == 0) - method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT; - else if (g_ascii_strcasecmp (provider->recv_socket_type, "secure") == 0) - method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT; - else if (g_ascii_strcasecmp (provider->recv_socket_type, "STARTTLS") == 0) - method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT; - else if (g_ascii_strcasecmp (provider->recv_socket_type, "TLS") == 0) - method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT; - else - method = CAMEL_NETWORK_SECURITY_METHOD_NONE; - - sdata->security_method = method; - sdata->recv_security_method = method; - } - - if (provider->send_socket_type) { - CamelNetworkSecurityMethod method; - - if (g_ascii_strcasecmp (provider->send_socket_type, "SSL") == 0) - method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT; - else if (g_ascii_strcasecmp (provider->send_socket_type, "secure") == 0) - method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT; - else if (g_ascii_strcasecmp (provider->send_socket_type, "STARTTLS") == 0) - method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT; - else if (g_ascii_strcasecmp (provider->send_socket_type, "TLS") == 0) - method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT; - else - method = CAMEL_NETWORK_SECURITY_METHOD_NONE; - - sdata->send_security_method = method; - } - - sdata->send_auth = provider->send_auth; - sdata->recv_auth = provider->recv_auth; - sdata->send_user = provider->send_username; - sdata->recv_user = provider->recv_username; - - g_free (provider); - - return sdata; -} - static void next_page (GtkWidget *entry, MailAccountView *mav) @@ -1080,7 +996,6 @@ mail_account_view_construct (MailAccountView *view, view->original, EMAE_PAGES, backend, "org.gnome.evolution.mail.config.accountWizard", view->wpages); gtk_widget_hide (e_config_create_widget (E_CONFIG (view->edit->config))); - view->edit->emae_check_servers = emae_check_servers; if (!view->original) { e_account_set_bool (em_account_editor_get_modified_account (view->edit), E_ACCOUNT_SOURCE_SAVE_PASSWD, TRUE); e_account_set_bool (em_account_editor_get_modified_account (view->edit), E_ACCOUNT_TRANSPORT_SAVE_PASSWD, TRUE); diff --git a/configure.ac b/configure.ac index e8b02bb90c..4bb19e00a4 100644 --- a/configure.ac +++ b/configure.ac @@ -1668,6 +1668,7 @@ mail/default/sr@latin/Makefile mail/default/sv/Makefile mail/default/zh_CN/Makefile mail/importers/Makefile +mail/mail-autoconfig/Makefile maint/Makefile modules/Makefile modules/addressbook/Makefile @@ -1725,7 +1726,6 @@ smime/gui/Makefile sounds/Makefile capplet/Makefile capplet/settings/Makefile -capplet/settings/mail-autoconfig/Makefile evolution-zip evolution-calendar.pc evolution-mail.pc diff --git a/mail/Makefile.am b/mail/Makefile.am index 1ddbec649c..0a14a19ee9 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = . default importers +SUBDIRS = . default importers mail-autoconfig privsolib_LTLIBRARIES = libevolution-mail.la @@ -105,6 +105,7 @@ mailinclude_HEADERS = \ mail-autofilter.h \ mail-config.h \ mail-folder-cache.h \ + mail-guess-servers.h \ mail-mt.h \ mail-ops.h \ mail-send-recv.h \ @@ -178,6 +179,7 @@ libevolution_mail_la_SOURCES = \ mail-autofilter.c \ mail-config.c \ mail-folder-cache.c \ + mail-guess-servers.c \ mail-mt.c \ mail-ops.c \ mail-send-recv.c \ diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 0d930a1184..15a93be5c3 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -70,6 +70,7 @@ #include "em-utils.h" #include "mail-ops.h" #include "mail-mt.h" +#include "mail-guess-servers.h" #if defined (HAVE_NSS) && defined (ENABLE_SMIME) #include "smime/gui/e-cert-selector.h" @@ -82,24 +83,6 @@ #define d(x) -static ServerData mail_servers[] = { - { "gmail", "imap.gmail.com", "smtp.gmail.com", "imap", - CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT }, - { "googlemail", "imap.gmail.com", "smtp.gmail.com", "imap", - CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT }, - { "yahoo", "pop3.yahoo.com", "smtp.yahoo.com", "pop", - CAMEL_NETWORK_SECURITY_METHOD_NONE }, - { "aol", "imap.aol.com", "smtp.aol.com", "imap", - CAMEL_NETWORK_SECURITY_METHOD_NONE }, - { "msn", "pop3.email.msn.com", "smtp.email.msn.com", "pop", - CAMEL_NETWORK_SECURITY_METHOD_NONE, "@", "@"}, - { "hotmail", "pop3.live.com", "smtp.live.com", "pop", - CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT, "@", "@"}, - { "live.com", "pop3.live.com", "smtp.live.com", "pop", - CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT, "@", "@"}, - -}; - /* econfig item for the extra config hings */ struct _receive_options_item { EMConfigItem item; @@ -4302,17 +4285,84 @@ emae_service_complete (EMAccountEditor *emae, static ServerData * emae_check_servers (const gchar *email) { - gint len = G_N_ELEMENTS (mail_servers), i; - gchar *server = strchr (email, '@'); - - server++; + ServerData *sdata = g_new0 (ServerData, 1); + EmailProvider *provider = g_new0 (EmailProvider, 1); + gchar *dupe = g_strdup (email); + gchar *tmp; + + /* FIXME: Find a way to free the provider once given to account settings. */ + provider->email = (gchar *) email; + tmp = strchr (email, '@'); + tmp++; + provider->domain = tmp; + tmp = strchr (dupe, '@'); + *tmp = 0; + provider->username = (gchar *) g_quark_to_string (g_quark_from_string (dupe)); + g_free (dupe); + + if (!mail_guess_servers (provider)) { + g_free (provider); + g_free (sdata); + return NULL; + } + /*printf("Recv: %s\n%s(%s), %s by %s \n Send: %s\n%s(%s), %s by %s\n via %s to %s\n", + provider->recv_type, provider->recv_hostname, provider->recv_port, provider->recv_username, provider->recv_auth, + provider->send_type, provider->send_hostname, provider->send_port, provider->send_username, provider->send_auth, + provider->recv_socket_type, provider->send_socket_type); */ + + sdata->recv = provider->recv_hostname; + sdata->recv_port = provider->recv_port; + sdata->send = provider->send_hostname; + sdata->send_port = provider->send_port; + if (strcmp (provider->recv_type, "pop3") == 0) + sdata->proto = g_strdup ("pop"); + else if (strcmp (provider->recv_type, "imap") == 0) + sdata->proto = g_strdup ("imapx"); + else + sdata->proto = provider->recv_type; + if (provider->recv_socket_type) { + CamelNetworkSecurityMethod method; + + if (g_ascii_strcasecmp (provider->recv_socket_type, "SSL") == 0) + method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT; + else if (g_ascii_strcasecmp (provider->recv_socket_type, "secure") == 0) + method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT; + else if (g_ascii_strcasecmp (provider->recv_socket_type, "STARTTLS") == 0) + method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT; + else if (g_ascii_strcasecmp (provider->recv_socket_type, "TLS") == 0) + method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT; + else + method = CAMEL_NETWORK_SECURITY_METHOD_NONE; + + sdata->security_method = method; + sdata->recv_security_method = method; + } - for (i = 0; i < len; i++) { - if (strstr (server, mail_servers[i].key) != NULL) - return &mail_servers[i]; + if (provider->send_socket_type) { + CamelNetworkSecurityMethod method; + + if (g_ascii_strcasecmp (provider->send_socket_type, "SSL") == 0) + method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT; + else if (g_ascii_strcasecmp (provider->send_socket_type, "secure") == 0) + method = CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT; + else if (g_ascii_strcasecmp (provider->send_socket_type, "STARTTLS") == 0) + method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT; + else if (g_ascii_strcasecmp (provider->send_socket_type, "TLS") == 0) + method = CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT; + else + method = CAMEL_NETWORK_SECURITY_METHOD_NONE; + + sdata->send_security_method = method; } - return NULL; + sdata->send_auth = provider->send_auth; + sdata->recv_auth = provider->recv_auth; + sdata->send_user = provider->send_username; + sdata->recv_user = provider->recv_username; + + g_free (provider); + + return sdata; } static gboolean |