[gotmail] New gotmail fixes hotmail breakage

paul cannon <[email protected]> Thu, 13 Mar 2003 18:49:18 -0700
Newsgroups gmane.mail.gotmail
Message-ID <[email protected]>
Folks-

Lalit Chhabra's patch to fix the new hotmail breakage was quite
successful and well made. Kudos to him- I packaged that fix up with
Chris Ham's fix for skipping pages when deleting as 0.7.8. Minutes later
I decided there were too many little bugs amassing in the Savannah and
Debian trackers, and added bugfixes for nearly all of them. The later
version is 0.7.9.

Both versions are on Savannah (although I'd suggest only using 0.7.9);
0.7.9 is in Debian incoming, and should hit mirrors for sid in the next
few days.

One thing I haven't put in is the work on integrating SpamAssassin and
gotmail. Good work has been done there, but I have a few concerns about
putting it into the upstream. One, it looks like I'd need to depend on
all of SpamAssassin; Two, gotmail is getting so messy. The python
rewrite[1] will make it possible to have configurable hooks to perform
this sort of operation.

Still, I encourage everyone to use the patch posted by John Freutel
(#1062) if they want gotmail to work with SpamAssassin. It won't apply
perfectly cleanly to 0.7.9, but I'm attaching one that will [2].

Enjoy the new version, and keep up the good work! The community is
helping greatly to keep gotmail running smoothly.


[1] Not yet named; I've called it "botmail", "gotfemail", "gotmail2",
and "pyGotmail" alternately as development code names. I think I'm
leaning towards "gotmail2".

[2] Savannah is a bit broken; seems I can't close or update patches
for gotmail, even though I'm the admin. I've mailed them about this
problem. John, can you please post the updated one on the website?

-- 
  _  _ . .|  _ _ ._ ._  _ ._  [email protected]
 |_)(_||_|| (_(_|| || |(_)| | http://ssl.usu.edu/paul/
 |

_______________________________________________
Gotmail-list mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/gotmail-list
sapatch2 (text/plain, 3 KB)
Patch to make SpamAssassin work with gotmail; updated for gotmail 0.7.9.
Requires the Perl module Mail::SpamAssassin.

--- gotmail.old	2003-03-13 18:31:38.000000000 -0700
+++ gotmail	2003-03-13 18:40:49.000000000 -0700
@@ -31,6 +31,8 @@
 
 require 5.004;
 
+# Uncomment this if you have SpamAssassin installed
+# use Mail::SpamAssassin;
 use English;
 use URI::Escape;
 use POSIX qw(tmpnam);
@@ -38,7 +40,7 @@
 use strict;
 
 # Signal handlers:
-$SIG{INT} = $SIG{__DIE__} =
+$SIG{INT} = $SIG{TERM} =
 	sub {
 		my($text) = @_;
 		print STDERR "gotmail died with message: $text\n";
@@ -88,6 +90,7 @@
 my($conf_save_to_login) = 0;   # 0 = no, 1 = yes
 my($conf_procmail) = 0; # 0 = no, 1 = yes
 my($conf_procmail_bin) = '/usr/bin/procmail';
+my($conf_sa) = 0; # 0 = no, 1 = yes
 
 # Global variables...
 my($host) = ""; # The name of the hotmail server we are talking to...
@@ -169,6 +172,7 @@
 	print "  --use-procmail            Send all messages only to procmail\n";
 	print "  --procmail-bin <path>     Use this program as procmail (default is\n" .
 	      "                              /usr/bin/procmail) (implies --use-procmail)\n";
+	print "  --use-sa                  Use SpamAssassin to not download spam\n";
 	print "  --curl-bin <path>         Specify the path to the cURL program if it's\n" .
 	      "                              not in your path.\n";
 	print "  --silent                  Do not print messages\n";
@@ -262,6 +266,8 @@
 			$conf_procmail = 1;
 		} elsif ($_ =~ /^curl-bin=(.+)$/i) {
 			$conf_curl = $1;
+		} elsif ($_ =~ /^use-sa/i) {
+			$conf_sa = 1;
 		}
 	}
 
@@ -406,6 +412,9 @@
 				dispUsageAndExit();
 			}
 		}
+		elsif ($element =~ /^--use-sa$/i) {
+			$conf_sa = 1;
+		}
 		else {
 			dispText("Unrecognized option $element\n");
 			dispUsageAndExit();
@@ -887,9 +896,26 @@
 				return;
 			}
 
+			my $Message = getEmail($msg_url, 1, $foldername);
+
+			# Check for spam, if requested to.  Probable SPAMS are
+			# not downloaded
+
+			if ($conf_sa) {
+				my $SpamTest = Mail::SpamAssassin -> new();
+
+				my $MessageObject = $SpamTest -> check_message_text($Message);
+				my $IsSpam = $MessageObject -> is_spam();
+
+				if ($IsSpam) {
+					dispText("Probably spam, skipping.\n");
+					next;
+				}
+			}
+
 			# Are we resending or saving?
 			if ($conf_procmail) {
-				my($output) = getEmail($msg_url, 1, $foldername);
+				my($output) = $Message;
 				dispText("Sending mail message to procmail...");
 				open PR,"|" . $conf_procmail_bin;
 				print PR $output;
@@ -897,7 +923,7 @@
 				print "Done.\n";
 			}
 			elsif ($resend_address eq "") {
-				my($output) = getEmail($msg_url, 1, $foldername);
+				my($output) = $Message;
 				my($outfile) = $conf_folder_directory;
 
 				if ($conf_save_to_login) {
@@ -912,7 +938,7 @@
 				doSaveEmail($outfile, $output);
 				dispText("Saving message to $outfile...\n");
 			} elsif ($conf_smtpserver) {
-				my($output) = getEmail($msg_url, 1, $foldername);
+				my($output) = $Message;
 				doResendSMTPEmail($resend_address, $output, $conf_smtpserver);
 			} else {
 				my($output) = getEmail($msg_url, 0, $foldername);