diff options
author | Tor Lillqvist <tlillqvist@novell.com> | 2010-10-15 11:10:08 +0200 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2010-10-15 11:10:08 +0200 |
commit | a07a2d9c940884fd55924080eec2d46d003262de (patch) | |
tree | ac9ce13ccd7bb8da2b7eb8814afaa072f66572f0 /shell/source/win32 | |
parent | c63d5210fd85cf8ec41c29f8fc17d39c676726be (diff) |
mail-document-subject.diff: sanitize subject if document mailed from LibreOffice
bnc#459176
Diffstat (limited to 'shell/source/win32')
-rw-r--r-- | shell/source/win32/simplemail/senddoc.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/shell/source/win32/simplemail/senddoc.cxx b/shell/source/win32/simplemail/senddoc.cxx index e1a08d84f694..28c378cb8a5f 100644 --- a/shell/source/win32/simplemail/senddoc.cxx +++ b/shell/source/win32/simplemail/senddoc.cxx @@ -30,6 +30,10 @@ #include "precompiled_shell.hxx" #include <osl/diagnose.h> #include <sal/macros.h> +#include <rtl/string.hxx> +#include <rtl/ustring.hxx> +#include <rtl/uri.hxx> +#include <osl/thread.hxx> #include "simplemapi.hxx" @@ -166,7 +170,17 @@ void initMapiMessage( { ZeroMemory(pMapiMessage, sizeof(MapiMessage)); + try { + rtl_uString *subject = NULL; + rtl_uString_newFromAscii(&subject, const_cast<char*>(gSubject.c_str())); + rtl_uString *decoded_subject = NULL; + rtl_uriDecode(subject, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8, &decoded_subject); + rtl::OUString ou_subject(decoded_subject); + pMapiMessage->lpszSubject = strdup(OUStringToOString(ou_subject, osl_getThreadTextEncoding(), RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK).getStr()); + } + catch (...) { pMapiMessage->lpszSubject = const_cast<char*>(gSubject.c_str()); + } pMapiMessage->lpszNoteText = (gBody.length() ? const_cast<char*>(gBody.c_str()) : NULL); pMapiMessage->lpOriginator = aMapiOriginator; pMapiMessage->lpRecips = &aMapiRecipientList[0]; |