[svn] GpgOL - r323 - in trunk: po src

svn author wk cvs at cvs.gnupg.org
Mon Nov 30 18:42:00 CET 2009


Author: wk
Date: 2009-11-30 18:42:00 +0100 (Mon, 30 Nov 2009)
New Revision: 323

Modified:
   trunk/po/de.po
   trunk/po/sv.po
   trunk/src/ChangeLog
   trunk/src/display.cpp
   trunk/src/ext-commands.cpp
   trunk/src/message-events.cpp
Log:
Plaintext of encrypted message is now shown again.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-11-27 17:06:07 UTC (rev 322)
+++ trunk/src/ChangeLog	2009-11-30 17:42:00 UTC (rev 323)
@@ -1,3 +1,14 @@
+2009-11-30  Werner Koch  <wk at g10code.com>
+
+	* message-events.cpp (OnReadComplete): Use GetInspector if none was
+	found.
+	* display.cpp (update_display): Print the window hierarchy in case
+	of an error.
+	* ext-commands.cpp (get_inspector): Add arg HWND.  First try
+	get_inspector_from_hwnd.
+	(get_crypto_flags, set_crypto_flags): Add arg HWND.
+	(InstallCommands, DoCommand): Pass HWND to crypt_flags functions.
+
 2009-11-27  Werner Koch  <wk at g10code.com>
 
 	* message-events.cpp (get_crypto_flags): Replace EECB arg by HWND.

Modified: trunk/po/de.po  [not shown]
Modified: trunk/po/sv.po  [not shown]
Modified: trunk/src/display.cpp
===================================================================
--- trunk/src/display.cpp	2009-11-27 17:06:07 UTC (rev 322)
+++ trunk/src/display.cpp	2009-11-30 17:42:00 UTC (rev 323)
@@ -272,6 +272,7 @@
     {
       log_error ("%s:%s: window handle not found for parent %p\n",
                  SRCNAME, __func__, hwnd);
+      log_window_hierarchy (hwnd, "this is the window hierachy:");
       return -1;
     }
 }

Modified: trunk/src/ext-commands.cpp
===================================================================
--- trunk/src/ext-commands.cpp	2009-11-27 17:06:07 UTC (rev 322)
+++ trunk/src/ext-commands.cpp	2009-11-30 17:42:00 UTC (rev 323)
@@ -107,23 +107,21 @@
 /* Note: Duplicated from message-events.cpp.  Eventually we should get
    rid of this module.  */
 static LPDISPATCH
-get_inspector (LPEXCHEXTCALLBACK eecb)
+get_inspector (LPEXCHEXTCALLBACK eecb, HWND hwnd)
 {
   LPDISPATCH obj;
-  LPDISPATCH inspector = NULL;
+  LPDISPATCH inspector;
   
-  obj = get_eecb_object (eecb);
-  if (obj)
+  inspector = get_inspector_from_hwnd (hwnd);
+  if (!inspector)
     {
-      /* This should be MailItem; use the getInspector method.  */
-      //inspector = get_oom_object (obj, "GetInspector");
-      char *tmp = get_object_name (obj);
-      
-      log_debug ("%s:%s: object is at %p (%s)",
-                 SRCNAME, __func__, obj, tmp? tmp:"");
-      xfree (tmp);
-        
-      obj->Release ();
+      obj = get_eecb_object (eecb);
+      if (obj)
+        {
+          /* This should be MailItem; use the getInspector method.  */
+          inspector = get_oom_object (obj, "GetInspector");
+          obj->Release ();
+        }
     }
   return inspector;
 }
@@ -132,12 +130,13 @@
 /* Note: Duplicated from message-events.cpp.  Eventually we should get
    rid of this module.  */
 static int
