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 | 59e48cc7e19dcf1181bf24239ac0604f79f44014 (patch) | |
tree | e4de9532264575f495944849ee21bf6d31b47c65 /shell | |
parent | 168acebb90f6bbdfe30079802c760da26c3f17aa (diff) |
mail-document-subject.diff: sanitize subject if document mailed from LibreOffice
bnc#459176
Diffstat (limited to 'shell')
-rw-r--r-- | shell/source/win32/simplemail/senddoc.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/shell/source/win32/simplemail/senddoc.cxx b/shell/source/win32/simplemail/senddoc.cxx index 696cd80b04..76aa7cc517 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)); - pMapiMessage->lpszSubject = const_cast<char*>(gSubject.c_str()); + 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]; |