Bug (and fix) with subjects encoded by RFC 2047

Min-gyu Cho <[email protected]> Wed, 17 Jan 2007 18:33:56 -0500
Newsgroups gmane.mail.spam.active-spam-killer.general
Message-ID <[email protected]>
Hi, all,

First of all, thank all the developer(s) of Active Spam Killer (a-s-k). 
I think this is very nice solution to prevent most of spams.

I just installed and tested 2.4.1. I found out that a-s-k can't handle 
subjects encoded by RFC 2047. I tried to find relevant bug reports, but 
couldn't find one, thus I'm filing this bug report (and quick and dirty 
fix). I checked with the most recent version (2.5.3), but it seems like 
that the same problem still exists.

The problem happens when the subject of reply is encoded by RFC 2047. In 
that case, a-s-k can't retrieve MD5 hash code properly, and generates 
another message with new MD5 message.

I found a (quick and dirty) solution to this using decode_header 
function in email package. The patch for the solution is appended below. 
However, somebody will be able to make it neater since I just made a 
quick solution.

I hope this is helpful for other a-s-k users.

Min-gyu Cho

----


--- askmessage.py       2003-05-19 10:17:22.000000000 -0400
+++ askmessage-fixed.py   2007-01-17 18:25:54.000000000 -0500
@@ -36,6 +36,7 @@
  import askconfig
  import askmail
  import asklock
+from email.Header import decode_header

 
#------------------------------------------------------------------------------

@@ -213,7 +214,7 @@
                 Returns the subject of the message, or '' if none is 
defined.
                 """

- 
return(mimify.mime_decode_header(self.msg.getheader("Subject", "")))
+ 
return(decode_header(mimify.mime_decode_header(self.msg.getheader("Subject", 
"")))[0][0])

 
#----------------------------------------------------------------------------------
         def get_date(self):



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV