gotmail patch (partial)

"John Fruetel" <[email protected]> Wed, 3 Dec 2003 01:45:25 -0800
Newsgroups gmane.mail.gotmail
Message-ID <[email protected]>
Ok, I have a good headstart on a patch for gotmail.

This patch seems to 'basically' work, although I know some things still
aren't working.  Still, I think its a good start.

----- Original Message ----- 
From: "John Fruetel" <[email protected]>
To: <[email protected]>
Sent: Tuesday, December 02, 2003 8:03 PM
Subject: Re: [gotmail] Re: New Hotmail error report


> And so it begins.  I'm going to take a crack at it tonight, but I'm not
> making any promises.
>
> I use gotmail to filter spam with SpamAssassin.  And suddenly, my cron
jobs
> dont work anymore.

_______________________________________________
Gotmail-list mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/gotmail-list
gotmail.patch (application/octet-stream, 3.4 KB)
--- gotmail.orig	Tue Dec  2 21:57:33 2003
+++ gotmail	Wed Dec  3 01:31:51 2003
@@ -456,7 +456,7 @@
 
 sub doCleanOtherFiles()
 {
-	if (-e $log) { unlink($log); }
+#	if (-e $log) { unlink($log); }
 }
 
 # Check all the required programs are installed.
@@ -720,7 +720,11 @@
 	my($inbox_location) = "";
 	$page = join "", @redirect_page;
 	if ($page =~ m/Location: (\S+)/i) {
-		$inbox_location = $1;
+		my $inbox_loc = $1;
+		$inbox_loc =~ /(.+)\/dasp\/ua_info.asp\?pg=browser_limit(.+)/;
+		$inbox_location = "$1\/HoTMail";
+	  dispText("Going to Inbox Page: $inbox_location\n");
+	  my(@redirect_page) = getPage($inbox_location, "", 0, 1, 0);
 	} elsif ($page =~ /unavailable/i) {
 		die("Hotmail is reporting that your account is temporarily " .
 		    "unavailable. Please try again later.");
@@ -888,21 +892,42 @@
 	my $next_page_str = join("", grep(/Next Page/i, @folder));
 
 	# Redo the list on a table row by table row basis
-	my @messages = split(/<tr[^>]*>|<\/tr>/i, join("",@folder));
-	@messages = grep(/<a href=\"\/cgi-bin\/getmsg\?/i, @messages);
+	my @messages;
+
+  foreach my $f (@folder)
+  {
+    $f =~ m/.*(<a href=\"javascript:G\('\/cgi-bin\/getmsg\?.*\">)/i;
+    my $m = $1;
+		if ($m) 
+		{
+			push @messages, $m;
+		}
+  }
+  #my $fold = join("", @folder);
+	#my @mess2= split(/<tr name=\".+\">|<\/tr>/i, $fold);
+	#my @messages = grep(/<a href=\"javascript:G\('\/cgi-bin\/getmsg\?/i, @mess2);
 
 	# Get the messages in this folder...
+  #print "\$fold:$fold";
+  #print "\@messages:@messages";
+  #print "\@mess2:@mess2";
+  
+  @messages = sort @messages;
+  my $oldItem = "";
 	foreach my $item (@messages)
 	{
-		if ($item =~ m/<a href=\"(\/cgi-bin\/getmsg\?\S+)\">/i) {
+
+		if ($item ne $oldItem) {
+      $oldItem = $item;
+      $item =~ m/<a href=\"javascript:G\('(\/cgi-bin\/getmsg\?\S+)\">/i;
 			my $msg_url = $1;
 
 			# Since the folder is in newest first order, if we are only getting
 			# new messages, and this is not a new message, we can stop here.
 
-			if ($conf_only_get_new_messages && ($item !~ /newmail/i)) {
-				return;
-			}
+#			if ($conf_only_get_new_messages && ($item !~ /newmail/i)) {
+#				return;
+#			}
 
       my $Message =getEmail($msg_url, 1, $foldername);
 
@@ -1025,9 +1050,11 @@
 	                split(/(<tr[^>]*>|<\/tr>)/, $onestr);
 
 	foreach my $item (@folder_list) {
-		if ($item =~ m/<a(.*)href=\"\/cgi-bin\/HoTMaiL\?(\S+)\"\s*><font class="Wf">(.+)<\/font><\/a>/) {
-			my($url) = $2;
-			my($name) = $3;
+#	  dispText("Loading folder $item...\n");
+#		if ($item =~ m/<a(.*)href=\"\/cgi-bin\/HoTMaiL\?(\S+)\"\s*><font class="Wf">(.+)<\/font><\/a>/) {
+		if ($item =~ m/.*<a href=\"\/cgi-bin\/HoTMaiL\?(.+)\" >(.+)<\/a>.*/) {
+			my($url) = $1;
+			my($name) = $2;
 
 			# Establish numbers of new, unread, total mail in box - courtesy
 			# of Jens Preikschat <[email protected]>
@@ -1039,10 +1066,11 @@
 			# Establish "total number of messages" and "number of unread messages"
 			# in the folder
 
-			$item =~ m/<td><font class="Wf">(\d+)<\/font><\/td> <td><font class="Wf">(\d+)<\/font><\/td> <td align="right"/;
+			$item =~ m/<td align=center>(\d+)<\/td> <td align=center>(\d+)<\/td>/;
 			my($totalItems) = $1;
 			my($unreadItems) = $2;
 
+#	    dispText("Unread Items:$unreadItems\n");
 			if ((!$conf_only_get_new_messages) || ($unreadItems > 0)) {
 				# Check that this actually _is_ a folder name, without any
 				# html tags. Also makes sure we are not getting the trash