Changeset 207


Ignore:
Timestamp:
05/30/08 09:18:51 (13 years ago)
Author:
bas
Message:

email2trac.py.in:

  • fixed a bug and made spam_header configurable, closes #63 and #64
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r205 r207  
    4141
    4242    Author: Jim Meyering jim add meyering dot net
    43     Implemented by: Bas van der Vlies
     43    Applied by: Bas van der Vlies
     44
     45  * Made some approvements to spam function:
     46     - If the he X-Spam-Score header is present, but has no value
     47        email2trac will crash, closes #63
     48
     49     - Added config option which header field we must check
     50       for determing if mail is Spam, eg:
     51        - spam_header : X-Spam-Level (default: X-Spam-Score)
     52 
     53    Author: email2trac at bulk dot squeakyblue dot com
     54    Applied by: Bas van der Vlies
     55
     56   
    4457
    45582008-02-04
  • trunk/email2trac.py.in

    r206 r207  
    175175                        self.SPAM_LEVEL = 0
    176176
     177                if parameters.has_key('spam_header'):
     178                        self.SPAM_HEADER = parameters['spam_header']
     179                else:
     180                        self.SPAM_HEADER = 'X-Spam-Score'
     181
    177182                if parameters.has_key('email_quote'):
    178183                        self.EMAIL_QUOTE = str(parameters['email_quote'])
     
    246251                """
    247252                spam = False
    248                 if message.has_key('X-Spam-Score'):
    249                         spam_l = string.split(message['X-Spam-Score'])
    250                         number = spam_l[0].count('*')
    251 
     253                if message.has_key(self.SPAM_HEADER):
     254                        spam_l = string.split(message[self.SPAM_HEADER])
     255
     256                        try:
     257                                number = spam_l[0].count('*')
     258                        except IndexError, detail:
     259                                number = 0
     260                               
    252261                        if number >= self.SPAM_LEVEL:
    253262                                spam = True
Note: See TracChangeset for help on using the changeset viewer.