From anadelonbrin at users.sourceforge.net Sun May 2 22:08:16 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Sun May 2 22:08:19 2004 Subject: [Spambayes-checkins] spambayes/scripts sb_notesfilter.py,1.7,1.8 Message-ID: Update of /cvsroot/spambayes/spambayes/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30940/scripts Modified Files: sb_notesfilter.py Log Message: Incorrect (old?) function name for opening a storage object. Index: sb_notesfilter.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_notesfilter.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sb_notesfilter.py 5 Feb 2004 08:13:26 -0000 1.7 --- sb_notesfilter.py 3 May 2004 02:08:13 -0000 1.8 *************** *** 288,292 **** def run(bdbname, useDBM, ldbname, rdbname, foldname, doTrain, doClassify): ! bayes = storage.open_database(bdbname, useDBM) try: --- 288,292 ---- def run(bdbname, useDBM, ldbname, rdbname, foldname, doTrain, doClassify): ! bayes = storage.open_storage(bdbname, useDBM) try: From anadelonbrin at users.sourceforge.net Sun May 2 22:12:34 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Sun May 2 22:12:37 2004 Subject: [Spambayes-checkins] spambayes/scripts sb_imapfilter.py,1.29,1.30 Message-ID: Update of /cvsroot/spambayes/spambayes/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31705/scripts Modified Files: sb_imapfilter.py Log Message: Temporary fix for [ 941596 ] sb_imapfilter.py not adding headers / moving messages The problem is that not all IMAP servers recognise that the new message is there immediately after an APPEND, but we need to find it. A no-op generally gives enough time for the server to do its thing, and won't hit anyone else significantly. The proper fix is to put in a loop waiting for the server to dish out the new "EXISTS" data, but I'll leave that for post 1.0. Also change the exception catching to catch any exception. A new message parsing problem raises a TypeError not an email.Error, so was causing imapfilter to crash. We really want to keep going no matter what, otherwise we leave the user's mailbox in an ugly state. Index: sb_imapfilter.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** sb_imapfilter.py 25 Apr 2004 03:45:30 -0000 1.29 --- sb_imapfilter.py 3 May 2004 02:12:32 -0000 1.30 *************** *** 399,403 **** try: new_msg = email.Parser.Parser().parsestr(data[self.rfc822_key]) ! except email.Errors.MessageParseError, e: # Yikes! Barry set this to return at this point, which # would work ok for training (IIRC, that's all he's --- 399,409 ---- try: new_msg = email.Parser.Parser().parsestr(data[self.rfc822_key]) ! # We use a general 'except' because the email package doesn't ! # always return email.Errors (it can return a TypeError, for ! # example) if the email is invalid. In any case, we want ! # to keep going, and not crash, because we might leave the ! # user's mailbox in a bad state if we do. Better to soldier ! # on. ! except: # Yikes! Barry set this to return at this point, which # would work ok for training (IIRC, that's all he's *************** *** 508,511 **** --- 514,522 ---- response = imap.uid("STORE", self.uid, "+FLAGS.SILENT", "(\\Deleted \\Seen)") self._check(response, 'store') + # Not all IMAP servers immediately offer the new message + # (stupidly), but we need to find it. Generally a 'no-op' will + # allow the server time to handle it, so do that. + # See [ 941596 ] sb_imapfilter.py not adding headers / moving messages + imap.noop() # We need to update the uid, as it will have changed. From anadelonbrin at users.sourceforge.net Sun May 2 23:13:14 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Sun May 2 23:13:22 2004 Subject: [Spambayes-checkins] spambayes CHANGELOG.txt, 1.41, 1.42 WHAT_IS_NEW.txt, 1.32, 1.33 Message-ID: Update of /cvsroot/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7896 Modified Files: CHANGELOG.txt WHAT_IS_NEW.txt Log Message: Bring up to date. Index: CHANGELOG.txt =================================================================== RCS file: /cvsroot/spambayes/spambayes/CHANGELOG.txt,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** CHANGELOG.txt 12 Apr 2004 01:41:33 -0000 1.41 --- CHANGELOG.txt 3 May 2004 03:13:12 -0000 1.42 *************** *** 1,4 **** --- 1,15 ---- [Note that all dates are in English, not American format - i.e. day/month/year] + Final Release 1 + =============== + Tony Meyer 03/05/2004 Temporary fix for [ 941596 ] sb_imapfilter.py not adding headers / moving messages + Tony Meyer 03/05/2004 imapfilter: catch any exceptions, not just email.Errors + Tony Meyer 03/05/2004 NotesFilter: Incorrect (old?) function name for opening a storage object. + Mark Hammond 29/04/2004 Outlook: Change the default pushbutton in the "filter now" dialog to be the start button, and make ESC work as cancel. + Skip Montanaro 28/04/2004 tte.py: add -R/--reverse flag to iterate over the mailboxes in reverse + Tony Meyer 25/04/2004 If the move_trained_[ham|spam]_to_folder options were used, this would wipe out the SpamBayes headers. Fix that. + Tony Meyer 25/04/2004 Update message.py for the newer way that the persistent_use_database option works. + Tony Meyer 23/04/2004 Fix [ 940155 ] Data Folder location + Beta Release 1 ============== Index: WHAT_IS_NEW.txt =================================================================== RCS file: /cvsroot/spambayes/spambayes/WHAT_IS_NEW.txt,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** WHAT_IS_NEW.txt 12 Apr 2004 01:41:34 -0000 1.32 --- WHAT_IS_NEW.txt 3 May 2004 03:13:12 -0000 1.33 *************** *** 11,16 **** changes" section. ! New in Beta Release 1 ! ===================== -------------------------- --- 11,16 ---- changes" section. ! New in Release 1.0 ! ================== -------------------------- *************** *** 18,32 **** -------------------------- ! o The 'flat' or interchange format used by the sb_dbexpimp.py script has ! changed to CSV (comma-separated-values, as popularised by Microsoft ! Excel), rather than the old '`' separated format. If you have any ! existing files in the old format, you should use the old 1.0a9 script to ! convert these back to a pickle (or some other format), and then use the ! new script to convert them to CSV (if desired). This change should ! alleviate problems with some unicode characters in the database, and ! make it easier for other programs (such as Excel) to use the exported ! database. ! ! There should be no other incompatible changes (from 1.0a9) in this release. --- 18,22 ---- -------------------------- ! There should be no incompatible changes (from 1.0b1) in this release. *************** *** 37,110 **** Outlook Plugin -------------- ! o Various minor improvements. ! ! POP3 Proxy / SMTP Proxy ! ----------------------- ! o Fix an error that stopped the SMTP proxy working at all in many cases. ! ! Web Interface ! ------------- ! o The pre-filled out bug reports have been simplified somewhat, and ! the readability of the resulting message has been improved. ! o If a single choice was made for the "Notate To" or "Notate Subject" ! options, the configuration page would in future present that option ! with radio buttons instead of checkboxes, meaning that the option ! could not be turned off, and that adding an extra choice could not be ! made. This has been fixed. ! o Messages stored in the cache directories are 'expired' after a certain ! number of days, to save space. This occurs when launching sb_server ! and when executing a POP3 USER command (for those that have very long ! running instances of sb_server). When a message was due to expire on ! the USER command check (rather than on launch), sb_server would ! incorrectly attempt to (un)train the message, resulting in a loss of ! training data or a "can't find this file" error, depending on whether ! the message was in memory. This is now fixed. ! ! POP3 Proxy Service / POP3 Proxy Tray Application ! ------------------------------------------------ ! o The POP3 Proxy service was left out of the 1.0a9 installer, although ! it was present in the source archive. This has been corrected. IMAP Filter ----------- ! o The filter better handles invalid messages. ! o The filter should leave the "Seen" status of messages alone with ! more IMAP servers than previously. ! ! sb_filter ! --------- ! o Improved speed when using sb_filter.py to process an entire mailbox. ! ! Tokenizer ! --------- ! o Collect all potential MTA complaints, not just sendmail's ! "may be forged". General ------- ! o Added new flags and results data to the contrib/tte.py script. ! o Added a new script - sb_bnfilter.py, which works like sb_filter ! but avoids startup overhead (like sb_xmlrpcserver.py aims to, but ! without as much administration work). Transition ========== ! If you are transitioning from a version older than 1.0a9, please also read the notes in the previous release notes (accessible from ). - o To take advantage of improvements in the tokenizing engine at the core - of SpamBayes, you may wish to do a full retrain; this is not necessary, - however. - - See also the changes listed in "Incompatible changes" at the top of - this document. - Reported Bugs Fixed =================== The following bugs tracked via the Sourceforge system were fixed: ! 851785, 906581, 737967, 895606 A URL containing the details of these bugs can be made by appending the --- 27,58 ---- Outlook Plugin -------------- ! o Default buttons in some dialogs have been corrected. IMAP Filter ----------- ! o The code that allows the filter to keep going when a message cannot ! be parsed correctly has been strengthened. If the filter crashed ! with a "TypeError" when processing some messages, this should fix ! that problem. ! o If the move_trained_[ham|spam]_to_folder options were used, this ! would wipe out the SpamBayes headers. This is now fixed. General ------- ! o Added -R/--reverse flag to tte.py ! o Fix an error that stopped the notes filter working at all in many cases. Transition ========== ! If you are transitioning from a version older than 1.0b1, please read the notes in the previous release notes (accessible from ). Reported Bugs Fixed =================== The following bugs tracked via the Sourceforge system were fixed: ! 940155, 941596 A URL containing the details of these bugs can be made by appending the *************** *** 118,130 **** release. Patches integrated =================== ! The following patches tracked via the Sourceforge system were integrated ! for this release: ! 797579, 848311 - A url containing the details of these feature requests can be made by - appending the request number to this url: - http://sourceforge.net/tracker/index.php?func=detail&group_id=61702&atid=498105&aid= Newly Deprecated Options --- 66,75 ---- release. + Patches integrated =================== ! No patches tracked via the Sourceforge system were integrated for this ! release. Newly Deprecated Options *************** *** 145,150 **** not using any newly deprecated options. ! Discussion of why any particular option has been deprecated can be found in ! the spambayes-dev archives (at ). No options have been deprecated in this release. --- 90,96 ---- not using any newly deprecated options. ! Discussion regarding the deprecation of any particular option can be found ! in the spambayes-dev archives (at ! ). No options have been deprecated in this release. From mhammond at users.sourceforge.net Mon May 3 19:21:02 2004 From: mhammond at users.sourceforge.net (Mark Hammond) Date: Mon May 3 19:21:06 2004 Subject: [Spambayes-checkins] spambayes/Outlook2000 msgstore.py,1.85,1.86 Message-ID: Update of /cvsroot/spambayes/spambayes/Outlook2000 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30496 Modified Files: msgstore.py Log Message: Fix [ 918157 ] "Could not watch the specified folders". msgstore.IsReceiveFolder() would fail on an exchange server. Index: msgstore.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/Outlook2000/msgstore.py,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** msgstore.py 7 Mar 2004 01:58:38 -0000 1.85 --- msgstore.py 3 May 2004 23:21:00 -0000 1.86 *************** *** 628,634 **** def IsReceiveFolder(self, msg_class = "IPM.Note"): # Is this folder the nominated "receive folder" for its store? ! mapi_store = self.msgstore._GetMessageStore(self.id[0]) ! eid, ret_class = mapi_store.GetReceiveFolder(msg_class, 0) ! return mapi_store.CompareEntryIDs(eid, self.id[1]) def CreateFolder(self, name, comments = None, type = None, --- 628,639 ---- def IsReceiveFolder(self, msg_class = "IPM.Note"): # Is this folder the nominated "receive folder" for its store? ! try: ! mapi_store = self.msgstore._GetMessageStore(self.id[0]) ! eid, ret_class = mapi_store.GetReceiveFolder(msg_class, 0) ! return mapi_store.CompareEntryIDs(eid, self.id[1]) ! except pythoncom.com_error: ! # Error getting the receive folder from the store (or maybe our ! # store - but that would be insane!). Either way, we can't be it! ! return False def CreateFolder(self, name, comments = None, type = None, From mhammond at users.sourceforge.net Mon May 3 21:56:37 2004 From: mhammond at users.sourceforge.net (Mark Hammond) Date: Mon May 3 21:56:41 2004 Subject: [Spambayes-checkins] spambayes/Outlook2000 config.py,1.29,1.30 Message-ID: Update of /cvsroot/spambayes/spambayes/Outlook2000 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24962/Outlook2000 Modified Files: config.py Log Message: Add help-text for the 'verbose' option, so popup tooltips work for it. Index: config.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/Outlook2000/config.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** config.py 22 Dec 2003 03:13:33 -0000 1.29 --- config.py 4 May 2004 01:56:34 -0000 1.30 *************** *** 105,109 **** MSG_READ_STATE, RESTORE), ("verbose", "Changes the verbosity of the debug output from the program", 0, ! """""", INTEGER, RESTORE), ), --- 105,109 ---- MSG_READ_STATE, RESTORE), ("verbose", "Changes the verbosity of the debug output from the program", 0, ! """Indicates how much information is written to the SpamBayes log file.""", INTEGER, RESTORE), ), From mhammond at users.sourceforge.net Mon May 3 22:06:53 2004 From: mhammond at users.sourceforge.net (Mark Hammond) Date: Mon May 3 22:06:56 2004 Subject: [Spambayes-checkins] spambayes/windows spambayes.iss,1.14,1.15 Message-ID: Update of /cvsroot/spambayes/spambayes/windows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27725 Modified Files: spambayes.iss Log Message: Towards 1.0rc1 Index: spambayes.iss =================================================================== RCS file: /cvsroot/spambayes/spambayes/windows/spambayes.iss,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** spambayes.iss 13 Apr 2004 04:11:35 -0000 1.14 --- spambayes.iss 4 May 2004 02:06:51 -0000 1.15 *************** *** 5,11 **** [Setup] ; Version specific constants ! AppVerName=SpamBayes 1.0b1 ! AppVersion=0.991 ! OutputBaseFilename=spambayes-1.0b1 ; Normal constants. Be careful about changing 'AppName' AppName=SpamBayes --- 5,11 ---- [Setup] ; Version specific constants ! AppVerName=SpamBayes 1.0rc1 ! AppVersion=0.992 ! OutputBaseFilename=spambayes-1.0rc1 ; Normal constants. Be careful about changing 'AppName' AppName=SpamBayes From mhammond at users.sourceforge.net Tue May 4 00:24:13 2004 From: mhammond at users.sourceforge.net (Mark Hammond) Date: Tue May 4 00:24:16 2004 Subject: [Spambayes-checkins] spambayes/spambayes Version.py,1.29,1.30 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19284 Modified Files: Version.py Log Message: Version 1.0rc1 Index: Version.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/Version.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Version.py 13 Apr 2004 03:32:47 -0000 1.29 --- Version.py 4 May 2004 04:24:10 -0000 1.30 *************** *** 40,50 **** # 0.99 indicates '1.0b/rc/' so will go 0.992 etc, until a real # 1.0, which can get 1.0 :) ! "Version": 0.991, ! "BinaryVersion": 0.991, "Description": "SpamBayes Outlook Addin", ! "Date": "April 2004", ! "Full Description": "%(Description)s Version 1.0b1 (%(Date)s)", "Full Description Binary": ! "%(Description)s Binary Version 1.0b1 (%(Date)s)", # Note this means we can change the download page later, and old # versions will still go to the new page. --- 40,50 ---- # 0.99 indicates '1.0b/rc/' so will go 0.992 etc, until a real # 1.0, which can get 1.0 :) ! "Version": 0.992, ! "BinaryVersion": 0.992, "Description": "SpamBayes Outlook Addin", ! "Date": "May 2004", ! "Full Description": "%(Description)s Version 1.0rc1 (%(Date)s)", "Full Description Binary": ! "%(Description)s Binary Version 1.0rc1 (%(Date)s)", # Note this means we can change the download page later, and old # versions will still go to the new page. *************** *** 55,65 **** # Note these version numbers also currently don't appear in the # "description" strings below - see above ! "Version": 0.5, ! "BinaryVersion": 0.5, "Description": "SpamBayes POP3 Proxy", ! "Date": "April 2004", ! "Full Description": """%(Description)s Version 1.0b1 (%(Date)s)""", "Full Description Binary": ! """%(Description)s Binary Version 1.0b1 (%(Date)s)""", # Note this means we can change the download page later, and old # versions will still go to the new page. --- 55,65 ---- # Note these version numbers also currently don't appear in the # "description" strings below - see above ! "Version": 0.6, ! "BinaryVersion": 0.6, "Description": "SpamBayes POP3 Proxy", ! "Date": "May 2004", ! "Full Description": """%(Description)s Version 1.0rc1 (%(Date)s)""", "Full Description Binary": ! """%(Description)s Binary Version 1.0rc1 (%(Date)s)""", # Note this means we can change the download page later, and old # versions will still go to the new page. From anadelonbrin at users.sourceforge.net Tue May 4 00:26:14 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Tue May 4 00:26:17 2004 Subject: [Spambayes-checkins] spambayes/spambayes Version.py,1.30,1.31 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19531/spambayes Modified Files: Version.py Log Message: imapfilter has changed quite a bit, too - at least several bugs have been fixed, so bump it's version as well. Index: Version.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/Version.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Version.py 4 May 2004 04:24:10 -0000 1.30 --- Version.py 4 May 2004 04:26:12 -0000 1.31 *************** *** 74,80 **** }, "IMAP Filter" : { ! "Version": 0.3, "Description": "SpamBayes IMAP Filter", ! "Date": "April 2004", "Full Description": """%(Description)s Version %(Version)s (%(Date)s)""", }, --- 74,80 ---- }, "IMAP Filter" : { ! "Version": 0.4, "Description": "SpamBayes IMAP Filter", ! "Date": "May 2004", "Full Description": """%(Description)s Version %(Version)s (%(Date)s)""", }, From anadelonbrin at users.sourceforge.net Tue May 4 00:30:04 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Tue May 4 00:30:07 2004 Subject: [Spambayes-checkins] spambayes CHANGELOG.txt, 1.42, 1.43 WHAT_IS_NEW.txt, 1.33, 1.34 Message-ID: Update of /cvsroot/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20310 Modified Files: CHANGELOG.txt WHAT_IS_NEW.txt Log Message: Last one before 1.0rc1 (bring up to date) Index: CHANGELOG.txt =================================================================== RCS file: /cvsroot/spambayes/spambayes/CHANGELOG.txt,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** CHANGELOG.txt 3 May 2004 03:13:12 -0000 1.42 --- CHANGELOG.txt 4 May 2004 04:30:02 -0000 1.43 *************** *** 3,6 **** --- 3,7 ---- Final Release 1 =============== + Mark Hammond 04/05/2004 Fix [ 918157 ] "Could not watch the specified folders". msgstore.IsReceiveFolder() would fail on an exchange server. Tony Meyer 03/05/2004 Temporary fix for [ 941596 ] sb_imapfilter.py not adding headers / moving messages Tony Meyer 03/05/2004 imapfilter: catch any exceptions, not just email.Errors Index: WHAT_IS_NEW.txt =================================================================== RCS file: /cvsroot/spambayes/spambayes/WHAT_IS_NEW.txt,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** WHAT_IS_NEW.txt 3 May 2004 03:13:12 -0000 1.33 --- WHAT_IS_NEW.txt 4 May 2004 04:30:02 -0000 1.34 *************** *** 54,58 **** =================== The following bugs tracked via the Sourceforge system were fixed: ! 940155, 941596 A URL containing the details of these bugs can be made by appending the --- 54,58 ---- =================== The following bugs tracked via the Sourceforge system were fixed: ! 940155, 941596, 918157 A URL containing the details of these bugs can be made by appending the From montanaro at users.sourceforge.net Tue May 4 07:19:40 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Tue May 4 07:19:44 2004 Subject: [Spambayes-checkins] spambayes/spambayes mboxutils.py,1.4,1.5 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28208 Modified Files: mboxutils.py Log Message: Added as_string() - a function which attempts to work around problems flatten()-ing some Message objects in versions of the email package < 2.5.5. Index: mboxutils.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/mboxutils.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mboxutils.py 15 Dec 2003 13:58:49 -0000 1.4 --- mboxutils.py 4 May 2004 11:19:37 -0000 1.5 *************** *** 137,140 **** --- 137,176 ---- return msg + def as_string(msg, unixfrom=False): + """Convert a Message object to a string in a safe-ish way. + + In email pkg version 2.5.4 and earlier, msg.as_string() can raise + TypeError for some malformed messages. This catches that and attempts + to return something approximating the original message. + + To Do: This really should be done by subclassing email.Message.Message + and making this function the as_string() method. After 1.0. + """ + if isinstance(msg, str): + return msg + try: + return msg.as_string(unixfrom) + except TypeError: + ty, val, tb = sys.exc_info() + exclines = traceback.format_exception(ty, val, tb)[1:] + excstr = " ".join(exclines).strip() + headers = [] + if unixfrom: + headers.append(msg.get_unixfrom()) + for hdr in msg.keys(): + for val in msg.get_all(hdr): + headers.append("%s: %s" % (hdr, val)) + headers.append("X-Spambayes-Exception: %s" % excstr) + parts = ["%s\n" % "\n".join(headers)] + boundary = msg.get_boundary() + for part in msg.get_payload(): + if boundary: + parts.append(boundary) + parts.append(part.as_string()) + if boundary: + parts.append("--%s--" % boundary) + return "\n".join(parts) + + header_break_re = re.compile(r"\r?\n(\r?\n)") From montanaro at users.sourceforge.net Tue May 4 08:58:56 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Tue May 4 08:59:01 2004 Subject: [Spambayes-checkins] spambayes/spambayes mboxutils.py,1.5,1.6 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14691 Modified Files: mboxutils.py Log Message: add missing traceback import (was testing as_string() in situ) make sure message ends w/ newline Index: mboxutils.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/mboxutils.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mboxutils.py 4 May 2004 11:19:37 -0000 1.5 --- mboxutils.py 4 May 2004 12:58:54 -0000 1.6 *************** *** 28,31 **** --- 28,32 ---- import email.Message import re + import traceback class DirOfTxtFileMailbox: *************** *** 170,174 **** if boundary: parts.append("--%s--" % boundary) ! return "\n".join(parts) --- 171,176 ---- if boundary: parts.append("--%s--" % boundary) ! # make sure it ends with a newline: ! return "\n".join(parts)+"\n" From montanaro at users.sourceforge.net Tue May 4 09:02:10 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Tue May 4 09:02:14 2004 Subject: [Spambayes-checkins] spambayes/spambayes hammie.py,1.14,1.15 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15608 Modified Files: hammie.py Log Message: use mboxutils.as_string() to more robustly flatten messages (this occurrence affects sb_filter.py) Index: hammie.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/hammie.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** hammie.py 5 Feb 2004 08:13:27 -0000 1.14 --- hammie.py 4 May 2004 13:02:08 -0000 1.15 *************** *** 144,148 **** del msg[debugheader] msg.add_header(debugheader, disp) ! return msg.as_string(unixfrom=(msg.get_unixfrom() is not None)) def train(self, msg, is_spam, add_header=False): --- 144,150 ---- del msg[debugheader] msg.add_header(debugheader, disp) ! result = mboxutils.as_string(msg, unixfrom=(msg.get_unixfrom() ! is not None)) ! return result def train(self, msg, is_spam, add_header=False): From montanaro at users.sourceforge.net Tue May 4 09:02:54 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Tue May 4 09:02:58 2004 Subject: [Spambayes-checkins] spambayes/scripts sb_filter.py,1.13,1.14 Message-ID: Update of /cvsroot/spambayes/spambayes/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15727 Modified Files: sb_filter.py Log Message: use mboxutils.as_string() to more robustly flatten Message objects Index: sb_filter.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_filter.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** sb_filter.py 11 Feb 2004 14:55:47 -0000 1.13 --- sb_filter.py 4 May 2004 13:02:51 -0000 1.14 *************** *** 251,255 **** else: unixfrom = True ! sys.stdout.write(msg.as_string(unixfrom=unixfrom)) if __name__ == "__main__": --- 251,256 ---- else: unixfrom = True ! result = mboxutils.as_string(msg, unixfrom=unixfrom) ! sys.stdout.write(result) if __name__ == "__main__": From montanaro at users.sourceforge.net Tue May 4 09:03:52 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Tue May 4 09:04:00 2004 Subject: [Spambayes-checkins] spambayes/scripts sb_bnserver.py,1.1,1.2 Message-ID: Update of /cvsroot/spambayes/spambayes/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15887 Modified Files: sb_bnserver.py Log Message: use mboxutils.as_string() to more robustly flatten Message objects Index: sb_bnserver.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_bnserver.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sb_bnserver.py 13 Apr 2004 13:22:45 -0000 1.1 --- sb_bnserver.py 4 May 2004 13:03:47 -0000 1.2 *************** *** 152,156 **** for action in actions: action(msg) ! return msg.as_string(1) --- 152,156 ---- for action in actions: action(msg) ! return mboxutils.as_string(msg, 1) From montanaro at users.sourceforge.net Tue May 4 09:29:40 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Tue May 4 09:29:43 2004 Subject: [Spambayes-checkins] spambayes/spambayes mboxutils.py,1.6,1.7 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20982 Modified Files: mboxutils.py Log Message: * keys() for messages doesn't work quite the way it does for other mapping objects - use items() instead. * handle parts which are strings. Index: mboxutils.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/mboxutils.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mboxutils.py 4 May 2004 12:58:54 -0000 1.6 --- mboxutils.py 4 May 2004 13:29:34 -0000 1.7 *************** *** 159,165 **** if unixfrom: headers.append(msg.get_unixfrom()) ! for hdr in msg.keys(): ! for val in msg.get_all(hdr): ! headers.append("%s: %s" % (hdr, val)) headers.append("X-Spambayes-Exception: %s" % excstr) parts = ["%s\n" % "\n".join(headers)] --- 159,164 ---- if unixfrom: headers.append(msg.get_unixfrom()) ! for (hdr, val) in msg.items(): ! headers.append("%s: %s" % (hdr, val)) headers.append("X-Spambayes-Exception: %s" % excstr) parts = ["%s\n" % "\n".join(headers)] *************** *** 168,172 **** if boundary: parts.append(boundary) ! parts.append(part.as_string()) if boundary: parts.append("--%s--" % boundary) --- 167,174 ---- if boundary: parts.append(boundary) ! try: ! parts.append(part.as_string()) ! except AttributeError: ! parts.append(str(part)) if boundary: parts.append("--%s--" % boundary) From anadelonbrin at users.sourceforge.net Tue May 4 20:37:10 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Tue May 4 20:37:14 2004 Subject: [Spambayes-checkins] spambayes CHANGELOG.txt, 1.43, 1.44 WHAT_IS_NEW.txt, 1.34, 1.35 Message-ID: Update of /cvsroot/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1666 Modified Files: CHANGELOG.txt WHAT_IS_NEW.txt Log Message: Better naming and add Skip's sb_filter (etc) fix. Index: CHANGELOG.txt =================================================================== RCS file: /cvsroot/spambayes/spambayes/CHANGELOG.txt,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** CHANGELOG.txt 4 May 2004 04:30:02 -0000 1.43 --- CHANGELOG.txt 5 May 2004 00:37:07 -0000 1.44 *************** *** 1,6 **** [Note that all dates are in English, not American format - i.e. day/month/year] ! Final Release 1 ! =============== Mark Hammond 04/05/2004 Fix [ 918157 ] "Could not watch the specified folders". msgstore.IsReceiveFolder() would fail on an exchange server. Tony Meyer 03/05/2004 Temporary fix for [ 941596 ] sb_imapfilter.py not adding headers / moving messages --- 1,8 ---- [Note that all dates are in English, not American format - i.e. day/month/year] ! Release Candidate 1 ! =================== ! Skip Montanaro 05/05/2004 sb_filter, sb_bnfilter use new mboxutils as_string(). ! Skip Montanaro 04/05/2004 mboxutils: Added as_string() - a function which attempts to work around problems flatten()-ing some Message objects in versions of the email package < 2.5.5. Mark Hammond 04/05/2004 Fix [ 918157 ] "Could not watch the specified folders". msgstore.IsReceiveFolder() would fail on an exchange server. Tony Meyer 03/05/2004 Temporary fix for [ 941596 ] sb_imapfilter.py not adding headers / moving messages Index: WHAT_IS_NEW.txt =================================================================== RCS file: /cvsroot/spambayes/spambayes/WHAT_IS_NEW.txt,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** WHAT_IS_NEW.txt 4 May 2004 04:30:02 -0000 1.34 --- WHAT_IS_NEW.txt 5 May 2004 00:37:07 -0000 1.35 *************** *** 11,16 **** changes" section. ! New in Release 1.0 ! ================== -------------------------- --- 11,16 ---- changes" section. ! New in 1.0 Release Candiate 1 ! ============================= -------------------------- *************** *** 42,45 **** --- 42,47 ---- o Added -R/--reverse flag to tte.py o Fix an error that stopped the notes filter working at all in many cases. + o sb_filter and sb_bnfilter now better handle messages that fail to + correctly parse. From anadelonbrin at users.sourceforge.net Tue May 4 20:38:24 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Tue May 4 20:38:27 2004 Subject: [Spambayes-checkins] spambayes/spambayes __init__.py,1.10,1.11 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1867/spambayes Modified Files: __init__.py Log Message: 1.0rc1 Index: __init__.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/__init__.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** __init__.py 13 Apr 2004 04:51:37 -0000 1.10 --- __init__.py 5 May 2004 00:38:22 -0000 1.11 *************** *** 1,3 **** # package marker. ! __version__ = '1.0b1' --- 1,3 ---- # package marker. ! __version__ = '1.0rc1' From mhammond at users.sourceforge.net Wed May 5 02:49:22 2004 From: mhammond at users.sourceforge.net (Mark Hammond) Date: Wed May 5 02:49:26 2004 Subject: [Spambayes-checkins] website index.ht, 1.32, 1.33 download.ht, 1.24, 1.25 windows.ht, 1.36, 1.37 Message-ID: Update of /cvsroot/spambayes/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29216 Modified Files: index.ht download.ht windows.ht Log Message: Version 1.0rc1 Index: index.ht =================================================================== RCS file: /cvsroot/spambayes/website/index.ht,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** index.ht 13 Apr 2004 05:11:24 -0000 1.32 --- index.ht 5 May 2004 06:49:20 -0000 1.33 *************** *** 5,9 ****

