[git] GpgOL - branch, nomapi, updated. gpgol-1.4.0-107-g256f026

by Andre Heinecke cvs at cvs.gnupg.org
Wed Oct 19 17:29:11 CEST 2016


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, nomapi has been updated
       via  256f0265bcf8b09e76ad7fcfe348083db26a0965 (commit)
       via  d089674c175e3342d44cad8cf6a1c5725b1af641 (commit)
       via  6665230511a34cdef88417f73b849c0d396f7309 (commit)
       via  906d853b7194413ac1ed40f351dc61a61d38dea3 (commit)
       via  50baf81a7eae15ca0d52d4dc4bfa2db70b39e1b7 (commit)
       via  ef3ce7817e907ee472ef93dba0a94f43e9cb81e8 (commit)
       via  9f9fa94c5d094a9f0e1f50df67db72971540ea87 (commit)
       via  2504182ba54075776645838354a91f07b1f5c585 (commit)
       via  c0ee14685f1f42c5c4e60bc616fc8f188cbd7ac6 (commit)
       via  1a962ea6f281eecf98b3bf1b410831ae7eb5d255 (commit)
       via  9f5274d8f75f27bcbc803ea606c4548d32144dcb (commit)
      from  cdf5d93e22ad19730a7bd31c3b751f8738b87bd4 (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 256f0265bcf8b09e76ad7fcfe348083db26a0965
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 17:28:30 2016 +0200

    Fix multipart S/MIME handling
    
    * src/parsecontroller.cpp (ParseController::parse): Use
    gpgme_data_identify to figure out if our data is smime.

diff --git a/src/parsecontroller.cpp b/src/parsecontroller.cpp
index 2e84876..104c3d4 100644
--- a/src/parsecontroller.cpp
+++ b/src/parsecontroller.cpp
@@ -93,29 +93,24 @@ ParseController::~ParseController()
 
 static void
 operation_for_type(msgtype_t type, bool *decrypt,
-                   bool *verify, Protocol *protocol)
+                   bool *verify)
 {
   *decrypt = false;
   *verify = false;
-  *protocol = Protocol::UnknownProtocol;
   switch (type)
     {
       case MSGTYPE_GPGOL_MULTIPART_ENCRYPTED:
       case MSGTYPE_GPGOL_PGP_MESSAGE:
         *decrypt = true;
-        *protocol = Protocol::OpenPGP;
         break;
       case MSGTYPE_GPGOL_MULTIPART_SIGNED:
       case MSGTYPE_GPGOL_CLEAR_SIGNED:
         *verify = true;
-        *protocol = Protocol::OpenPGP;
         break;
       case MSGTYPE_GPGOL_OPAQUE_SIGNED:
-        *protocol = Protocol::CMS;
         *verify = true;
         break;
       case MSGTYPE_GPGOL_OPAQUE_ENCRYPTED:
-        *protocol = Protocol::CMS;
         *decrypt = true;
         break;
       default:
@@ -125,12 +120,12 @@ operation_for_type(msgtype_t type, bool *decrypt,
 }
 
 static bool
-is_opaque_signed (Data &data)
+is_smime (Data &data)
 {
   data.seek (0, SEEK_SET);
   auto id = data.type();
   data.seek (0, SEEK_SET);
-  return id == Data::CMSSigned;
+  return id == Data::CMSSigned || id == Data::CMSEncrypted;
 }
 
 static std::string
@@ -196,7 +191,18 @@ ParseController::parse()
   // Wrap the input stream in an attachment / GpgME Data
   Protocol protocol;
   bool decrypt, verify;
-  operation_for_type (m_type, &decrypt, &verify, &protocol);
+  operation_for_type (m_type, &decrypt, &verify);
+
+  Data input (m_inputprovider);
+  if ((m_inputprovider->signature() && is_smime (*m_inputprovider->signature())) ||
+      is_smime (input))
+    {
+      protocol = Protocol::CMS;
+    }
+  else
+    {
+      protocol = Protocol::OpenPGP;
+    }
   auto ctx = Context::createForProtocol (protocol);
   if (!ctx)
     {
@@ -221,9 +227,7 @@ ParseController::parse()
     }
   ctx->setArmor(true);
 
-  Data output(m_outputprovider);
-
-  Data input (m_inputprovider);
+  Data output (m_outputprovider);
   log_debug ("%s:%s: decrypt: %i verify: %i with protocol: %s",
              SRCNAME, __func__,
              decrypt, verify,
@@ -235,10 +239,11 @@ ParseController::parse()
       auto combined_result = ctx->decryptAndVerify(input, output);
       m_decrypt_result = combined_result.first;
       m_verify_result = combined_result.second;
+
       if ((!m_decrypt_result.error () &&
           m_verify_result.signatures ().empty() &&
           m_outputprovider->signature ()) ||
-          is_opaque_signed (output))
+          is_smime (output))
         {
           /* There is a signature in the output. So we have
              to verify it now as an extra step. */

commit d089674c175e3342d44cad8cf6a1c5725b1af641
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 17:26:13 2016 +0200

    Fix some double free's in oomhelp
    
    * src/oomhelp.cpp (get_oom_object): Fix double free on
    error.
    (put_pa_string): Fix double frees.
    
    --
    VariantClear frees the contents of a variant, too. So
    don't free the data in the Variant twice.

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index cca297b..e232f03 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -313,8 +313,6 @@ get_oom_object (LPDISPATCH pStart, const char *fullname)
                      (unsigned int)argErr);
           dump_excepinfo (execpinfo);
           VariantClear (&vtResult);
-          if (parmstr)
-            SysFreeString (parmstr);
           gpgol_release (pDisp);
           return NULL;  /* Invoke failed.  */
         }
@@ -857,10 +855,12 @@ put_pa_string (LPDISPATCH pDisp, const char *dasl_id, const char *value)
   /* Variant 0 carries the data. */
   wchar_t *w_value = utf8_to_wchar (value);
   BSTR b_value = SysAllocString(w_value);
+  VariantInit (&cVariant[0]);
   cVariant[0].vt = VT_BSTR;
   cVariant[0].bstrVal = b_value;
 
   /* Variant 1 is the DASL as found out by experiments. */
+  VariantInit (&cVariant[1]);
   cVariant[1].vt = VT_BSTR;
   cVariant[1].bstrVal = b_property;
   dispparams.rgvarg = cVariant;
@@ -871,9 +871,8 @@ put_pa_string (LPDISPATCH pDisp, const char *dasl_id, const char *value)
   hr = propertyAccessor->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
                                  DISPATCH_METHOD, &dispparams,
                                  &rVariant, &execpinfo, &argErr);
