[git] GpgOL - branch, master, updated. gpgol-1.4.0-204-gb527d97

by Andre Heinecke cvs at cvs.gnupg.org
Thu Dec 1 17:40:04 CET 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, master has been updated
       via  b527d97b06c684bc00df3023407c60c4338a71ec (commit)
      from  5e58582a83da40ea2b0e234e1a9f638c6ccfd9c7 (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 b527d97b06c684bc00df3023407c60c4338a71ec
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Dec 1 17:37:57 2016 +0100

    Preselect sign / encrypt for reply / forward
    
    * src/mail.cpp (Mail::Mail): Initalize crypto flags.
    (Mail::get_crypto_flags): New.
    (Mail::parsing_done): Set crypto flags.
    * src/mailitem-events.cpp (EVENT_SINK_INVOKE): Handle reply, forward
    and ReplyAll.
    
    --
    This sets sign for signed mails, encrypt for encrypted mails
    and sign & encrypt for signed and encrypted mails.

diff --git a/src/mail.cpp b/src/mail.cpp
index 1e820c6..162b817 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -78,6 +78,7 @@ Mail::Mail (LPDISPATCH mailitem) :
     m_close_triggered(false),
     m_is_html_alternative(false),
     m_moss_position(0),
+    m_crypto_flags(0),
     m_type(MSGTYPE_UNKNOWN)
 {
   if (get_mail_for_item (mailitem))
@@ -711,6 +712,16 @@ Mail::parsing_done()
   m_decrypt_result = m_parser->decrypt_result ();
   m_verify_result = m_parser->verify_result ();
 
+  m_crypto_flags = 0;
+  if (m_decrypt_result.numRecipients())
+    {
+      m_crypto_flags |= 1;
+    }
+  if (m_verify_result.numSignatures())
+    {
+      m_crypto_flags |= 2;
+    }
+
   update_sigstate ();
   m_needs_wipe = true;
 
@@ -1703,3 +1714,9 @@ Mail::get_cached_html_body () const
 {
   return m_html_body;
 }
+
+int
+Mail::get_crypto_flags () const
+{
+  return m_crypto_flags;
+}
diff --git a/src/mail.h b/src/mail.h
index 7eddf34..680ea1c 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -299,6 +299,11 @@ public:
 
   /** Get the html body. It is updated in update_oom_data. */
   const std::string & get_cached_html_body () const;
+
+  /** Returns 1 if the mail was encrypted, 2 if signed, 3 if both.
+      Only valid after decrypt_verify.
+  */
+  int get_crypto_flags () const;
 private:
   void update_categories ();
   void update_body ();
@@ -317,6 +322,7 @@ private:
        m_close_triggered, /* We have programtically triggered a close */
        m_is_html_alternative; /* Body Format is not plain text */
   int m_moss_position; /* The number of the original message attachment. */
+  int m_crypto_flags;
   std::string m_sender;
   std::string m_html_body; /* Cached html body. */
   msgtype_t m_type; /* Our messagetype as set in mapi */
diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp
index c23aa9d..4ae4ec3 100644
--- a/src/mailitem-events.cpp
+++ b/src/mailitem-events.cpp
@@ -418,6 +418,38 @@ EVENT_SINK_INVOKE(MailItemEvents)
           delete m_mail;
           return S_OK;
         }
+      case Forward:
+      case Reply:
+      case ReplyAll:
+        {
+          log_oom_extra ("%s:%s: Reply Forward ReplyAll: %p",
+                         SRCNAME, __func__, m_mail);
+          int crypto_flags = 0;
+          if (!(crypto_flags = m_mail->get_crypto_flags ()))
+            {
+              break;
+            }
+          if (parms->cArgs != 2 || parms->rgvarg[1].vt != (VT_DISPATCH) ||
+              parms->rgvarg[0].vt != (VT_BOOL | VT_BYREF))
+            {
+              /* This happens in the weird case */
+              log_debug ("%s:%s: Unexpected args %i %x %x named: %i",
+                         SRCNAME, __func__, parms->cArgs, parms->rgvarg[0].vt, parms->rgvarg[1].vt,
+                         parms->cNamedArgs);
+              break;
+            }
+          LPMESSAGE msg = get_oom_base_message (parms->rgvarg[1].pdispVal);
+          if (!msg)
+            {
+              log_debug ("%s:%s: Failed to get base message",
+                         SRCNAME, __func__);
+              break;
+            }
+          set_gpgol_draft_info_flags (msg, crypto_flags);
+          gpgol_release (msg);
+          break;
+        }
+
       default:
         log_oom_extra ("%s:%s: Message:%p Unhandled Event: %lx \n",
                        SRCNAME, __func__, m_object, dispid);

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

Summary of changes:
 src/mail.cpp            | 17 +++++++++++++++++
 src/mail.h              |  6 ++++++
 src/mailitem-events.cpp | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+)


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




More information about the Gnupg-commits mailing list