[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:23314] NEW PATCH: common SMTP server
From:       Sylpheed Patches <sylpheed () thewildbeast ! co ! uk>
Date:       2004-08-06 6:26:06
Message-ID: E1BsyB4-0000AS-00 () alpha ! xcalibre ! co ! uk
[Download RAW message or body]

ANNOUNCING THE RELEASE OF A NEW PATCH

Patch Author: Tommy Reynolds <Tommy.Reynolds@MegaCoder.com>
Title:        common SMTP server
Filename:     common-smtp-server.patch (7.4 kb)
Works with:   0.9.12

Description:
This patch adds a "common SMTP server" setting to the Common 
Preferences SEND menu that allows a road warrior to conveniently 
switch the SMTP server used for all the mail accounts to 'localhost' 
without having to destroy the current it-works-at-home settings. 
This is needed because some ISP's don't want to appear to relay 
mail for spammers.

--------------------------
This is an automated message from the Sylpheed Patch homepage.
<http://www.thewildbeast.co.uk/sylpheed>

If you have made a patch that you want included at the
Sylpheed Patch homepage, request details from
<sylpheed@thewildbeast.co.uk>.

["common-smtp-server.patch" (text/plain)]

Index: src/defs.h
===================================================================
RCS file: /cvsroot/sylpheed/sylpheed/src/defs.h,v
retrieving revision 1.34
diff -u -p -r1.34 defs.h
--- src/defs.h	15 Jun 2004 09:51:14 -0000	1.34
+++ src/defs.h	4 Aug 2004 16:53:02 -0000
@@ -69,6 +69,7 @@
 /* #define DEFAULT_INC_PROGRAM	"imget" */
 #define DEFAULT_SENDMAIL_CMD	"/usr/sbin/sendmail -t -i"
 #define DEFAULT_BROWSER_CMD	"mozilla -remote 'openURL(%s, new-window)'"
+#define	DEFAULT_COMMON_SMTP_SERVER "localhost"
 
 #ifdef _PATH_MAILDIR
 #  define DEFAULT_SPOOL_PATH	_PATH_MAILDIR