-  SysFreeString (b_property);
-  SysFreeString (b_value);
   VariantClear (&cVariant[0]);
+  VariantClear (&cVariant[1]);
   gpgol_release (propertyAccessor);
   if (hr != S_OK)
     {
@@ -882,10 +881,11 @@ put_pa_string (LPDISPATCH pDisp, const char *dasl_id, const char *value)
                  SRCNAME, __func__,
                  rVariant.pdispVal, rVariant.vt, (unsigned int)hr,
                  (unsigned int)argErr);
-      dump_excepinfo (execpinfo);
       VariantClear (&rVariant);
+      dump_excepinfo (execpinfo);
       return -1;
     }
+  VariantClear (&rVariant);
   return 0;
 }
 

commit 6665230511a34cdef88417f73b849c0d396f7309
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 17:22:04 2016 +0200

    Simplify / fix S/MIME data collection.
    
    * src/mimedataprovider.cpp: Copy everything if expect
    no headers is true.
    * src/parsecontroller.cpp (expect_no_headers): Only expect
    headers for multipart signed.
    
    --
    Besides multipart signed outlook only puts the crypto part in
    the attachment that we treat as MOSS attachment. So we don't
    see any headers and parsing this as text can lead to problems
    for smime where the content is binary.

diff --git a/src/mimedataprovider.cpp b/src/mimedataprovider.cpp
index 44944bd..9e27844 100644
--- a/src/mimedataprovider.cpp
+++ b/src/mimedataprovider.cpp
@@ -60,7 +60,6 @@ struct mime_context
   rfc822parse_t msg;  /* The handle of the RFC822 parser. */
 
   int verify_mode;    /* True if we want to verify a signature. */
