[git] GpgOL - branch, master, updated. gpgol-2.3.1-26-g83c0023

by Andre Heinecke cvs at cvs.gnupg.org
Tue Nov 6 08:57:12 CET 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  83c00237b6b9f37e1079b4a7b3baf0e34a8d9d97 (commit)
       via  a49abe7fe79e25a15b60a78093abc9704a5ef198 (commit)
       via  b9dea48de425c00e0d0630ae11144e72ac9352d2 (commit)
       via  99d4c80e57459d834aad1b63c18a1cc3823ce3de (commit)
      from  dc2a57f878282e50ccae9c55b3cfadcea1bb7f27 (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 83c00237b6b9f37e1079b4a7b3baf0e34a8d9d97
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Nov 6 08:56:27 2018 +0100

    Fix infographic url
    
    * src/ribbon-callbacks.cpp (launch_cert_details): Fix url.
    
    --
    The old redirect redirects to 404 :-( Maybe time to
    change the infographic.

diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 2d3604c..fc5d79a 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -676,7 +676,7 @@ HRESULT launch_cert_details (LPDISPATCH ctrl)
 
   if (!mail || (!mail->isSigned () && !mail->isEncrypted ()))
     {
-      ShellExecuteA(NULL, NULL, "https://emailselfdefense.fsf.org/infographic",
+      ShellExecuteA(NULL, NULL, "https://emailselfdefense.fsf.org/en/infographic.html",
                     0, 0, SW_SHOWNORMAL);
       return S_OK;
     }

commit a49abe7fe79e25a15b60a78093abc9704a5ef198
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Nov 6 08:54:26 2018 +0100

    Add junk mail handling
    
    * src/categorymanager.cpp (getJunkMailCategory): New.
    * src/mail.cpp (Mail::decryptVerify_o): Handle junk.
    * src/mail.h (Mail::m_is_junk): New.
    
    --
    Junk mails are special. An addon can't access the attachments
    so we can't decrypt PGP-MIME. We just add a marker to let
    the user now and register our folder event handler so
    that the mail can be moved out of junk.
    
    GnuPG-Bug-Id: T4188

diff --git a/src/categorymanager.cpp b/src/categorymanager.cpp
index e671f2d..d8c67e0 100644
--- a/src/categorymanager.cpp
+++ b/src/categorymanager.cpp
@@ -251,3 +251,16 @@ CategoryManager::getEncMailCategory ()
     }
   return decStr;
 }
+
+/* static */
+const std::string &
+CategoryManager::getJunkMailCategory ()
+{
+  static std::string decStr;
+  if (decStr.empty())
+    {
+      decStr = std::string ("GpgOL: ") +
+                            std::string (_("Junk Email cannot be processed"));
+    }
+  return decStr;
+}
diff --git a/src/categorymanager.h b/src/categorymanager.h
index 0e96485..f76018d 100644
--- a/src/categorymanager.h
+++ b/src/categorymanager.h
@@ -61,6 +61,8 @@ public:
     /** Get the name of the encryption category. */
     static const std::string & getEncMailCategory ();
 
+    /** Get the name of the junk category. */
+    static const std::string & getJunkMailCategory ();
 private:
     class Private;
     std::shared_ptr<Private> d;
diff --git a/src/mail.cpp b/src/mail.cpp
index 9305057..eafa3ef 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -107,7 +107,8 @@ Mail::Mail (LPDISPATCH mailitem) :
     m_first_autosecure_check(true),
     m_locate_count(0),
     m_is_about_to_be_moved(false),
-    m_locate_in_progress(false)
+    m_locate_in_progress(false),
+    m_is_junk(false)
 {
   TSTART;
   if (getMailForItem (mailitem))
@@ -1058,6 +1059,7 @@ int
 Mail::decryptVerify_o ()
 {
   TSTART;
+
   if (!isCryptoMail ())
     {
       log_debug ("%s:%s: Decrypt Verify for non crypto mail: %p.",
@@ -1070,10 +1072,31 @@ Mail::decryptVerify_o ()
                  SRCNAME, __func__, m_mailitem);
       TRETURN 1;
     }
+
+  auto cipherstream = get_attachment_stream_o (m_mailitem, m_moss_position);
+  if (!cipherstream)
+    {
+      m_is_junk = is_junk_mail (m_mailitem);
+      if (m_is_junk)
+        {
+          log_debug ("%s:%s: Detected: %p as junk",
+                     SRCNAME, __func__, m_mailitem);
+          auto mngr = CategoryManager::instance ();
+          m_store_id = mngr->addCategoryToMail (this,
+                                   CategoryManager::getJunkMailCategory (),
+                                   3 /* peach */);
+          installFolderEventHandler_o ();
+          TRETURN 0;
+        }
+      log_debug ("%s:%s: Failed to get cipherstream. Aborting handling.",
+                 SRCNAME, __func__);
+      m_type = MSGTYPE_UNKNOWN;
+      TRETURN 1;
+    }
+
   setUUID_o ();
   m_processed = true;
 
-
   /* Insert placeholder */
   char *placeholder_buf = nullptr;
   if (m_type == MSGTYPE_GPGOL_WKS_CONFIRMATION)
@@ -1133,22 +1156,12 @@ Mail::decryptVerify_o ()
   memdbg_alloc (placeholder_buf);
   xfree (placeholder_buf);
 
-  /* Do the actual parsing */
-  auto cipherstream = get_attachment_stream_o (m_mailitem, m_moss_position);
-
   if (m_type == MSGTYPE_GPGOL_WKS_CONFIRMATION)
     {
       WKSHelper::instance ()->handle_confirmation_read (this, cipherstream);
       TRETURN 0;
     }
 
-  if (!cipherstream)
-    {
-      log_debug ("%s:%s: Failed to get cipherstream.",
-                 SRCNAME, __func__);
-      TRETURN 1;
-    }
-
   m_parser = std::shared_ptr <ParseController> (new ParseController (cipherstream, m_type));
   m_parser->setSender(GpgME::UserID::addrSpecFromString(getSender_o ().c_str()));
   log_data ("%s:%s: Parser for \"%s\" is %p",
@@ -2212,6 +2225,13 @@ Mail::removeCategories_o ()
       CategoryManager::instance ()->removeCategory (this,
                                 CategoryManager::getEncMailCategory ());
     }
+  if (m_is_junk)
+    {
+      log_oom ("%s:%s: Unreffing junk category",
+                       SRCNAME, __func__);
+      CategoryManager::instance ()->removeCategory (this,
+                                CategoryManager::getJunkMailCategory ());
+    }
   TRETURN;
 }
 
@@ -2347,15 +2367,15 @@ Mail::updateCategories_o ()
       int color = 0;
       if (lvl == 2)
         {
-          color = 7;
+          color = 7; /* Olive */
         }
       if (lvl == 3)
         {
-          color = 5;
+          color = 5; /* Green */
         }
       if (lvl == 4)
         {
-          color = 20;
+          color = 20; /* Dark Green */
         }
       m_store_id = mngr->addCategoryToMail (this, buf, color);
       m_verify_category = buf;
@@ -2370,7 +2390,7 @@ Mail::updateCategories_o ()
     {
       const auto id = mngr->addCategoryToMail (this,
                                  CategoryManager::getEncMailCategory (),
-                                 8);
+                                 8 /* Blue */);
       if (m_store_id.empty())
         {
           m_store_id = id;
diff --git a/src/mail.h b/src/mail.h
index 05d26d0..170770c 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -654,5 +654,6 @@ private:
   bool m_locate_in_progress; /* Simplified state variable for locate */
   std::string m_store_id; /* Store id for categories */
   std::string m_verify_category; /* The category string for the verify result */
+  bool m_is_junk; /* Mail is in the junk folder */
 };
 #endif // MAIL_H

commit b9dea48de425c00e0d0630ae11144e72ac9352d2
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Nov 5 16:44:00 2018 +0100

    Add junk/spam mail folder detection
    
    * src/oomhelp.cpp, src/oomhelp.h (is_junk_mail): New.
    
    --
    We can't access attachments in junk so we need some special
    handling. As there is no "Junk" property we do this by
    comparing the entryid of the accounts junk folder with
    the actual folder of the mail.
    
    GnuPG-Bug-Id: T4188

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 9ac1083..ace525a 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -2872,3 +2872,60 @@ release_disp (LPDISPATCH obj)
   gpgol_release (obj);
   TRETURN;
 }
+
+bool
+is_junk_mail (LPDISPATCH mailitem)
+{
+  TSTART;
+  if (!mailitem)
+    {
+      STRANGEPOINT;
+      TRETURN false;
+    }
+
+  auto mapi_namespace = MAKE_SHARED (get_oom_object (mailitem, "Session"));
+
+  if (!mapi_namespace)
+    {
+      STRANGEPOINT;
+      TRETURN false;
+    }
+
+  auto spam_folder = MAKE_SHARED (get_oom_object (mapi_namespace.get(),
+                                                  "GetDefaultFolder(23)"));
+
+  if (!spam_folder)
+    {
+      STRANGEPOINT;
+      TRETURN false;
+    }
+
+  auto mail_folder = MAKE_SHARED (get_oom_object (mailitem, "Parent"));
+
+  if (!mail_folder)
+    {
+      STRANGEPOINT;
+      TRETURN false;
+    }
+
+  char *spam_id = get_oom_string (spam_folder.get(), "entryID");
+  if (!spam_id)
+    {
+      STRANGEPOINT;
+      TRETURN false;
+    }
+  char *folder_id = get_oom_string (mail_folder.get(), "entryID");
+  if (!folder_id)
+    {
+      STRANGEPOINT;
+      free (spam_id);
+      TRETURN false;
+    }
+
+  bool ret = !strcmp (spam_id, folder_id);
+
+  free (spam_id);
+  free (folder_id);
+
+  TRETURN ret;
+}
diff --git a/src/oomhelp.h b/src/oomhelp.h
index 3f9199c..762f578 100644
--- a/src/oomhelp.h
+++ b/src/oomhelp.h
@@ -427,4 +427,7 @@ LPDISPATCH find_or_add_text_prop (LPDISPATCH props, const char *name);
 
 /* Find a user property and return it if found. */
 LPDISPATCH find_user_prop (LPDISPATCH props, const char *name);
+
+/* Return true if this message is in the junk folder for this account */
+bool is_junk_mail (LPDISPATCH mailitem);
 #endif /*OOMHELP_H*/

commit 99d4c80e57459d834aad1b63c18a1cc3823ce3de
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Nov 5 09:11:14 2018 +0100

    Fix tests build for different gpgmepp prefix
    
    * tests/Makefile.am: Add GPGME_CXXFLAGS to CXXFLAGS.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index dfb96b0..336794f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,11 +32,11 @@ if !HAVE_W32_SYSTEM
 AM_CXXFLAGS = -I$(top_srcdir)/src $(GPGME_CFLAGS) $(GPGME_CFLAGS)/gpgme++ \
 			  $(LIBASSUAN_CFLAGS) -std=c++11  -D_FILE_OFFSET_BITS=64 \
 			  -DBUILD_TESTS -DDATADIR=\"$(abs_srcdir)/data\" \
-              -DGPGHOMEDIR=\"$(abs_srcdir)/gnupg_home\"
+              -DGPGHOMEDIR=\"$(abs_srcdir)/gnupg_home\" $(GPGMEPP_CXXFLAGS)
 else
 AM_CXXFLAGS = -I$(top_srcdir)/src $(GPGME_CFLAGS) $(GPGME_CFLAGS)/gpgme++ \
-			  $(LIBASSUAN_CFLAGS) -std=c++11  -D_FILE_OFFSET_BITS=64 \
-			  -DBUILD_TESTS
+			  $(LIBASSUAN_CFLAGS) $(GPGMEPP_CXXFLAGS) -std=c++11 \
+			  -D_FILE_OFFSET_BITS=64 -DBUILD_TESTS
 endif
 LDADD = @GPG_ERROR_LIBS@
 

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

Summary of changes:
 src/categorymanager.cpp  | 13 +++++++++++
 src/categorymanager.h    |  2 ++
 src/mail.cpp             | 52 +++++++++++++++++++++++++++++--------------
 src/mail.h               |  1 +
 src/oomhelp.cpp          | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/oomhelp.h            |  3 +++
 src/ribbon-callbacks.cpp |  2 +-
 tests/Makefile.am        |  6 ++---
 8 files changed, 116 insertions(+), 20 deletions(-)


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




More information about the Gnupg-commits mailing list