[svn] GpgOL - r229 - in trunk: . po src
svn author wk
cvs at cvs.gnupg.org
Fri Mar 7 13:53:30 CET 2008
Author: wk
Date: 2008-03-07 13:53:28 +0100 (Fri, 07 Mar 2008)
New Revision: 229
Modified:
trunk/NEWS
trunk/po/de.po
trunk/po/sv.po
trunk/src/ChangeLog
trunk/src/mapihelp.cpp
trunk/src/mapihelp.h
trunk/src/message-events.cpp
trunk/src/mimemaker.c
trunk/src/mymapitags.h
Log:
Pass the sender address to the UI server.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2008-03-07 11:30:33 UTC (rev 228)
+++ trunk/src/ChangeLog 2008-03-07 12:53:28 UTC (rev 229)
@@ -1,5 +1,9 @@
2008-03-07 Werner Koch <wk at g10code.com>
+ * mapihelp.cpp (mapi_get_sender): New.
+ * mymapitags.h (PR_PRIMARY_SEND_ACCT): New.
+ * mimemaker.c (do_mime_sign): Pass the sender to the engine.
+
* common.h (opt): Add field SVN_REVISION.
* main.c (read_options, write_options): Set it.
* olflange.cpp (GpgolExt): Print a warning on program update.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2008-03-07 11:30:33 UTC (rev 228)
+++ trunk/NEWS 2008-03-07 12:53:28 UTC (rev 229)
@@ -13,7 +13,12 @@
* Soft line breaks in QP encoded messages are now correctly
processed.
+ * The sender's address is send to the UI server to allow it to select
+ an appropriate signing key.
+ * Automatic protocol selection works now also with signing.
+
+
Noteworthy changes for version 0.10.5 (2008-02-18)
==================================================
Modified: trunk/po/de.po [not shown]
Modified: trunk/po/sv.po [not shown]
Modified: trunk/src/mapihelp.cpp
===================================================================
--- trunk/src/mapihelp.cpp 2008-03-07 11:30:33 UTC (rev 228)
+++ trunk/src/mapihelp.cpp 2008-03-07 12:53:28 UTC (rev 229)
@@ -948,6 +948,66 @@
+/* Return teh sender of the message. According to the specs this is
+ an UTF-8 string; we rely on that the UI server handles
+ internationalized domain names. */
+char *
+mapi_get_sender (LPMESSAGE message)
+{
+ HRESULT hr;
+ LPSPropValue propval = NULL;
+ char *buf;
+ char *p0, *p;
+
+ if (!message)
+ return NULL; /* No message: Nop. */
+
+ hr = HrGetOneProp ((LPMAPIPROP)message, PR_PRIMARY_SEND_ACCT, &propval);
+ if (FAILED (hr))
+ {
+ log_debug ("%s:%s: HrGetOneProp failed: hr=%#lx\n",
+ SRCNAME, __func__, hr);
+ return NULL;
+ }
+
+ if (PROP_TYPE (propval->ulPropTag) != PT_UNICODE)
+ {
+ log_debug ("%s:%s: HrGetOneProp returns invalid type %lu\n",
+ SRCNAME, __func__, PROP_TYPE (propval->ulPropTag) );
+ MAPIFreeBuffer (propval);
+ return NULL;
+ }
+
+ buf = wchar_to_utf8 (propval->Value.lpszW);
+ MAPIFreeBuffer (propval);
+ if (!buf)
+ {
+ log_error ("%s:%s: error converting to utf8\n", SRCNAME, __func__);
+ return NULL;
+ }
+ /* The PR_PRIMARY_SEND_ACCT property seems to be divided into fields
+ using Ctrl-A as delimiter. The first field looks like the ascii
+ formatted number of fields to follow, the second field like the
+ email account and the third seems to be a textual description of
+ that account. We return the second field. */
+ p = strchr (buf, '\x01');
+ if (!p)
+ {
+ log_error ("%s:%s: unknown format of the value `%s'\n",
+ SRCNAME, __func__, buf);
+ xfree (buf);
+ return NULL;
+ }
+ for (p0=buf, p++; *p && *p != '\x01';)
+ *p0++ = *p++;
+ *p0 = 0;
+ log_debug ("%s:%s: address is `%s'\n", SRCNAME, __func__, buf);
+ return buf;
+}
+
+
+
+
/* Return the message type. This function knows only about our own
message types. Returns MSGTYPE_UNKNOWN for any MESSAGE we have
no special support for. */
Modified: trunk/src/mapihelp.h
===================================================================
--- trunk/src/mapihelp.h 2008-03-07 11:30:33 UTC (rev 228)
+++ trunk/src/mapihelp.h 2008-03-07 12:53:28 UTC (rev 229)
@@ -1,5 +1,5 @@
/* mapihelp.h - Helper functions for MAPI
- * Copyright (C) 2005, 2007 g10 Code GmbH
+ * Copyright (C) 2005, 2007, 2008 g10 Code GmbH
*
* This file is part of GpgOL.
*
@@ -103,6 +103,7 @@
int mapi_change_message_class (LPMESSAGE message, int sync_override);
char *mapi_get_message_class (LPMESSAGE message);
+char *mapi_get_sender (LPMESSAGE message);
msgtype_t mapi_get_message_type (LPMESSAGE message);
int mapi_to_mime (LPMESSAGE message, const char *filename);
Modified: trunk/src/message-events.cpp
===================================================================
--- trunk/src/message-events.cpp 2008-03-07 11:30:33 UTC (rev 228)
+++ trunk/src/message-events.cpp 2008-03-07 12:53:28 UTC (rev 229)
@@ -276,7 +276,7 @@
if (SUCCEEDED (hr))
{
protocol_t proto = m_pExchExt->m_protoSelection;
-
+
if (m_pExchExt->m_gpgEncrypt && m_pExchExt->m_gpgSign)
rc = message_sign_encrypt (msg, proto, hWnd);
else if (m_pExchExt->m_gpgEncrypt && !m_pExchExt->m_gpgSign)
Modified: trunk/src/mimemaker.c
===================================================================
--- trunk/src/mimemaker.c 2008-03-07 11:30:33 UTC (rev 228)
+++ trunk/src/mimemaker.c 2008-03-07 12:53:28 UTC (rev 229)
@@ -1184,7 +1184,8 @@
/* Prepare the signing. FIXME: figure out the signer of the mail. */
if (engine_create_filter (&filter, collect_signature, &sigbuffer))
goto failure;
- if (engine_sign_start (filter, hwnd, protocol, NULL, &protocol))
+ if (engine_sign_start (filter, hwnd, protocol,
+ mapi_get_sender (message), &protocol))
goto failure;
protocol = check_protocol (protocol);
Modified: trunk/src/mymapitags.h
===================================================================
--- trunk/src/mymapitags.h 2008-03-07 11:30:33 UTC (rev 228)
+++ trunk/src/mymapitags.h 2008-03-07 12:53:28 UTC (rev 229)
@@ -381,6 +381,7 @@
#define PR_PREPROCESS PROP_TAG( PT_BOOLEAN, 0x0E22)
#define PR_ORIGINATING_MTA_CERTIFICATE PROP_TAG( PT_BINARY, 0x0E25)
#define PR_PROOF_OF_SUBMISSION PROP_TAG( PT_BINARY, 0x0E26)
+#define PR_PRIMARY_SEND_ACCT PROP_TAG( PT_UNICODE, 0x0E28)
#define PR_ENTRYID PROP_TAG( PT_BINARY, 0x0FFF)
#define PR_OBJECT_TYPE PROP_TAG( PT_LONG, 0x0FFE)
#define PR_ICON PROP_TAG( PT_BINARY, 0x0FFD)
More information about the Gnupg-commits
mailing list