CVS: sylpheedclaws/sylpheed-claws/src wizard.c,1.1.2.40,1.1.2.41 prefs_account.c,1.105.2.72,1.105.2.73

[email protected] Mon, 11 Dec 2006 18:08:15 +0000
Newsgroups gmane.mail.sylpheed.claws.cvs
Message-ID <[email protected]>
Update of /pack/anoncvs/sylpheedclaws/sylpheed-claws/src
In directory sunsite.dk:/tmp/cvs-serv568/src

Modified Files:
      Tag: gtk2
	wizard.c prefs_account.c 
Log Message:
2006-12-11 [colin]	2.6.1cvs16

	* src/prefs_account.c
		Check for existence of inbox for local
		accounts too
	* src/wizard.c
		Allow setting the port to use for servers
		by using the usual "server.example.com:port"
		syntax. Fixes bug 1077, 'sylpheed-claws does 
		not start when IMAP server is unavailable'

Index: wizard.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/Attic/wizard.c,v
retrieving revision 1.1.2.40
retrieving revision 1.1.2.41
diff -u -d -r1.1.2.40 -r1.1.2.41
--- wizard.c	2006/12/05 09:22:12	1.1.2.40
+++ wizard.c	2006/12/11 18:08:08	1.1.2.41
@@ -545,7 +545,9 @@
 	PrefsAccount *prefs_account = prefs_account_new();
 	GList *account_list = NULL;
 	GtkWidget *menu, *menuitem;
-	
+	gchar *smtp_server, *recv_server;
+	gint smtp_port, recv_port;
+
 	menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wizard->recv_type));
 	menuitem = gtk_menu_get_active(GTK_MENU(menu));
 	prefs_account->protocol = GPOINTER_TO_INT
@@ -641,21 +643,42 @@
 		prefs_account->account_name = g_strdup_printf("%s",
 				gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
 
+	recv_server = g_strdup(gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
+	smtp_server = g_strdup(gtk_entry_get_text(GTK_ENTRY(wizard->smtp_server)));
+
+	if (prefs_account->protocol != A_LOCAL && strstr(recv_server, ":")) {
+		recv_port = atoi(strstr(recv_server, ":")+1);
+		*(strstr(recv_server, ":")) = '\0';
+		if (prefs_account->protocol == A_IMAP4) {
+			prefs_account->set_imapport = TRUE;
+			prefs_account->imapport = recv_port;
+		} else if (prefs_account->protocol == A_POP3) {
+			prefs_account->set_popport = TRUE;
+			prefs_account->popport = recv_port;
+		}
+	}
+	if (strstr(smtp_server, ":")) {
+		smtp_port = atoi(strstr(smtp_server, ":")+1);
+		*(strstr(smtp_server, ":")) = '\0';
+		prefs_account->set_smtpport = TRUE;
+		prefs_account->smtpport = smtp_port;
+	}
+	
 	prefs_account->name = g_strdup(
 				gtk_entry_get_text(GTK_ENTRY(wizard->full_name)));
 	prefs_account->address = g_strdup(
 				gtk_entry_get_text(GTK_ENTRY(wizard->email)));
 	prefs_account->organization = g_strdup(
 				gtk_entry_get_text(GTK_ENTRY(wizard->organization)));
-	prefs_account->smtp_server = g_strdup(
-				gtk_entry_get_text(GTK_ENTRY(wizard->smtp_server)));
+	prefs_account->smtp_server = g_strdup(smtp_server);
 
 	if (prefs_account->protocol != A_LOCAL)
-		prefs_account->recv_server = g_strdup(
-				gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
+		prefs_account->recv_server = g_strdup(recv_server);
 	else
-		prefs_account->local_mbox = g_strdup(
-				gtk_entry_get_text(GTK_ENTRY(wizard->recv_server)));
+		prefs_account->local_mbox = g_strdup(recv_server);
+
+	g_free(recv_server);
+	g_free(smtp_server);
 
 	prefs_account->userid = g_strdup(
 				gtk_entry_get_text(GTK_ENTRY(wizard->recv_username)));

Index: prefs_account.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/prefs_account.c,v
retrieving revision 1.105.2.72
retrieving revision 1.105.2.73
diff -u -d -r1.105.2.72 -r1.105.2.73
--- prefs_account.c	2006/12/11 17:55:28	1.105.2.72
+++ prefs_account.c	2006/12/11 18:08:08	1.105.2.73
@@ -2521,7 +2521,7 @@
 		alertpanel_error(_("POP3 server is not entered."));
 		return -1;
 	}
-	if (protocol == A_POP3) {
+	if (protocol == A_POP3 || protocol == A_LOCAL) {
 		const gchar *mailbox = gtk_entry_get_text(GTK_ENTRY(receive.inbox_entry));
 		FolderItem *inbox =  folder_find_item_from_identifier(mailbox);
 	    	if (inbox == NULL) {