[Spambayes-checkins] spambayes pop3proxy.py,1.64,1.65

Tony Meyer anadelonbrin at users.sourceforge.net
Mon Mar 10 18:48:32 EST 2003


Update of /cvsroot/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv27657

Modified Files:
	pop3proxy.py 
Log Message:
Adding capability for level and evidence headers in pop3proxy.  Also changes prob/score header so that it is on a separate header, not with the classification.  Tidies up the whole extra header section in pop3proxy.  Fixed the check for correct add_mailid in OptionConfig.

Index: pop3proxy.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/pop3proxy.py,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** pop3proxy.py	9 Mar 2003 23:55:27 -0000	1.64
--- pop3proxy.py	11 Mar 2003 02:48:29 -0000	1.65
***************
*** 481,485 ****
  
              # Now find the spam disposition and add the header.
!             prob = state.bayes.spamprob(tokenizer.tokenize(messageText))
              if prob < options.ham_cutoff:
                  disposition = options.header_ham_string
--- 481,487 ----
  
              # Now find the spam disposition and add the header.
!             (prob, clues) = state.bayes.spamprob\
!                             (tokenizer.tokenize(messageText),
!                              evidence=True)
              if prob < options.ham_cutoff:
                  disposition = options.header_ham_string
***************
*** 502,509 ****
              headers, body = re.split(r'\n\r?\n', messageText, 1)
              messageName = state.getNewMessageName()
!             id_header = ""
              if command == 'RETR' and not state.isTest:
                  if options.pop3proxy_add_mailid_to.find("header") != -1:
!                     id_header = options.pop3proxy_mailid_header_name \
                              + ": " + messageName + "\r\n"
                  if options.pop3proxy_add_mailid_to.find("body") != -1:
--- 504,512 ----
              headers, body = re.split(r'\n\r?\n', messageText, 1)
              messageName = state.getNewMessageName()
!             headers += '\r\n%s: %s\r\n' % (options.hammie_header_name,
!                                            disposition)
              if command == 'RETR' and not state.isTest:
                  if options.pop3proxy_add_mailid_to.find("header") != -1:
!                     headers += options.pop3proxy_mailid_header_name \
                              + ": " + messageName + "\r\n"
                  if options.pop3proxy_add_mailid_to.find("body") != -1:
***************
*** 512,523 ****
                              + messageName + "\r\n.\r\n"
              else:
!                 id_header = options.hammie_header_name + "-ID: Test\r\n"
  
              if options.pop3proxy_include_prob:
!                 header = '%s: %s, %s\r\n' % (options.hammie_header_name,
!                                              disposition, prob)
!             else:
!                 header = '%s: %s\r\n' % (options.hammie_header_name, disposition)
!             headers = headers + "\n" + header + id_header + "\r\n"
              
              if options.pop3proxy_notate_to \
--- 515,536 ----
                              + messageName + "\r\n.\r\n"
              else:
!                 headers += options.hammie_header_name + "-ID: Test\r\n"
  
              if options.pop3proxy_include_prob:
!                 headers += '%s: %s\r\n' % (options.pop3proxy_prob_header_name,
!                                            prob)
!             if options.pop3proxy_include_thermostat:
!                 thermostat = '**********'
!                 headers += '%s: %s\r\n' % \
!                           (options.pop3proxy_thermostat_header_name,
!                            thermostat[int(prob*10):])
!             if options.pop3proxy_include_evidence:
!                 headers += options.pop3proxy_evidence_header_name + ": "
!                 headers += "; ".join(["%r: %.2f" % (word, prob)
!                          for word, score in clues
!                          if (word[0] == '*' or
!                              score <= options.clue_mailheader_cutoff or
!                              score >= 1.0 - options.clue_mailheader_cutoff)])
!             headers += "\r\n"
              
              if options.pop3proxy_notate_to \





More information about the Spambayes-checkins mailing list