[Spambayes-checkins] spambayes imapfilter.py,1.27,1.28

Tony Meyer anadelonbrin at users.sourceforge.net
Sun Apr 20 00:58:54 EDT 2003


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

Modified Files:
	imapfilter.py 
Log Message:
Change imap filter to specify servers in the pop3proxy style,
i.e. server[:port] rather than have two options.  If you were
previously specifying a port, you will need to change your
configuration file, otherwise no change is necessary.

Index: imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/imapfilter.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** imapfilter.py	19 Apr 2003 08:22:00 -0000	1.27
--- imapfilter.py	20 Apr 2003 06:58:52 -0000	1.28
***************
*** 454,457 ****
--- 454,463 ----
  or training will be performed."""
  
+     server = options["imap", "server"]
+     username = options["imap", "username"]
+     if server == "" or username == "":
+         print "You need to specify both a server and a username."
+         sys.exit()
+ 
      if promptForPass:
          pwd = getpass()
***************
*** 472,477 ****
          print "Done."            
                  
!     imap = IMAPSession(options["imap", "server"],
!                        options["imap", "port"], imapDebug)
  
      imap_filter = IMAPFilter(classifier)
--- 478,490 ----
          print "Done."            
                  
!     if server.find(':') > -1:
!         server, port = server.split(':', 1)
!         port = int(port)
!     else:
!         if options["imap", "use_ssl"]:
!             port = 993
!         else:
!             port = 143
!     imap = IMAPSession(server, port, imapDebug)
  
      imap_filter = IMAPFilter(classifier)
***************
*** 482,486 ****
      # XXX using the same port by default.
      if launchUI:
!         imap.login(options["imap", "username"], pwd)
          httpServer = UserInterfaceServer(options["html_ui", "port"])
          httpServer.register(IMAPUserInterface(classifier, imap))
--- 495,499 ----
      # XXX using the same port by default.
      if launchUI:
!         imap.login(username, pwd)
          httpServer = UserInterfaceServer(options["html_ui", "port"])
          httpServer.register(IMAPUserInterface(classifier, imap))
***************
*** 488,492 ****
      else:
          while True:
!             imap.login(options["imap", "username"], pwd)
  
              if doTrain:
--- 501,505 ----
      else:
          while True:
!             imap.login(username, pwd)
  
              if doTrain:





More information about the Spambayes-checkins mailing list