[svn] GpgOL - r214 - in trunk: po src

svn author wk cvs at cvs.gnupg.org
Thu Jan 31 16:46:51 CET 2008


Author: wk
Date: 2008-01-31 16:46:49 +0100 (Thu, 31 Jan 2008)
New Revision: 214

Modified:
   trunk/po/de.po
   trunk/po/sv.po
   trunk/src/ChangeLog
   trunk/src/ext-commands.cpp
   trunk/src/mapihelp.cpp
   trunk/src/mapihelp.h
   trunk/src/message.cpp
   trunk/src/olflange.cpp
   trunk/src/session-events.cpp
   trunk/src/user-events.cpp
Log:
Another take on the sent-folder problem.  Not yet finished.


Modified: trunk/po/de.po
===================================================================
--- trunk/po/de.po	2008-01-29 15:14:52 UTC (rev 213)
+++ trunk/po/de.po	2008-01-31 15:46:49 UTC (rev 214)
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: GpgOL 0.10.0\n"
 "Report-Msgid-Bugs-To: bug-gpgol at g10code.com\n"
-"POT-Creation-Date: 2008-01-03 12:18+0100\n"
+"POT-Creation-Date: 2008-01-29 20:07+0100\n"
 "PO-Revision-Date: 2007-12-07 08:44+0100\n"
 "Last-Translator: Werner Koch <wk at gnupg.org>\n"
 "Language-Team: de\n"
@@ -56,7 +56,7 @@
 msgid "Select Certificate Manager"
 msgstr "GnuPG Zertifikats&verwaltung"
 
-#: src/engine.c:364
+#: src/engine.c:365
 msgid ""
 "The user interface server is not available or does not work.  Using an "
 "internal user interface.\n"
@@ -70,7 +70,7 @@
 "Diese ist allerdings sehr vereinfacht und kann z.B. keine S/MIME "
 "verschlüsselten Nachrichten entschlüsseln."
 
-#: src/engine.c:368 src/ext-commands.cpp:672 src/main.c:603 src/main.c:609
+#: src/engine.c:369 src/ext-commands.cpp:682 src/main.c:603 src/main.c:609
 msgid "GpgOL"
 msgstr "GpgOL"
 
@@ -208,111 +208,111 @@
 msgid "*** End Notation ***\n"
 msgstr "*** Ende Notation ***\n"
 
-#: src/ext-commands.cpp:431
+#: src/ext-commands.cpp:441
 msgid "&Decrypt and verify message"
 msgstr "Entschlüsseln/Prüfen der Nachricht"
 
-#: src/ext-commands.cpp:432
+#: src/ext-commands.cpp:442
 msgid "&Verify signature"
 msgstr "&Unterschrift prüfen"
 
-#: src/ext-commands.cpp:433
+#: src/ext-commands.cpp:443
 msgid "&Display crypto information"
 msgstr "~Krypto Informationen anzeigen"
 
-#: src/ext-commands.cpp:443
+#: src/ext-commands.cpp:453
 msgid ">GnuPG protocol"
 msgstr ">GnuPG Protokoll"
 
-#: src/ext-commands.cpp:444
+#: src/ext-commands.cpp:454
 msgid "auto"
 msgstr "automatisch"
 
-#: src/ext-commands.cpp:445
+#: src/ext-commands.cpp:455
 msgid "PGP/MIME"
 msgstr "PGP/MIME"
 
-#: src/ext-commands.cpp:446
+#: src/ext-commands.cpp:456
 msgid "S/MIME"
 msgstr "S/MIME"
 
-#: src/ext-commands.cpp:448
+#: src/ext-commands.cpp:458
 msgid "&encrypt message with GnuPG"
 msgstr "Nachricht mit GnuPG verschlüsseln"
 
-#: src/ext-commands.cpp:449
+#: src/ext-commands.cpp:459
 msgid "&sign message with GnuPG"
 msgstr "Nachricht mit GnuPG unterschreiben"
 
-#: src/ext-commands.cpp:453 src/ext-commands.cpp:849
+#: src/ext-commands.cpp:463 src/ext-commands.cpp:859
 msgid "Encrypt message with GnuPG"
 msgstr "Nachricht mit GnuPG verschlüsseln"
 
-#: src/ext-commands.cpp:454 src/ext-commands.cpp:859
+#: src/ext-commands.cpp:464 src/ext-commands.cpp:869
 msgid "Sign message with GnuPG"
 msgstr "Nachricht mit GnuPG unterschreiben"
 
-#: src/ext-commands.cpp:489
+#: src/ext-commands.cpp:499
 msgid "GnuPG Certificate &Manager"
 msgstr "GnuPG Zertifikats&verwaltung"
 
-#: src/ext-commands.cpp:493
+#: src/ext-commands.cpp:503
 msgid "Open the certificate manager"
 msgstr "Die Zertifikatsverwaltung öffnen"
 
-#: src/ext-commands.cpp:671
+#: src/ext-commands.cpp:681
 msgid "Could not start certificate manager"
 msgstr "Die Zertifikatsverwaltung konnte nicht aufgerufen werden"
 
