[svn] GpgOL - r249 - trunk/src
svn author wk
cvs at cvs.gnupg.org
Fri May 2 20:37:48 CEST 2008
Author: wk
Date: 2008-05-02 20:37:47 +0200 (Fri, 02 May 2008)
New Revision: 249
Modified:
trunk/src/ChangeLog
trunk/src/display.cpp
trunk/src/main.c
trunk/src/message-events.cpp
trunk/src/mimeparser.c
trunk/src/rfc822parse.c
Log:
Distinguish inline and attachment dispositions.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2008-04-16 18:24:36 UTC (rev 248)
+++ trunk/src/ChangeLog 2008-05-02 18:37:47 UTC (rev 249)
@@ -1,3 +1,9 @@
+2008-05-02 Werner Koch <wk at g10code.com>
+
+ * mimeparser.c (t2body): Detect non-inline text parts.
+ * rfc822parse.c (rfc822parse_query_parameter): Add special mode
+ for an ATTR of NULL.
+
2008-04-16 Werner Koch <wk at g10code.com>
* message-events.h (class GpgolMessageEvents): Add M_GOTINSPECTOR.
Modified: trunk/src/display.cpp
===================================================================
--- trunk/src/display.cpp 2008-04-16 18:24:36 UTC (rev 248)
+++ trunk/src/display.cpp 2008-05-02 18:37:47 UTC (rev 249)
@@ -201,9 +201,14 @@
is_inspector_display (HWND hwnd)
{
struct find_message_window_state findstate;
+ int rc;
memset (&findstate, 0, sizeof findstate);
- return !!find_message_window (hwnd, &findstate);
+ rc = !!find_message_window (hwnd, &findstate);
+ if (!rc)
+ log_window_hierarchy (hwnd, "The windows blow hwnd %p", hwnd);
+
+ return rc;
}
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2008-04-16 18:24:36 UTC (rev 248)
+++ trunk/src/main.c 2008-05-02 18:37:47 UTC (rev 249)
@@ -1,5 +1,5 @@
/* main.c - DLL entry point
- * Copyright (C) 2005, 2007 g10 Code GmbH
+ * Copyright (C) 2005, 2007, 2008 g10 Code GmbH
*
* This file is part of GpgOL.
*
Modified: trunk/src/message-events.cpp
===================================================================
--- trunk/src/message-events.cpp 2008-04-16 18:24:36 UTC (rev 248)
+++ trunk/src/message-events.cpp 2008-05-02 18:37:47 UTC (rev 249)
@@ -127,6 +127,11 @@
shows a grey window with a notice that the message can't be
shown due to active content. */
+ /* The is_inspector_display function is not reliable enough.
+ Missing another solution we set it to true for now with the
+ result that the preview decryption can't be disabled. */
+ m_gotinspector = 1;
+
if (m_gotinspector || opt.preview_decrypt)
{
eecb->GetObject (&mdb, (LPMAPIPROP *)&message);
Modified: trunk/src/mimeparser.c
===================================================================
--- trunk/src/mimeparser.c 2008-04-16 18:24:36 UTC (rev 248)
+++ trunk/src/mimeparser.c 2008-05-02 18:37:47 UTC (rev 249)
@@ -704,6 +704,7 @@
size_t off;
char *p;
int is_text = 0;
+ int not_inline_text = 0;
char *filename = NULL;
char *charset = NULL;
@@ -731,6 +732,9 @@
s = rfc822parse_query_parameter (field, "filename", 0);
if (s)
filename = xstrdup (s);
+ s = rfc822parse_query_parameter (field, NULL, 1);
+ if (s && !strcmp (s, "inline"))
+ not_inline_text = 1;
rfc822parse_release_field (field);
}
@@ -838,6 +842,11 @@
rfc822parse_release_field (field); /* (Content-type) */
ctx->in_data = 1;
+ /* Need to start an attachment if we have seen a content disposition
+ other then the inline type. */
+ if (is_text && not_inline_text)
+ ctx->collect_attachment = 1;
+
if (debug_mime_parser)
log_debug ("%s:%s: this body: nesting=%d partno=%d is_text=%d, is_opq=%d"
" charset=\"%s\"\n",
@@ -847,7 +856,7 @@
ctx->mimestruct_cur->charset?ctx->mimestruct_cur->charset:"");
/* If this is a text part, decide whether we treat it as our body. */
- if (is_text)
+ if (is_text && !not_inline_text)
{
ctx->collect_attachment = 1;
Modified: trunk/src/rfc822parse.c
===================================================================
--- trunk/src/rfc822parse.c 2008-04-16 18:24:36 UTC (rev 248)
+++ trunk/src/rfc822parse.c 2008-05-02 18:37:47 UTC (rev 249)
@@ -1012,8 +1012,9 @@
With LOWER_VALUE set to true, a matching field value will be
lowercased.
- Note, that ATTR should be lowercase. A CTX of NULL is allowed and
- will return NULL.
+ Note, that ATTR should be lowercase. If ATTR is NULL the fucntion
+ returns the first token of the field; i.e. not the parameter but
+ the actual value. A CTX of NULL is allowed and will return NULL.
*/
const char *
rfc822parse_query_parameter (rfc822parse_field_t ctx, const char *attr,
@@ -1021,6 +1022,22 @@
{
TOKEN t, a;
+ if (!attr)
+ {
+ t = ctx;
+ if (t
+ && (t->type == tATOM || t->type == tQUOTED || t->type == tDOMAINLIT))
+ {
+ if ( lower_value && !t->flags.lowered )
+ {
+ lowercase_string (t->data);
+ t->flags.lowered = 1;
+ }
+ return t->data;
+ }
+ return NULL;
+ }
+
for (t = ctx; t; t = t->next)
{
/* skip to the next semicolon */
@@ -1213,7 +1230,22 @@
}
else
printf ("*** media: text/plain [assumed]\n");
-
+
+ ctx = rfc822parse_parse_field (msg, "Content-Disposition", -1);
+ if (ctx)
+ {
+ const char *s1;
+ TOKEN t;
+
+ s1 = rfc822parse_query_parameter (ctx, NULL, 1);
+ if (s1)
+ printf ("*** disp: type=`%s'\n", s1);
+ s1 = rfc822parse_query_parameter (ctx, "filename", 0);
+ if (s1)
+ printf ("*** disp: fname=`%s'\n", s1);
+
+ rfc822parse_release_field (ctx);
+ }
}
More information about the Gnupg-commits
mailing list