[svn] GpgOL - r277 - in trunk: . forms po src

svn author wk cvs at cvs.gnupg.org
Mon Oct 27 16:44:26 CET 2008


Author: wk
Date: 2008-10-27 16:44:26 +0100 (Mon, 27 Oct 2008)
New Revision: 277

Added:
   trunk/forms/gpgol-cs_de.cfg
Modified:
   trunk/ChangeLog
   trunk/forms/Makefile.am
   trunk/po/de.po
   trunk/po/sv.po
   trunk/src/ChangeLog
   trunk/src/mapihelp.cpp
   trunk/src/olflange.cpp
Log:
Another cryptoex update.  This time for inline encrypted messages.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-10-27 12:38:17 UTC (rev 276)
+++ trunk/ChangeLog	2008-10-27 15:44:26 UTC (rev 277)
@@ -1,3 +1,7 @@
+2008-10-27  Werner Koch  <wk at g10code.com>
+
+	* forms/gpgol-cs_de.cfg: New. 
+
 2008-08-06  Werner Koch  <wk at g10code.com>
 
 	Release 0.10.15.

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-10-27 12:38:17 UTC (rev 276)
+++ trunk/src/ChangeLog	2008-10-27 15:44:26 UTC (rev 277)
@@ -1,7 +1,11 @@
 2008-10-27  Werner Koch  <wk at g10code.com>
 
+	* olflange.cpp (install_forms): Add gpgol-cs.
+
 	* mapihelp.cpp (get_internetcharsetbody_tag): New.
 	(mapi_get_body_as_stream): Try the new tag first.
+	(get_msgcls_from_pgp_lines): Ditto.  Remove the simple access
+	method.
 
 2008-10-24  Werner Koch  <wk at g10code.com>
 

Modified: trunk/forms/Makefile.am
===================================================================
--- trunk/forms/Makefile.am	2008-10-27 12:38:17 UTC (rev 276)
+++ trunk/forms/Makefile.am	2008-10-27 15:44:26 UTC (rev 277)
@@ -13,9 +13,8 @@
 
 icons = encr-l.ico encr-s.ico sign-l.ico sign-s.ico
 
-cfg_german = gpgol_de.cfg gpgol-ms_de.cfg 
+cfg_german = gpgol_de.cfg gpgol-ms_de.cfg gpgol-cs_de.cfg 
 
-
 dist_pkgdata_DATA = $(icons) $(cfg_german)
 
 

Added: trunk/forms/gpgol-cs_de.cfg
===================================================================
--- trunk/forms/gpgol-cs_de.cfg	                        (rev 0)
+++ trunk/forms/gpgol-cs_de.cfg	2008-10-27 15:44:26 UTC (rev 277)
@@ -0,0 +1,35 @@
+[Description]
+MessageClass=IPM.Note.GpgOL.ClearSigned
+DesignerRuntimeGuid={0006F020-0000-0000-C000-000000000046}
+CLSID={00061033-0000-0000-C000-000000000046}
+DisplayName=Form for class IPM.Note.GpgOL.MultipartSigned
+Category=Standard
+Subcategory=Formular
+Comment=
+LargeIcon=sign-l.ico
+SmallIcon=sign-s.ico
+VersionMajor=1
+VersionMinor=0
+Locale=deu
+Hidden=1
+Owner=Public Domain
+
+[Properties]
+
+[Verbs]
+Verb1=1
+
+[Verb.1]
+DisplayName=Ö&ffnen
+Code=0
+Flags=0
+Attribs=2
+
+[Extensions]
+Extensions1=1
+
+[Extension.1]
+Type=30
+NmidPropset={00020D0C-0000-0000-C000-000000000046}
+NmidInteger=1
+Value=1011111111111111