-#: src/ext-commands.cpp:733
+#: src/ext-commands.cpp:743
 msgid "Select this option to decrypt and verify the message."
 msgstr ""
 "Wählen Sie diese Option um die Nachricht zu entschlüsseln bzw. zu "
 "verifizieren."
 
-#: src/ext-commands.cpp:740
+#: src/ext-commands.cpp:750
 msgid "Select this option to show information on the crypto status"
 msgstr ""
 "Wählen Sie diese Option um Informationen über den Krypto-Status der "
 "Nachricht anzuzeigen."
 
-#: src/ext-commands.cpp:748 src/ext-commands.cpp:829
+#: src/ext-commands.cpp:758 src/ext-commands.cpp:839
 msgid "Check the signature now and display the result"
 msgstr "Die digitale Unterschrift jetzt prüfen und das Resultat anzeigen"
 
-#: src/ext-commands.cpp:755
+#: src/ext-commands.cpp:765
 msgid "Select this option to automatically select the protocol."
 msgstr "Wählen Sie diese Option zum das Protokoll automatisch auszuwählen."
 
-#: src/ext-commands.cpp:762
+#: src/ext-commands.cpp:772
 msgid "Select this option to select the PGP/MIME protocol."
 msgstr "Wählen Sie diese Option zum das PGP/MIME Protokoll auszuwählen."
 
-#: src/ext-commands.cpp:769
+#: src/ext-commands.cpp:779
 msgid "Select this option to select the S/MIME protocol."
 msgstr "Wählen Sie diese Option zum das S/MIME Protokoll auszuwählen."
 
-#: src/ext-commands.cpp:776
+#: src/ext-commands.cpp:786
 msgid "Select this option to encrypt the message."
 msgstr "Wählen Sie diese Option zum Verschlüsseln der Nachricht."
 
-#: src/ext-commands.cpp:783
+#: src/ext-commands.cpp:793
 msgid "Select this option to sign the message."
 msgstr "Wählen Sie diese Option zum Unterschreiben der Nachricht."
 
-#: src/ext-commands.cpp:790
+#: src/ext-commands.cpp:800
 msgid "Select this option to open the certificate manager"
 msgstr "Wählen Sie diese Option zum die Zertifikatsverwaltung zu öffenen."
 
-#: src/ext-commands.cpp:819
+#: src/ext-commands.cpp:829
 msgid "Show S/MIME status info"
 msgstr "S/MIME Status Informationen anzeigen"
 
-#: src/ext-commands.cpp:839
+#: src/ext-commands.cpp:849
 msgid "Use S/MIME for sign/encrypt"
 msgstr "S/MIME zum signieren/verschlüsseln verwenden"
 
-#: src/ext-commands.cpp:869
+#: src/ext-commands.cpp:879
 msgid "Open the GpgOL certificate manager"
 msgstr "Zertifikatsverwaltung von GpgOL öffnen"
 
@@ -334,7 +334,7 @@
 "\n"
 "geschrieben."
 
-#: src/mapihelp.cpp:1228
+#: src/mapihelp.cpp:1284
 msgid ""
 "[The content of this message is not visible because it has been decrypted by "
 "another Outlook session.  Use the \"decrypt/verify\" command to make it "
@@ -344,7 +344,7 @@
 "Outlook Sitzung entschlüsselt wurde.  Verwenden Sie den Menüpunkt "
 "\"entschlüsseln/verifizieren\" um den Inhalt wieder sichtbar zu machen.]"
 
-#: src/mapihelp.cpp:1774
+#: src/mapihelp.cpp:1859
 msgid ""
 "[The content of this message is not visible due to an processing error in "
 "GpgOL.]"
@@ -352,7 +352,7 @@
 "[Aufgrund eines Verarbeitungsfehlers in GpgOL ist der Inhalt dieser "
 "Nachricht nicht sichtbar.]"
 
-#: src/message-events.cpp:215
+#: src/message-events.cpp:219
 msgid ""
 "Sorry, we can only encrypt plain text messages and\n"
 "no RTF messages. Please make sure that only the text\n"
@@ -363,13 +363,13 @@
 "Sie sicher, daß lediglich das Text Format ausgewählt wurde.\n"
 "(In der Menüleiste: \"Format\" => \"Nur Text\")"
 
-#: src/message.cpp:152
+#: src/message.cpp:161
 msgid "[Crypto operation failed - can't show the body of the message]"
 msgstr ""
 "[Krypto-Operation ist fehlgeschlagen - Der Text der Nachricht kann nicht "
 "angezeigt werden.]"
 
-#: src/message.cpp:241
+#: src/message.cpp:250
 #, c-format
 msgid ""
 "Message class: %s\n"
@@ -382,29 +382,29 @@
 "Struktur der Nachricht:\n"
 "%s"
 
-#: src/message.cpp:249
+#: src/message.cpp:258
 msgid "GpgOL - Message Information"
 msgstr "GpgOL - Informationen zu der Nachricht"
 
-#: src/message.cpp:837
+#: src/message.cpp:867
 msgid "No recipients to encrypt to are given"
 msgstr "Empfänger zum Verschlüsseln wurde nicht angegeben"
 