News

!

The first beta version of SpamBayes (both source and Windows binary installer) is now available!

See the download page for more.

--- 5,9 ----

News

!

The Version 1.0 release candidate (both source and Windows binary installer) is now available!

See the download page for more.

Index: download.ht =================================================================== RCS file: /cvsroot/spambayes/website/download.ht,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** download.ht 13 Apr 2004 06:15:56 -0000 1.24 --- download.ht 5 May 2004 06:49:20 -0000 1.25 *************** *** 3,10 **** Author: SpamBayes !

Beta release 1 of version 1.0 of the SpamBayes project is now available.

This release is primarily to shake out those last few bugs on the way to a final 1.0 release. Feedback to spambayes@python.org.

Microsoft Windows

Microsoft Windows users are encouraged to use the installation program to --- 3,14 ---- Author: SpamBayes !

Version 1.0 (Release Candidate 1) of the SpamBayes project is now available.

This release is primarily to shake out those last few bugs on the way to a final 1.0 release. Feedback to spambayes@python.org. +

You may like to view the release notes + or the files that make up this release. +

Microsoft Windows

Microsoft Windows users are encouraged to use the installation program to Index: windows.ht =================================================================== RCS file: /cvsroot/spambayes/website/windows.ht,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** windows.ht 13 Apr 2004 05:11:24 -0000 1.36 --- windows.ht 5 May 2004 06:49:20 -0000 1.37 *************** *** 11,17 ****

