summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-09-10 13:28:24 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-09-10 23:04:33 +0200
commite871b6a31aa5004daa7fb3b8531bd7f43e8fc203 (patch)
tree7f8151dcd6a58f711489b17b6c351e51806d9cbd /tools
parenta7b38dcf930a4f6b7dccfbf44bea5bf763e17cdc (diff)
Reduce INetMIMEMessage::EnableAttachChild to its only use case
Change-Id: I67221408d6b9d2aee942ca8bd39ca51da0209551
Diffstat (limited to 'tools')
-rw-r--r--tools/source/inet/inetmsg.cxx67
1 files changed, 13 insertions, 54 deletions
diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx
index 0a8b84df22a0..bf124380ef13 100644
--- a/tools/source/inet/inetmsg.cxx
+++ b/tools/source/inet/inetmsg.cxx
@@ -25,7 +25,6 @@
#include <tools/inetstrm.hxx>
#include <tools/contnr.hxx>
#include <rtl/instance.hxx>
-#include <rtl/strbuf.hxx>
#include <comphelper/string.hxx>
#include <stdio.h>
@@ -803,67 +802,27 @@ OUString INetMIMEMessage::GetDefaultContentType()
return OUString("text/plain; charset=us-ascii");
}
-bool INetMIMEMessage::EnableAttachChild (INetMessageContainerType eType)
+bool INetMIMEMessage::EnableAttachMultipartFormDataChild()
{
// Check context.
if (IsContainer())
return false;
- // Setup Content-Type header field.
- OStringBuffer aContentType;
- switch (eType)
- {
- case INETMSG_MESSAGE_RFC822:
- aContentType.append("message/rfc822");
- break;
-
- case INETMSG_MULTIPART_ALTERNATIVE:
- aContentType.append("multipart/alternative");
- break;
-
- case INETMSG_MULTIPART_DIGEST:
- aContentType.append("multipart/digest");
- break;
-
- case INETMSG_MULTIPART_PARALLEL:
- aContentType.append("multipart/parallel");
- break;
-
- case INETMSG_MULTIPART_RELATED:
- aContentType.append("multipart/related");
- break;
-
- case INETMSG_MULTIPART_FORM_DATA:
- aContentType.append("multipart/form-data");
- break;
-
- default:
- aContentType.append("multipart/mixed");
- break;
- }
-
- // Setup boundary for multipart types.
- if (aContentType.toString().startsWithIgnoreAsciiCase("multipart/"))
- {
- // Generate a unique boundary from current time.
- sal_Char sTail[16 + 1];
- tools::Time aCurTime( tools::Time::SYSTEM );
- sal_uInt64 nThis = reinterpret_cast< sal_uIntPtr >( this ); // we can be on a 64bit architecture
- nThis = ( ( nThis >> 32 ) ^ nThis ) & SAL_MAX_UINT32;
- sprintf (sTail, "%08X%08X",
- static_cast< unsigned int >(aCurTime.GetTime()),
- static_cast< unsigned int >(nThis));
- m_aBoundary = "------------_4D48";
- m_aBoundary += sTail;
-
- // Append boundary as ContentType parameter.
- aContentType.append("; boundary=");
- aContentType.append(m_aBoundary);
- }
+ // Generate a unique boundary from current time.
+ sal_Char sTail[16 + 1];
+ tools::Time aCurTime( tools::Time::SYSTEM );
+ sal_uInt64 nThis = reinterpret_cast< sal_uIntPtr >( this ); // we can be on a 64bit architecture
+ nThis = ( ( nThis >> 32 ) ^ nThis ) & SAL_MAX_UINT32;
+ sprintf (sTail, "%08X%08X",
+ static_cast< unsigned int >(aCurTime.GetTime()),
+ static_cast< unsigned int >(nThis));
+ m_aBoundary = "------------_4D48";
+ m_aBoundary += sTail;
// Set header fields.
SetMIMEVersion(OUString("1.0"));
- SetContentType(OStringToOUString(aContentType.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US));
+ SetContentType(
+ OUString::fromUtf8("multipart/form-data; boundary=" + m_aBoundary));
SetContentTransferEncoding(OUString("7bit"));
// Done.