-#: src/message.cpp:853
+#: src/message.cpp:883
 #, c-format
 msgid "Encryption failed (%s)"
 msgstr "Verschlüsselungsfehler (%s)"
 
-#: src/message.cpp:874
+#: src/message.cpp:904
 #, c-format
 msgid "Signing failed (%s)"
 msgstr "Unterschrifterstellungsfehler (%s)"
 
-#: src/mimeparser.c:956
+#: src/mimeparser.c:1063
 msgid "Error writing to stream"
 msgstr "Dateischreibfehler"
 
-#: src/mimeparser.c:957
+#: src/mimeparser.c:1064
 msgid "I/O-Error"
 msgstr "Ein-/Ausgabefehler"
 
@@ -510,7 +510,7 @@
 msgid "This is GpgOL version %s"
 msgstr "Dies ist GpgOL Version %s"
 
-#: src/olflange.cpp:483
+#: src/olflange.cpp:481
 msgid ""
 "This version of Outlook is too old!\n"
 "\n"

Modified: trunk/po/sv.po
===================================================================
--- trunk/po/sv.po	2008-01-29 15:14:52 UTC (rev 213)
+++ trunk/po/sv.po	2008-01-31 15:46:49 UTC (rev 214)
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: GPGol\n"
 "Report-Msgid-Bugs-To: bug-gpgol at g10code.com\n"
-"POT-Creation-Date: 2008-01-03 12:18+0100\n"
+"POT-Creation-Date: 2008-01-29 20:07+0100\n"
 "PO-Revision-Date: 2006-12-12 23:52+0100\n"
 "Last-Translator: Daniel Nylander <po at danielnylander.se>\n"
 "Language-Team: Swedish <tp-sv at listor.tp-sv.se>\n"
@@ -57,7 +57,7 @@
 msgid "Select Certificate Manager"
 msgstr "GPG-nyckel&hanterare"
 
-#: src/engine.c:364
+#: src/engine.c:365
 msgid ""
 "The user interface server is not available or does not work.  Using an "
 "internal user interface.\n"
@@ -66,7 +66,7 @@
 "are not readable."
 msgstr ""
 
-#: src/engine.c:368 src/ext-commands.cpp:672 src/main.c:603 src/main.c:609
+#: src/engine.c:369 src/ext-commands.cpp:682 src/main.c:603 src/main.c:609
 msgid "GpgOL"
 msgstr ""
 
@@ -207,121 +207,121 @@
 msgid "*** End Notation ***\n"
 msgstr "*** Notation slut ***\n"
 
-#: src/ext-commands.cpp:431
+#: src/ext-commands.cpp:441
 msgid "&Decrypt and verify message"
 msgstr "&Dekryptera och validera meddelandet"
 
-#: src/ext-commands.cpp:432
+#: src/ext-commands.cpp:442
 #, fuzzy
 msgid "&Verify signature"
 msgstr "FELAKTIG signatur!"
 
-#: src/ext-commands.cpp:433
+#: src/ext-commands.cpp:443
 msgid "&Display crypto information"
 msgstr ""
 
-#: src/ext-commands.cpp:443
+#: src/ext-commands.cpp:453
 msgid ">GnuPG protocol"
 msgstr ""
 
-#: src/ext-commands.cpp:444
+#: src/ext-commands.cpp:454
 msgid "auto"
 msgstr ""
 
-#: src/ext-commands.cpp:445
+#: src/ext-commands.cpp:455
 #, fuzzy
 msgid "PGP/MIME"
 msgstr "[PGP/MIME-meddelande]"
 
-#: src/ext-commands.cpp:446
+#: src/ext-commands.cpp:456
 msgid "S/MIME"
 msgstr ""
 
-#: src/ext-commands.cpp:448
+#: src/ext-commands.cpp:458
 #, fuzzy
 msgid "&encrypt message with GnuPG"
 msgstr "Signera meddelandet med GPG"
 
-#: src/ext-commands.cpp:449
+#: src/ext-commands.cpp:459
 #, fuzzy
 msgid "&sign message with GnuPG"
 msgstr "Signera meddelandet med GPG"
 
-#: src/ext-commands.cpp:453 src/ext-commands.cpp:849
+#: src/ext-commands.cpp:463 src/ext-commands.cpp:859
 #, fuzzy
 msgid "Encrypt message with GnuPG"
 msgstr "Signera meddelandet med GPG"
 
-#: src/ext-commands.cpp:454 src/ext-commands.cpp:859
+#: src/ext-commands.cpp:464 src/ext-commands.cpp:869
 #, fuzzy
 msgid "Sign message with GnuPG"
 msgstr "Signera meddelandet med GPG"
 
-#: src/ext-commands.cpp:489
+#: src/ext-commands.cpp:499
 #, fuzzy
 msgid "GnuPG Certificate &Manager"
 msgstr "GPG-nyckel&hanterare"
 
-#: src/ext-commands.cpp:493
+#: src/ext-commands.cpp:503
 msgid "Open the certificate manager"
 msgstr ""
 
-#: src/ext-commands.cpp:671
+#: src/ext-commands.cpp:681
 #, fuzzy
 msgid "Could not start certificate manager"
 msgstr "Kunde inte starta nyckelhanteraren"
 