-  int no_mail_header; /* True if we want to bypass all MIME parsing.  */
 
   int nesting_level;  /* Current MIME nesting level. */
   int in_data;        /* We are currently in data (body or attachment). */
@@ -403,40 +402,6 @@ message_cb (void *opaque, rfc822parse_event_t event,
   mime_context_t ctx = provider->mime_context();
 
   debug_message_event (event);
-  if (ctx->no_mail_header)
-    {
-      if (event == RFC822PARSE_OPEN)
-        {
-          /* We ignore the open event */
-          return 0;
-        }
-      /* Assume that this is not a regular mail but plain text. */
-      if (!ctx->body_seen)
-        {
-          log_mime_parser ("%s:%s: assuming this is plain text without headers\n",
-                           SRCNAME, __func__);
-          ctx->start_hashing = 1;
-          ctx->collect_crypto_data = 1;
-          /* Create a fake MIME structure.  */
-          /* Fixme: We might want to take it from the enclosing message.  */
-          {
-            const char ctmain[] = "text";
-            const char ctsub[] = "plain";
-            mimestruct_item_t ms;
-
-            ms = (mimestruct_item_t) xmalloc (sizeof *ms + strlen (ctmain) + 1 + strlen (ctsub));
-            ctx->mimestruct_cur = ms;
-            *ctx->mimestruct_tail = ms;
-            ctx->mimestruct_tail = &ms->next;
-            ms->next = NULL;
-            strcpy (stpcpy (stpcpy (ms->content_type, ctmain), "/"), ctsub);
-            ms->level = 0;
-            ms->filename = NULL;
-            ms->charset = NULL;
-          }
-        }
-      return 0;
-    }
 
   if (event == RFC822PARSE_BEGIN_HEADER || event == RFC822PARSE_T2BODY)
     {
@@ -499,15 +464,12 @@ message_cb (void *opaque, rfc822parse_event_t event,
 
 MimeDataProvider::MimeDataProvider(bool no_headers) :
   m_signature(nullptr),
-  m_has_html_body(false)
+  m_has_html_body(false),
+  m_collect_everything(no_headers)
 {
   m_mime_ctx = (mime_context_t) xcalloc (1, sizeof *m_mime_ctx);
   m_mime_ctx->msg = rfc822parse_open (message_cb, this);
   m_mime_ctx->mimestruct_tail = &m_mime_ctx->mimestruct;
-  if (no_headers)
-    {
-      m_mime_ctx->no_mail_header = 1;
-    }
 }
 
 #ifdef HAVE_W32_SYSTEM
@@ -781,6 +743,16 @@ MimeDataProvider::collect_data(LPSTREAM stream)
       log_mime_parser ("%s:%s: Read %lu bytes.",
                        SRCNAME, __func__, bRead);
 
+      if (m_collect_everything)
+        {
+          /* For S/MIME, Clearsigned, PGP MESSAGES we just pass everything
+             on. Only the Multipart classes need parsing. And the output
+             of course. */
+          log_mime_parser ("%s:%s: Just copying data.",
+                           SRCNAME, __func__);
+          m_crypto_data.write ((void*)buf, (size_t) bRead);
+          continue;
+        }
       m_rawbuf += std::string (buf, bRead);
       size_t not_taken = collect_input_lines (m_rawbuf.c_str(),
                                               m_rawbuf.size());
@@ -813,6 +785,16 @@ MimeDataProvider::collect_data(FILE *stream)
       log_mime_parser ("%s:%s: Read " SIZE_T_FORMAT " bytes.",
                        SRCNAME, __func__, bRead);
 
+      if (m_collect_everything)
+        {
+          /* For S/MIME, Clearsigned, PGP MESSAGES we just pass everything
+             on. Only the Multipart classes need parsing. And the output
+             of course. */
+          log_mime_parser ("%s:%s: Making verbatim copy" SIZE_T_FORMAT " bytes.",
+                           SRCNAME, __func__, bRead);
+          m_crypto_data.write ((void*)buf, bRead);
+          continue;
+        }
       m_rawbuf += std::string (buf, bRead);
       size_t not_taken = collect_input_lines (m_rawbuf.c_str(),
                                               m_rawbuf.size());
diff --git a/src/mimedataprovider.h b/src/mimedataprovider.h
index 85d1127..83961ff 100644
--- a/src/mimedataprovider.h
+++ b/src/mimedataprovider.h
@@ -148,5 +148,7 @@ private:
   std::string m_body_charset;
   /* Do we have html at all */
   bool m_has_html_body;
+  /* Collect everything */
+  bool m_collect_everything;
 };
 #endif // MIMEDATAPROVIDER_H
diff --git a/src/parsecontroller.cpp b/src/parsecontroller.cpp
index 8a69550..2e84876 100644
--- a/src/parsecontroller.cpp
+++ b/src/parsecontroller.cpp
@@ -59,9 +59,7 @@ using namespace GpgME;
 static bool
 expect_no_headers (msgtype_t type)
 {
-  return type != MSGTYPE_GPGOL_MULTIPART_SIGNED &&
-         type != MSGTYPE_GPGOL_OPAQUE_SIGNED &&
-         type != MSGTYPE_GPGOL_OPAQUE_ENCRYPTED;
+  return type != MSGTYPE_GPGOL_MULTIPART_SIGNED;
 }
 
 #ifdef HAVE_W32_SYSTEM

commit 906d853b7194413ac1ed40f351dc61a61d38dea3
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 17:20:39 2016 +0200

    Fix ignoring S/MIME if S/MIME disabled
    
    * src/mail.cpp (Mail::decrypt_verify): Ignore MSGTYPE_SMIME
    * src/mapihelp.cpp (mapi_change_message_class): Also ignore
    multipartsigned.

diff --git a/src/mail.cpp b/src/mail.cpp
index a4b5fd0..1465836 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -480,7 +480,8 @@ do_parsing (LPVOID arg)
 int
 Mail::decrypt_verify()
 {
-  if (m_type == MSGTYPE_UNKNOWN || m_type == MSGTYPE_GPGOL)
+  if (m_type == MSGTYPE_UNKNOWN || m_type == MSGTYPE_GPGOL ||
+      m_type == MSGTYPE_SMIME)
     {
       /* Not a message for us. */
       return 0;
diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
index 9c25abc..61768f2 100644
--- a/src/mapihelp.cpp
+++ b/src/mapihelp.cpp
@@ -1242,7 +1242,8 @@ mapi_change_message_class (LPMESSAGE message, int sync_override)
           newvalue = (char*)xmalloc (strlen (s) + 1);
           strcpy (stpcpy (newvalue, "IPM.Note.GpgOL"), s+14);
         }
-      else if (!strcmp (s, "IPM.Note.SMIME.MultipartSigned"))
+      else if (opt.enable_smime &&
+               !strcmp (s, "IPM.Note.SMIME.MultipartSigned"))
         {
           /* This is an S/MIME message class but smime support is not
              enabled.  We need to check whether this is actually a

commit 50baf81a7eae15ca0d52d4dc4bfa2db70b39e1b7
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 17:19:25 2016 +0200

    tests: Check if file was opened before parsing.
    
    * tests/run-parser.cpp (main): Check fp_in.

diff --git a/tests/run-parser.cpp b/tests/run-parser.cpp
index 286bd51..49c9226 100644
--- a/tests/run-parser.cpp
+++ b/tests/run-parser.cpp
@@ -104,6 +104,7 @@ int main(int argc, char **argv)
 
   fp_in = fopen (argv[0], "rb");
 
+  if (fp_in)
     {
       ParseController parser(fp_in, msgtype);
       parser.parse();
@@ -116,6 +117,10 @@ int main(int argc, char **argv)
         {
           std::cout << "Attachment: " << attach->get_display_name();
         }
+      fclose (fp_in);
+    }
+  else
+    {
+      std::cout << "failed to open input: " << argv[0];
     }
-  fclose (fp_in);
 }

commit ef3ce7817e907ee472ef93dba0a94f43e9cb81e8
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 17:18:47 2016 +0200

    Remove categories on revert
    
    * src/mail.cpp (Mail::remove_categories): New.
    * src/mail.h: Update accordingly.
    * src/revert.cpp: Use it.

diff --git a/src/mail.cpp b/src/mail.cpp
index 9749419..a4b5fd0 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -1027,6 +1027,15 @@ Mail::is_valid_sig ()
 }
 
 void
+Mail::remove_categories ()
+{
+  const char *decCategory = _("GpgOL: Encrypted Message");
+  const char *verifyCategory = _("GpgOL: Verified Sender");
+  remove_category (m_mailitem, decCategory);
+  remove_category (m_mailitem, verifyCategory);
+}
+
+void
 Mail::update_categories ()
 {
   const char *decCategory = _("GpgOL: Encrypted Message");
diff --git a/src/mail.h b/src/mail.h
index 9b8527a..83c10ab 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -240,6 +240,9 @@ public:
       if it is not signed. */
   const char *get_sig_fpr() const;
 
+  /** Remove all categories of this mail */
+  void remove_categories ();
+
 private:
   void update_categories ();
   void update_body ();
diff --git a/src/revert.cpp b/src/revert.cpp
index 7573e30..719fdfb 100644
--- a/src/revert.cpp
+++ b/src/revert.cpp
@@ -559,6 +559,11 @@ gpgol_mailitem_revert (LPDISPATCH mailitem)
               goto done;
             }
         }
+      else if (is_smime && !opt.enable_smime)
+        {
+          /* SMIME is disabled remove our categories. */
+          mail->remove_categories ();
+        }
     }
 
   result = 0;

commit 9f9fa94c5d094a9f0e1f50df67db72971540ea87
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 17:16:37 2016 +0200

    Fix crash if not attachments found
    
    * src/mail.cpp (get_attachment_stream): Add safeguards.
    
    --
    Should never happen bug just happened due to a bug.

diff --git a/src/mail.cpp b/src/mail.cpp
index 0f6e20b..9749419 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -256,6 +256,12 @@ get_attachment (LPDISPATCH mailitem, int pos)
 static LPSTREAM
 get_attachment_stream (LPDISPATCH mailitem, int pos)
 {
+  if (!pos)
+    {
+      log_debug ("%s:%s: Called with zero pos.",
+                 SRCNAME, __func__);
+      return NULL;
+    }
   LPDISPATCH attachment = get_attachment (mailitem, pos);
   LPATTACH mapi_attachment = NULL;
   LPSTREAM stream = NULL;
@@ -267,6 +273,7 @@ get_attachment_stream (LPDISPATCH mailitem, int pos)
     {
       log_debug ("%s:%s: Failed to get MapiObject of attachment: %p",
                  SRCNAME, __func__, attachment);
+      return NULL;
     }
   if (FAILED (mapi_attachment->OpenProperty (PR_ATTACH_DATA_BIN, &IID_IStream,
                                              0, MAPI_MODIFY, (LPUNKNOWN*) &stream)))

commit 2504182ba54075776645838354a91f07b1f5c585
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 17:14:57 2016 +0200

    Update messagelist forms icons
    
    * forms/gpgol-cs.cfg, gpgol-ms.cfg, gpgol.cfg: Remove locale.
    * forms/encr-s.ico, forms/sign-s.ico: New.

diff --git a/forms/encr-s.ico b/forms/encr-s.ico
index feb6bfc..b143440 100755
Binary files a/forms/encr-s.ico and b/forms/encr-s.ico differ
diff --git a/forms/gpgol-cs.cfg b/forms/gpgol-cs.cfg
index 8a8a351..11d7471 100644
--- a/forms/gpgol-cs.cfg
+++ b/forms/gpgol-cs.cfg
@@ -10,7 +10,6 @@ LargeIcon=sign-l.ico
 SmallIcon=sign-s.ico
 VersionMajor=1
 VersionMinor=0
-Locale=eng
 Hidden=1
 Owner=Public Domain
 
diff --git a/forms/gpgol-ms.cfg b/forms/gpgol-ms.cfg
index 329be32..10b47c5 100644
--- a/forms/gpgol-ms.cfg
+++ b/forms/gpgol-ms.cfg
@@ -10,7 +10,6 @@ LargeIcon=sign-l.ico
 SmallIcon=sign-s.ico
 VersionMajor=1
 VersionMinor=0
-Locale=eng
 Hidden=1
 Owner=Public Domain
 
diff --git a/forms/gpgol.cfg b/forms/gpgol.cfg
index 13b69e0..08a72f7 100644
--- a/forms/gpgol.cfg
+++ b/forms/gpgol.cfg
@@ -10,7 +10,6 @@ LargeIcon=encr-l.ico
 SmallIcon=encr-s.ico
 VersionMajor=1
 VersionMinor=0
-Locale=eng
 Hidden=1
 Owner=Public Domain
 
diff --git a/forms/sign-s.ico b/forms/sign-s.ico
index 77aebcc..079a02f 100755
Binary files a/forms/sign-s.ico and b/forms/sign-s.ico differ

commit c0ee14685f1f42c5c4e60bc616fc8f188cbd7ac6
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 11:52:16 2016 +0200

    Move init code behind check for application
    
    * src/gpgoladdin.cpp (GpgolAddin::OnStartupComplete):
    Move init code together.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index 0b36f87..6ea357f 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -323,29 +323,27 @@ GpgolAddin::OnStartupComplete (SAFEARRAY** custom)
   (void)custom;
   TRACEPOINT;
 
-  install_forms ();
-
   if (!create_responder_window())
     {
       log_error ("%s:%s: Failed to create the responder window;",
                  SRCNAME, __func__);
     }
 
+  if (!m_application)
+    {
+      /* Should not happen as OnConnection should be called before */
+      log_error ("%s:%s: no application set;",
+                 SRCNAME, __func__);
+      return E_NOINTERFACE;
+    }
   /* Set up categories */
   const char *decCategory = _("GpgOL: Encrypted Message");
   const char *verifyCategory = _("GpgOL: Verified Sender");
   ensure_category_exists (m_application, decCategory, 8);
   ensure_category_exists (m_application, verifyCategory, 5);
-
-  if (m_application)
-    {
-      m_applicationEventSink = install_ApplicationEvents_sink(m_application);
-      return S_OK;
-    }
-  /* Should not happen as OnConnection should be called before */
-  log_error ("%s:%s: no application set;",
-             SRCNAME, __func__);
-  return E_NOINTERFACE;
+  install_forms ();
+  m_applicationEventSink = install_ApplicationEvents_sink(m_application);
+  return S_OK;
 }
 
 STDMETHODIMP

commit 1a962ea6f281eecf98b3bf1b410831ae7eb5d255
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 11:49:50 2016 +0200

    Declare MAPIFormContainer
    
    * src/mymapi.h: Add stub declaration for mapiformcontainer.
    
    --
    Most functions don't have their correct params I only added
    the one I tried to use.

diff --git a/src/mymapi.h b/src/mymapi.h
index c9c2751..7b84d6c 100644
--- a/src/mymapi.h
+++ b/src/mymapi.h
@@ -1200,7 +1200,38 @@ DECLARE_INTERFACE_(IMAPISecureMessage, IUnknown)
 };
 
 STDAPI MAPIOpenLocalFormContainer (LPMAPIFORMCONTAINER FAR *ppfcnt);
