[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.117,1.118

Mark Hammond mhammond at users.sourceforge.net
Wed Dec 17 01:31:59 EST 2003


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

Modified Files:
	addin.py 
Log Message:
Now we create a temporary mail item to create the 'Spam' field, we need
to create it *before* we hook folder events, else we attempt to filter 
the temp message.


Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.117
retrieving revision 1.118
diff -C2 -d -r1.117 -r1.118
*** addin.py	16 Dec 2003 05:06:32 -0000	1.117
--- addin.py	17 Dec 2003 06:31:57 -0000	1.118
***************
*** 1314,1317 ****
--- 1314,1333 ----
                  folder = msgstore_folder.GetOutlookItem()
                  name = msgstore_folder.GetFQName()
+                 # Ensure the field is created before we hook the folder
+                 # events, else there is a chance our event handler will
+                 # see the temporary message we create.
+                 try:
+                     self.manager.EnsureOutlookFieldsForFolder(msgstore_folder.GetID())
+                 except:
+                     # An exception checking that Outlook's folder has a
+                     # 'spam' field is not fatal, nor really even worth
+                     # telling the user about, nor even worth a traceback
+                     # (as it is likely a COM error).
+                     print "ERROR: Failed to check folder '%s' for " \
+                           "Spam field" % name
+                     etype, value, tb = sys.exc_info()
+                     tb = None # dont want it, and nuke circular ref
+                     traceback.print_exception(etype, value, tb)
+                 # now setup the hook.
                  try:
                      new_hook = DispatchWithEvents(folder.Items, HandlerClass)
***************
*** 1322,1337 ****
                      new_hook.Init(msgstore_folder, self.application, self.manager)
                      new_hooks[msgstore_folder.id] = new_hook
-                     try:
-                         self.manager.EnsureOutlookFieldsForFolder(msgstore_folder.GetID())
-                     except:
-                         # An exception checking that Outlook's folder has a
-                         # 'spam' field is not fatal, nor really even worth
-                         # telling the user about, nor even worth a traceback
-                         # (as it is likely a COM error).
-                         print "ERROR: Failed to check folder '%s' for " \
-                               "Spam field" % name
-                         etype, value, tb = sys.exc_info()
-                         tb = None # dont want it, and nuke circular ref
-                         traceback.print_exception(etype, value, tb)
                      print "SpamBayes: Watching for new messages in folder", name
              else:
--- 1338,1341 ----





More information about the Spambayes-checkins mailing list