-#: src/ext-commands.cpp:733
+#: src/ext-commands.cpp:743
 #, fuzzy
 msgid "Select this option to decrypt and verify the message."
 msgstr "Välj det här alternativet för att kryptera meddelandet."
 
-#: src/ext-commands.cpp:740
+#: src/ext-commands.cpp:750
 #, fuzzy
 msgid "Select this option to show information on the crypto status"
 msgstr "Välj det här alternativet för att signera meddelandet."
 
-#: src/ext-commands.cpp:748 src/ext-commands.cpp:829
+#: src/ext-commands.cpp:758 src/ext-commands.cpp:839
 msgid "Check the signature now and display the result"
 msgstr ""
 
-#: src/ext-commands.cpp:755
+#: src/ext-commands.cpp:765
 #, fuzzy
 msgid "Select this option to automatically select the protocol."
 msgstr "Välj det här alternativet för att kryptera meddelandet."
 
-#: src/ext-commands.cpp:762
+#: src/ext-commands.cpp:772
 #, fuzzy
 msgid "Select this option to select the PGP/MIME protocol."
 msgstr "Välj det här alternativet för att kryptera meddelandet."
 
-#: src/ext-commands.cpp:769
+#: src/ext-commands.cpp:779
 #, fuzzy
 msgid "Select this option to select the S/MIME protocol."
 msgstr "Välj det här alternativet för att kryptera meddelandet."
 
-#: src/ext-commands.cpp:776
+#: src/ext-commands.cpp:786
 msgid "Select this option to encrypt the message."
 msgstr "Välj det här alternativet för att kryptera meddelandet."
 
-#: src/ext-commands.cpp:783
+#: src/ext-commands.cpp:793
 msgid "Select this option to sign the message."
 msgstr "Välj det här alternativet för att signera meddelandet."
 
-#: src/ext-commands.cpp:790
+#: src/ext-commands.cpp:800
 #, fuzzy
 msgid "Select this option to open the certificate manager"
 msgstr "Välj det här alternativet för att kryptera meddelandet."
 
-#: src/ext-commands.cpp:819
+#: src/ext-commands.cpp:829
 msgid "Show S/MIME status info"
 msgstr ""
 
-#: src/ext-commands.cpp:839
+#: src/ext-commands.cpp:849
 msgid "Use S/MIME for sign/encrypt"
 msgstr ""
 
-#: src/ext-commands.cpp:869
+#: src/ext-commands.cpp:879
 msgid "Open the GpgOL certificate manager"
 msgstr ""
 
@@ -338,21 +338,21 @@
 "\"%s\""
 msgstr ""
 
-#: src/mapihelp.cpp:1228
+#: src/mapihelp.cpp:1284
 msgid ""
 "[The content of this message is not visible because it has been decrypted by "
 "another Outlook session.  Use the \"decrypt/verify\" command to make it "
 "visible]"
 msgstr ""
 
-#: src/mapihelp.cpp:1774
+#: src/mapihelp.cpp:1859
 msgid ""
 "[The content of this message is not visible due to an processing error in "
 "GpgOL.]"
 msgstr ""
 
 # A bit unclear in the original text
-#: src/message-events.cpp:215
+#: src/message-events.cpp:219
 msgid ""
 "Sorry, we can only encrypt plain text messages and\n"
 "no RTF messages. Please make sure that only the text\n"
@@ -362,11 +362,11 @@
 "och inte RTF-meddelanden. Se till att endast textformatet\n"
 "har valts i inställningarna."
 
-#: src/message.cpp:152
+#: src/message.cpp:161
 msgid "[Crypto operation failed - can't show the body of the message]"
 msgstr ""
 
-#: src/message.cpp:241
+#: src/message.cpp:250
 #, c-format
 msgid ""
 "Message class: %s\n"
@@ -375,30 +375,30 @@
 "%s"
 msgstr ""
 
-#: src/message.cpp:249
+#: src/message.cpp:258
 msgid "GpgOL - Message Information"
 msgstr ""
 
-#: src/message.cpp:837
+#: src/message.cpp:867
 msgid "No recipients to encrypt to are given"
 msgstr ""
 
-#: src/message.cpp:853
+#: src/message.cpp:883
 #, fuzzy, c-format
 msgid "Encryption failed (%s)"
 msgstr "Kryptering misslyckades"
 
-#: src/message.cpp:874
+#: src/message.cpp:904
 #, fuzzy, c-format
 msgid "Signing failed (%s)"
 msgstr "Signering misslyckades"
 
-#: src/mimeparser.c:956
+#: src/mimeparser.c:1063
 #, fuzzy
 msgid "Error writing to stream"
 msgstr "Fel vid skrivning av fil"
 
-#: src/mimeparser.c:957
+#: src/mimeparser.c:1064
 msgid "I/O-Error"
 msgstr "In-/Ut-fel"
 
@@ -477,7 +477,7 @@
 msgid "This is GpgOL version %s"
 msgstr ""
 