Latest Release

!

The latest release is 1.0b1 - see the ! release notes ! or download the installation program.

--- 11,17 ----

Latest Release

!

The latest release is 1.0rc1 - see the ! release notes ! or download the installation program.

*************** *** 74,78 ****

Windows users using other mail clients and retrieving mail via POP3 can now download the same ! installation program and use it to install a binary version of sb_server, including a tray application.

--- 74,78 ----

Windows users using other mail clients and retrieving mail via POP3 can now download the same ! installation program and use it to install a binary version of sb_server, including a tray application.

From anadelonbrin at users.sourceforge.net Wed May 5 03:42:15 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Wed May 5 03:42:22 2004 Subject: [Spambayes-checkins] website applications.ht,1.27,1.28 Message-ID: Update of /cvsroot/spambayes/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6022 Modified Files: applications.ht Log Message: Version 1.0rc1 Index: applications.ht =================================================================== RCS file: /cvsroot/spambayes/website/applications.ht,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** applications.ht 13 Apr 2004 05:11:24 -0000 1.27 --- applications.ht 5 May 2004 07:42:09 -0000 1.28 *************** *** 4,15 ****

Applications

!

A number of applications are available in the SpamBayes project. Not ! all of these are particularly polished, finished pieces of work, but ! they're getting there (and help is always appreciated). !

Outlook

Sean True and Mark Hammond have developed an addin for Outlook (2000 and XP) that ! adds support for the spambayes classifier.