+/* IMAPIFormContainer*/
+struct MAPIFormMgr;
+typedef struct MAPIFormMgr *LPMAPIFORMMGR;
 
+typedef ULONG HFRMREG;
+#define HFRMREG_DEFAULT  0
+#define HFRMREG_LOCAL    1
+#define HFRMREG_PERSONAL 2
+#define HFRMREG_FOLDER   3
+
+#undef INTERFACE
+#define INTERFACE MAPIFormMgr
+
+DECLARE_INTERFACE_(MAPIFormMgr, IUnknown)
+{
+  DECLARE_IUNKNOWN_METHODS;
+
+  STDMETHOD(LoadForm)(void) PURE;
+  STDMETHOD(ResolveMessageClass)(void) PURE;
+  STDMETHOD(ResolveMultipleMessageClasses)(void) PURE;
+  STDMETHOD(CalcFormPropSet)(void) PURE;
+  STDMETHOD(CreateForm)(void) PURE;
+  STDMETHOD(SelectForm)(void) PURE;
+  STDMETHOD(SelectMultipleForms)(void) PURE;
+  STDMETHOD(SelectFormContainer)(void) PURE;
+  STDMETHOD(OpenFormContainer)(HFRMREG, LPUNKNOWN, LPMAPIFORMCONTAINER FAR *) PURE;
+  STDMETHOD(PrepareForm)(void) PURE;
+  STDMETHOD(IsInConflict)(void) PURE;
+  STDMETHOD(GetLastError)(void) PURE;
+};
+
+STDAPI MAPIOpenFormMgr (LPMAPISESSION, LPMAPIFORMMGR FAR *);
 
 #ifdef __cplusplus
 }