-#: src/olflange.cpp:483
+#: src/olflange.cpp:481
 msgid ""
 "This version of Outlook is too old!\n"
 "\n"

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-01-29 15:14:52 UTC (rev 213)
+++ trunk/src/ChangeLog	2008-01-31 15:46:49 UTC (rev 214)
@@ -1,3 +1,15 @@
+2008-01-31  Werner Koch  <wk at g10code.com>
+
+	* message.cpp (message_verify): Check that the body attachment is
+	available before shortcutting the verification.
+	* user-events.cpp (OnSelectionChange): Change SMIME message
+	class.
+	* mapihelp.cpp (mapi_change_message_class): Add arg
+	SYNC_OVERRIDE. Changed all callers to pass false.
+	(mapi_test_sig_status): Take care of sent messages.
+	(mapi_get_gpgol_body_attachment): Change args to allow use as
+	testing fucntion too.  Adjusted caller.
+
 2008-01-29  Werner Koch  <wk at g10code.com>
 
 	* mimemaker.c (do_mime_sign): Set CTE for SMIME.

Modified: trunk/src/ext-commands.cpp
===================================================================
--- trunk/src/ext-commands.cpp	2008-01-29 15:14:52 UTC (rev 213)
+++ trunk/src/ext-commands.cpp	2008-01-31 15:46:49 UTC (rev 214)
@@ -703,7 +703,8 @@
       hr = eecb->GetObject (&mdb, (LPMAPIPROP *)&message);
       if (SUCCEEDED (hr))
         {
-          mapi_change_message_class (message);
+          /* We sync here. */
+          mapi_change_message_class (message, 1);
 	}
       ul_release (message, __func__, __LINE__);
       ul_release (mdb, __func__, __LINE__);

Modified: trunk/src/mapihelp.cpp
===================================================================
--- trunk/src/mapihelp.cpp	2008-01-29 15:14:52 UTC (rev 213)
+++ trunk/src/mapihelp.cpp	2008-01-31 15:46:49 UTC (rev 214)
@@ -485,10 +485,12 @@
 
 
 /* This function checks whether MESSAGE requires processing by us and
-   adjusts the message class to our own.  Return true if the message
-   was changed. */
+   adjusts the message class to our own.  By passing true for
+   SYNC_OVERRIDE the actual MAPI message class will be updated to our
+   own message class overide.  Return true if the message was
+   changed. */
 int
-mapi_change_message_class (LPMESSAGE message)
+mapi_change_message_class (LPMESSAGE message, int sync_override)
 {
   HRESULT hr;
   ULONG tag;
@@ -496,6 +498,7 @@
   LPSPropValue propval = NULL;
   char *newvalue = NULL;
   int need_save = 0;
+  int have_override = 0;
 
   if (!message)
     return 0; /* No message: Nop. */
@@ -515,7 +518,10 @@
         }
     }
   else
-    log_debug ("%s:%s: have override message class\n", SRCNAME, __func__);
+    {
+      have_override = 1;
+      log_debug ("%s:%s: have override message class\n", SRCNAME, __func__);
+    }
     
   if ( PROP_TYPE (propval->ulPropTag) == PT_STRING8 )
     {
@@ -610,6 +616,21 @@
           newvalue = (char*)xmalloc (strlen (s) + 1);
           strcpy (stpcpy (newvalue, "IPM.Note.GpgOL"), s+14);
         }