Requirements

    --- 4,14 ----

    Applications

    !

    A number of applications are available in the SpamBayes project. ! Which application is right for you depends on which operating system, ! mail client, and mail delivery system you use.

    Outlook

    Sean True and Mark Hammond have developed an addin for Outlook (2000 and XP) that ! adds support for the SpamBayes classifier.

    Requirements

      *************** *** 29,33 ****

      Mark has packaged together an installer for the plugin. Go to the Windows page for more.

      !

      Download the beta1 release.

      Alternatively, you can use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      --- 28,32 ----

      Mark has packaged together an installer for the plugin. Go to the Windows page for more.

      !

      Alternatively, to run from source, download 1.0 release candidate 1.

      Alternatively, you can use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      *************** *** 45,49 ****

      Availability

      !

      Download the beta1 release.

      Alternatively, use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      --- 44,48 ----

      Availability

      !

      Download 1.0 release candidate 1.

      Alternatively, use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      *************** *** 60,66 ****

      Availability

      !

      Windows users can now download an installer for a binary version of sb_server, ! including a tray application to access it. Download the beta1 release.

      !

      Alternatively, to run from source, download the beta1 release.

      Alternatively, use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      --- 59,66 ----

      Availability

      !

      Windows users can now download an installer ! for a binary version of sb_server, including a tray application to access ! it.

      !

      Alternatively, to run from source, download 1.0 release candidate 1.

      Alternatively, use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      *************** *** 77,81 ****

      Availability

      !

      Download the beta1 release.

      Alternatively, use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      --- 77,81 ----

      Availability

      !

      Download 1.0 release candidate 1.

      Alternatively, use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      *************** *** 93,97 ****

      Availability

      !

      Download the beta1 release.

      Alternatively, use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      --- 93,97 ----

      Availability

      !

      Download 1.0 release candidate 1.

      Alternatively, use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      *************** *** 111,114 ****

      Availability

      !

      Download the beta1 release.

      Alternatively, use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      --- 111,114 ----

      Availability

      !

      Download 1.0 release candidate 1.

      Alternatively, use CVS to get the code - go to the CVS page on the project's sourceforge site for more.

      From htrd at users.sourceforge.net Wed May 5 17:31:54 2004 From: htrd at users.sourceforge.net (Toby Dickenson) Date: Wed May 5 17:31:58 2004 Subject: [Spambayes-checkins] spambayes/src - New directory Message-ID: Update of /cvsroot/spambayes/spambayes/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24018/src Log Message: Directory /cvsroot/spambayes/spambayes/src added to the repository From htrd at users.sourceforge.net Wed May 5 17:58:47 2004 From: htrd at users.sourceforge.net (Toby Dickenson) Date: Wed May 5 17:58:51 2004 Subject: [Spambayes-checkins] spambayes/scripts sb_bnfilter.py, 1.2, 1.2.2.1 sb_bnserver.py, 1.2, 1.2.2.1 Message-ID: Update of /cvsroot/spambayes/spambayes/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29733/scripts Modified Files: Tag: bnfilter_in_c_branch sb_bnfilter.py sb_bnserver.py Log Message: first add of c implementation of sb_bnfilter. tweak python version to minimise differences between the two. enable psyco in sb_bnserver Index: sb_bnfilter.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_bnfilter.py,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** sb_bnfilter.py 20 Apr 2004 09:25:59 -0000 1.2 --- sb_bnfilter.py 5 May 2004 21:58:44 -0000 1.2.2.1 *************** *** 75,78 **** --- 75,82 ---- -A number terminate this server after this many requests + -y + inhibit psyco. By default Psyco is used if installed. + Psyco is a Python optimiser; see http://psyco.sourceforge.net/ + [all Psycho usage is EXPERIMENTAL] """ *************** *** 90,94 **** def main(): try: ! opts, args = getopt.getopt(sys.argv[1:], 'hfgstGSd:p:o:a:A:k:') except getopt.error, msg: usage(2, msg) --- 94,98 ---- def main(): try: ! opts, args = getopt.getopt(sys.argv[1:], 'hfgstGSd:p:o:a:A:k:y') except getopt.error, msg: usage(2, msg) *************** *** 107,110 **** --- 111,116 ---- server_options.append(opt) server_options.append(arg) + elif opt in ('-y',): + server_options.append(opt) elif opt == '-k': filename = arg *************** *** 198,202 **** else: return s ! def fork_server(options): if os.fork(): --- 204,208 ---- else: return s ! def fork_server(options): if os.fork(): *************** *** 213,222 **** # Use exec rather than import here because eventually it may be nice to # reimplement this one file in C ! os.execv(sys.executable,[sys.executable, ! os.path.join(os.path.split(sys.argv[0])[0], ! 'sb_bnserver.py') ]+options) # should never get here sys._exit(1) ! if __name__ == "__main__": --- 219,236 ---- # Use exec rather than import here because eventually it may be nice to # reimplement this one file in C ! os.execvp('python',['python',find_server()]+options) # should never get here sys._exit(1) ! ! def find_server(): ! base = os.path.split(sys.argv[0])[0] ! for suffix in ("../libexec/sb_bnserver.py", ! "../scripts/sb_bnserver.py", ! "sb_bnserver.py"): ! path = os.path.join(base,suffix) ! if os.path.exists(path): ! return path ! # drop-through means we didnt find one ! raise EnvironmentError('cant find sb_sbserver.py') if __name__ == "__main__": Index: sb_bnserver.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_bnserver.py,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** sb_bnserver.py 4 May 2004 13:03:47 -0000 1.2 --- sb_bnserver.py 5 May 2004 21:58:44 -0000 1.2.2.1 *************** *** 52,56 **** """Main program; parse options and go.""" try: ! opts, args = getopt.getopt(sys.argv[1:], 'hd:p:o:a:A:') except getopt.error, msg: usage(2, msg) --- 52,56 ---- """Main program; parse options and go.""" try: ! opts, args = getopt.getopt(sys.argv[1:], 'hd:p:o:a:A:y') except getopt.error, msg: usage(2, msg) *************** *** 72,75 **** --- 72,76 ---- from spambayes import Options, storage options = Options.options + use_psyco = 1 for opt, arg in opts: *************** *** 82,88 **** --- 83,97 ---- elif opt == '-A': server.number = int(arg) + elif opt == '-y': + use_psyco = 0 h = make_HammieFilter() h.dbname, h.usedb = storage.database_type(opts) server.hammie = h + if use_psyco: + try: + import psyco + psyco.full() + except ImportError: + pass server.serve_until_idle() h.close() From htrd at users.sourceforge.net Wed May 5 17:58:47 2004 From: htrd at users.sourceforge.net (Toby Dickenson) Date: Wed May 5 17:58:52 2004 Subject: [Spambayes-checkins] spambayes/src sb_bnfilter.c,NONE,1.1.2.1 Message-ID: Update of /cvsroot/spambayes/spambayes/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29733/src Added Files: Tag: bnfilter_in_c_branch sb_bnfilter.c Log Message: first add of c implementation of sb_bnfilter. tweak python version to minimise differences between the two. enable psyco in sb_bnserver --- NEW FILE: sb_bnfilter.c --- #include #include #include #include #include #include #include extern char *optarg; extern int optind; #define ARGV_FOR_SERVER_LEN 30 const char *argv_for_server[ARGV_FOR_SERVER_LEN]; int argv_for_server_len = 0; const char *socket_filename = NULL; #define CMDLINE_FOR_ACTION_LEN 1024 char cmdline_for_action[CMDLINE_FOR_ACTION_LEN] = ""; int cmdline_for_action_len = 0; static void usage(int code,const char *message) { if(message) { fputs(message,stderr); } fprintf(stderr,"FIXME: usage info goes in here\n"); exit(code); } static void add_argv_to_server(const char *a) { if(argv_for_server_len+2 > ARGV_FOR_SERVER_LEN) { usage(2, "Error: too many arguments for server\n"); } argv_for_server[argv_for_server_len+0] = a; argv_for_server[argv_for_server_len+1] = NULL; ++argv_for_server_len; } static void add_argv_to_action(const char *a) { int length = strlen(a); if(cmdline_for_action_len+2+length > CMDLINE_FOR_ACTION_LEN) { usage(2, "Error: too many arguments for action\n"); } if(cmdline_for_action_len) { cmdline_for_action[cmdline_for_action_len++] = ' '; } strcpy(cmdline_for_action+cmdline_for_action_len, a); cmdline_for_action_len += length; } static int exists(const char *filename) { struct stat junk_stat_buf; if(stat(filename,&junk_stat_buf)) { if(errno==ENOENT) { return 0; } } return 1; } static const char *find_server(const char *filter) { /* where might our server be, relative to this program ? */ const char *suffix1 = "../libexec/sb_bnserver.py"; /* in /usr/libexec. I guess thats the right place when installed */ const char *suffix2 = "../scripts/sb_bnserver.py"; /* running from cvs checkout, and compiled into the same directory as our source */ const char *suffix3 = "sb_bnserver.py"; /* in /usr/bin. not ideal, but likely to happen anyway */ int i = strlen(filter); char *server = malloc(i+strlen(suffix1)+1); /* suffix1 is the longest */ if(!server) { perror("malloc of server filename"); exit(3); } /* copy the filter filename */ strcpy(server,filter); /* find the position of the trailing directory seperator, or the start of the string if there isnt one */ for(;i>0;--i) { if(server[i-1]=='/') break; } /* try each one in turn */ strcpy(server+i,suffix1); if(exists(server)) return server; strcpy(server+i,suffix2); if(exists(server)) return server; strcpy(server+i,suffix3); if(exists(server)) return server; fprintf(stderr,"Cant find sb_bnserver.py\n"); exit(3); } static void init_socket_filename() { char hostname[256]; const char *home = getenv("HOME"); const char *intermediate = "/.sbbnsock-"; char *filename; if(!home) { usage(3,"HOME environment variable not defined"); } if(gethostname(hostname,256)) { perror("gethostname"); exit(3); } socket_filename = filename = malloc(strlen(hostname)+strlen(intermediate)+strlen(home)+1); if(!socket_filename) { perror("malloc of socket_filename"); exit(3); } strcpy(filename,home); strcat(filename,intermediate); strcat(filename,hostname); } static void process_argv(int argc,const char **argv) { int opt; while(-1 != (opt = getopt(argc,argv,"hfgstGSd:p:o:a:A:k:y"))) { switch(opt) { case '?': default: usage(2,NULL); break; case 'h': usage(0,NULL); break; case 'd': add_argv_to_server("-d"); add_argv_to_server(optarg); break; case 'p': add_argv_to_server("-p"); add_argv_to_server(optarg); break; case 'o': add_argv_to_server("-o"); add_argv_to_server(optarg); break; case 'a': add_argv_to_server("-a"); add_argv_to_server(optarg); break; case 'A': add_argv_to_server("-A"); add_argv_to_server(optarg); break; case 'y': add_argv_to_server("-y"); break; case 'f': add_argv_to_action("-f"); break; case 'g': add_argv_to_action("-g"); break; case 's': add_argv_to_action("-s"); break; case 't': add_argv_to_action("-t"); break; case 'G': add_argv_to_action("-G"); break; case 'S': add_argv_to_action("-S"); break; case 'k': socket_filename = optarg; break; } } if(optind!=argc) { usage(2, "Error: unrecognised arguments\n"); } } static void fork_server() { if(fork()) { /* parent */ return; } /* child */ close(0); open("/dev/null",O_RDONLY); /*close(1); open("/dev/null",O_WRONLY);*/ setsid(); execvp(argv_for_server[0],argv_for_server); perror("failed to exec python"); } static int make_socket() { int refused_count = 0; int no_server_count = 0; int s; int sleep_time; int saved_errno; struct sockaddr_un addr_un; while(1) { s = socket(AF_UNIX,SOCK_STREAM,0); if(s>=0) { if(strlen(socket_filename)>sizeof(addr_un.sun_path)) { usage(3,"socket name too long"); } addr_un.sun_family = AF_UNIX; memcpy(addr_un.sun_path, socket_filename, sizeof(addr_un.sun_path)); if(!connect(s,(struct sockaddr *)&addr_un,sizeof(addr_un))) { return s; } } /* drop-through means we didnt connect */ saved_errno = errno; if(saved_errno==EAGAIN) { /* baaaah */ } else if(saved_errno == ENOENT || !exists(socket_filename)) { ++no_server_count; if(no_server_count>4) { fprintf(stderr, "Cant see server... sb_bnfilter giving up"); exit(4); } fork_server(); } else if(saved_errno == ECONNREFUSED) { ++refused_count; if(refused_count == 6) { unlink(socket_filename); } if(refused_count>6) { fprintf(stderr, "Cant connect to server... sb_bnfilter giving up\n"); exit(4); } } else { fprintf(stderr, "Unexpected error %d... sb_bnfilter giving up\n", saved_errno); exit(4); } if(refused_count+no_server_count > 2) /* use sleep if sleeping for more than one second */ sleep(1<<(refused_count+no_server_count-2)); else /* use usleep if less */ usleep(200000<<(refused_count+no_server_count)); } } void do_pipe(int s_fd) { int expected_size, total_size=0, error_code; FILE *output; char buf[4096]; FILE *f = fdopen(s_fd,"w+"); fprintf(f,"%s\n",cmdline_for_action); while(!feof(stdin)) { int i = fread(buf,1,4096,stdin); if(ferror(stdin)) { perror("reading from stdin"); exit(3); } if(i!=fwrite(buf,1,i,f)) { perror("writing to pipe"); exit(3); } } if(fflush(f)) { perror("writing to pipe"); exit(3); } shutdown(s_fd,1); if(2!=fscanf(f,"%d\n%d\n",&error_code,&expected_size)) { perror("reading size from pipe"); exit(3); } output = ((error_code)?(stderr):(stdout)); while(!feof(f)) { int i = fread(buf,1,4096,f); if(ferror(f)) { perror("reading from pipe"); exit(3); } if(i!=fwrite(buf,1,i,output)) { perror("writing to output"); exit(3); } total_size += i; } if(fflush(output)) { perror("writing to output"); exit(3); } if(total_size!=expected_size) { fprintf(stderr,"Size mismatch, %d != %d\n", total_size, expected_size); exit(3); } if(error_code) { exit(error_code); } } int main(int argc,const char **argv) { add_argv_to_server("python"); add_argv_to_server(find_server(argv[0])); init_socket_filename(); process_argv(argc,argv); add_argv_to_server(socket_filename); do_pipe(make_socket()); return 0; } From anadelonbrin at users.sourceforge.net Thu May 6 16:42:11 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Thu May 6 16:42:20 2004 Subject: [Spambayes-checkins] spambayes/Outlook2000/docs troubleshooting.html, 1.20, 1.21 Message-ID: Update of /cvsroot/spambayes/spambayes/Outlook2000/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20525/Outlook2000/docs Modified Files: troubleshooting.html Log Message: Fix typo (patch -> path). Change references to using rsgsvr32 with outlook_addin.dll to using our little registration utility instead. Neither I nor many other people can get the regsvr32 method to work these days, but our little utility works nicely. Index: troubleshooting.html =================================================================== RCS file: /cvsroot/spambayes/spambayes/Outlook2000/docs/troubleshooting.html,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** troubleshooting.html 22 Dec 2003 03:13:56 -0000 1.20 --- troubleshooting.html 6 May 2004 20:42:08 -0000 1.21 *************** *** 113,118 ****
    • If the SpamBayes addin is not listed, then SpamBayes should be reinstalled (Note that running regsvr32.exe ! outlook_addin.dll from the SpamBayes directory may also solve ! this problem)
    • If the SpamBayes addin is listed but not checked, then simply check it and close the dialog.
    • --- 113,119 ----
    • If the SpamBayes addin is not listed, then SpamBayes should be reinstalled (Note that running regsvr32.exe ! outlook_addin.dll or ! outlook_addin_register.exe from the SpamBayes directory may also ! solve this problem).
    • If the SpamBayes addin is listed but not checked, then simply check it and close the dialog.
    • *************** *** 249,255 **** To register SpamBayes in this way, you must log on as a user with permissions to modify the system registry, then execute the command ! (obviously with the correct patch substituted):
      !     regsvr32.exe ! /i:hkey_local_machine "c:\Program Files\SpamBayes\bin\outlook_addin.dll"
      If you check the installation log after performing such an install, you should see the following messages:
      --- 250,256 ---- To register SpamBayes in this way, you must log on as a user with permissions to modify the system registry, then execute the command ! (obviously with the correct path substituted):
      !     ! "c:\Program Files\SpamBayes\bin\outlook_addin_register.exe" hkey_local_machine
      If you check the installation log after performing such an install, you should see the following messages:
      From anadelonbrin at users.sourceforge.net Tue May 11 22:08:40 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Tue May 11 22:08:45 2004 Subject: [Spambayes-checkins] spambayes/Outlook2000/dialogs FolderSelector.py, 1.36, 1.37 Message-ID: Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1495/Outlook2000/dialogs Modified Files: FolderSelector.py Log Message: Psts and the main Exchange store have top level folders with parents (with empty display names), and no grandparents. Anything below the top level *does* have a grandparent. This means our test for "top level folder" can be: does it have a parent *and* grandparent. However, a secondary Exchange account doesn't have the empty-display-name parent, so the top-level doesn't have a parent, and the top selectable folder doesn't have a grandparent, and our test fails. Allow for this by checking for the "Access denied" exception when getting the grandparent, and assuming that this means that this is what is happening. This will only fail if we get an 'access denied' error for the empty-display-name parent, which should not be the case. This fixes the "Please select child folder" problem reported by various people on the list. I think it closes a SF bug, but the SF site is down, so I can't check. This would be a good bugfix candidate for 1.0 (or some similar fix, if Mark can think of a better solution in this case). Index: FolderSelector.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/FolderSelector.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** FolderSelector.py 27 Feb 2004 02:59:51 -0000 1.36 --- FolderSelector.py 12 May 2004 02:08:36 -0000 1.37 *************** *** 491,497 **** folder = self.manager.message_store.GetFolder(spec.folder_id) parent = folder.GetParent() ! valid = parent is not None and parent.GetParent() is not None except self.manager.message_store.MsgStoreException, details: ! print "Eeek - couldn't get the folder to check valid" valid = False if not valid: --- 491,523 ---- folder = self.manager.message_store.GetFolder(spec.folder_id) parent = folder.GetParent() ! try: ! # Psts and the main Exchange store have top level ! # folders with parents (with empty display names), ! # and no grandparents. Anything below the top ! # level *does* have a grandparent. This means our ! # test for "top level folder" can be: does it have ! # a parent *and* grandparent. However, a ! # secondary Exchange account doesn't have the ! # empty-display-name parent, so the top-level ! # doesn't have a parent, and the top selectable ! # folder doesn't have a grandparent, and our test ! # fails. Allow for this by checking for the ! # "Access denied" exception when getting the ! # grandparent, and assuming that this means that ! # this is what is happening. This will only fail ! # if we get an 'access denied' error for the ! # empty-display-name parent, which should not be ! # the case. ! grandparent = parent.GetParent() ! except self.manager.message_storeMsgStoreException, details: ! if "0x80070005" in details: ! valid = parent is not None ! else: ! raise # but only down a couple of lines... ! else: ! valid = parent is not None and grandparent is not None except self.manager.message_store.MsgStoreException, details: ! print "Eeek - couldn't get the folder to check " \ ! "valid:", details valid = False if not valid: From anadelonbrin at users.sourceforge.net Thu May 13 00:05:53 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Thu May 13 00:06:07 2004 Subject: [Spambayes-checkins] spambayes/spambayes UserInterface.py, 1.46, 1.47 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29965/spambayes Modified Files: UserInterface.py Log Message: If a user tried to send a bug report before entering in any servers to proxy, this would generate an IndexError. Fix that. This should be copied into the 1.0 release branch. (bugfix candidate). Index: UserInterface.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/UserInterface.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** UserInterface.py 22 Feb 2004 02:41:50 -0000 1.46 --- UserInterface.py 13 May 2004 04:05:50 -0000 1.47 *************** *** 1046,1053 **** % (sb_ver, sb_type, py_ver, os_name, self.classifier.nham, self.classifier.nspam) ! domain_guess = options["pop3proxy", "remote_servers"][0] ! for pre in ["pop.", "pop3.", "mail.",]: ! if domain_guess.startswith(pre): ! domain_guess = domain_guess[len(pre):] report.from_addr.value = "[YOUR EMAIL ADDRESS]@%s" % (domain_guess,) report.subject.value = "Problem with %s: [PROBLEM SUMMARY]" % \ --- 1046,1057 ---- % (sb_ver, sb_type, py_ver, os_name, self.classifier.nham, self.classifier.nspam) ! remote_servers = options["pop3proxy", "remote_servers"] ! if remote_servers: ! domain_guess = remote_servers[0] ! for pre in ["pop.", "pop3.", "mail.",]: ! if domain_guess.startswith(pre): ! domain_guess = domain_guess[len(pre):] ! else: ! domain_guess = "[YOUR ISP]" report.from_addr.value = "[YOUR EMAIL ADDRESS]@%s" % (domain_guess,) report.subject.value = "Problem with %s: [PROBLEM SUMMARY]" % \ From anadelonbrin at users.sourceforge.net Thu May 13 18:01:32 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Thu May 13 18:01:37 2004 Subject: [Spambayes-checkins] spambayes/spambayes message.py,1.49,1.50 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25079/spambayes Modified Files: message.py Log Message: Handle people using a storage type that isn't pickle/dbm (like one of the sql ones). If we trigger the TypeError problem, try to do our best to put the message together anyway (this is better than just leaving an X-SpamBayes-Exception header, which sb_server/sb_imapfilter currently do. This is what sb_filter currently does. Ideally, we should move to the new FeedParser in the email package, but we need to do that in some way that provides 2.2 users with an option. Maybe use it if it is there? Bugfix candidate. Index: message.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/message.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** message.py 25 Apr 2004 03:45:30 -0000 1.49 --- message.py 13 May 2004 22:01:28 -0000 1.50 *************** *** 212,215 **** --- 212,221 ---- options["Storage", "persistent_use_database"] == "pickle": msginfoDB = MessageInfoPickle(message_info_db_name) + else: + # Ah - now, what? Maybe the user has mysql or pgsql or zeo, + # or some other newfangled thing! We don't know what to do + # in that case, so just use a pickle, since it's the safest + # option. + msginfoDB = MessageInfoPickle(message_info_db_name) class Message(email.Message.Message): *************** *** 277,281 **** # \r\n *only*). imaplib *should* take care of this for us (in the # append function), but does not, so we do it here ! return self._force_CRLF(email.Message.Message.as_string(self, unixfrom)) def modified(self): --- 283,294 ---- # \r\n *only*). imaplib *should* take care of this for us (in the # append function), but does not, so we do it here ! try: ! return self._force_CRLF(\ ! email.Message.Message.as_string(self, unixfrom)) ! except TypeError: ! parts = [] ! for part in self.get_payload(): ! parts.append(email.Message.Message.as_string(part, unixfrom)) ! return self._force_CRLF("\n".join(parts)) def modified(self): From anadelonbrin at users.sourceforge.net Sat May 15 23:50:03 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Sat May 15 23:50:10 2004 Subject: [Spambayes-checkins] spambayes/scripts sb_imapfilter.py,1.30,1.31 Message-ID: Update of /cvsroot/spambayes/spambayes/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20591/scripts Modified Files: sb_imapfilter.py Log Message: Sometimes we can't fetch a message, which means we can't even add the exception header like with invalid messages. We don't want imapfilter to crash, though, rather just skip that message, warn the user and keep going. Add code to allow for this sort of behaviour. One specific case of this is a MemoryError with really large messages. Handle this as above. Change some error checking to asserts, which they should really have been in the first place. Index: sb_imapfilter.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** sb_imapfilter.py 3 May 2004 02:12:32 -0000 1.30 --- sb_imapfilter.py 16 May 2004 03:50:00 -0000 1.31 *************** *** 338,341 **** --- 338,342 ---- self.got_substance = False self.invalid = False + self.could_not_retrieve = False def setFolder(self, folder): *************** *** 377,394 **** if self.got_substance: return ! if not self.uid or not self.id: ! print "Cannot get substance of message without an id and an UID" ! return imap.SelectFolder(self.folder.name) try: ! response = imap.uid("FETCH", self.uid, self.rfc822_command) ! except IMAP4.error: ! self.rfc822_command = "RFC822" ! self.rfc822_key = "RFC822" ! response = imap.uid("FETCH", self.uid, self.rfc822_command) ! if response[0] != "OK": ! self.rfc822_command = "RFC822" ! self.rfc822_key = "RFC822" ! response = imap.uid("FETCH", self.uid, self.rfc822_command) self._check(response, "uid fetch") data = _extract_fetch_data(response[1][0]) --- 378,412 ---- if self.got_substance: return ! assert(self.id, "Cannot get substance of message without an id") ! assert(self.uid, "Cannot get substance of message without an UID") imap.SelectFolder(self.folder.name) try: ! try: ! response = imap.uid("FETCH", self.uid, self.rfc822_command) ! except IMAP4.error: ! self.rfc822_command = "RFC822" ! self.rfc822_key = "RFC822" ! response = imap.uid("FETCH", self.uid, self.rfc822_command) ! if response[0] != "OK": ! self.rfc822_command = "RFC822" ! self.rfc822_key = "RFC822" ! response = imap.uid("FETCH", self.uid, self.rfc822_command) ! except MemoryError: ! # Really big messages can trigger a MemoryError here. ! # The problem seems to be line 311 (Python 2.3) of socket.py, ! # which has "return "".join(buffers)". ! # We want to handle this gracefully, although we can't really ! # do what we do later, and rewrite the message, since we can't ! # load it in the first place. Maybe an elegant solution would ! # be to get the message in parts, or just use the first X ! # characters for classification. For now, we just carry on, ! # warning the user and ignoring the message. ! self.could_not_retrieve = True ! print >>sys.stderr, "MemoryError with message %s (uid %s)" % \ ! (self.id, self.uid) ! # We could print the traceback, too, but don't for the moment. ! #traceback.print_exc(None, stream) ! return ! self._check(response, "uid fetch") data = _extract_fetch_data(response[1][0]) *************** *** 476,485 **** # we can't actually update the message with IMAP # so what we do is create a new message and delete the old one ! if self.folder is None: ! raise RuntimeError, """Can't save a message that doesn't ! have a folder.""" ! if not self.id: ! raise RuntimeError, """Can't save a message that doesn't have ! an id.""" response = imap.uid("FETCH", self.uid, "(FLAGS INTERNALDATE)") self._check(response, 'fetch (flags internaldate)') --- 494,500 ---- # we can't actually update the message with IMAP # so what we do is create a new message and delete the old one ! assert(self.folder is not None, ! "Can't save a message that doesn't have a folder.") ! assert(self.id, "Can't save a message that doesn't have an id.") response = imap.uid("FETCH", self.uid, "(FLAGS INTERNALDATE)") self._check(response, 'fetch (flags internaldate)') *************** *** 666,669 **** --- 681,691 ---- num_trained = 0 for msg in self: + if msg.could_not_retrieve: + # Something went wrong, and we couldn't even get + # an invalid message, so just skip this one. + # Annoyinly, we'll try to do it every time the + # script runs, but hopefully the user will notice + # the errors and move it soon enough. + continue if msg.GetTrained() == (not isSpam): msg.get_substance() *************** *** 702,705 **** --- 724,734 ---- count["unsure"] = 0 for msg in self: + if msg.could_not_retrieve: + # Something went wrong, and we couldn't even get + # an invalid message, so just skip this one. + # Annoyinly, we'll try to do it every time the + # script runs, but hopefully the user will notice + # the errors and move it soon enough. + continue if msg.GetClassification() is None: msg.get_substance() From anadelonbrin at users.sourceforge.net Mon May 17 17:17:58 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Mon May 17 17:18:08 2004 Subject: [Spambayes-checkins] spambayes/windows spambayes.iss,1.15,1.16 Message-ID: Update of /cvsroot/spambayes/spambayes/windows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3606/windows Modified Files: spambayes.iss Log Message: We 'built' the copy of default_bayes_customize to install into the user's application directory (not the data directory these days), but we never actually installed it. Do that. Should be copied to the 1.0 release branch. (Bugfix candidate). Fixes [ 955442 ] default_bayes_customize.ini not handled right Index: spambayes.iss =================================================================== RCS file: /cvsroot/spambayes/spambayes/windows/spambayes.iss,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** spambayes.iss 4 May 2004 02:06:51 -0000 1.15 --- spambayes.iss 17 May 2004 21:17:55 -0000 1.16 *************** *** 27,30 **** --- 27,31 ---- Source: "py2exe\dist\docs\outlook\*.*"; DestDir: "{app}\docs\outlook"; Check: InstallingOutlook; Flags: ignoreversion recursesubdirs Source: "py2exe\dist\docs\outlook\docs\welcome.html"; DestDir: "{app}\docs\outlook\docs"; Check: InstallingOutlook; Flags: isreadme + Source: "py2exe\dist\bin\default_bayes_customize.ini"; DestDir: "{app}\bin"; Check: InstallingOutlook; Flags: ignoreversion Source: "py2exe\dist\bin\sb_server.exe"; DestDir: "{app}\bin"; Check: InstallingProxy; Flags: ignoreversion From anadelonbrin at users.sourceforge.net Mon May 17 21:17:10 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Mon May 17 21:17:14 2004 Subject: [Spambayes-checkins] website windows.ht,1.37,1.38 Message-ID: Update of /cvsroot/spambayes/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20744 Modified Files: windows.ht Log Message: Typo in link to installer (missing a "1"). Index: windows.ht =================================================================== RCS file: /cvsroot/spambayes/website/windows.ht,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** windows.ht 5 May 2004 06:49:20 -0000 1.37 --- windows.ht 18 May 2004 01:17:07 -0000 1.38 *************** *** 13,17 ****

      The latest release is 1.0rc1 - see the release notes ! or download the installation program.

      --- 13,17 ----

      The latest release is 1.0rc1 - see the release notes ! or download the installation program.

      From montanaro at users.sourceforge.net Fri May 21 09:31:43 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Fri May 21 09:31:48 2004 Subject: [Spambayes-checkins] spambayes/scripts sb_dbexpimp.py,1.12,1.13 Message-ID: Update of /cvsroot/spambayes/spambayes/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19922 Modified Files: sb_dbexpimp.py Log Message: Fake UnicodeDecodeError for Python 2.2 compatibility. Try a few encodings when attempting to convert non-ASCII strings to unicode. (Maybe an attempt should be made to store all non-ASCII strings as Unicode in the classifier's database.) Index: sb_dbexpimp.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_dbexpimp.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** sb_dbexpimp.py 24 Mar 2004 21:30:43 -0000 1.12 --- sb_dbexpimp.py 21 May 2004 13:31:40 -0000 1.13 *************** *** 93,100 **** from __future__ import generators try: True, False except NameError: - # Maintain compatibility with Python 2.2 True, False = 1, 0 --- 93,100 ---- from __future__ import generators + # Python 2.2 compatibility stuff try: True, False except NameError: True, False = 1, 0 *************** *** 104,107 **** --- 104,115 ---- import spambayes.compatcsv as csv + try: + x = UnicodeDecodeError + except NameError: + UnicodeDecodeError = UnicodeError + else: + del x + + import spambayes.storage from spambayes.Options import options *************** *** 115,123 **** return s def uunquote(s): ! try: ! return unicode(s, 'utf-8') ! except UnicodeDecodeError: ! return s def runExport(dbFN, useDBM, outFN): --- 123,136 ---- return s + # Heaven only knows what encoding non-ASCII stuff will be in + # Try a few common western encodings and punt if they all fail def uunquote(s): ! for encoding in ("utf-8", "cp1252", "iso-8859-1"): ! try: ! return unicode(s, encoding) ! except UnicodeDecodeError: ! pass ! # punt ! return s def runExport(dbFN, useDBM, outFN): From montanaro at users.sourceforge.net Fri May 21 09:34:46 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Fri May 21 09:34:57 2004 Subject: [Spambayes-checkins] spambayes/spambayes compatcsv.py,1.1,1.2 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20535 Modified Files: compatcsv.py Log Message: correct a list chomping bug (forgot a slicing ":") use .readline() instead of .next() for Python 2.2 compatibility Index: compatcsv.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/compatcsv.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** compatcsv.py 16 Mar 2004 21:36:22 -0000 1.1 --- compatcsv.py 21 May 2004 13:34:42 -0000 1.2 *************** *** 21,25 **** def next(self): ! return self.parse_line(self.fp.next()) def parse_line(self, line): --- 21,25 ---- def next(self): ! return self.parse_line(self.fp.readline()) def parse_line(self, line): *************** *** 40,44 **** if match is None: # embedded newline ! line = line + self.fp.next() continue else: --- 40,44 ---- if match is None: # embedded newline ! line = line + self.fp.readline() continue else: *************** *** 64,68 **** field = unicode(field, "utf-8") result.append(field) ! line = line[len(field)+len(match.group(2))] return result --- 64,68 ---- field = unicode(field, "utf-8") result.append(field) ! line = line[len(field)+len(match.group(2)):] return result From anadelonbrin at users.sourceforge.net Mon May 24 02:23:29 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Mon May 24 02:23:33 2004 Subject: [Spambayes-checkins] spambayes/scripts sb_imapfilter.py,1.31,1.32 Message-ID: Update of /cvsroot/spambayes/spambayes/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31611/scripts Modified Files: sb_imapfilter.py Log Message: With the verbose output, put the final counts on a line all by themselves. Possible bugfix candidate (only a cosmetic change, but can't break anything). Index: sb_imapfilter.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** sb_imapfilter.py 16 May 2004 03:50:00 -0000 1.31 --- sb_imapfilter.py 24 May 2004 06:23:26 -0000 1.32 *************** *** 777,781 **** total_ham_trained += num_ham_trained if options['globals', 'verbose']: ! print " %s trained." % (num_ham_trained) if options["imap", "spam_train_folders"] != "": --- 777,781 ---- total_ham_trained += num_ham_trained if options['globals', 'verbose']: ! print "\n %s trained." % (num_ham_trained) if options["imap", "spam_train_folders"] != "": *************** *** 790,794 **** total_spam_trained += num_spam_trained if options['globals', 'verbose']: ! print " %s trained." % (num_spam_trained) if total_ham_trained or total_spam_trained: --- 790,794 ---- total_spam_trained += num_spam_trained if options['globals', 'verbose']: ! print "\n %s trained." % (num_spam_trained) if total_ham_trained or total_spam_trained: From montanaro at users.sourceforge.net Tue May 25 10:58:42 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Tue May 25 10:58:55 2004 Subject: [Spambayes-checkins] spambayes/contrib pycksum.py,NONE,1.1 Message-ID: Update of /cvsroot/spambayes/spambayes/contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17359 Added Files: pycksum.py Log Message: A fuzzy checksum program similar based on a message posted a long time ago by Justin Mason of the SpamAssassin group. --- NEW FILE: pycksum.py --- #!/usr/bin/env python """ A fuzzy checksum program based on a message posted to the spambayes list a long time ago from Justin Mason of the SpamAssassin gang. The basic idea is that you dump stuff that can be obviously variable (email addresses and such), compute several partial checksums over what remains, then compare pieces against previous partial checksums to make a decision about a match. Note that this concept can break down for small messages. I only use it downstream from Spambayes - after it's scored the message as spam: :0 * ^X-Spambayes-Classification: (.*-)?spam { ### this recipe gobbles items with matching body checksums (taken ### loosely to try and avoid obvious tricks) :0 W: cksum.lock | pycksum.py -v $HOME/tmp/cksum.cache 2>> $HOME/tmp/cksum.log ... further spam processing here } That reduces the risk of tossing out mail I'm actually interested in. ;-) I run it in verbose mode and save the log message. It catches a fair fraction of duplicate spams, probably 3 out of every 4. (Mail for several email addresses funnels into skip@mojam.com.) """ # message on stdin # cmdline arg is db file to store checksums # exit status is designed to fit into procmail's idea of delivery - exiting # with a 0 implies the message is a duplicate and the message is deemed # delivered - exiting with a 1 implies the message hasn't been seen before import getopt import sys import email.Parser import md5 import anydbm import re import time import binascii def flatten(body): # three types are possible: list, string, Message if isinstance(body, str): return body if hasattr(body, "get_payload"): payload = body.get_payload() if payload is None: return "" return flatten(payload) if isinstance(body, list): return "\n".join([flatten(b) for b in body]) raise TypeError, ("unrecognized body type: %s" % type(body)) def clean(data): """Clean the obviously variable stuff from a chunk of data. The first (and perhaps only) use of this is to try and eliminate bits of data that keep multiple spam email messages from looking the same. """ # Get rid of anything which looks like an HTML tag and downcase it all data = re.sub(r"<[^>]*>", "", data).lower() # delete anything which looks like a url or email address # not sure what a pmguid: url is but it seems to occur frequently in spam # also convert all runs of whitespace into a single space return " ".join([w for w in data.split() if ('@' not in w and (':' not in w or w[:4] != "ftp:" and w[:7] != "mailto:" and w[:5] != "http:" and w[:7] != "gopher:" and w[:8] != "pmguid:"))]) def generate_checksum(msg): # modelled after Justin Mason's fuzzy checksummer for SpamAssassin. # Message body is cleaned, then broken into lines. The list of lines is # then broken into four parts and separate checksums are generated for # each part. They are then joined together with '.'. Downstream # processes can split those chunks into pieces and consider them # separately or in various combinations if desired. body = flatten(msg) lines = clean(body) chunksize = len(lines)//4+1 sum = [] for i in range(4): chunk = "\n".join(lines[i*chunksize:(i+1)*chunksize]) sum.append(binascii.b2a_hex(md5.new(chunk).digest())) return ".".join(sum) def save_checksum(cksum, f): pieces = cksum.split('.') result = 1 db = anydbm.open(f, "c") maxdblen = 2**14 # consider the first three pieces, the last three pieces and the middle # two pieces - one or more will likely eliminate attempts at disrupting # the checksum - if any are found in the db file, call it a match for subsum in (".".join(pieces[:-1]), ".".join(pieces[1:-1]), ".".join(pieces[1:])): if not db.has_key(subsum): db[subsum] = str(time.time()) if len(db) > maxdblen: items = [(float(db[k]),k) for k in db.keys()] items.sort() # the -20 brings us down a bit below the max so we aren't # constantly running this chunk of code items = items[:-(maxdblen-20)] for v,k in items: del db[k] else: result = 0 break db.close() return result def main(args): opts, args = getopt.getopt(args, "v") verbose = 0 for opt, arg in opts: if opt == "-v": verbose = 1 if not args: dbf = None else: dbf = args[0] msg = email.Parser.Parser().parse(sys.stdin) cksum = generate_checksum(msg) if dbf is None: print cksum result = 1 disp = 'nodb' else: result = save_checksum(cksum, dbf) disp = result and 'old' or 'new' if verbose: t = time.strftime("%Y-%m-%d:%H:%M:%S", time.localtime(time.time())) logmsg = "%s/%s/%s/%s\n" % (t, cksum, disp, msg['message-id']) sys.stderr.write(logmsg) return result if __name__ == "__main__": sys.exit(main(sys.argv[1:])) From anadelonbrin at users.sourceforge.net Tue May 25 19:16:42 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Tue May 25 19:16:47 2004 Subject: [Spambayes-checkins] spambayes/scripts sb_mboxtrain.py,1.11,1.12 Message-ID: Update of /cvsroot/spambayes/spambayes/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19010/scripts Modified Files: sb_mboxtrain.py Log Message: Add a comment to mboxutils. mboxtrain is the last (I think) script that still gets hit by the TypeError problem, so fix that. For the moment, this fix is just to apply the fix that Skip made for sb_filter - i.e. instead of calling msg.as_string(), we call mboxutils.as_string(msg). I can't see how this would break anything, unless the mboxutils.as_string code is broken, which is already in 1.0, so this seems to be a good bugfix candidate. Closes [ 942262 ] TypeError: string payload expected: Index: sb_mboxtrain.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_mboxtrain.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** sb_mboxtrain.py 5 Feb 2004 08:13:26 -0000 1.11 --- sb_mboxtrain.py 25 May 2004 23:16:39 -0000 1.12 *************** *** 51,55 **** import sys, os, getopt, email import shutil ! from spambayes import hammie, storage from spambayes.Options import options, get_pathname_option --- 51,55 ---- import sys, os, getopt, email import shutil ! from spambayes import hammie, storage, mboxutils from spambayes.Options import options, get_pathname_option *************** *** 83,87 **** # multipart/alternative? try: ! msg.as_string() except TypeError: # We'll be unable to represent this as text :( --- 83,87 ---- # multipart/alternative? try: ! mboxutils.as_string(msg) except TypeError: # We'll be unable to represent this as text :( *************** *** 145,149 **** continue f = file(tfn, "wb") ! f.write(msg.as_string()) f.close() shutil.copystat(cfn, tfn) --- 145,149 ---- continue f = file(tfn, "wb") ! f.write(mboxutils.as_string(msg)) f.close() shutil.copystat(cfn, tfn) *************** *** 190,194 **** if options["Headers", "include_trained"]: # Write it out with the Unix "From " line ! outf.write(msg.as_string(True)) if options["Headers", "include_trained"]: --- 190,194 ---- if options["Headers", "include_trained"]: # Write it out with the Unix "From " line ! outf.write(mboxutils.as_string(msg, True)) if options["Headers", "include_trained"]: *************** *** 246,250 **** continue f = file(tfn, "wb") ! f.write(msg.as_string()) f.close() shutil.copystat(cfn, tfn) --- 246,250 ---- continue f = file(tfn, "wb") ! f.write(mboxutils.as_string(msg)) f.close() shutil.copystat(cfn, tfn) From anadelonbrin at users.sourceforge.net Tue May 25 19:16:43 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Tue May 25 19:16:49 2004 Subject: [Spambayes-checkins] spambayes/spambayes mboxutils.py,1.7,1.8 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19010/spambayes Modified Files: mboxutils.py Log Message: Add a comment to mboxutils. mboxtrain is the last (I think) script that still gets hit by the TypeError problem, so fix that. For the moment, this fix is just to apply the fix that Skip made for sb_filter - i.e. instead of calling msg.as_string(), we call mboxutils.as_string(msg). I can't see how this would break anything, unless the mboxutils.as_string code is broken, which is already in 1.0, so this seems to be a good bugfix candidate. Closes [ 942262 ] TypeError: string payload expected: Index: mboxutils.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/mboxutils.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mboxutils.py 4 May 2004 13:29:34 -0000 1.7 --- mboxutils.py 25 May 2004 23:16:40 -0000 1.8 *************** *** 147,150 **** --- 147,155 ---- To Do: This really should be done by subclassing email.Message.Message and making this function the as_string() method. After 1.0. + + [Tony] Better: sb_filter & sb_mboxtrain should stop using this and + start using the spambayes.Message classes. They might need a little + bit of rearranging, but that should work nicely, and mean that all + this code is together in one place. """ if isinstance(msg, str): From anadelonbrin at users.sourceforge.net Wed May 26 23:54:26 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Wed May 26 23:54:31 2004 Subject: [Spambayes-checkins] website faq.txt,1.71,1.72 Message-ID: Update of /cvsroot/spambayes/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31524 Modified Files: faq.txt Log Message: Why don't you filter/moderate the list and make it so only subscribers can post? Index: faq.txt =================================================================== RCS file: /cvsroot/spambayes/website/faq.txt,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** faq.txt 27 Apr 2004 11:47:36 -0000 1.71 --- faq.txt 27 May 2004 03:54:23 -0000 1.72 *************** *** 1351,1354 **** --- 1351,1396 ---- + Why does the spambayes@python.org mailing list get spam? + -------------------------------------------------------- + + A reasonably small amount of messages posted to spambayes@python.org are + spam, bounce messages, out-of-office messages, and so on. People often + wonder (and ask) why we don't filter these out, or require all posters + to be subscribers to the mailing list, or moderate the list. + + No filtering is done because spam is often discussed on the list. For + example, you can send in a spam message that you received, with the clues + that it generated, and ask why it scored what it did. Or you might want + to give an example of a new technique that spammers are using, and ask + how well we think that SpamBayes will handle it. It's very difficult + to distinguish between this mail and legitimate mail, and we don't want + any false positives (this is a small amount of traffic, after all). + + We don't require all posters to be subscribers because this is hard on + one-time posters, who are probably start three-quarters of all threads, + and account for about half the messages. These people often want help + with setting up SpamBayes, and are sometimes not particularly confortable + with computers, so the fewer loops to jump through to get help, the + better. It would also defeat the "submit bug report" ability of + sb_server (which ensures that we get enough information), which is also + likely to appear in the Outlook plug-in. + + We don't moderate the list, because we're too busy to give timely answers + to everyone as it is, let alone continue developing and testing. If you + understand the time commitment involved in moderation, and can do it + 24 hours a day, 7 days a week (we're an international bunch around here), + then please let us know, and we can give this a shot. + + None of this should bother you, though. Why? Because if you set SpamBayes + up, and train it appropriately, you'll see almost none of these messages. + Just about all the developers do this, and we don't see any of these messages + (often the first time is when someone quotes it asking why it got to the + list) unless we're checking through caught spam. There's a higher than + normal chance of a false positive (those messages about spam), but there's + a reasonable chance you don't care about missing those anyway, and, at least + in our experience, SpamBayes does a pretty good job at correctly classifying + those anyway (given good training). + + Development =========== From anadelonbrin at users.sourceforge.net Wed May 26 23:58:13 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Wed May 26 23:58:17 2004 Subject: [Spambayes-checkins] website faq.txt,1.72,1.73 Message-ID: Update of /cvsroot/spambayes/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32084 Modified Files: faq.txt Log Message: Grammar problems. Index: faq.txt =================================================================== RCS file: /cvsroot/spambayes/website/faq.txt,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** faq.txt 27 May 2004 03:54:23 -0000 1.72 --- faq.txt 27 May 2004 03:58:03 -0000 1.73 *************** *** 1368,1372 **** We don't require all posters to be subscribers because this is hard on ! one-time posters, who are probably start three-quarters of all threads, and account for about half the messages. These people often want help with setting up SpamBayes, and are sometimes not particularly confortable --- 1368,1372 ---- We don't require all posters to be subscribers because this is hard on ! one-time posters, who probably start three-quarters of all threads, and account for about half the messages. These people often want help with setting up SpamBayes, and are sometimes not particularly confortable *************** *** 1386,1394 **** Just about all the developers do this, and we don't see any of these messages (often the first time is when someone quotes it asking why it got to the ! list) unless we're checking through caught spam. There's a higher than normal chance of a false positive (those messages about spam), but there's a reasonable chance you don't care about missing those anyway, and, at least in our experience, SpamBayes does a pretty good job at correctly classifying ! those anyway (given good training). --- 1386,1394 ---- Just about all the developers do this, and we don't see any of these messages (often the first time is when someone quotes it asking why it got to the ! list), unless we're checking through caught spam. There's a higher than normal chance of a false positive (those messages about spam), but there's a reasonable chance you don't care about missing those anyway, and, at least in our experience, SpamBayes does a pretty good job at correctly classifying ! those too (given good training). From tim.one at comcast.net Thu May 27 01:48:39 2004 From: tim.one at comcast.net (Tim Peters) Date: Thu May 27 01:48:51 2004 Subject: [Spambayes-checkins] website faq.txt,1.71,1.72 In-Reply-To: Message-ID: [Tony Meyer] > Modified Files: > faq.txt > Log Message: > Why don't you filter/moderate the list and make it so only subscribers can > post? Thanks, Tony! For many things -- this one just reminded me . From kpitt at users.sourceforge.net Thu May 27 10:35:43 2004 From: kpitt at users.sourceforge.net (Kenny Pitt) Date: Thu May 27 10:35:47 2004 Subject: [Spambayes-checkins] spambayes/Outlook2000/docs troubleshooting.html, 1.21, 1.22 Message-ID: Update of /cvsroot/spambayes/spambayes/Outlook2000/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11083 Modified Files: troubleshooting.html Log Message: Outlook 2003 has the same Disabled Items behavior as 2002, so list it in the relevant versions. Outlook 2002 is also known as Outlook XP, so include that as well. Index: troubleshooting.html =================================================================== RCS file: /cvsroot/spambayes/spambayes/Outlook2000/docs/troubleshooting.html,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** troubleshooting.html 6 May 2004 20:42:08 -0000 1.21 --- troubleshooting.html 27 May 2004 14:35:39 -0000 1.22 *************** *** 121,125 ****
        !
      • If you are running Outlook 2002, you may find that if you go back to the dialog, the addin will still be unselected.  In this case, perform the following:
      • --- 121,125 ----
          !
        • If you are running Outlook XP/2002/2003, you may find that if you go back to the dialog, the addin will still be unselected.  In this case, perform the following:
        • *************** *** 134,138 ****
        • Select SpamBayes. 
        • Click Enable.
        • !
        • Restart Outlook 2002.
        • --- 134,138 ----
        • Select SpamBayes. 
        • Click Enable.
        • !
        • Restart Outlook.
        • From montanaro at users.sourceforge.net Sun May 30 12:54:03 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Sun May 30 12:54:07 2004 Subject: [Spambayes-checkins] spambayes/spambayes compatcsv.py,1.2,1.3 Message-ID: Update of /cvsroot/spambayes/spambayes/spambayes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29361 Modified Files: compatcsv.py Log Message: Abandon regexes as bad way to parse csv file - add simple unit test as well Index: compatcsv.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/spambayes/compatcsv.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** compatcsv.py 21 May 2004 13:34:42 -0000 1.2 --- compatcsv.py 30 May 2004 16:53:59 -0000 1.3 *************** *** 20,25 **** return self def next(self): ! return self.parse_line(self.fp.readline()) def parse_line(self, line): --- 20,35 ---- return self + def _readline(self): + line = self.fp.readline() + # strip any EOL detritus + while line[-1:] in ("\r", "\n"): + line = line[:-1] + return line + def next(self): ! line = self._readline() ! if not line: ! raise StopIteration ! return self.parse_line(line) def parse_line(self, line): *************** *** 35,68 **** result = [] while line: if line[0] == '"': ! # search for ending quotation mark ! match = re.match('"(.*?)"[^"]', line) ! if match is None: ! # embedded newline ! line = line + self.fp.readline() ! continue ! else: ! field = match.group(1) ! field = field.replace('""', '"') ! try: ! dummy = unicode(field, "ascii") ! except UnicodeError: ! field = unicode(field, "utf-8") ! result.append(field) ! line = line[len(field)+3:] ! else: ! # field is terminated by a comma or EOL ! match = re.match("(.*?)(,|%s)"%EOL, line) ! if match is None: ! print "parse error:", line ! raise ! field = match.group(1) ! try: ! dummy = unicode(field, "ascii") ! except UnicodeError: ! field = unicode(field, "utf-8") ! result.append(field) ! line = line[len(field)+len(match.group(2)):] return result --- 45,83 ---- result = [] while line: + # quoted field if line[0] == '"': ! line = line[1:] ! field = [] ! while True: ! if line[0:2] == '""': ! field.append('"') ! line = line[2:] ! elif line[0] == '"': ! # end of field - skip quote and possible comma ! line = line[1:] ! if line[0:1] == ',': ! line = line[1:] ! break ! else: ! field.append(line[0]) ! line = line[1:] ! # ran out of line before field ! if not line: ! field.append("\n") ! line = self._readline() ! if not line: ! raise IOError, "end-of-file during parsing" else: ! # unquoted field ! field = [] ! while line: ! if line[0] == ',': ! # end of field ! line = line[1:] ! break ! else: ! field.append(line[0]) ! line = line[1:] ! result.append("".join(field)) return result *************** *** 84,85 **** --- 99,120 ---- result = ",".join(result) self.fp.write(result+EOL) + + if __name__ == "__main__": + import unittest + import StringIO + + class TestCase(unittest.TestCase): + def test_reader(self): + f = StringIO.StringIO('''\ + """rare""",1,0 + "beginning; + end=""itinhh.txt""",1,0 + ''') + f.seek(0) + rdr = reader(f) + self.assertEqual(rdr.next(), ['"rare"', '1', '0']) + self.assertEqual(rdr.next(), + ['beginning;\n\tend="itinhh.txt"','1', '0']) + self.assertRaises(StopIteration, rdr.next) + + unittest.main() From montanaro at users.sourceforge.net Sun May 30 13:01:41 2004 From: montanaro at users.sourceforge.net (Skip Montanaro) Date: Sun May 30 13:01:45 2004 Subject: [Spambayes-checkins] spambayes/scripts sb_dbexpimp.py,1.13,1.14 Message-ID: Update of /cvsroot/spambayes/spambayes/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30998/scripts Modified Files: sb_dbexpimp.py Log Message: handle case of importing the old object craft csv module Index: sb_dbexpimp.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/scripts/sb_dbexpimp.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** sb_dbexpimp.py 21 May 2004 13:31:40 -0000 1.13 --- sb_dbexpimp.py 30 May 2004 17:01:38 -0000 1.14 *************** *** 101,104 **** --- 101,107 ---- try: import csv + # might get the old object craft csv module - has no reader attr + if not hasattr(csv, "reader"): + raise ImportError except ImportError: import spambayes.compatcsv as csv From anadelonbrin at users.sourceforge.net Mon May 31 19:11:46 2004 From: anadelonbrin at users.sourceforge.net (Tony Meyer) Date: Mon May 31 19:11:50 2004 Subject: [Spambayes-checkins] spambayes/windows autoconfigure.py,1.11,1.12 Message-ID: Update of /cvsroot/spambayes/spambayes/windows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26016/windows Modified Files: autoconfigure.py Log Message: Add fixes from [ 962693 ] mozilla/thunderbird/netscape profile dir detection (but not the mozilla part, at least yet) Index: autoconfigure.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/windows/autoconfigure.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** autoconfigure.py 8 Jan 2004 20:35:53 -0000 1.11 --- autoconfigure.py 31 May 2004 23:11:44 -0000 1.12 *************** *** 290,294 **** if not m: break ! current_pos = m.end() server_num = m.group(1) server = m.group(2) --- 290,294 ---- if not m: break ! current_pos += m.end() server_num = m.group(1) server = m.group(2) *************** *** 299,303 **** # Find the port ! port_string = 'user_pref("mail.smtpserver.smtp1.port", ' port_loc = prefs.find(port_string) if port_loc == -1: --- 299,304 ---- # Find the port ! port_string = 'user_pref("mail.smtpserver.smtp%d.port", ' \ ! % (server_num,) port_loc = prefs.find(port_string) if port_loc == -1: *************** *** 339,344 **** filter_filename = "%s%smsgFilterRules.dat" % (config_location, os.sep) store_name = "" # how do we get this? ! spam_folder_url = "mailbox:////%s//Junk%20Mail" % (store_name,) ! unsure_folder_url = "mailbox:////%s//Possible%20Junk" % (store_name,) header_name = options["Headers", "classification_header_name"] spam_tag = options["Headers", "header_spam_string"] --- 340,345 ---- filter_filename = "%s%smsgFilterRules.dat" % (config_location, os.sep) store_name = "" # how do we get this? ! spam_folder_url = "mailbox:////%s//Junk%%20Mail" % (store_name,) ! unsure_folder_url = "mailbox:////%s//Possible%%20Junk" % (store_name,) header_name = options["Headers", "classification_header_name"] spam_tag = options["Headers", "header_spam_string"] *************** *** 449,460 **** if proto == "POP3": for (server_key, port_key), sect in translate.items(): - server = "%s:%s" % (account[server_key][0], - account[port_key][0]) if sect[:4] == "pop3": pop_proxy = move_to_next_free_port(pop_proxy) proxy = pop_proxy else: smtp_proxy = move_to_next_free_port(smtp_proxy) proxy = smtp_proxy options[sect, "remote_servers"] += (server,) options[sect, "listen_ports"] += (proxy,) --- 450,466 ---- if proto == "POP3": for (server_key, port_key), sect in translate.items(): if sect[:4] == "pop3": + default_port = 110 pop_proxy = move_to_next_free_port(pop_proxy) proxy = pop_proxy else: + default_port = 25 smtp_proxy = move_to_next_free_port(smtp_proxy) proxy = smtp_proxy + if account.has_key(port_key): + port = account[port_key][0] + else: + port = default_port + server = "%s:%s" % (account[server_key][0], port) options[sect, "remote_servers"] += (server,) options[sect, "listen_ports"] += (proxy,) From mhammond at users.sourceforge.net Mon May 31 22:09:20 2004 From: mhammond at users.sourceforge.net (Mark Hammond) Date: Mon May 31 22:09:24 2004 Subject: [Spambayes-checkins] spambayes/Outlook2000/dialogs FolderSelector.py, 1.37, 1.38 Message-ID: Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28307 Modified Files: FolderSelector.py Log Message: Fix the folderselector bug fix! Index: FolderSelector.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/FolderSelector.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** FolderSelector.py 12 May 2004 02:08:36 -0000 1.37 --- FolderSelector.py 1 Jun 2004 02:09:18 -0000 1.38 *************** *** 510,515 **** # the case. grandparent = parent.GetParent() ! except self.manager.message_storeMsgStoreException, details: ! if "0x80070005" in details: valid = parent is not None else: --- 510,516 ---- # the case. grandparent = parent.GetParent() ! except self.manager.message_store.MsgStoreException, details: ! hr, msg, exc, argErr = details.mapi_exception ! if hr == winerror.E_ACCESSDENIED: valid = parent is not None else: From mhammond at users.sourceforge.net Mon May 31 22:14:41 2004 From: mhammond at users.sourceforge.net (Mark Hammond) Date: Mon May 31 22:14:44 2004 Subject: [Spambayes-checkins] spambayes/Outlook2000/dialogs FolderSelector.py, 1.38, 1.39 Message-ID: Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29242 Modified Files: FolderSelector.py Log Message: Oops - need to import winerror! (Tony needs to test this anyway; I can't repro the original problem - he knows this :) Index: FolderSelector.py =================================================================== RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/FolderSelector.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** FolderSelector.py 1 Jun 2004 02:09:18 -0000 1.38 --- FolderSelector.py 1 Jun 2004 02:14:38 -0000 1.39 *************** *** 6,9 **** --- 6,10 ---- import win32api import win32gui + import winerror import struct, array