commit 9f5274d8f75f27bcbc803ea606c4548d32144dcb
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Oct 19 11:47:29 2016 +0200

    Remove localized forms
    
    * forms/Makefile.am: Update accordingly.
    * forms/gpgol-cs_en.cfg,
    forms/gpgol-cs_de.cfg,
    forms/gpgol-ms_en.cfg,
    forms/gpgol-ms_de.cfg,
    forms/gpgol_en.cfg,
    forms/gpgol_de.cfg: Removed.
    *forms/gpgol-cs.cfg,
    forms/gpgol-ms.cfg,
    forms/gpgol.cfg: New.
    
    * src/olflange.cpp: Use generic forms.
    
    --
    The contents were not localized anyway and we only use the
    forms for the icon.

diff --git a/forms/Makefile.am b/forms/Makefile.am
index 564c604..993455d 100644
--- a/forms/Makefile.am
+++ b/forms/Makefile.am
@@ -13,11 +13,6 @@
 
 icons = encr-l.ico encr-s.ico sign-l.ico sign-s.ico
 
-cfg_german  = gpgol_de.cfg gpgol-ms_de.cfg gpgol-cs_de.cfg 
-cfg_english = gpgol_en.cfg gpgol-ms_en.cfg gpgol-cs_en.cfg 
-
-dist_pkgdata_DATA = $(icons) $(cfg_german) $(cfg_english)
-
-
-
+cfg = gpgol.cfg gpgol-ms.cfg gpgol-cs.cfg
 
