Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15921/scripts

Modified Files:
        sb_imapfilter.py 
Log Message:
Fix [ 1182754 ] 1.1a1: imapfilter browser chokes on incorrect password

Index: sb_imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -d -r1.58 -r1.59
*** sb_imapfilter.py    21 Apr 2005 07:09:09 -0000      1.58
--- sb_imapfilter.py    13 May 2005 04:23:11 -0000      1.59
***************
*** 148,152 ****
  from spambayes import tokenizer, storage, message, Dibbler
  from spambayes.UserInterface import UserInterfaceServer
! from spambayes.ImapUI import IMAPUserInterface
  from spambayes.Version import get_current_version
  
--- 148,152 ----
  from spambayes import tokenizer, storage, message, Dibbler
  from spambayes.UserInterface import UserInterfaceServer
! from spambayes.ImapUI import IMAPUserInterface, LoginFailure
  from spambayes.Version import get_current_version
  
***************
*** 171,174 ****
--- 171,175 ----
                 (self.command, self.response)
  
+ 
  class IMAPSession(BaseIMAP):
      '''A class extending the IMAP4 class, with a few optimizations'''
***************
*** 245,259 ****
          """Log in to the IMAP server, catching invalid username/password."""
          assert self.connected, "Must be connected before logging in."
          try:
!             if 'AUTH=CRAM-MD5' in self.capabilities:
!                 self.login_cram_md5(username, pwd)
!             else:
!                 BaseIMAP.login(self, username, pwd)  # superclass login
          except BaseIMAP.error, e:
!             msg = "There was an error logging in to the IMAP server." \
!                   " The username (%s) and/or password may " \
!                   "be incorrect." % (username,)
!             print msg
!             sys.exit()
          self.logged_in = True
  
--- 246,263 ----
          """Log in to the IMAP server, catching invalid username/password."""
          assert self.connected, "Must be connected before logging in."
+         if 'AUTH=CRAM-MD5' in self.capabilities:
+             login_func = self.login_cram_md5
+             args = (username, pwd)
+             description = "MD5"
+         else:
+             login_func = BaseIMAP.login # superclass login
+             args = (self, username, pwd)
+             description = "plain-text"
          try:
!             login_func(*args)
          except BaseIMAP.error, e:
!             msg = "The username (%s) and/or password (sent in %s) may " \
!                   "be incorrect." % (username, description)
!             raise LoginFailure(msg)
          self.logged_in = True
  
***************
*** 1220,1225 ****
                          if os.path.exists(fn):
                              options.merge_file(fn)
!                             
!                     imap.login(username, password)
                      imap_filter.imap_server = imap
  
--- 1224,1233 ----
                          if os.path.exists(fn):
                              options.merge_file(fn)
! 
!                     try:                    
!                         imap.login(username, password)
!                     except LoginFailure, e:
!                         print str(e)
!                         continue
                      imap_filter.imap_server = imap
  

_______________________________________________
Spambayes-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/spambayes-checkins

Reply via email to