[Spambayes-checkins] spambayes imapfilter.py,1.22,1.23

Tony Meyer anadelonbrin at users.sourceforge.net
Fri Apr 18 17:03:35 EDT 2003


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

Modified Files:
	imapfilter.py 
Log Message:
Add support for the web ui (for configuration, mostly).

Index: imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/imapfilter.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** imapfilter.py	18 Apr 2003 06:56:59 -0000	1.22
--- imapfilter.py	18 Apr 2003 23:03:32 -0000	1.23
***************
*** 25,28 ****
--- 25,29 ----
              -i debuglvl : a somewhat mysterious imaplib debugging level
              -l minutes  : period of time between filtering operations
+             -b          : Launch a web browser showing the user interface.
  
  Examples:
***************
*** 58,67 ****
      o Find a better way to remove old msg from info database when saving
        modified messages
-     o Web UI for configuration and setup. Tony thinks it would be
-         nice if there was a web ui to this for the initial setup (i.e. like
-         pop3proxy), which offered a list of folders to filter/train/etc.  It
-         could then record a uid for the folder rather than a name, and it
-         avoids the problems with different imap servers having different
-         naming styles a list is retrieved via imap.list()
      o IMAPMessage and IMAPFolder currently carry out very simple checks
        of responses received from IMAP commands, but if the response is not
--- 59,62 ----
***************
*** 106,110 ****
  
  from spambayes.Options import options
! from spambayes import tokenizer, storage, message
  
  # global IMAPlib object
--- 101,107 ----
  
  from spambayes.Options import options
! from spambayes import tokenizer, storage, message, Dibbler
! from spambayes.UserInterface import UserInterfaceServer
! from spambayes.ImapUI import IMAPUserInterface
  
  # global IMAPlib object
***************
*** 369,373 ****
      global imap
      try:
!         opts, args = getopt.getopt(sys.argv[1:], 'htcvpl:e:i:d:D:')
      except getopt.error, msg:
          print >>sys.stderr, str(msg) + '\n\n' + __doc__
--- 366,370 ----
      global imap
      try:
!         opts, args = getopt.getopt(sys.argv[1:], 'hbtcvpl:e:i:d:D:')
      except getopt.error, msg:
          print >>sys.stderr, str(msg) + '\n\n' + __doc__
***************
*** 381,385 ****
      imapDebug = 0
      sleepTime = 0
!     promptForPass = 0
  
      for opt, arg in opts:
--- 378,383 ----
      imapDebug = 0
      sleepTime = 0
!     promptForPass = False
!     launchUI = False
  
      for opt, arg in opts:
***************
*** 393,396 ****
--- 391,396 ----
              useDBM = True
              bdbname = arg
+         elif opt == "-b":
+             launchUI = True
          elif opt == '-t':
              doTrain = True
***************
*** 411,415 ****
              sleepTime = int(arg) * 60
  
!     if not (doClassify or doTrain):
          print "-c and/or -t operands must be specified"
          sys.exit()
--- 411,415 ----
              sleepTime = int(arg) * 60
  
!     if not (doClassify or doTrain or launchUI):
          print "-c and/or -t operands must be specified"
          sys.exit()
***************
*** 437,440 ****
--- 437,448 ----
  
      imap_filter = IMAPFilter(classifier)
+ 
+     # Web interface
+     # XXX If someone is running *both* pop3proxy and imapfilter
+     # XXX then there will be trouble since both interfaces are
+     # XXX using the same port by default.
+     httpServer = UserInterfaceServer(options["html_ui", "port"])
+     httpServer.register(IMAPUserInterface(classifier, imap))
+     Dibbler.run(launchBrowser=launchUI)
  
      while True:





More information about the Spambayes-checkins mailing list