+dist_pkgdata_DATA = $(icons) $(cfg)
diff --git a/forms/gpgol-cs_en.cfg b/forms/gpgol-cs.cfg
similarity index 100%
rename from forms/gpgol-cs_en.cfg
rename to forms/gpgol-cs.cfg
diff --git a/forms/gpgol-cs_de.cfg b/forms/gpgol-cs_de.cfg
deleted file mode 100644
index e5c541e..0000000
--- a/forms/gpgol-cs_de.cfg
+++ /dev/null
@@ -1,35 +0,0 @@
-[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
diff --git a/forms/gpgol-ms_en.cfg b/forms/gpgol-ms.cfg
similarity index 100%
rename from forms/gpgol-ms_en.cfg
rename to forms/gpgol-ms.cfg
diff --git a/forms/gpgol-ms_de.cfg b/forms/gpgol-ms_de.cfg
deleted file mode 100644
index 141d8c4..0000000
--- a/forms/gpgol-ms_de.cfg
+++ /dev/null
@@ -1,35 +0,0 @@
-[Description]
-MessageClass=IPM.Note.GpgOL.MultipartSigned
-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
diff --git a/forms/gpgol_en.cfg b/forms/gpgol.cfg
similarity index 99%
rename from forms/gpgol_en.cfg
rename to forms/gpgol.cfg
index 823dca4..13b69e0 100644
--- a/forms/gpgol_en.cfg
+++ b/forms/gpgol.cfg
@@ -33,4 +33,3 @@ Type=30
 NmidPropset={00020D0C-0000-0000-C000-000000000046}
 NmidInteger=1
 Value=1011111111111111
-
diff --git a/forms/gpgol_de.cfg b/forms/gpgol_de.cfg
deleted file mode 100644
index d4be76c..0000000
--- a/forms/gpgol_de.cfg
+++ /dev/null
@@ -1,36 +0,0 @@
-[Description]
-MessageClass=IPM.Note.GpgOL
-DesignerRuntimeGuid={0006F020-0000-0000-C000-000000000046}
-CLSID={00061033-0000-0000-C000-000000000046}
-DisplayName=Form for class IPM.Note.GpgOL
-Category=Standard
-Subcategory=Formular
-Comment=
-LargeIcon=encr-l.ico
-SmallIcon=encr-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
-
diff --git a/src/olflange.cpp b/src/olflange.cpp
index 1020da0..66b5b68 100644
--- a/src/olflange.cpp
+++ b/src/olflange.cpp
@@ -798,26 +798,10 @@ install_forms (void)
       NULL,
     };
   int formidx;
