[git] GpgOL - branch, master, updated. gpgol-2.2.0-16-gb853a5a

by Andre Heinecke cvs at cvs.gnupg.org
Fri Jun 22 15:21:24 CEST 2018


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  b853a5a70e325c80628edf4720e3ccb6030f1860 (commit)
       via  d78c84ff7bb45a3ac6a5f277db2210730b0609c9 (commit)
      from  b4b5960c7397ce65d0c105f3538270157fd40e5e (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 b853a5a70e325c80628edf4720e3ccb6030f1860
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Jun 22 15:19:34 2018 +0200

    Fix WKS when async enc is disabled
    
    * src/mailitem-events.cpp (Send): Allow notify after the
    send.
    * src/windowmessages.cpp (CRYPTO_DONE): Don't do allow notify here.

diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index 9191005..41c1376 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -30,6 +30,7 @@
 #include "mail.h"
 #include "mapihelp.h"
 #include "gpgoladdin.h"
+#include "wks-helper.h"
 
 #undef _
 #define _(a) utf8_gettext (a)
@@ -361,16 +362,17 @@ EVENT_SINK_INVOKE(MailItemEvents)
           if (m_mail->cryptState () == Mail::NoCryptMail &&
               m_mail->needs_crypto_m ())
             {
+              log_debug ("%s:%s: Send event for crypto mail %p saving and starting.",
+                         SRCNAME, __func__, m_mail);
+
               // First contact with a mail to encrypt update
               // state and oom data.
               m_mail->updateOOMData_o ();
+
               m_mail->setCryptState (Mail::NeedsFirstAfterWrite);
 
               // Check inline response state before the write.
               m_mail->check_inline_response ();
-
-              log_debug ("%s:%s: Send event for crypto mail %p saving and starting.",
-                         SRCNAME, __func__, m_mail);
               // Save the Mail
               invoke_oom_method (m_object, "Save", NULL);
 
@@ -431,6 +433,7 @@ EVENT_SINK_INVOKE(MailItemEvents)
                 }
               log_debug ("%s:%s: Passing send event for no-mime message %p.",
                          SRCNAME, __func__, m_object);
+              WKSHelper::instance()->allow_notify (1000);
               break;
             }
 
@@ -516,8 +519,9 @@ EVENT_SINK_INVOKE(MailItemEvents)
                 {
                   break;
                 }
-              log_debug ("%s:%s: Passing send event for message %p.",
+              log_debug ("%s:%s: Passing send event for mime-encrypted message %p.",
                          SRCNAME, __func__, m_object);
+              WKSHelper::instance()->allow_notify (1000);
               break;
             }
           else
diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp
index 787f435..83d0cfd 100644
--- a/src/windowmessages.cpp
+++ b/src/windowmessages.cpp
@@ -151,10 +151,6 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
               invoke_oom_method (mail->item (), "Send", NULL);
               log_debug ("%s:%s:  Send for %p completed.",
                          SRCNAME, __func__, mail);
-              // Allow the WKS helper to queue a notification.
-              WKSHelper::instance()->allow_notify ();
-              log_debug ("%s:%s:  Crypto done handler completed.",
-                         SRCNAME, __func__);
               break;
             }
           case (BRING_TO_FRONT):

commit d78c84ff7bb45a3ac6a5f277db2210730b0609c9
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Jun 22 14:46:04 2018 +0200

    More cleanup and convetional naming
    
    --

diff --git a/src/mail.cpp b/src/mail.cpp
index 783ccd3..11266e5 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -202,6 +202,7 @@ Mail::~Mail()
                  SRCNAME, __func__);
 }
 
+//static
 Mail *
 Mail::getMailForItem (LPDISPATCH mailitem)
 {
@@ -220,6 +221,7 @@ Mail::getMailForItem (LPDISPATCH mailitem)
   return it->second;
 }
 
+//static
 Mail *
 Mail::getMailForUUID (const char *uuid)
 {
@@ -237,6 +239,7 @@ Mail::getMailForUUID (const char *uuid)
   return it->second;
 }
 
+//static
 bool
 Mail::isValidPtr (const Mail *mail)
 {
@@ -297,7 +300,7 @@ Mail::preProcessMessage_m ()
 }
 
 static LPDISPATCH
-get_attachment (LPDISPATCH mailitem, int pos)
+get_attachment_o (LPDISPATCH mailitem, int pos)
 {
   LPDISPATCH attachment;
   LPDISPATCH attachments = get_oom_object (mailitem, "Attachments");
@@ -418,7 +421,7 @@ Mail::checkAttachments_o () const
 
 /** Get the cipherstream of the mailitem. */
 static LPSTREAM
-get_attachment_stream (LPDISPATCH mailitem, int pos)
+get_attachment_stream_o (LPDISPATCH mailitem, int pos)
 {
   if (!pos)
     {
@@ -426,7 +429,7 @@ get_attachment_stream (LPDISPATCH mailitem, int pos)
                  SRCNAME, __func__);
       return NULL;
     }
-  LPDISPATCH attachment = get_attachment (mailitem, pos);
+  LPDISPATCH attachment = get_attachment_o (mailitem, pos);
   LPSTREAM stream = NULL;
 
   if (!attachment)
@@ -610,7 +613,7 @@ copy_attachment_to_file (std::shared_ptr<Attachment> att, HANDLE hFile)
 /** Sets some meta data on the last attachment added. The meta
   data is taken from the attachment object. */
 static int
-fixup_last_attachment (LPDISPATCH mail, std::shared_ptr<Attachment> attachment)
+fixup_last_attachment_o (LPDISPATCH mail, std::shared_ptr<Attachment> attachment)
 {
   /* Currently we only set content id */
   if (attachment->get_content_id ().empty())
@@ -620,7 +623,7 @@ fixup_last_attachment (LPDISPATCH mail, std::shared_ptr<Attachment> attachment)
       return 0;
     }
 
-  LPDISPATCH attach = get_attachment (mail, -1);
+  LPDISPATCH attach = get_attachment_o (mail, -1);
   if (!attach)
     {
       log_error ("%s:%s: No attachment.",
@@ -637,7 +640,7 @@ fixup_last_attachment (LPDISPATCH mail, std::shared_ptr<Attachment> attachment)
 /** Helper to update the attachments of a mail object in oom.
   does not modify the underlying mapi structure. */
 static int
-add_attachments(LPDISPATCH mail,
+add_attachments_o(LPDISPATCH mail,
                 std::vector<std::shared_ptr<Attachment> > attachments)
 {
   int err = 0;
@@ -675,7 +678,7 @@ add_attachments(LPDISPATCH mail,
       xfree (wchar_file);
       xfree (wchar_name);
 
-      err = fixup_last_attachment (mail, att);
+      err = fixup_last_attachment_o (mail, att);
     }
   return err;
 }
@@ -1004,7 +1007,7 @@ Mail::decryptVerify_o ()
   xfree (placeholder_buf);
 
   /* Do the actual parsing */
-  auto cipherstream = get_attachment_stream (m_mailitem, m_moss_position);
+  auto cipherstream = get_attachment_stream_o (m_mailitem, m_moss_position);
 
   if (m_type == MSGTYPE_GPGOL_WKS_CONFIRMATION)
     {
@@ -1309,7 +1312,7 @@ Mail::parsing_done()
       m_crypto_flags |= 2;
     }
 
-  updateSigstate_o ();
+  updateSigstate ();
   m_needs_wipe = !m_is_send_again;
 
   TRACEPOINT;
@@ -1334,7 +1337,7 @@ Mail::parsing_done()
   checkAttachments_o ();
 
   /* Update attachments */
-  if (add_attachments (m_mailitem, m_parser->get_attachments()))
+  if (add_attachments_o (m_mailitem, m_parser->get_attachments()))
     {
       log_error ("%s:%s: Failed to update attachments.",
                  SRCNAME, __func__);
@@ -1378,7 +1381,7 @@ Mail::encryptSignStart_o ()
       return -1;
     }
   int flags = 0;
-  if (!needs_crypto())
+  if (!needs_crypto_m ())
     {
       return 0;
     }
@@ -1452,7 +1455,7 @@ Mail::encryptSignStart_o ()
 }
 
 int
-Mail::needs_crypto ()
+Mail::needs_crypto_m () const
 {
   LPMESSAGE message = get_oom_message (m_mailitem);
   bool ret;
@@ -1737,7 +1740,7 @@ Mail::isSMIME_m ()
 }
 
 static std::string
-get_string (LPDISPATCH item, const char *str)
+get_string_o (LPDISPATCH item, const char *str)
 {
   char *buf = get_oom_string (item, str);
   if (!buf)
@@ -1750,19 +1753,19 @@ get_string (LPDISPATCH item, const char *str)
 std::string
 Mail::getSubject_o () const
 {
-  return get_string (m_mailitem, "Subject");
+  return get_string_o (m_mailitem, "Subject");
 }
 
 std::string
 Mail::getBody_o () const
 {
-  return get_string (m_mailitem, "Body");
+  return get_string_o (m_mailitem, "Body");
 }
 
 std::string
 Mail::getHTMLBody_o () const
 {
-  return get_string (m_mailitem, "HTMLBody");
+  return get_string_o (m_mailitem, "HTMLBody");
 }
 
 char **
@@ -1898,9 +1901,9 @@ get_uid_for_sender (const Key &k, const char *sender)
 }
 
 void
-Mail::updateSigstate_o ()
+Mail::updateSigstate ()
 {
-  std::string sender = getSender_o ();
+  std::string sender = getSender ();
 
   if (sender.empty())
     {
@@ -2736,7 +2739,7 @@ Mail::appendToInlineBody (const std::string &data)
 }
 
 int
-Mail::inlineBodyToBody ()
+Mail::inlineBodyToBody_o ()
 {
   if (!m_crypter)
     {
@@ -2852,7 +2855,7 @@ Mail::updateCryptOOM_o ()
 
   if (getDoPGPInline ())
     {
-      if (inlineBodyToBody ())
+      if (inlineBodyToBody_o ())
         {
           log_error ("%s:%s: Inline body to body failed %p.",
                      SRCNAME, __func__, this);
@@ -3011,7 +3014,7 @@ Mail::locateAllCryptoRecipients_o ()
   std::map<LPDISPATCH, Mail *>::iterator it;
   for (it = s_mail_map.begin(); it != s_mail_map.end(); ++it)
     {
-      if (it->second->needs_crypto ())
+      if (it->second->needs_crypto_m ())
         {
           it->second->locateKeys_o ();
         }
diff --git a/src/mail.h b/src/mail.h
index 287d07d..4e6bb92 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -251,7 +251,7 @@ public:
   int encryptSignStart_o ();
 
   /** @brief Necessary crypto operations were completed successfully. */
-  bool wasCryptoSuccessful_m () { return m_crypt_successful || !needs_crypto(); }
+  bool wasCryptoSuccessful_m () { return m_crypt_successful || !needs_crypto_m (); }
 
   /** @brief Message should be encrypted and or signed.
     0: No
@@ -259,7 +259,7 @@ public:
     2: Sign
     3: Encrypt & Sign
   */
-  int needs_crypto ();
+  int needs_crypto_m () const;
 
   /** @brief wipe the plaintext from the message and encrypt attachments.
    *
@@ -453,7 +453,7 @@ public:
   void appendToInlineBody (const std::string &data);
 
   /** Set the inline body as OOM body property. */
-  int inlineBodyToBody ();
+  int inlineBodyToBody_o ();
 
   /** Get the crypt state */
   CryptState cryptState () const {return m_crypt_state;}
@@ -590,7 +590,7 @@ public:
 
 private:
   void updateCategories_o ();
-  void updateSigstate_o ();
+  void updateSigstate ();
 
   LPDISPATCH m_mailitem;
   LPDISPATCH m_event_sink;
diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index be15eea..9191005 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -143,23 +143,12 @@ EVENT_SINK_INVOKE(MailItemEvents)
         {
           log_oom_extra ("%s:%s: Open : %p",
                          SRCNAME, __func__, m_mail);
-          LPMESSAGE message;
-          if (g_ol_version_major < 14 && m_mail->setUUID_o ())
-            {
-              /* In Outlook 2007 we need the uid for every
-                 open mail to track the message in case
-                 it is sent and crypto is required. */
-              log_debug ("%s:%s: Failed to set uuid.",
-                         SRCNAME, __func__);
-              delete m_mail; /* deletes this, too */
-              return S_OK;
-            }
           int draft_flags = 0;
           if (!opt.encrypt_default && !opt.sign_default)
             {
               return S_OK;
             }
-          message = get_oom_base_message (m_object);
+          LPMESSAGE message = get_oom_base_message (m_object);
           if (!message)
             {
               log_error ("%s:%s: Failed to get message.",
@@ -248,7 +237,7 @@ EVENT_SINK_INVOKE(MailItemEvents)
                   Testing shows that Outlook always sends these three in a row
                   */)
                 {
-                  if (opt.autosecure || (m_mail->needs_crypto() & 1))
+                  if (opt.autosecure || (m_mail->needs_crypto_m () & 1))
                     {
                       /* XXX Racy race. This is a fix for crashes
                          that happend if a resolved recipient is copied an pasted.
@@ -355,7 +344,7 @@ EVENT_SINK_INVOKE(MailItemEvents)
            */
           log_oom_extra ("%s:%s: Send : %p",
                          SRCNAME, __func__, m_mail);
-          if (!m_mail->needs_crypto () && m_mail->cryptState () == Mail::NoCryptMail)
+          if (!m_mail->needs_crypto_m () && m_mail->cryptState () == Mail::NoCryptMail)
             {
              log_debug ("%s:%s: No crypto neccessary. Passing send for %p obj %p",
                         SRCNAME, __func__, m_mail, m_object);
@@ -370,7 +359,7 @@ EVENT_SINK_INVOKE(MailItemEvents)
            }
 
           if (m_mail->cryptState () == Mail::NoCryptMail &&
-              m_mail->needs_crypto ())
+              m_mail->needs_crypto_m ())
             {
               // First contact with a mail to encrypt update
               // state and oom data.
@@ -626,7 +615,7 @@ EVENT_SINK_INVOKE(MailItemEvents)
             }
 
           if (!m_mail->isCryptoMail () && m_mail->is_forwarded_crypto_mail () &&
-              !m_mail->needs_crypto () && m_mail->cryptState () == Mail::NoCryptMail)
+              !m_mail->needs_crypto_m () && m_mail->cryptState () == Mail::NoCryptMail)
             {
               /* We are sure now that while this is a forward of an encrypted
                * mail that the forward should not be signed or encrypted. So

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

Summary of changes:
 src/mail.cpp            | 45 ++++++++++++++++++++++++---------------------
 src/mail.h              |  8 ++++----
 src/mailitem-events.cpp | 33 +++++++++++++--------------------
 src/windowmessages.cpp  |  4 ----
 4 files changed, 41 insertions(+), 49 deletions(-)


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




More information about the Gnupg-commits mailing list