[git] GpgOL - branch, master, updated. gpgol-1.4.0-281-g4a702e6

by Andre Heinecke cvs at cvs.gnupg.org
Mon Aug 21 13:22:56 CEST 2017


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, master has been updated
       via  4a702e68616dd6f07f309dd721db4154f3333f9c (commit)
       via  790d4251054dadbe6c9d1578399386273cdf847d (commit)
       via  1a77fc1ccab8a93b654e5adea005727cb4518a8d (commit)
      from  1a7f63cc4d9089e9f4a36b78b52e62f20a17364a (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 4a702e68616dd6f07f309dd721db4154f3333f9c
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Aug 21 13:21:15 2017 +0200

    Be more relaxed if something is before PGP Marker
    
    * src/mapihelp.cpp (get_msgcls_from_pgp_lines): Remove abort
    statement for text before message.
    
    --
    This might cause problems in case somone does something
    like:
    
    Hey here is your password encrypted:
    -----BEGIN PGP MESSAGE-----
    
    But meh. It's more robutst this way in case we have an
    MTA that modifies the body.

diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
index b4c025f..5c29b6c 100644
--- a/src/mapihelp.cpp
+++ b/src/mapihelp.cpp
@@ -703,11 +703,16 @@ get_msgcls_from_pgp_lines (LPMESSAGE message)
             msgcls = xstrdup ("IPM.Note.GpgOL.PGPMessage");
           break;
         }
+
+#if 0
+      This might be too strict for some broken implementations. Lets
+      look anywhere in the first 1k.
       else if (!trailing_ws_p (p))
         break;  /* Text before the PGP message - don't take this as a
                    proper message.  */
+#endif
     }
-  
+
 
   xfree (body);
   return msgcls;

commit 790d4251054dadbe6c9d1578399386273cdf847d
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Aug 21 13:20:05 2017 +0200

    Accept more inline PGP Messages
    
    * src/mapihelp.cpp (change_message_class_ipm_note): Accept
    html only and multipart/related to check for pgp lines.

diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
index 908c9c6..b4c025f 100644
--- a/src/mapihelp.cpp
+++ b/src/mapihelp.cpp
@@ -981,7 +981,9 @@ change_message_class_ipm_note (LPMESSAGE message)
     }
   else if (!ct || !strcmp (ct, "text/plain") ||
            !strcmp (ct, "multipart/mixed") ||
-           !strcmp (ct, "multipart/alternative"))
+           !strcmp (ct, "multipart/alternative") ||
+           !strcmp (ct, "multipart/related") ||
+           !strcmp (ct, "text/html"))
     {
       /* It is quite common to have a multipart/mixed or alternative
          mail with separate encrypted PGP parts.  Look at the body to

commit 1a77fc1ccab8a93b654e5adea005727cb4518a8d
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Aug 21 13:04:55 2017 +0200

    Add hack to replace doubled linefeeds
    
    * src/mail.cpp (Mail::update_body): Replace doubled linefeeds before
    a newline.
    (find_and_replace): New helper.

diff --git a/src/mail.cpp b/src/mail.cpp
index e819434..1f65f44 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -760,6 +760,16 @@ Mail::decrypt_verify()
   return 0;
 }
 
+void find_and_replace(std::string& source, const std::string &find,
+                      const std::string &replace)
+{
+  for(std::string::size_type i = 0; (i = source.find(find, i)) != std::string::npos;)
+    {
+      source.replace(i, find.length(), replace);
+      i += replace.length();
+    }
+}
+
 void
 Mail::update_body()
 {
@@ -786,7 +796,10 @@ Mail::update_body()
         }
       return;
     }
-  const auto html = m_parser->get_html_body();
+  auto html = m_parser->get_html_body ();
+  /** Outlook does not show newlines if \r\r\n is a newline. We replace
+    these as apparently some other buggy MUA sends this. */
+  find_and_replace (html, "\r\r\n", "\r\n");
   if (opt.prefer_html && !html.empty())
     {
       char *converted = ansi_charset_to_utf8 (m_parser->get_html_charset().c_str(),
@@ -800,7 +813,8 @@ Mail::update_body()
         }
       return;
     }
-  const auto body = m_parser->get_body();
+  auto body = m_parser->get_body ();
+  find_and_replace (body, "\r\r\n", "\r\n");
   char *converted = ansi_charset_to_utf8 (m_parser->get_body_charset().c_str(),
                                           body.c_str(), body.size());
   int ret = put_oom_string (m_mailitem, "Body", converted ? converted : "");

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

Summary of changes:
 src/mail.cpp     | 18 ++++++++++++++++--
 src/mapihelp.cpp | 11 +++++++++--
 2 files changed, 25 insertions(+), 4 deletions(-)


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




More information about the Gnupg-commits mailing list