Modified: trunk/po/de.po  [not shown]
Modified: trunk/po/sv.po  [not shown]
Modified: trunk/src/mapihelp.cpp
===================================================================
--- trunk/src/mapihelp.cpp	2008-10-27 12:38:17 UTC (rev 276)
+++ trunk/src/mapihelp.cpp	2008-10-27 15:44:26 UTC (rev 277)
@@ -499,7 +499,6 @@
 get_msgcls_from_pgp_lines (LPMESSAGE message)
 {
   HRESULT hr;
-  LPSPropValue lpspvFEID = NULL;
   LPSTREAM stream;
   STATSTG statInfo;
   ULONG nread;
@@ -507,103 +506,98 @@
   char *body = NULL;
   char *p;
   char *msgcls = NULL;
-
-  hr = HrGetOneProp ((LPMAPIPROP)message, PR_BODY, &lpspvFEID);
-  if (SUCCEEDED (hr))  /* Message is small enough to be retrieved directly. */
-    { 
-      switch ( PROP_TYPE (lpspvFEID->ulPropTag) )
-        {
-        case PT_UNICODE:
-          body = wchar_to_utf8 (lpspvFEID->Value.lpszW);
-          if (!body)
-            log_debug ("%s: error converting to utf8\n", __func__);
-          break;
-          
-        case PT_STRING8:
-          body = xstrdup (lpspvFEID->Value.lpszA);
-          break;
-          
-        default:
-          log_debug ("%s: proptag=0x%08lx not supported\n",
-                     __func__, lpspvFEID->ulPropTag);
-          break;
-        }
-      MAPIFreeBuffer (lpspvFEID);
+  ULONG tag;
+  int   is_binary = 0;
+  
+  hr = 0;
+  if (!get_internetcharsetbody_tag (message, &tag) )
+    {
+      hr = message->OpenProperty (tag, &IID_IStream, 0, 0, 
+                                  (LPUNKNOWN*)&stream);
+      if (!hr)
+        is_binary = 1;
     }
-  else /* Message is large; use an IStream to read it.  */
+  if (hr)
     {
-      hr = message->OpenProperty (PR_BODY, &IID_IStream, 0, 0, 
+      tag = PR_BODY;
+      hr = message->OpenProperty (tag, &IID_IStream, 0, 0, 
                                   (LPUNKNOWN*)&stream);
-      if (hr)
-        {
-          log_debug ("%s:%s: OpenProperty failed: hr=%#lx",
-                     SRCNAME, __func__, hr);
-          return NULL;
-        }
+    }
+  if (hr)
+    {
+      log_debug ("%s:%s: OpenProperty(%lx) failed: hr=%#lx",
+                 SRCNAME, __func__, tag, hr);
+      return NULL;
+    }
+  
+  hr = stream->Stat (&statInfo, STATFLAG_NONAME);
+  if (hr)
+    {
+      log_debug ("%s:%s: Stat failed: hr=%#lx", SRCNAME, __func__, hr);
+      stream->Release ();
+      return NULL;
+    }
+  
+  /* We read only the first 1k to decide whether this is actually an
+     OpenPGP armored message .  */
+  nbytes = (size_t)statInfo.cbSize.QuadPart;
+  if (nbytes > 1024*2)
+    nbytes = 1024*2;
+  body = (char*)xmalloc (nbytes + 2);
+  hr = stream->Read (body, nbytes, &nread);
+  if (hr)
+    {
+      log_debug ("%s:%s: Read failed: hr=%#lx", SRCNAME, __func__, hr);
+      xfree (body);
+      stream->Release ();
+      return NULL;
+    }
+  body[nread] = 0;
+  body[nread+1] = 0;
+  if (nread != nbytes)
+    {
+      log_debug ("%s:%s: not enough bytes returned\n", SRCNAME, __func__);
       
-      hr = stream->Stat (&statInfo, STATFLAG_NONAME);
-      if (hr)
+      xfree (body);
+      stream->Release ();
+      return NULL;
+    }
+  stream->Release ();
+
+  if (!is_binary)
+    {
+      char *tmp;
+      tmp = wchar_to_utf8 ((wchar_t*)body);
+      if (!tmp)
+        log_debug ("%s: error converting to utf8\n", __func__);
+      else
         {
-          log_debug ("%s:%s: Stat failed: hr=%#lx", SRCNAME, __func__, hr);
-          stream->Release ();
-          return NULL;
-        }
-      
-      /* We read only the first 1k to decide whether this is actually
-         an OpenPGP armored message .  */
-      nbytes = (size_t)statInfo.cbSize.QuadPart;
-      if (nbytes > 1024*2)
-        nbytes = 1024*2;
-      body = (char*)xmalloc (nbytes + 2);
-      hr = stream->Read (body, nbytes, &nread);
-      if (hr)
-        {
-          log_debug ("%s:%s: Read failed: hr=%#lx", SRCNAME, __func__, hr);
           xfree (body);
-          stream->Release ();
-          return NULL;
+          body = tmp;
         }
-      body[nread] = 0;
-      body[nread+1] = 0;
-      if (nread != statInfo.cbSize.QuadPart)
-        {
-          log_debug ("%s:%s: not enough bytes returned\n", SRCNAME, __func__);
-          xfree (body);
-          stream->Release ();
-          return NULL;
-        }
-      stream->Release ();
-      
-      {
-        char *tmp;
-        tmp = wchar_to_utf8 ((wchar_t*)body);
-        if (!tmp)
-          log_debug ("%s: error converting to utf8\n", __func__);
-        else
-          {
-            xfree (body);
-            body = tmp;
-          }
-      }
     }
 
-  /* The first ~1k of the body of the message is now availble in the
+
+  /* The first ~1k of the body of the message is now available in the
      utf-8 string BODY.  Walk over it to figure out its type.  */
   for (p=body; p && *p; p = (p=strchr (p+1, '\n')? (p+1):NULL))
-    if (!strncmp (p, "-----BEGIN PGP ", 15))
-      {
-        if (!strncmp (p+15, "SIGNED MESSAGE-----", 19)
-            && trailing_ws_p (p+15+19))
-          msgcls = xstrdup ("IPM.Note.GpgOL.ClearSigned");
-        else if (!strncmp (p+15, "MESSAGE-----", 12)
-                 && trailing_ws_p (p+15+12))
-          msgcls = xstrdup ("IPM.Note.GpgOL.PGPMessage");
-        break;
-      }
-    else if (!trailing_ws_p (p))
-      break;  /* Text before the PGP message - don't take this as a
-                 proper message.  */
-         
+    {
+      if (!strncmp (p, "-----BEGIN PGP ", 15))
+        {
+          if (!strncmp (p+15, "SIGNED MESSAGE-----", 19)
+              && trailing_ws_p (p+15+19))
+            msgcls = xstrdup ("IPM.Note.GpgOL.ClearSigned");
+          else if (!strncmp (p+15, "MESSAGE-----", 12)
+                   && trailing_ws_p (p+15+12))
+            msgcls = xstrdup ("IPM.Note.GpgOL.PGPMessage");
+          break;
+        }
+      else if (!trailing_ws_p (p))
+        break;  /* Text before the PGP message - don't take this as a
+                   proper message.  */
+    }
+  
+
   xfree (body);
   return msgcls;
 }

Modified: trunk/src/olflange.cpp
===================================================================
--- trunk/src/olflange.cpp	2008-10-27 12:38:17 UTC (rev 276)
+++ trunk/src/olflange.cpp	2008-10-27 15:44:26 UTC (rev 277)
@@ -655,6 +655,7 @@
     {
       "gpgol",
       "gpgol-ms",
+      "gpgol-cs",
       NULL,
     };
   int formidx;




More information about the Gnupg-commits mailing list