Add support for specifying on which port to connect to a server; fix a potential infinite loop in unicode.

svn path=/trunk/; revision=5041
This commit is contained in:
Peter Williams
2000-08-25 21:09:53 +00:00
parent 10e6501b5d
commit dbce630738
13 changed files with 67 additions and 1 deletions

View File

@ -1,3 +1,16 @@
2000-08-25 Peter Williams <peterw@helixcode.com>
* camel.c (camel_init): Don't call unicode_init; code in e-util
will do it, and if unicode_init is called twice, you get an
infinite loop when looking up nonexistant encodings (patch
has been submitted to libunicode's maintainer).
* camel-provider.h: Add a new field, default_ports, which
helps the configuration code guess about how to make CamelURL's
from providers.
* providers/*/camel-*-provider.c: Specify default ports.
2000-08-25 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-folder.c

View File

@ -79,6 +79,7 @@ typedef struct {
int flags;
CamelType object_types [CAMEL_NUM_PROVIDER_TYPES];
gint default_ports [CAMEL_NUM_PROVIDER_TYPES];
GHashTable *service_cache;

View File

@ -40,7 +40,8 @@ camel_init(void)
#endif /* G_THREADS_ENABLED */
#endif /* ENABLE_THREADS */
unicode_init ();
/* Taken care of by e-util/e-unicode.c */
/*unicode_init ();*/
return 0;
}

View File

@ -45,6 +45,7 @@ static CamelProvider imap_provider = {
CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_STORAGE,
{ 0, 0 },
{ 143, 0 },
NULL
};

View File

@ -40,6 +40,7 @@ static CamelProvider mbox_provider = {
CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_STORAGE,
{ 0, 0 },
{ 0, 0 },
NULL

View File

@ -39,6 +39,7 @@ static CamelProvider mh_provider = {
CAMEL_PROVIDER_IS_STORAGE,
{0, 0},
{0, 0},
NULL

View File

@ -39,6 +39,7 @@ static CamelProvider news_provider = {
CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_STORAGE,
{ 0, 0 },
{ 119, 0 },
NULL
};
@ -55,6 +56,7 @@ static CamelProvider nntp_provider = {
CAMEL_PROVIDER_IS_REMOTE,
{ 0, 0 },
{ 119, 0 },
NULL
};

View File

@ -42,6 +42,7 @@ static CamelProvider pop3_provider = {
CAMEL_PROVIDER_IS_REMOTE | CAMEL_PROVIDER_IS_SOURCE,
{ 0, 0 },
{ 110, 0 },
NULL
};

View File

@ -40,6 +40,7 @@ static CamelProvider sendmail_provider = {
0,
{ 0, 0 },
{ 0, 0 },
NULL

View File

@ -40,6 +40,7 @@ static CamelProvider smtp_provider = {
0,
{ 0, 0 },
{ 0, 25 },
NULL
};

View File

@ -35,6 +35,7 @@ static CamelProvider vee_provider = {
0,
{ 0, 0 },
{ 0, 0 },
NULL

View File

@ -1,3 +1,14 @@
2000-08-25 Peter Williams <peterw@helixcode.com>
* mail-config-gui.c (service_page_item_new): If the service wants
a host, also let the user specify a port.
(MailDialogServicePageItem): Add members for the port GtkEntry and
the default port.
(service_page_get_url): Translate the port in the entry back into
the CamelURL.
(service_page_set_url): Read in the port from the URL or use
the default.
2000-08-25 Jeffrey Stedfast <fejj@helixcode.com>
* mail-crypto.c (mail_crypto_openpgp_encrypt): Implemented PGP 2.x

View File

@ -76,6 +76,7 @@ typedef struct
gboolean userneed;
GtkWidget *host;
gboolean hostneed;
GtkWidget *port;
GtkWidget *path;
gboolean pathneed;
GtkWidget *auth_optionmenu;
@ -84,6 +85,7 @@ typedef struct
GtkWidget *auth_detect;
GtkWidget *keep_on_server;
gint pnum;
gint default_port;
} MailDialogServicePageItem;
struct _MailDialogServicePage
@ -588,6 +590,18 @@ service_page_get_url (MailDialogServicePage *page)
url->user = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->user), 0, -1);
if (spitem->host)
url->host = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->host), 0, -1);
if (spitem->port) {
gchar *val;
val = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->port), 0, -1);
if (*val)
url->port = atoi (val);
else
url->port = 0;
g_free (val);
}
if (spitem->path) {
gchar *path;
path = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->path),
@ -647,6 +661,21 @@ service_page_set_url (MailDialogServicePage *page, MailConfigService *service)
if (spitem->host && url && url->host)
e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->host), url->host);
if (spitem->port) {
gchar *tmp;
if (url && url->port) {
tmp = g_strdup_printf ("%d", url->port);
} else if (spitem->default_port) {
tmp = g_strdup_printf ("%d", spitem->default_port);
} else {
tmp = g_strdup ("");
}
e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->port), tmp);
g_free (tmp);
}
if (spitem->path && url && url->path) {
if (url->host && *url->path)
e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->path),
@ -901,6 +930,8 @@ service_page_item_new (MailDialogServicePage *page, MailService *mcs)
item->host = service_page_add_elem (page, table, row++, _("Server:"));
item->hostneed = ((service_flags & CAMEL_SERVICE_URL_NEED_HOST)
== CAMEL_SERVICE_URL_NEED_HOST);
item->port = service_page_add_elem (page, table, row++, _("Port:"));
item->default_port = mcs->provider->default_ports[mcs->type];
}
if (service_flags & CAMEL_SERVICE_URL_ALLOW_USER) {