Index: src/prefs_common.c
===================================================================
RCS file: /cvsroot/sylpheed/sylpheed/src/prefs_common.c,v
retrieving revision 1.174
diff -u -p -r1.174 prefs_common.c
--- src/prefs_common.c	16 Jul 2004 04:35:24 -0000	1.174
+++ src/prefs_common.c	4 Aug 2004 16:53:03 -0000
@@ -82,6 +82,10 @@ static struct Send {
 	GtkWidget *entry_extsend;
 	GtkWidget *button_extsend;
 
+	GtkWidget *checkbtn_common_smtp_server;
+	GtkWidget *entry_common_smtp_server;
+	GtkWidget *button_common_smtp_server;
+
 	GtkWidget *checkbtn_savemsg;
 
 	GtkWidget *optmenu_charset;
@@ -262,6 +266,15 @@ static PrefParam param[] = {
 	{"ext_sendmail_cmd", DEFAULT_SENDMAIL_CMD,
 	 &prefs_common.extsend_cmd, P_STRING,
 	 &p_send.entry_extsend, prefs_set_data_from_entry, prefs_set_entry},
+/* COMMON SMTP SERVER */
+	{"use_common_smtp_server", "FALSE", 
+	 &prefs_common.use_common_smtp_server, P_BOOL,
+	 &p_send.checkbtn_common_smtp_server,
+	 prefs_set_data_from_toggle, prefs_set_toggle},
+	{"common_smtp_server", DEFAULT_COMMON_SMTP_SERVER,
+	 &prefs_common.common_smtp_server, P_STRING,
+	 &p_send.entry_common_smtp_server, prefs_set_data_from_entry, prefs_set_entry},
+/* COMMON SMTP SERVER */
 	{"save_message", "TRUE", &prefs_common.savemsg, P_BOOL,
 	 &p_send.checkbtn_savemsg,
 	 prefs_set_data_from_toggle, prefs_set_toggle},
@@ -1067,6 +1080,13 @@ static void prefs_send_create(void)
 	GtkWidget *label_encoding;
 	GtkWidget *label_encoding_desc;
 
+	GtkWidget *frame_common_smtp_server;
+	GtkWidget *vbox_common_smtp_server;
+	GtkWidget *checkbtn_common_smtp_server;
+	GtkWidget *label_common_smtp_server;
+	GtkWidget *entry_common_smtp_server;
+	GtkWidget *hbox_common_smtp_server;
+
 	vbox1 = gtk_vbox_new (FALSE, VSPACING);
 	gtk_widget_show (vbox1);
 	gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
@@ -1094,12 +1114,37 @@ static void prefs_send_create(void)
 	entry_extsend = gtk_entry_new ();
 	gtk_widget_show (entry_extsend);
 	gtk_box_pack_start (GTK_BOX (hbox1), entry_extsend, TRUE, TRUE, 0);
+	
+	/* Common SMTP server */
+	PACK_FRAME(vbox1, frame_common_smtp_server, _("Common SMTP Server"));
+
+	vbox_common_smtp_server = gtk_vbox_new (FALSE, VSPACING_NARROW);
+	gtk_widget_show (vbox_common_smtp_server);
+	gtk_container_add (GTK_CONTAINER (frame_common_smtp_server), vbox_common_smtp_server);
+	gtk_container_set_border_width (GTK_CONTAINER (vbox_common_smtp_server), 8);
+
+	PACK_CHECK_BUTTON (vbox_common_smtp_server, checkbtn_common_smtp_server,
+			   _("Use same SMTP server for all accounts"));
+
+	hbox_common_smtp_server = gtk_hbox_new (FALSE, 8);
+	gtk_widget_show (hbox_common_smtp_server);
+	gtk_box_pack_start (GTK_BOX (vbox_common_smtp_server), hbox_common_smtp_server, FALSE, FALSE, 0);
+	SET_TOGGLE_SENSITIVITY(checkbtn_common_smtp_server, hbox_common_smtp_server);
+
+	label_common_smtp_server = gtk_label_new (_("SMTP Server"));
+	gtk_widget_show (label_common_smtp_server);
+	gtk_box_pack_start (GTK_BOX (hbox_common_smtp_server), label_common_smtp_server, FALSE, FALSE, 0);
+
+	entry_common_smtp_server = gtk_entry_new ();
+	gtk_widget_show (entry_common_smtp_server);
+	gtk_box_pack_start (GTK_BOX (hbox_common_smtp_server), entry_common_smtp_server, TRUE, TRUE, 0);
 
 #if 0
 	button_extsend = gtk_button_new_with_label ("... ");
 	gtk_widget_show (button_extsend);
 	gtk_box_pack_start (GTK_BOX (hbox1), button_extsend, FALSE, FALSE, 0);
 #endif
+	/* Common SMTP Server -- End */
 
 	vbox2 = gtk_vbox_new (FALSE, 0);
 	gtk_widget_show (vbox2);
@@ -1216,6 +1261,9 @@ static void prefs_send_create(void)
 	p_send.checkbtn_extsend = checkbtn_extsend;
 	p_send.entry_extsend    = entry_extsend;
 	/* p_send.button_extsend   = button_extsend; */
+	p_send.checkbtn_common_smtp_server = checkbtn_common_smtp_server;
+	p_send.entry_common_smtp_server = entry_common_smtp_server;
+	/* p_send.button_common_smtp_server = button_common_smtp_server; */
 
 	p_send.checkbtn_savemsg  = checkbtn_savemsg;
 
Index: src/prefs_common.h
===================================================================
RCS file: /cvsroot/sylpheed/sylpheed/src/prefs_common.h,v
retrieving revision 1.78
diff -u -p -r1.78 prefs_common.h
--- src/prefs_common.h	16 Jul 2004 04:35:24 -0000	1.78
+++ src/prefs_common.h	4 Aug 2004 16:53:03 -0000
@@ -63,6 +63,8 @@ struct _PrefsCommon
 	/* Send */
 	gboolean use_extsend;
 	gchar *extsend_cmd;
+	gboolean use_common_smtp_server;
+	gchar *common_smtp_server;
 	gboolean savemsg;
 	gchar *outgoing_charset;
 	TransferEncodingMethod encoding_method;
Index: src/send_message.c
===================================================================
RCS file: /cvsroot/sylpheed/sylpheed/src/send_message.c,v
retrieving revision 1.15
diff -u -p -r1.15 send_message.c
--- src/send_message.c	8 Jun 2004 08:02:29 -0000	1.15
+++ src/send_message.c	4 Aug 2004 16:53:03 -0000
@@ -291,6 +291,25 @@ static gint send_message_local(const gch
 	return 0;
 }
 
+static gchar *
+get_smtp_server(
+	PrefsAccount *	ac_prefs
+)
+{
+	gchar *		smtp_server;
+
+	debug_print(
+		"Use common SMTP server? %s.\n",
+		prefs_common.use_common_smtp_server ? "YES" : "NO" );
+	if( prefs_common.use_common_smtp_server ) {
+		smtp_server = prefs_common.common_smtp_server;
+	} else	{
+		smtp_server = ac_prefs->smtp_server;
+	}
+	debug_print("Using SMTP server '%s'.\n", smtp_server );
+	return( smtp_server );
+}
+
 static gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp)
 {
 	Session *session;
@@ -328,7 +347,7 @@ static gint send_message_smtp(PrefsAccou
 			else {
 				smtp_session->pass =
 					input_dialog_query_password
-						(ac_prefs->smtp_server,
+						(get_smtp_server( ac_prefs ),
 						 smtp_session->user);
 				if (!smtp_session->pass)
 					smtp_session->pass = g_strdup("");
@@ -345,7 +364,7 @@ static gint send_message_smtp(PrefsAccou
 			else {
 				smtp_session->pass =
 					input_dialog_query_password
-						(ac_prefs->smtp_server,
+						(get_smtp_server( ac_prefs ),
 						 smtp_session->user);
 				if (!smtp_session->pass)
 					smtp_session->pass = g_strdup("");
@@ -378,13 +397,13 @@ static gint send_message_smtp(PrefsAccou
 	dialog->session = session;
 
 	text[0] = NULL;
-	text[1] = ac_prefs->smtp_server;
+	text[1] = get_smtp_server( ac_prefs );
 	text[2] = _("Connecting");
 	clist = GTK_CLIST(dialog->dialog->clist);
 	gtk_clist_append(clist, (gchar **)text);
 
 	g_snprintf(buf, sizeof(buf), _("Connecting to SMTP server: %s ..."),
-		   ac_prefs->smtp_server);
+		   get_smtp_server( ac_prefs ));
 	progress_dialog_set_label(dialog->dialog, buf);
 	log_message("%s\n", buf);
 
@@ -393,7 +412,7 @@ static gint send_message_smtp(PrefsAccou
 		(session, send_send_data_progressive, dialog);
 	session_set_send_data_notify(session, send_send_data_finished, dialog);
 
-	if (session_connect(session, ac_prefs->smtp_server, port) < 0) {
+	if (session_connect(session, get_smtp_server( ac_prefs ), port) < 0) {
 		session_destroy(session);
 		send_progress_dialog_destroy(dialog);
 		return -1;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic