[git] GpgOL - branch, master, updated. gpgol-2.0.6-128-g34f6bb7

by Andre Heinecke cvs at cvs.gnupg.org
Wed Apr 11 15:25:29 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  34f6bb73882ee5a9c996db506fb4f730aa57e658 (commit)
      from  88a3204d34b97430e7f1f80ebfe1f9f8e6fa9ddc (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 34f6bb73882ee5a9c996db506fb4f730aa57e658
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Apr 11 15:22:05 2018 +0200

    Implement send again for crypto mails
    
    * src/mail.cpp (Mail::set_is_send_again): New.
    (Mail::parsing_done): Add handling for send again.
    * src/mailitem-events.cpp: Detect a send again.
    
    --
    This detects the send again by the propchange of SendUsingAccount
    and a "sent" value of false. Usually crypto mails have a sent
    value of true.
    
    In this case we remove our attachments (so that they are not
    included in the sent again), set the draft info so that the
    crypto state is nicely preselected and finally change the
    type so that is_crypo_mail returns false for decrypted
    send again mails.
    
    GnuPG-Bug-Id: T3885

diff --git a/src/mail.cpp b/src/mail.cpp
index ea2f65a..a408800 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -93,7 +93,8 @@ Mail::Mail (LPDISPATCH mailitem) :
     m_crypt_state(NoCryptMail),
     m_window(nullptr),
     m_async_crypt_disabled(false),
-    m_is_forwarded_crypto_mail(false)
+    m_is_forwarded_crypto_mail(false),
+    m_is_send_again(false)
 {
   if (get_mail_for_item (mailitem))
     {
@@ -1143,7 +1144,7 @@ Mail::parsing_done()
     }
 
   update_sigstate ();
-  m_needs_wipe = true;
+  m_needs_wipe = !m_is_send_again;
 
   TRACEPOINT;
   /* Set categories according to the result. */
@@ -1164,6 +1165,26 @@ Mail::parsing_done()
                  SRCNAME, __func__);
     }
 
+  if (m_is_send_again)
+    {
+      log_debug ("%s:%s: I think that this is the send again of a crypto mail.",
+                 SRCNAME, __func__);
+
+      /* We no longer want to be treated like a crypto mail. */
+      m_type = MSGTYPE_UNKNOWN;
+      LPMESSAGE msg = get_oom_base_message (m_mailitem);
+      if (!msg)
+        {
+          TRACEPOINT;
+        }
+      else
+        {
+          set_gpgol_draft_info_flags (msg, m_crypto_flags);
+          gpgol_release (msg);
+        }
+      remove_our_attachments ();
+    }
+
   log_debug ("%s:%s: Delayed invalidate to update sigstate.",
              SRCNAME, __func__);
   CloseHandle(CreateThread (NULL, 0, delayed_invalidate_ui, (LPVOID) this, 0,
diff --git a/src/mail.h b/src/mail.h
index d267d8b..ee108a2 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -473,6 +473,14 @@ public:
   bool has_crypted_or_empty_body ();
 
   void update_body ();
+
+  /** Set if this mail looks like the send again of a crypto mail.
+      This will mean that after it is decrypted it is treated
+      like an unencrypted mail so that it can be encrypted again
+      or sent unencrypted.
+      */
+  void set_is_send_again (bool value) { m_is_send_again = value; }
+
 private:
   void update_categories ();
   void update_sigstate ();
@@ -513,5 +521,6 @@ private:
   bool m_async_crypt_disabled;
   std::string m_mime_data;
   bool m_is_forwarded_crypto_mail; /* Is this a forward of a crypto mail */
+  bool m_is_send_again; /* Is this a send again of a crypto mail */
 };
 #endif // MAIL_H
diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index ec6d6cc..f63665c 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -269,6 +269,21 @@ EVENT_SINK_INVOKE(MailItemEvents)
           log_oom ("%s:%s: Message %p propchange: %ls.",
                    SRCNAME, __func__, m_object, prop_name);
 
+          if (!wcscmp (prop_name, L"SendUsingAccount"))
+            {
+              bool sent = get_oom_bool (m_object, "Sent");
+              if (sent)
+                {
+                  log_debug ("%s:%s: Ignoring SendUsingAccount change for sent %p ",
+                             SRCNAME, __func__, m_object);
+                  return S_OK;
+                }
+              log_debug ("%s:%s: Message %p looks like send again.",
+                        SRCNAME, __func__, m_object);
+              m_mail->set_is_send_again (true);
+              return S_OK;
+            }
+
           /* We have tried several scenarios to handle propery changes.
              Only save the property in MAPI and call MAPI SaveChanges
              worked and did not leak plaintext but this caused outlook

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

Summary of changes:
 src/mail.cpp            | 25 +++++++++++++++++++++++--
 src/mail.h              |  9 +++++++++
 src/mailitem-events.cpp | 15 +++++++++++++++
 3 files changed, 47 insertions(+), 2 deletions(-)


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




More information about the Gnupg-commits mailing list