[svn] GpgOL - r261 - in trunk: doc src
svn author wk
cvs at cvs.gnupg.org
Fri Jun 27 20:10:45 CEST 2008
Author: wk
Date: 2008-06-27 20:10:42 +0200 (Fri, 27 Jun 2008)
New Revision: 261
Modified:
trunk/doc/gpgol.texi
trunk/src/ChangeLog
trunk/src/mapihelp.cpp
trunk/src/mapihelp.h
Log:
Save old message class.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2008-06-26 14:41:57 UTC (rev 260)
+++ trunk/src/ChangeLog 2008-06-27 18:10:42 UTC (rev 261)
@@ -1,3 +1,8 @@
+2008-06-27 Werner Koch <wk at g10code.com>
+
+ * mapihelp.cpp (get_gpgololdmsgclass_tag): New.
+ (mapi_change_message_class): Save old message class.
+
2008-06-19 Werner Koch <wk at g10code.com>
* olflange-dlgs.cpp (GPGOptionsDlgProc): Change S/MIME enabled
Modified: trunk/doc/gpgol.texi
===================================================================
--- trunk/doc/gpgol.texi 2008-06-26 14:41:57 UTC (rev 260)
+++ trunk/doc/gpgol.texi 2008-06-27 18:10:42 UTC (rev 261)
@@ -161,6 +161,14 @@
@table @code
+ at item GpgOL Msg Class
+This is a STRING8 property used as a override for PR_MESSAGE_CLASS.
+GpgOL uses this internally for creating messages.
+
+ at item GpgOL Old Msg Class
+This is a STRING8 property which saves the original PR_MESSAGE_CLASS
+before GpgOL chnages it.
+
@item GpgOL Attach Type
This is a property of type LONG and used to further describe the
attachments created by GpgOL. These values are used:
Modified: trunk/src/mapihelp.cpp
===================================================================
--- trunk/src/mapihelp.cpp 2008-06-26 14:41:57 UTC (rev 260)
+++ trunk/src/mapihelp.cpp 2008-06-27 18:10:42 UTC (rev 261)
@@ -144,7 +144,19 @@
return 0;
}
+/* Return the property tag for GpgOL Old Msg Class. The Old Msg Class
+ saves the message class as seen before we changed it the first
+ time. */
+int
+get_gpgololdmsgclass_tag (LPMESSAGE message, ULONG *r_tag)
+{
+ if (!(*r_tag = create_gpgol_tag (message, L"GpgOL Old Msg Class", __func__)))
+ return -1;
+ *r_tag |= PT_STRING8;
+ return 0;
+}
+
/* Return the property tag for GpgOL Attach Type. */
int
get_gpgolattachtype_tag (LPMESSAGE message, ULONG *r_tag)
@@ -926,7 +938,6 @@
newvalue = xstrdup ("IPM.Note.GpgOL");
}
}
- MAPIFreeBuffer (propval);
if (!newvalue)
{
/* We use our Sig-Status property to mark messages which passed
@@ -939,6 +950,37 @@
}
else
{
+ /* Save old message class if not yet done. (The second
+ consition is just a failsafe check). */
+ if (!get_gpgololdmsgclass_tag (message, &tag)
+ && PROP_TYPE (propval->ulPropTag) == PT_STRING8)
+ {
+ LPSPropValue propval2 = NULL;
+
+ hr = HrGetOneProp ((LPMAPIPROP)message, tag, &propval2);
+ if (!FAILED (hr))
+ MAPIFreeBuffer (propval2);
+ else
+ {
+ /* No such property - save it. */
+ log_debug ("%s:%s: saving old message class\n",
+ SRCNAME, __func__);
+ prop.ulPropTag = tag;
+ prop.Value.lpszA = propval->Value.lpszA;
+ hr = message->SetProps (1, &prop, NULL);
+ xfree (newvalue);
+ if (hr)
+ {
+ log_error ("%s:%s: can't save old message class: hr=%#lx\n",
+ SRCNAME, __func__, hr);
+ MAPIFreeBuffer (propval);
+ return 0;
+ }
+ need_save = 1;
+ }
+ }
+
+ /* Change message class. */
log_debug ("%s:%s: setting message class to `%s'\n",
SRCNAME, __func__, newvalue);
prop.ulPropTag = PR_MESSAGE_CLASS_A;
@@ -949,10 +991,12 @@
{
log_error ("%s:%s: can't set message class: hr=%#lx\n",
SRCNAME, __func__, hr);
+ MAPIFreeBuffer (propval);
return 0;
}
need_save = 1;
}
+ MAPIFreeBuffer (propval);
if (need_save)
{
Modified: trunk/src/mapihelp.h
===================================================================
--- trunk/src/mapihelp.h 2008-06-26 14:41:57 UTC (rev 260)
+++ trunk/src/mapihelp.h 2008-06-27 18:10:42 UTC (rev 261)
@@ -93,6 +93,7 @@
#define PGPBODYFILENAME "gpgolPGP.dat"
void log_mapi_property (LPMESSAGE message, ULONG prop, const char *propname);
+int get_gpgololdmsgclass_tag (LPMESSAGE message, ULONG *r_tag);
int get_gpgolattachtype_tag (LPMESSAGE message, ULONG *r_tag);
int get_gpgolsigstatus_tag (LPMESSAGE message, ULONG *r_tag);
int get_gpgolprotectiv_tag (LPMESSAGE message, ULONG *r_tag);
More information about the Gnupg-commits
mailing list