+      else if (opt.enable_smime && sync_override && have_override
+               && !strncmp (s, "IPM.Note.GpgOL", 14) && (!s[14]||s[14] =='.'))
+        {
+          /* In case the original message class is not yet an GpgOL
+             class we set it here.  This is needed to convince Outlook
+             not to do any special processing for IPM.Note.SMIME etc.  */
+          LPSPropValue propval2 = NULL;
+
+          hr = HrGetOneProp ((LPMAPIPROP)message, PR_MESSAGE_CLASS_A,
+                             &propval2);
+          if (SUCCEEDED (hr) && PROP_TYPE (propval2->ulPropTag) == PT_STRING8
+              && propval2->Value.lpszA && strcmp (propval2->Value.lpszA, s))
+            newvalue = (char*)xstrdup (s);
+          MAPIFreeBuffer (propval2);
+        }
       else if (opt.enable_smime && !strcmp (s, "IPM.Note.Secure.CexSig"))
         {
           /* This is a CryptoEx generated signature. */
@@ -661,6 +682,8 @@
     }
   else
     {
+      log_debug ("%s:%s: setting message class to `%s'\n",
+                     SRCNAME, __func__, newvalue);
       prop.ulPropTag = PR_MESSAGE_CLASS_A;
       prop.Value.lpszA = newvalue; 
       hr = message->SetProps (1, &prop, NULL);
@@ -743,12 +766,10 @@
   hr = HrGetOneProp ((LPMAPIPROP)message, tag, &propval);
   if (FAILED (hr))
     {
-      log_error ("%s:%s: HrGetOneProp(GpgOLMsgClass) failed: hr=%#lx\n",
-                 SRCNAME, __func__, hr);
       hr = HrGetOneProp ((LPMAPIPROP)message, PR_MESSAGE_CLASS_A, &propval);
       if (FAILED (hr))
         {
-          log_error ("%s:%s: HrGetOneProp() failed: hr=%#lx\n",
+          log_error ("%s:%s: HrGetOneProp(PR_MESSAGE_CLASS) failed: hr=%#lx\n",
                      SRCNAME, __func__, hr);
           return msgtype;
         }
@@ -1446,8 +1467,12 @@
   hr = HrGetOneProp ((LPMAPIPROP)msg, tag, &propval);
   if (FAILED (hr))
     return 0; /* No.  */  
+
+  /* We return False if we have an unknown signature status (?) or the
+     message has been setn by us and not yet checked (@).  */
   if (PROP_TYPE (propval->ulPropTag) == PT_STRING8)
-    yes = !(propval->Value.lpszA && !strcmp (propval->Value.lpszA, "?"));
+    yes = !(propval->Value.lpszA && (!strcmp (propval->Value.lpszA, "?")
+                                     || !strcmp (propval->Value.lpszA, "@")));
   else
     yes = 0;
 
@@ -1765,10 +1790,15 @@
    is stored there.  If R_ISHTML is not NULL a flag indicating whether
    the HTML is html formatted is stored there.  If R_PROTECTED is not
    NULL a flag indicating whether the message was protected is stored
-   there.  If no body attachment can be found or on any other error
-   NULL is returned.  Caller must free the returned string. */
-char *
-mapi_get_gpgol_body_attachment (LPMESSAGE message, size_t *r_nbytes, 
+   there.  If no body attachment can be found or on any other error an
+   error codes is returned and NULL is stored at R_BODY.  Caller must
+   free the returned string.  If NULL is passed for R_BODY, the
+   function will only test whether a body attachment is available and
+   return an error code if not.  R_IS_HTML and R_PROTECTED are not
+   defined in this case.  */
+int
+mapi_get_gpgol_body_attachment (LPMESSAGE message, 
+                                char **r_body, size_t *r_nbytes, 
                                 int *r_ishtml, int *r_protected)
 {    
   HRESULT hr;
@@ -1779,21 +1809,24 @@
   ULONG moss_tag;
   char *body = NULL;
   int bodytype;
+  int found = 0;
 
+  if (r_body)
+    *r_body = NULL;
   if (r_ishtml)
     *r_ishtml = 0;
   if (r_protected)
     *r_protected = 0;
 
   if (get_gpgolattachtype_tag (message, &moss_tag) )
-    return NULL;
+    return -1;
 
   hr = message->GetAttachmentTable (0, &mapitable);
   if (FAILED (hr))
     {
       log_debug ("%s:%s: GetAttachmentTable failed: hr=%#lx",
                  SRCNAME, __func__, hr);
-      return NULL;
+      return -1;
     }
       
   hr = HrQueryAllRows (mapitable, (LPSPropTagArray)&propAttNum,
@@ -1803,7 +1836,7 @@
       log_debug ("%s:%s: HrQueryAllRows failed: hr=%#lx",
                  SRCNAME, __func__, hr);
       mapitable->Release ();
-      return NULL;
+      return -1;
     }
   n_attach = mapirows->cRows > 0? mapirows->cRows : 0;
   if (!n_attach)
@@ -1811,7 +1844,7 @@
       FreeProws (mapirows);
       mapitable->Release ();
       log_debug ("%s:%s: No attachments at all", SRCNAME, __func__);
-      return NULL;
+      return -1;
     }
   log_debug ("%s:%s: message has %u attachments\n",
              SRCNAME, __func__, n_attach);
@@ -1842,8 +1875,12 @@
       if ((bodytype=has_gpgol_body_name (att))
            && get_gpgolattachtype (att, moss_tag) == ATTACHTYPE_FROMMOSS)
         {
-          if (get_attach_method (att) == ATTACH_BY_VALUE)
-            body = attach_to_buffer (att, r_nbytes, 1, r_protected);
+          found = 1;
+          if (r_body)
+            {
+              if (get_attach_method (att) == ATTACH_BY_VALUE)
+                body = attach_to_buffer (att, r_nbytes, 1, r_protected);
+            }
           att->Release ();
           if (r_ishtml)
             *r_ishtml = (bodytype == 2);
@@ -1853,13 +1890,20 @@
     }
   FreeProws (mapirows);
   mapitable->Release ();
-  if (!body)
+  if (!found)
     {
       log_error ("%s:%s: no suitable body attachment found", SRCNAME,__func__);
-      body = native_to_utf8 (_("[The content of this message is not visible"
-                               " due to an processing error in GpgOL.]"));
+      if (r_body)
+        *r_body = native_to_utf8 
+          (_("[The content of this message is not visible"
+             " due to an processing error in GpgOL.]"));
+      return -1;
     }
-  
-  return body;
+
+  if (r_body)
+    *r_body = body;
+  else
+    xfree (body);  /* (Should not happen.)  */
+  return 0;
 }
 

Modified: trunk/src/mapihelp.h
===================================================================
--- trunk/src/mapihelp.h	2008-01-29 15:14:52 UTC (rev 213)
+++ trunk/src/mapihelp.h	2008-01-31 15:46:49 UTC (rev 214)
@@ -91,7 +91,7 @@
 
 int mapi_set_header (LPMESSAGE msg, const char *name, const char *val);
 
-int mapi_change_message_class (LPMESSAGE message);
+int mapi_change_message_class (LPMESSAGE message, int sync_override);
 char *mapi_get_message_class (LPMESSAGE message);
 msgtype_t mapi_get_message_type (LPMESSAGE message);
 int mapi_to_mime (LPMESSAGE message, const char *filename);
@@ -123,7 +123,8 @@
 
 int   mapi_has_last_decrypted (LPMESSAGE message);
 int   mapi_test_last_decrypted (LPMESSAGE message);
-char *mapi_get_gpgol_body_attachment (LPMESSAGE message, size_t *r_nbytes,
+int   mapi_get_gpgol_body_attachment (LPMESSAGE message,
+                                      char **r_body, size_t *r_nbytes,
                                       int *r_ishtml, int *r_protected);
 
 

Modified: trunk/src/message.cpp
===================================================================
--- trunk/src/message.cpp	2008-01-29 15:14:52 UTC (rev 213)
+++ trunk/src/message.cpp	2008-01-31 15:46:49 UTC (rev 214)
@@ -77,7 +77,7 @@
         {
           log_debug ("%s:%s: message class not yet checked - doing now\n",
                      SRCNAME, __func__);
-          if (mapi_change_message_class (message))
+          if (mapi_change_message_class (message, 0))
             goto retry;
         }
       break;
@@ -86,7 +86,7 @@
         {
           log_debug ("%s:%s: message class not checked with smime enabled "
                      "- doing now\n", SRCNAME, __func__);
-          if (mapi_change_message_class (message))
+          if (mapi_change_message_class (message, 0))
             goto retry;
         }
       break;
@@ -140,6 +140,7 @@
 bool
 message_display_handler (LPEXCHEXTCALLBACK eecb, HWND hwnd)
 {
+  int err;
   HRESULT hr;
   LPMESSAGE message = NULL;
   LPMDB mdb = NULL;
@@ -151,10 +152,10 @@
     {
       /* (old: If the message was protected we don't allow a fallback to the
          OOM display methods.)  Now: As it is difficult to find the
-         actual winodw we now use the OOM display always.  */
-      body = mapi_get_gpgol_body_attachment (message, NULL, 
-                                             &ishtml, &wasprotected);
-      if (body)
+         actual window we now use the OOM display always.  */
+      err = mapi_get_gpgol_body_attachment (message, &body, NULL, 
+                                            &ishtml, &wasprotected);
+      if (!err && body)
         update_display (hwnd, /*wasprotected? NULL:*/ eecb, ishtml, body);
       else
         update_display (hwnd, NULL, 0, 
@@ -485,10 +486,15 @@
     }
   
   /* If a verification is forced, we set the cached signature status
-     first to "?" to mark that no verification has yet happened. */
+     first to "?" to mark that no verification has yet happened.  If a
+     verification status has been set and the body attachment is
+     available we don't do a verification again.  The need to check
+     for the body attachment is to avoid problems if that attachment
+     has accidently be deleted. */
   if (force)
     mapi_set_sig_status (message, "?");
-  else if (mapi_test_sig_status (message))
+  else if (mapi_test_sig_status (message) 
+           && !mapi_get_gpgol_body_attachment (message, NULL,NULL,NULL,NULL))
     return 0; /* Already checked that message.  */
 
   if (msgtype == MSGTYPE_GPGOL_CLEAR_SIGNED)

Modified: trunk/src/olflange.cpp
===================================================================
--- trunk/src/olflange.cpp	2008-01-29 15:14:52 UTC (rev 213)
+++ trunk/src/olflange.cpp	2008-01-31 15:46:49 UTC (rev 214)
@@ -500,6 +500,7 @@
       || lContext == EECONTEXT_VIEWER
       || lContext == EECONTEXT_SESSION)
     {
+
 //       LPUNKNOWN pApplication = get_outlook_application_object (pEECB);
 //       log_debug ("%s:%s: pApplication=%p\n",
 //                    SRCNAME, __func__, pApplication);

Modified: trunk/src/session-events.cpp
===================================================================
--- trunk/src/session-events.cpp	2008-01-29 15:14:52 UTC (rev 213)
+++ trunk/src/session-events.cpp	2008-01-31 15:46:49 UTC (rev 214)
@@ -108,7 +108,7 @@
      message class IPM.Note.SMIME.MultipartSigned.  If we would not
      change the message class here, OL will change it later (before an
      OnRead) to IPM.Note. */
-  mapi_change_message_class (pMessage);
+  mapi_change_message_class (pMessage, 0);
   log_mapi_property (pMessage, PR_MESSAGE_CLASS,"PR_MESSAGE_CLASS");
   ul_release (pMessage);
   ul_release (pMDB);

Modified: trunk/src/user-events.cpp
===================================================================
--- trunk/src/user-events.cpp	2008-01-29 15:14:52 UTC (rev 213)
+++ trunk/src/user-events.cpp	2008-01-31 15:46:49 UTC (rev 214)
@@ -43,17 +43,17 @@
 
 
 /* Wrapper around UlRelease with error checking. */
-// static void 
-// ul_release (LPVOID punk, const char *func, int lnr)
-// {
-//   ULONG res;
+static void 
+ul_release (LPVOID punk, const char *func, int lnr)
+{
+  ULONG res;
   
-//   if (!punk)
-//     return;
-//   res = UlRelease (punk);
-//   log_debug ("%s:%s:%d: UlRelease(%p) had %lu references\n", 
-//              SRCNAME, func, lnr, punk, res);
-// }
+  if (!punk)
+    return;
+  res = UlRelease (punk);
+  log_debug ("%s:%s:%d: UlRelease(%p) had %lu references\n", 
+             SRCNAME, func, lnr, punk, res);
+}
 
 
 
@@ -95,8 +95,10 @@
 GpgolUserEvents::OnSelectionChange (LPEXCHEXTCALLBACK eecb) 
 {
   HRESULT hr;
-  ULONG count, objtype;
+  ULONG count, objtype, msgflags;
   char msgclass[256];
+  LPENTRYID entryid = NULL;
+  ULONG entryidlen;
 
   log_debug ("%s:%s: received\n", SRCNAME, __func__);
 
@@ -104,8 +106,9 @@
   if (SUCCEEDED (hr) && count > 0)
     {
       /* Get the first selected item.  */
-      hr = eecb->GetSelectionItem (0L, NULL, NULL, &objtype,
-                                   msgclass, sizeof msgclass -1, NULL, 0L);
+      hr = eecb->GetSelectionItem (0L, &entryidlen, &entryid, &objtype,
+                                   msgclass, sizeof msgclass -1, 
+                                   &msgflags, 0L);
       if (SUCCEEDED(hr) && objtype == MAPI_MESSAGE)
         {
           log_debug ("%s:%s: message class: %s\n",
@@ -113,29 +116,49 @@
 
           /* If SMIME has been enabled and the current message is of
              class SMIME or in the past processed by CryptoEx, we
-             change the message class. */ 
-          // Unfortunaltely we can't use this because:
-          // 1. GetSelectionItem is as usual heavily undocumented and
-          // we need to guess a bit to see how to get message from the
-          // EntryID (2nd and 3rd arg).  2.  There are reports that
-          // OL2007 crashes when changing the message here.
-//           if (opt.enable_smime 
-//               && (!strncmp (msgclass, "IPM.Note.SMIME", 14)
-//                   || !strncmp (msgclass, "IPM.Note.Secure.Cex", 19)))
-//             {
-//               LPMESSAGE message = NULL;
-//               LPMDB mdb = NULL;
+             change the message class. 
 
-//               hr = eecb->GetObject (&mdb, (LPMAPIPROP *)&message);
-//               if (SUCCEEDED (hr) && !mapi_has_sig_status (message))
-//                 {
-//                   log_debug ("%s:%s: message class not yet checked"
-//                              " - doing now\n", SRCNAME, __func__);
-//                   mapi_change_message_class (message);
-//                 }
-//               ul_release (message, __func__, __LINE__);
-//               ul_release (mdb, __func__, __LINE__);
-//             }
+             Note that there is a report on the Net that OL2007
+             crashes when changing the message here. */
+          if (opt.enable_smime 
+              && (!strncmp (msgclass, "IPM.Note.SMIME", 14)
+                  || !strncmp (msgclass, "IPM.Note.Secure.Cex", 19)))
+            {
+              LPMAPIFOLDER folder = NULL;
+              LPMDB mdb = NULL;
+              LPMESSAGE message = NULL;
+
+              if (entryid)
+                log_hexdump (entryid, entryidlen, "selected entryid=");
+              else
+                log_debug ("no selected entry id");
+
+              hr = eecb->GetObject (&mdb, (LPMAPIPROP *)&folder);
+              if (SUCCEEDED (hr) && entryid)
+                {
+                  hr = mdb->OpenEntry (entryidlen, entryid,
+                                       &IID_IMessage, MAPI_BEST_ACCESS, 
+                                       &objtype, (IUnknown**)&message);
+                  if (SUCCEEDED (hr)) 
+                    {
+                      if (objtype == MAPI_MESSAGE)
+                        {
+                          log_debug ("%s:%s: about to change or sync "
+                                     "the message class",
+                                     SRCNAME, __func__);
+                          /* We sync the message class here to get rid
+                             of IPM.Note.SMIME etc. */
+                          mapi_change_message_class (message, 1);
+                        }
+                    }
+                  else
+                    log_error ("%s:%s: OpenEntry failed: hr=%#lx\n", 
+                               SRCNAME, __func__, hr);
+                  ul_release (message, __func__, __LINE__);
+                }
+              ul_release (folder, __func__, __LINE__);
+              ul_release (mdb, __func__, __LINE__);
+            }
         }
       else if (SUCCEEDED(hr) && objtype == MAPI_FOLDER)
         {
@@ -143,9 +166,12 @@
                      SRCNAME, __func__, objtype);
         }
     }
-
+  
+  if (entryid)
+    MAPIFreeBuffer (entryid);
 }
 
+
 /* I assume this is called from Outlook for all object changes.
 
    PEECB is a pointer to the IExchExtCallback interface.  */




More information about the Gnupg-commits mailing list