[ooo-build-commit] .: patches/dev300

Tor Lillqvist tml at kemper.freedesktop.org
Mon Feb 1 07:20:34 PST 2010


 patches/dev300/mail-document-subject.diff |   33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

New commits:
commit f678f40050fe0586b80e37fbc7223031247e40db
Author: Tor Lillqvist <tml at iki.fi>
Date:   Mon Feb 1 16:57:32 2010 +0200

    Decode URI escapes in subject field when sending document as mail
    
    When sending the current document as mail, decode any URI escape
    sequences (like %20 for spaces, and those for non-ASCII characters) of
    the document's filename before using it as the message subject. Fixes
    bnc#575653.

diff --git a/patches/dev300/mail-document-subject.diff b/patches/dev300/mail-document-subject.diff
index 608defc..90cb404 100644
--- a/patches/dev300/mail-document-subject.diff
+++ b/patches/dev300/mail-document-subject.diff
@@ -15,3 +15,36 @@
  				    xSimpleMailMessage->setAttachement( aAttachmentSeq );
  
  	                sal_Bool bSend( sal_False );
+--- shell/source/win32/simplemail/senddoc.cxx
++++ shell/source/win32/simplemail/senddoc.cxx
+@@ -34,9 +34,10 @@
+ #include "precompiled_shell.hxx"
+ #include <osl/diagnose.h>
+ 
+-#ifndef _RTL_STRING_HXX_
+ #include <rtl/string.hxx>
++#include <rtl/ustring.hxx>
++#include <rtl/uri.hxx>
++#include <osl/thread.hxx>
+-#endif
+ #include "simplemapi.hxx"
+ 
+ #define WIN32_LEAN_AND_MEAN
+@@ -175,6 +175,16 @@
+     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];


More information about the ooo-build-commit mailing list