spambayes (1.0.4-5.1) direct (non packaging) changes

Summary

 contrib/spambayes.el      |    2 +-
 scripts/sb_dbexpimp.py    |    3 ++-
 scripts/sb_imapfilter.py  |   16 ++++++++++++++--
 scripts/sb_notesfilter.py |    2 +-
 spambayes/Corpus.py       |    2 +-
 spambayes/FileCorpus.py   |    2 +-
 spambayes/message.py      |    2 +-
 7 files changed, 21 insertions(+), 8 deletions(-)

    
download this patch

Patch contents

--- spambayes-1.0.4.orig/spambayes/message.py
+++ spambayes-1.0.4/spambayes/message.py
@@ -71,11 +71,11 @@
 # This module is part of the spambayes project, which is Copyright 2002-3
 # The Python Software Foundation and is covered by the Python Software
 # Foundation license.
+from __future__ import generators
 
 __author__ = "Tim Stone <tim@fourstonesExpressions.com>"
 __credits__ = "Mark Hammond, Tony Meyer, all the spambayes contributors."
 
-from __future__ import generators
 
 try:
     True, False
--- spambayes-1.0.4.orig/spambayes/Corpus.py
+++ spambayes-1.0.4/spambayes/Corpus.py
@@ -75,11 +75,11 @@
 # This module is part of the spambayes project, which is Copyright 2002-3
 # The Python Software Foundation and is covered by the Python Software
 # Foundation license.
+from __future__ import generators
 
 __author__ = "Tim Stone <tim@fourstonesExpressions.com>"
 __credits__ = "Richie Hindle, Tim Peters, all the spambayes contributors."
 
-from __future__ import generators
 
 try:
     True, False
--- spambayes-1.0.4.orig/spambayes/FileCorpus.py
+++ spambayes-1.0.4/spambayes/FileCorpus.py
@@ -78,11 +78,11 @@
 # This module is part of the spambayes project, which is Copyright 2002
 # The Python Software Foundation and is covered by the Python Software
 # Foundation license.
+from __future__ import generators
 
 __author__ = "Tim Stone <tim@fourstonesExpressions.com>"
 __credits__ = "Richie Hindle, Tim Peters, all the spambayes contributors."
 
-from __future__ import generators
 
 from spambayes import Corpus
 from spambayes import message
--- spambayes-1.0.4.orig/scripts/sb_dbexpimp.py
+++ spambayes-1.0.4/scripts/sb_dbexpimp.py
@@ -88,9 +88,10 @@
 # The Python Software Foundation and is covered by the Python Software
 # Foundation license.
 
+from __future__ import generators
+
 __author__ = "Tim Stone <tim@fourstonesExpressions.com>"
 
-from __future__ import generators
 
 # Python 2.2 compatibility stuff
 try:
--- spambayes-1.0.4.orig/scripts/sb_imapfilter.py
+++ spambayes-1.0.4/scripts/sb_imapfilter.py
@@ -86,11 +86,11 @@
 # This module is part of the spambayes project, which is Copyright 2002-3
 # The Python Software Foundation and is covered by the Python Software
 # Foundation license.
+from __future__ import generators
 
 __author__ = "Tony Meyer <ta-meyer@ihug.co.nz>, Tim Stone"
 __credits__ = "All the Spambayes folk."
 
-from __future__ import generators
 
 try:
     True, False
@@ -108,6 +108,7 @@
 import traceback
 import email
 import email.Parser
+import hmac
 from getpass import getpass
 from email.Header import Header
 from email.Utils import parsedate
@@ -222,6 +223,14 @@
         self._read = self.read
         self.read = self.safe_read
 
+
+    # RFC 2195
+    def authenticatecrammd5(self, username, pwd):
+        self.authenticate('CRAM-MD5',
+                          lambda (response):
+                          username + " " + hmac.HMAC(pwd, response).hexdigest())
+
+
     def login(self, username, pwd):
         try:
             BaseIMAP.login(self, username, pwd)  # superclass login
@@ -925,7 +934,10 @@
     else:
         while True:
             imap = IMAPSession(server, port, imapDebug, doExpunge)
-            imap.login(username, pwd)
+            if 'AUTH=CRAM-MD5' in imap.capabilities:
+                imap.authenticatecrammd5(username, pwd)
+            else:
+                imap.login(username, pwd)
 
             if doTrain:
                 if options["globals", "verbose"]:
--- spambayes-1.0.4.orig/scripts/sb_notesfilter.py
+++ spambayes-1.0.4/scripts/sb_notesfilter.py
@@ -129,11 +129,11 @@
 # This module is part of the spambayes project, which is Copyright 2002
 # The Python Software Foundation and is covered by the Python Software
 # Foundation license.
+from __future__ import generators
 
 __author__ = "Tim Stone <tim@fourstonesExpressions.com>"
 __credits__ = "Mark Hammond, for his remarkable win32 modules."
 
-from __future__ import generators
 
 try:
     True, False
--- spambayes-1.0.4.orig/contrib/spambayes.el
+++ spambayes-1.0.4/contrib/spambayes.el
@@ -25,7 +25,7 @@
 ;; To install, just drop this file in your load path, and insert the
 ;; following lines in ~/.gnus:
 ;;
-;; (setq gnus-sum-load-hook
+;; (setq gnus-summary-mode-hook
 ;;   (lambda ()
 ;;     (require 'spambayes)
 ;;     (define-key gnus-summary-mode-map [(B) (s)] 'spambayes-gnus-refile-as-spam)