-get_crypto_flags (LPEXCHEXTCALLBACK eecb, bool *r_sign, bool *r_encrypt)
+get_crypto_flags (LPEXCHEXTCALLBACK eecb, HWND hwnd,
+                  bool *r_sign, bool *r_encrypt)
 {
   LPDISPATCH inspector;
   int rc;
 
-  inspector = get_inspector (eecb);
+  inspector = get_inspector (eecb, hwnd);
   if (!inspector)
     {
       log_error ("%s:%s: inspector not found", SRCNAME, __func__);
@@ -153,11 +152,11 @@
 
 
 static void
-set_crypto_flags (LPEXCHEXTCALLBACK eecb, bool sign, bool encrypt)
+set_crypto_flags (LPEXCHEXTCALLBACK eecb, HWND hwnd, bool sign, bool encrypt)
 {
   LPDISPATCH inspector;
 
-  inspector = get_inspector (eecb);
+  inspector = get_inspector (eecb, hwnd);
   if (!inspector)
     log_error ("%s:%s: inspector not found", SRCNAME, __func__);
   else
@@ -173,7 +172,7 @@
 STDMETHODIMP 
 GpgolExtCommands::InstallCommands (
 	LPEXCHEXTCALLBACK eecb, // The Exchange Callback Interface.
-	HWND hWnd,               // The window handle to the main window
+	HWND hwnd,               // The window handle to the main window
                                  // of context.
 	HMENU hMenu,             // The menu handle to main menu of context.
 	UINT FAR *pnCommandIDBase,  // The base command id.
@@ -182,11 +181,14 @@
 	ULONG lFlags)            // reserved
 {
   HRESULT hr;
-  m_hWnd = hWnd;
+  m_hWnd = hwnd;
   LPDISPATCH obj;
 
   (void)hMenu;
-  
+  (void)pnCommandIDBase;
+  (void)pTBEArray;
+  (void)nTBECnt;
+
   if (debug_commands)
     log_debug ("%s:%s: context=%s flags=0x%lx\n", SRCNAME, __func__, 
                ext_context_name (m_lContext), lFlags);
@@ -288,7 +290,7 @@
           if (force_encrypt)
             encrypt = true;
           
-          set_crypto_flags (eecb, sign, encrypt);
+          set_crypto_flags (eecb, hwnd,sign, encrypt);
         }
       xfree (draft_info);
     }
@@ -398,7 +400,7 @@
       
       log_debug ("%s:%s: command SaveMessage called\n", SRCNAME, __func__);
 
-      if (get_crypto_flags (eecb, &sign, &encrypt))
+      if (get_crypto_flags (eecb, hwnd, &sign, &encrypt))
         buf[0] = buf[1] = '?';
       else
         {
@@ -412,7 +414,7 @@
       if (SUCCEEDED (hr))
         mapi_set_gpgol_draft_info (message, buf);
       else
-        log_debug ("%s:%s: getObject failed: hr=%#lx\n",SRCNAME, __func__, hr);
+        log_error ("%s:%s: getObject failed: hr=%#lx\n",SRCNAME, __func__, hr);
       ul_release (message, __func__, __LINE__);
       ul_release (mdb, __func__, __LINE__);
       return S_FALSE; /* Pass on to next handler.  */
@@ -466,6 +468,10 @@
 GpgolExtCommands::QueryHelpText(UINT nCommandID, ULONG lFlags,
                                 LPTSTR pszText,  UINT nCharCnt)    
 {
+  (void)nCommandID;
+  (void)lFlags;
+  (void)pszText;
+  (void)nCharCnt;
 
   return S_FALSE;
 }
@@ -486,6 +492,10 @@
                                    LPTSTR description, UINT description_size,
                                    ULONG flags)          
 {
+  (void)toolbarid;
+  (void)buttonid;
+  (void)pTBB;
+  (void)description;
   (void)description_size;
   (void)flags;
 

Modified: trunk/src/message-events.cpp
===================================================================
--- trunk/src/message-events.cpp	2009-11-27 17:06:07 UTC (rev 322)
+++ trunk/src/message-events.cpp	2009-11-30 17:42:00 UTC (rev 323)
@@ -203,7 +203,29 @@
                    SRCNAME, __func__, hr);
       else
         {
-          LPDISPATCH inspector = get_inspector_from_hwnd (hwnd);
+          LPDISPATCH inspector;
+          LPDISPATCH obj;
+
+          inspector = get_inspector_from_hwnd (hwnd);
+          if (!inspector)
+            {
+              /* No inspector available.  We now force the creation of
+                 a new inspector by using the GetInspector method for
+                 the current MailItem.  In theory we could do this
+                 always but we better try the *from_hwnd method first
+                 as this will not create a new inspector in OL2007 if
+                 one already exists.  Not a real problem for OnRead
+                 but we had this problem in OnWrite.  */
+              obj = get_eecb_object (eecb);
+              if (obj)
+                {
+                  inspector = get_oom_object (obj, "GetInspector");
+                  if (opt.enable_debug & DBG_OOM)
+                    log_debug ("%s:%s: %p->GetInspector returned %p",
+                               SRCNAME, __func__, obj, inspector);
+                  obj->Release ();
+                }
+            }
           message_display_handler (message, inspector, hwnd);
           if (inspector)
             inspector->Release ();




More information about the Gnupg-commits mailing list