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

Mark Hammond mhammond at users.sourceforge.net
Thu Dec 18 21:23:36 EST 2003


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

Modified Files:
	addin.py 
Log Message:
* Try and tone down the toolbar message in the log to prevent people
  reporting it as a bug
* Handle situations where Outlook starts up in a confused state, which
  then confused us.


Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.118
retrieving revision 1.119
diff -C2 -d -r1.118 -r1.119
*** addin.py	17 Dec 2003 06:31:57 -0000	1.118
--- addin.py	19 Dec 2003 02:23:34 -0000	1.119
***************
*** 833,837 ****
                          break
                      item.Delete(False)
!                     print "Deleted the dead popup control - re-creating"
                  except pythoncom.com_error, e:
                      print "ERROR: Failed to delete our dead toolbar control"
--- 833,838 ----
                          break
                      item.Delete(False)
!                     print "The above toolbar message is common - " \
!                           "recreating the toolbar..."
                  except pythoncom.com_error, e:
                      print "ERROR: Failed to delete our dead toolbar control"
***************
*** 1245,1249 ****
                                      config.watch_include_sub):
              event_hook = self._GetHookForFolder(folder)
!             if event_hook.use_timer:
                  print "Processing missed spam in folder '%s' by starting a timer" \
                        % (folder.name,)
--- 1246,1258 ----
                                      config.watch_include_sub):
              event_hook = self._GetHookForFolder(folder)
!             # Note event_hook may be none in some strange cases where we
!             # were unable to hook the events for the folder.  This is
!             # generally caused by a temporary Outlook issue rather than a
!             # problem of ours we need to address.
!             if event_hook is None:
!                 manager.LogDebug(0,
!                     "Skipping processing of missed messages in folder '%s', "
!                     "as it is not available" % folder.name)
!             elif event_hook.use_timer:
                  print "Processing missed spam in folder '%s' by starting a timer" \
                        % (folder.name,)
***************
*** 1302,1306 ****
  
      def _GetHookForFolder(self, folder):
!         ret = self.folder_hooks[folder.id]
          assert ret.target == folder
          return ret
--- 1311,1317 ----
  
      def _GetHookForFolder(self, folder):
!         ret = self.folder_hooks.get(folder.id)
!         if ret is None: # we were unable to hook events for this folder.
!             return None
          assert ret.target == folder
          return ret
***************
*** 1312,1317 ****
              existing = self.folder_hooks.get(msgstore_folder.id)
              if existing is None or existing.__class__ != HandlerClass:
-                 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
--- 1323,1341 ----
              existing = self.folder_hooks.get(msgstore_folder.id)
              if existing is None or existing.__class__ != HandlerClass:
                  name = msgstore_folder.GetFQName()
+                 try:
+                     folder = msgstore_folder.GetOutlookItem()
+                 except self.manager.message_store.MsgStoreException, details:
+                     # Exceptions here are most likely when the folder is valid
+                     # and available to MAPI, but not via the Outlook.
+                     # One good way to provoke this is to configure Outlook's
+                     # profile so default delivery is set to "None".  Then,
+                     # when you start Outlook, it immediately displays an
+                     # error and terminates.  During this process, the addin
+                     # is initialized, attempts to get the folders, and fails.
+                     print "FAILED to open the Outlook folder '%s' " \
+                           "to hook events" % name
+                     print details
+                     continue
                  # Ensure the field is created before we hook the folder
                  # events, else there is a chance our event handler will





More information about the Spambayes-checkins mailing list