[Spambayes-checkins] spambayes smtpproxy.py,1.1,1.2

Tony Meyer anadelonbrin at users.sourceforge.net
Sun Mar 2 20:38:34 EST 2003


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

Modified Files:
	smtpproxy.py 
Log Message:
Added support for extracting an id from a message forwarded where the headers are converted to an HTML table (a la Mozilla Mail)

Index: smtpproxy.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/smtpproxy.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** smtpproxy.py	27 Feb 2003 04:15:03 -0000	1.1
--- smtpproxy.py	3 Mar 2003 04:38:31 -0000	1.2
***************
*** 41,47 ****
                                                          Header	Body
  *** Windows 2000 MUAs ***
! Eudora 5.2 Forward					                       *     *
! Eudora 5.2 Redirect					   	                         *
! Netscape Messenger (4.7) Forward (inline) 		           *     *
  Netscape Messenger (4.7) Forward (quoted) Plain      	         *
  Netscape Messenger (4.7) Forward (quoted) HTML      	         *
--- 41,47 ----
                                                          Header	Body
  *** Windows 2000 MUAs ***
! Eudora 5.2 Forward                                         *     *
! Eudora 5.2 Redirect                                              *
! Netscape Messenger (4.7) Forward (inline)                  *     *
  Netscape Messenger (4.7) Forward (quoted) Plain      	         *
  Netscape Messenger (4.7) Forward (quoted) HTML      	         *
***************
*** 75,79 ****
  Becky! 2.05.10 Forward                                           *
  Becky! 2.05.10 Redirect                                          *
! Becky! 2.05.10 Redirect as attachment                      *     * 
  """
  
--- 75,86 ----
  Becky! 2.05.10 Forward                                           *
  Becky! 2.05.10 Redirect                                          *
! Becky! 2.05.10 Redirect as attachment                      *     *
! Mozilla Mail 1.2.1 Forward (attachment)                    *     *
! Mozilla Mail 1.2.1 Forward (inline, plain)                 *1    *
! Mozilla Mail 1.2.1 Forward (inline, plain & html)          *1    *
! Mozilla Mail 1.2.1 Forward (inline, html)                  *1    *
! 
! *1 The header method will only work if auto-include original message
! is set, and if view all headers is true.
  """
  
***************
*** 84,88 ****
  from pop3proxy import _addressPortStr, ServerLineReader
  from pop3proxy import _addressAndPort, proxyListeners
! import string
  import socket, asyncore, asynchat
  
--- 91,95 ----
  from pop3proxy import _addressPortStr, ServerLineReader
  from pop3proxy import _addressAndPort, proxyListeners
! import string, re
  import socket, asyncore, asynchat
  
***************
*** 390,396 ****
              return None
          else:
!             id_location += len(options.pop3proxy_mailid_header_name) + 2
!             id_end = text.find('\r\n', id_location)
              id = text[id_location:id_end]
              return id
  
--- 397,419 ----
              return None
          else:
!             # A MUA might enclose the id in a table
!             # (Mozilla Mail does this with inline html)
!             s = re.compile(options.pop3proxy_mailid_header_name + \
!                            ':[\s]*</th>[\s]*<td>[\s]*')
!             if s.search(text[id_location:]) is not None:
!                 id_location += s.search(text[id_location:]).end()
!                 s = re.compile('[\d-]+</td>')
!                 id_end = s.search(text[id_location:]).end() + id_location
!             else:
!                 id_location += len(options.pop3proxy_mailid_header_name) + 2
!                 s = re.compile('[\w -]+[\\r]?\\n')
!                 id_end = s.search(text[id_location:]).end() + id_location
              id = text[id_location:id_end]
+             s = re.compile('</td>')
+             if s.search(id) is not None:
+                 id = s.split(id)[0]
+             s = re.compile('[\\r]?\\n')
+             if s.search(id) is not None:
+                 id = s.split(id)[0]
              return id
  





More information about the Spambayes-checkins mailing list