[git] GpgOL - branch, outlook14, updated. gpgol-1.1.3-15-ge928b6f

by Andre Heinecke cvs at cvs.gnupg.org
Thu Jul 11 11:02:22 CEST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, outlook14 has been updated
       via  e928b6fee0ffa319e4c8d13faf1eda09a0aab302 (commit)
       via  a86891f29d9f495e8aafc3824d575b15c5205aa9 (commit)
       via  1ac489eadc378b3326c912e930859c199aafd140 (commit)
      from  3f9cedf40b5bbba3ddf4fdcaad46e3749ce91724 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e928b6fee0ffa319e4c8d13faf1eda09a0aab302
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Jul 11 08:37:21 2013 +0000

    Fix decryptSelection by handling \r breaks
    
        * src/ribbon-callbacks.cpp (decryptSelection): Use fix_linebreaks.

diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 3535239..666eb17 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -436,7 +436,8 @@ decryptSelection (LPDISPATCH ctrl)
   engine_filter_t filter = NULL;
   LPOLEWINDOW actExplorer;
   HWND curWindow;
-  char* text = NULL;
+  char* selectedText = NULL;
+  int selectedLen = 0;
   int rc = 0;
   unsigned int session_number;
   HRESULT hr;
@@ -478,9 +479,9 @@ decryptSelection (LPDISPATCH ctrl)
       return S_OK;
     }
 
-  text = get_oom_string (selection, "Text");
+  selectedText = get_oom_string (selection, "Text");
 
-  if (!text || strlen (text) <= 1)
+  if (!selectedText || (selectedLen = strlen (selectedText)) <= 1)
     {
       /* TODO more usable if we just use all text in this case? */
       MessageBox (NULL,
@@ -490,8 +491,10 @@ decryptSelection (LPDISPATCH ctrl)
       return S_OK;
     }
 
+  fix_linebreaks (selectedText, &selectedLen);
+
   /* Determine the protocol based on the content */
-  protocol = is_cms_data (text, strlen (text)) ? PROTOCOL_SMIME :
+  protocol = is_cms_data (selectedText, selectedLen) ? PROTOCOL_SMIME :
     PROTOCOL_OPENPGP;
 
   hr = OpenStreamOnFile (MAPIAllocateBuffer, MAPIFreeBuffer,
@@ -530,7 +533,7 @@ decryptSelection (LPDISPATCH ctrl)
     }
 
   /* Write the text in the decryption sink. */
-  rc = write_buffer (decsink, text, strlen (text));
+  rc = write_buffer (decsink, selectedText, selectedLen);
 
   /* Flush the decryption sink and wait for the encryption to get
      ready.  */
@@ -602,7 +605,7 @@ decryptSelection (LPDISPATCH ctrl)
     log_debug ("%s:%s: failed rc=%d (%s) <%s>", SRCNAME, __func__, rc,
                gpg_strerror (rc), gpg_strsource (rc));
   engine_cancel (filter);
-  xfree (text);
+  xfree (selectedText);
   if (tmpstream)
     tmpstream->Release();
 

commit a86891f29d9f495e8aafc3824d575b15c5205aa9
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Jul 11 08:33:37 2013 +0000

    Add fix_linebreaks function
    
        This tries to fix linebreaks to be unix \n breaks.
    
        * src/common.c, src/util.h (fix_linebreaks): New.

diff --git a/src/common.c b/src/common.c
index fa75d52..549d768 100644
--- a/src/common.c
+++ b/src/common.c
@@ -969,3 +969,29 @@ percent_escape (const char *str, const char *extra)
 
   return ptr;
 }
+
+/* Fix linebreaks.
+   This either removes the \r if it is followed by a \n
+   or replaces it by a \n. This is neccessary because
+   Micrsoft Word buffers appearently use only the \r
+   to indicate line breaks.
+*/
+void
+fix_linebreaks (char *str, int *len)
+{
+  char *src;
+  char *dst;
+
+  src = str;
+  dst = str;
+  while (*src)
+    {
+      if (src[0] == '\r' && src[1] == '\n')
+        src++;
+      else if (src[0] == '\r')
+        src[0] = '\n';
+      *(dst++) = *(src++);
+    }
+  *dst = '\0';
+  *len = dst - str;
+}
diff --git a/src/util.h b/src/util.h
index 77cdef0..09cde90 100644
--- a/src/util.h
+++ b/src/util.h
@@ -47,6 +47,7 @@ extern "C" {
               while(*_vptr) { *_vptr=0; _vptr++; } \
                   } while(0)
 
+#include <windows.h>
 
 /* i18n stuff */
 #include "w32-gettext.h"
@@ -72,6 +73,8 @@ char *read_w32_registry_string (const char *root, const char *dir,
                                 const char *name);
 char *percent_escape (const char *str, const char *extra);
 
+void fix_linebreaks (char *str, int *len);
+
 /*-- main.c --*/
 const void *get_128bit_session_key (void);
 const void *get_64bit_session_marker (void);

commit 1ac489eadc378b3326c912e930859c199aafd140
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Jul 11 07:38:14 2013 +0000

    Include information source in comment
    
        The referenced blog contains a good explanation about
        changes in image handling the ribbonUI
    
        * src/ribbon-callbacks.cpp (getIcon): Expand comment about
        PNG's

diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 7499eeb..3535239 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -625,6 +625,9 @@ getIcon (int id, int size, VARIANT* result)
    In the future we might want to use PNGs here to have
    full Alpha Channel support for the icons
 
+   Some explanation about images and transparency in Ribbons:
+   http://blogs.msdn.com/b/jensenh/archive/2006/11/27/ribbonx-image-faq.aspx
+
    Here is an example how this could look like with gdiplus:
 
    GdiplusStartupInput gdiplusStartupInput;

-----------------------------------------------------------------------

Summary of changes:
 src/common.c             |   26 ++++++++++++++++++++++++++
 src/ribbon-callbacks.cpp |   18 ++++++++++++------
 src/util.h               |    3 +++
 3 files changed, 41 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list