-  LANGID langid;
-  const char *langsuffix;
   char buffer[MAX_PATH+10];
   char *datadir;
   int any_error = 0;
 
-  langid = PRIMARYLANGID (LANGIDFROMLCID (GetThreadLocale ()));
-  switch (langid)
-    {
-    case LANG_ENGLISH: langsuffix = "en"; break;
-    case LANG_GERMAN:  langsuffix = "de"; break;
-    default:
-      log_debug ("%s:%s: No forms available for primary language %d\n",
-                 SRCNAME, __func__, (int)langid);
-      /* Don't try again.  */
-      opt.forms_revision = GPGOL_FORMS_REVISION;
-      write_options ();
-      return;
-    }
-
   MAPIOpenLocalFormContainer (&formcontainer);
   if (!formcontainer)
     {
@@ -831,26 +815,31 @@ install_forms (void)
     {
       log_error ("%s:%s: error getting data directory\n",
                  SRCNAME, __func__);
+      gpgol_release (formcontainer);
       return;
     }
 
   for (formidx=0; forms[formidx]; formidx++)
     {
 
-      snprintf (buffer, MAX_PATH, "%s\\%s_%s.cfg",
-                datadir, forms[formidx], langsuffix);
+      snprintf (buffer, MAX_PATH, "%s\\%s.cfg",
+                datadir, forms[formidx]);
       hr = formcontainer->InstallForm (0, MAPIFORM_INSTALL_OVERWRITEONCONFLICT,
                                        buffer);
       if (hr)
         {
           any_error = 1;
-          log_error ("%s:%s: installing form `%s' failed: hr=%#lx\n",
-                     SRCNAME, __func__, buffer, hr);
+          LPMAPIERROR err;
+          formcontainer->GetLastError (hr, 0, &err);
+          log_error ("%s:%s: installing form `%s' failed: hr=%#lx err=%s\n",
+                     SRCNAME, __func__, buffer, hr, err ? err->lpszError : "null");
+          MAPIFreeBuffer (err);
         }
       else
         log_debug ("%s:%s: form `%s' installed\n",  SRCNAME, __func__, buffer);
     }
 
+  gpgol_release (formcontainer);
   xfree (datadir);
 
   if (!any_error)

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

Summary of changes:
 forms/Makefile.am                       |   9 ++---
 forms/encr-s.ico                        | Bin 2238 -> 2238 bytes
 forms/{gpgol-cs_en.cfg => gpgol-cs.cfg} |   1 -
 forms/gpgol-cs_de.cfg                   |  35 ------------------
 forms/{gpgol-ms_en.cfg => gpgol-ms.cfg} |   1 -
 forms/gpgol-ms_de.cfg                   |  35 ------------------
 forms/{gpgol_en.cfg => gpgol.cfg}       |   2 --
 forms/gpgol_de.cfg                      |  36 -------------------
 forms/sign-s.ico                        | Bin 2238 -> 2238 bytes
 src/gpgoladdin.cpp                      |  22 ++++++------
 src/mail.cpp                            |  19 +++++++++-
 src/mail.h                              |   3 ++
 src/mapihelp.cpp                        |   3 +-
 src/mimedataprovider.cpp                |  62 ++++++++++++--------------------
 src/mimedataprovider.h                  |   2 ++
 src/mymapi.h                            |  31 ++++++++++++++++
 src/olflange.cpp                        |  29 +++++----------
 src/oomhelp.cpp                         |  10 +++---
 src/parsecontroller.cpp                 |  35 +++++++++---------
 src/revert.cpp                          |   5 +++
 tests/run-parser.cpp                    |   7 +++-
 21 files changed, 134 insertions(+), 213 deletions(-)
 rename forms/{gpgol-cs_en.cfg => gpgol-cs.cfg} (98%)
 delete mode 100644 forms/gpgol-cs_de.cfg
 rename forms/{gpgol-ms_en.cfg => gpgol-ms.cfg} (98%)
 delete mode 100644 forms/gpgol-ms_de.cfg
 rename forms/{gpgol_en.cfg => gpgol.cfg} (97%)
 delete mode 100644 forms/gpgol_de.cfg


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




More information about the Gnupg-commits mailing list