diff options
-rw-r--r-- | include/tools/inetmsg.hxx | 207 | ||||
-rw-r--r-- | include/tools/inetstrm.hxx | 17 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 2 | ||||
-rw-r--r-- | tools/source/inet/inetmsg.cxx | 201 | ||||
-rw-r--r-- | tools/source/inet/inetstrm.cxx | 8 | ||||
-rw-r--r-- | unotools/source/ucbhelper/ucblockbytes.cxx | 2 |
6 files changed, 169 insertions, 268 deletions
diff --git a/include/tools/inetmsg.hxx b/include/tools/inetmsg.hxx index fb6370a4d107..eb14ffca5efa 100644 --- a/include/tools/inetmsg.hxx +++ b/include/tools/inetmsg.hxx @@ -99,7 +99,29 @@ typedef ::std::vector< INetMessageHeader* > HeaderList_impl; #define INETMSG_RFC822_RETURN_RECEIPT_TO 15 #define INETMSG_RFC822_NUMHDR 16 -class TOOLS_DLLPUBLIC INetRFC822Message +#define INETMSG_MIME_VERSION 0 +#define INETMSG_MIME_CONTENT_DESCRIPTION 1 +#define INETMSG_MIME_CONTENT_DISPOSITION 2 +#define INETMSG_MIME_CONTENT_ID 3 +#define INETMSG_MIME_CONTENT_TYPE 4 +#define INETMSG_MIME_CONTENT_TRANSFER_ENCODING 5 +#define INETMSG_MIME_NUMHDR 6 + +enum INetMessageContainerType +{ + INETMSG_MESSAGE_RFC822, + INETMSG_MULTIPART_MIXED, + INETMSG_MULTIPART_ALTERNATIVE, + INETMSG_MULTIPART_DIGEST, + INETMSG_MULTIPART_PARALLEL, + INETMSG_MULTIPART_RELATED, + INETMSG_MULTIPART_FORM_DATA +}; + +class INetMIMEMessage; +typedef ::std::vector< INetMIMEMessage* > INetMIMEMessgeList_impl; + +class TOOLS_DLLPUBLIC INetMIMEMessage { HeaderList_impl m_aHeaderList; @@ -108,11 +130,25 @@ class TOOLS_DLLPUBLIC INetRFC822Message SvLockBytesRef m_xDocLB; void ListCleanup_Impl(); - void ListCopy (const INetRFC822Message& rMsg); + void ListCopy (const INetMIMEMessage& rMsg); + + sal_uIntPtr m_nRFC822Index[INETMSG_RFC822_NUMHDR]; + + sal_uIntPtr m_nMIMEIndex[INETMSG_MIME_NUMHDR]; + INetMIMEMessage* pParent; + INetMIMEMessgeList_impl aChildren; + OString m_aBoundary; + bool bHeaderParsed; + + friend class INetMIMEMessageStream; + + const OString& GetMultipartBoundary() const { return m_aBoundary; } + void SetMultipartBoundary (const OString& rBnd) { m_aBoundary = rBnd; } - sal_uIntPtr m_nIndex[INETMSG_RFC822_NUMHDR]; + void CleanupImp(); + void CopyImp (const INetMIMEMessage& rMsg); + void SetHeaderParsed() { bHeaderParsed = true; } -protected: OUString GetHeaderName_Impl ( sal_uIntPtr nIndex, rtl_TextEncoding eEncoding) const { @@ -155,15 +191,15 @@ protected: const OUString &rValue, sal_uIntPtr &rnIndex); - virtual SvStream& operator<< (SvStream& rStrm) const; - virtual SvStream& operator>> (SvStream& rStrm); + sal_uIntPtr SetRFC822HeaderField ( + const INetMessageHeader &rHeader, sal_uIntPtr nNewIndex); public: - INetRFC822Message(); - INetRFC822Message (const INetRFC822Message& rMsg); - virtual ~INetRFC822Message(); + INetMIMEMessage(); + INetMIMEMessage (const INetMIMEMessage& rMsg); + ~INetMIMEMessage(); - INetRFC822Message& operator= (const INetRFC822Message& rMsg); + INetMIMEMessage& operator= (const INetMIMEMessage& rMsg); sal_uIntPtr GetHeaderCount() const { return m_aHeaderList.size(); } @@ -186,7 +222,7 @@ public: } } - virtual sal_uIntPtr SetHeaderField ( + sal_uIntPtr SetHeaderField ( const INetMessageHeader &rField, sal_uIntPtr nIndex = ((sal_uIntPtr)-1) ); @@ -203,235 +239,150 @@ public: static bool ParseDateField ( const OUString& rDateField, DateTime& rDateTime); + bool HeaderParsed() const { return bHeaderParsed; } + + INetMIMEMessage* CreateMessage ( + const INetMIMEMessage& rMsg) const; + // Header fields. OUString GetBCC() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_BCC], + m_nRFC822Index[INETMSG_RFC822_BCC], INetMIME::HEADER_FIELD_ADDRESS); } OUString GetCC() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_CC], + m_nRFC822Index[INETMSG_RFC822_CC], INetMIME::HEADER_FIELD_ADDRESS); } OUString GetComments() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_COMMENTS], + m_nRFC822Index[INETMSG_RFC822_COMMENTS], INetMIME::HEADER_FIELD_TEXT); } OUString GetDate() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_DATE], + m_nRFC822Index[INETMSG_RFC822_DATE], INetMIME::HEADER_FIELD_STRUCTURED); } OUString GetFrom() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_FROM], + m_nRFC822Index[INETMSG_RFC822_FROM], INetMIME::HEADER_FIELD_ADDRESS); } OUString GetInReplyTo() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_IN_REPLY_TO], + m_nRFC822Index[INETMSG_RFC822_IN_REPLY_TO], INetMIME::HEADER_FIELD_ADDRESS); // ??? MESSAGE_ID ??? } OUString GetKeywords() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_KEYWORDS], + m_nRFC822Index[INETMSG_RFC822_KEYWORDS], INetMIME::HEADER_FIELD_PHRASE); } OUString GetMessageID() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_MESSAGE_ID], + m_nRFC822Index[INETMSG_RFC822_MESSAGE_ID], INetMIME::HEADER_FIELD_MESSAGE_ID); } OUString GetReferences() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_REFERENCES], + m_nRFC822Index[INETMSG_RFC822_REFERENCES], INetMIME::HEADER_FIELD_ADDRESS); } OUString GetReplyTo() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_REPLY_TO], + m_nRFC822Index[INETMSG_RFC822_REPLY_TO], INetMIME::HEADER_FIELD_ADDRESS); } OUString GetReturnPath() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_RETURN_PATH], + m_nRFC822Index[INETMSG_RFC822_RETURN_PATH], INetMIME::HEADER_FIELD_ADDRESS); } OUString GetReturnReceiptTo() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_RETURN_RECEIPT_TO], + m_nRFC822Index[INETMSG_RFC822_RETURN_RECEIPT_TO], INetMIME::HEADER_FIELD_ADDRESS); } OUString GetSender() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_SENDER], + m_nRFC822Index[INETMSG_RFC822_SENDER], INetMIME::HEADER_FIELD_ADDRESS); } OUString GetSubject() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_SUBJECT], + m_nRFC822Index[INETMSG_RFC822_SUBJECT], INetMIME::HEADER_FIELD_TEXT); } OUString GetTo() const { return GetHeaderValue_Impl ( - m_nIndex[INETMSG_RFC822_TO], + m_nRFC822Index[INETMSG_RFC822_TO], INetMIME::HEADER_FIELD_TEXT); } - // Stream operators. - - friend SvStream& WriteINetMessage( - SvStream& rStrm, const INetRFC822Message& rMsg) - { - return rMsg.operator<< (rStrm); - } - - friend SvStream& ReadINetMessage ( - SvStream& rStrm, INetRFC822Message& rMsg) - { - return rMsg.operator>> (rStrm); - } - - friend SvStream& operator<< ( - SvStream& rStrm, const INetRFC822Message& rMsg) - { - return rMsg.operator<< (rStrm); - } - - friend SvStream& operator>> ( - SvStream& rStrm, INetRFC822Message& rMsg) - { - return rMsg.operator>> (rStrm); - } -}; - -#define INETMSG_MIME_VERSION 0 -#define INETMSG_MIME_CONTENT_DESCRIPTION 1 -#define INETMSG_MIME_CONTENT_DISPOSITION 2 -#define INETMSG_MIME_CONTENT_ID 3 -#define INETMSG_MIME_CONTENT_TYPE 4 -#define INETMSG_MIME_CONTENT_TRANSFER_ENCODING 5 -#define INETMSG_MIME_NUMHDR 6 - -enum INetMessageContainerType -{ - INETMSG_MESSAGE_RFC822, - INETMSG_MULTIPART_MIXED, - INETMSG_MULTIPART_ALTERNATIVE, - INETMSG_MULTIPART_DIGEST, - INETMSG_MULTIPART_PARALLEL, - INETMSG_MULTIPART_RELATED, - INETMSG_MULTIPART_FORM_DATA -}; - -class INetMIMEMessage; -typedef ::std::vector< INetMIMEMessage* > INetMIMEMessgeList_impl; - -class TOOLS_DLLPUBLIC INetMIMEMessage : public INetRFC822Message -{ - sal_uIntPtr m_nIndex[INETMSG_MIME_NUMHDR]; - INetMIMEMessage* pParent; - INetMIMEMessgeList_impl aChildren; - OString m_aBoundary; - bool bHeaderParsed; - - friend class INetMIMEMessageStream; - - const OString& GetMultipartBoundary() const { return m_aBoundary; } - void SetMultipartBoundary (const OString& rBnd) { m_aBoundary = rBnd; } - - void CleanupImp(); - void CopyImp (const INetMIMEMessage& rMsg); - void SetHeaderParsed() { bHeaderParsed = true; } - -protected: - virtual SvStream& operator<< (SvStream& rStrm) const SAL_OVERRIDE; - virtual SvStream& operator>> (SvStream& rStrm) SAL_OVERRIDE; - -public: - INetMIMEMessage(); - INetMIMEMessage (const INetMIMEMessage& rMsg); - virtual ~INetMIMEMessage(); - - INetMIMEMessage& operator= (const INetMIMEMessage& rMsg); - - bool HeaderParsed() const { return bHeaderParsed; } - - INetMIMEMessage* CreateMessage ( - const INetMIMEMessage& rMsg) const; - - using INetRFC822Message::SetHeaderField; - virtual sal_uIntPtr SetHeaderField ( - const INetMessageHeader &rHeader, - sal_uIntPtr nIndex = ((sal_uIntPtr)-1) - ) SAL_OVERRIDE; - - // Header fields. - void SetMIMEVersion (const OUString& rVersion); OUString GetMIMEVersion() const { - return GetHeaderValue (m_nIndex[INETMSG_MIME_VERSION]); + return GetHeaderValue (m_nMIMEIndex[INETMSG_MIME_VERSION]); } OUString GetContentDescription() const { - return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_DESCRIPTION]); + return GetHeaderValue (m_nMIMEIndex[INETMSG_MIME_CONTENT_DESCRIPTION]); } void SetContentDisposition (const OUString& rDisposition); OUString GetContentDisposition() const { - return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_DISPOSITION]); + return GetHeaderValue (m_nMIMEIndex[INETMSG_MIME_CONTENT_DISPOSITION]); } OUString GetContentID() const { - return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_ID]); + return GetHeaderValue (m_nMIMEIndex[INETMSG_MIME_CONTENT_ID]); } void SetContentType (const OUString& rType); OUString GetContentType() const { - return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_TYPE]); + return GetHeaderValue (m_nMIMEIndex[INETMSG_MIME_CONTENT_TYPE]); } void SetContentTransferEncoding (const OUString& rEncoding); OUString GetContentTransferEncoding() const { - return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_TRANSFER_ENCODING]); + return GetHeaderValue (m_nMIMEIndex[INETMSG_MIME_CONTENT_TRANSFER_ENCODING]); } OUString GetDefaultContentType (); @@ -466,17 +417,9 @@ public: // Stream operators. - friend SvStream& operator<< ( - SvStream& rStrm, const INetMIMEMessage& rMsg) - { - return rMsg.operator<< (rStrm); - } + friend SvStream& operator <<(SvStream& rStrm, const INetMIMEMessage& rMsg); - friend SvStream& operator>> ( - SvStream& rStrm, INetMIMEMessage& rMsg) - { - return rMsg.operator>> (rStrm); - } + friend SvStream& operator >>(SvStream& rStrm, INetMIMEMessage& rMsg); }; #endif diff --git a/include/tools/inetstrm.hxx b/include/tools/inetstrm.hxx index b5c4e04b873c..09ee43e8eb1d 100644 --- a/include/tools/inetstrm.hxx +++ b/include/tools/inetstrm.hxx @@ -23,7 +23,6 @@ #include <sal/types.h> #include <rtl/ustring.hxx> -class INetRFC822Message; class INetMIMEMessage; class SvMemoryStream; class SvStream; @@ -81,7 +80,7 @@ enum INetMessageStreamState /// Message Generator Interface. class INetMessageIStream : public INetIStream { - INetRFC822Message *pSourceMsg; + INetMIMEMessage *pSourceMsg; bool bHeaderGenerated; sal_uIntPtr nBufSiz; @@ -106,8 +105,8 @@ public: INetMessageIStream (sal_uIntPtr nBufferSize = 2048); virtual ~INetMessageIStream (void); - INetRFC822Message *GetSourceMessage (void) const { return pSourceMsg; } - void SetSourceMessage (INetRFC822Message *pMsg) { pSourceMsg = pMsg; } + INetMIMEMessage *GetSourceMessage (void) const { return pSourceMsg; } + void SetSourceMessage (INetMIMEMessage *pMsg) { pSourceMsg = pMsg; } void GenerateHeader (bool bGen = true) { bHeaderGenerated = !bGen; } bool IsHeaderGenerated (void) const { return bHeaderGenerated; } @@ -116,7 +115,7 @@ public: /// Message Parser Interface. class INetMessageOStream : public INetOStream { - INetRFC822Message *pTargetMsg; + INetMIMEMessage *pTargetMsg; bool bHeaderParsed; INetMessageStreamState eOState; @@ -135,8 +134,8 @@ public: INetMessageOStream (void); virtual ~INetMessageOStream (void); - INetRFC822Message *GetTargetMessage (void) const { return pTargetMsg; } - void SetTargetMessage (INetRFC822Message *pMsg) { pTargetMsg = pMsg; } + INetMIMEMessage *GetTargetMessage (void) const { return pTargetMsg; } + void SetTargetMessage (INetMIMEMessage *pMsg) { pTargetMsg = pMsg; } void ParseHeader (bool bParse = true) { bHeaderParsed = !bParse; } bool IsHeaderParsed (void) const { return bHeaderParsed; } @@ -193,7 +192,7 @@ public: using INetMessageIStream::SetSourceMessage; void SetSourceMessage (INetMIMEMessage *pMsg) { - INetMessageIStream::SetSourceMessage ((INetRFC822Message *)pMsg); + INetMessageIStream::SetSourceMessage (pMsg); } INetMIMEMessage *GetSourceMessage (void) const { @@ -203,7 +202,7 @@ public: using INetMessageOStream::SetTargetMessage; void SetTargetMessage (INetMIMEMessage *pMsg) { - INetMessageOStream::SetTargetMessage ((INetRFC822Message *)pMsg); + INetMessageOStream::SetTargetMessage (pMsg); } INetMIMEMessage *GetTargetMessage (void) const { diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 4c8746f27f04..4deb194d504a 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1638,7 +1638,7 @@ void SfxHeaderAttributes_Impl::SetAttribute( const SvKeyValue& rKV ) else if( rKV.GetKey().equalsIgnoreAsciiCase( "expires" ) ) { DateTime aDateTime( DateTime::EMPTY ); - if( INetRFC822Message::ParseDateField( rKV.GetValue(), aDateTime ) ) + if( INetMIMEMessage::ParseDateField( rKV.GetValue(), aDateTime ) ) { aDateTime.ConvertToLocalTime(); pDoc->GetMedium()->SetExpired_Impl( aDateTime ); diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index a710bc229320..7a781704b799 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -48,7 +48,7 @@ inline sal_Unicode ascii_toLowerCase( sal_Unicode ch ) return ch; } -void INetRFC822Message::ListCleanup_Impl() +void INetMIMEMessage::ListCleanup_Impl() { // Cleanup. sal_uIntPtr i, n = m_aHeaderList.size(); @@ -57,7 +57,7 @@ void INetRFC822Message::ListCleanup_Impl() m_aHeaderList.clear(); } -void INetRFC822Message::ListCopy (const INetRFC822Message &rMsg) +void INetMIMEMessage::ListCopy (const INetMIMEMessage &rMsg) { if (!(this == &rMsg)) { @@ -74,7 +74,7 @@ void INetRFC822Message::ListCopy (const INetRFC822Message &rMsg) } } -void INetRFC822Message::SetHeaderField_Impl ( +void INetMIMEMessage::SetHeaderField_Impl ( INetMIME::HeaderFieldType eType, const OString &rName, const OUString &rValue, @@ -121,42 +121,6 @@ enum _ImplINetRFC822MessageHeaderState INETMSG_RFC822_LETTER_S }; -INetRFC822Message::INetRFC822Message() - : m_nDocSize(0) -{ - for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++) - m_nIndex[i] = CONTAINER_ENTRY_NOTFOUND; -} - -INetRFC822Message::INetRFC822Message (const INetRFC822Message& rMsg) - : m_nDocSize (rMsg.m_nDocSize), - m_aDocName (rMsg.m_aDocName), - m_xDocLB (rMsg.m_xDocLB) -{ - ListCopy (rMsg); - for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++) - m_nIndex[i] = rMsg.m_nIndex[i]; -} - -INetRFC822Message& INetRFC822Message::operator= (const INetRFC822Message& rMsg) -{ - if (this != &rMsg) - { - m_nDocSize = rMsg.m_nDocSize; - m_aDocName = rMsg.m_aDocName; - m_xDocLB = rMsg.m_xDocLB; - ListCopy (rMsg); - for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++) - m_nIndex[i] = rMsg.m_nIndex[i]; - } - return *this; -} - -INetRFC822Message::~INetRFC822Message() -{ - ListCleanup_Impl(); -} - /* ParseDateField and local helper functions. * * Parses a String in (implied) GMT format into class Date and tools::Time objects. @@ -200,7 +164,7 @@ static sal_uInt16 ParseMonth(const OString& rStr, sal_uInt16& nIndex) return (i + 1); } -bool INetRFC822Message::ParseDateField ( +bool INetMIMEMessage::ParseDateField ( const OUString& rDateFieldW, DateTime& rDateTime) { OString aDateField(OUStringToOString(rDateFieldW, @@ -310,7 +274,7 @@ bool INetRFC822Message::ParseDateField ( } // Header Field Parser -sal_uIntPtr INetRFC822Message::SetHeaderField ( +sal_uIntPtr INetMIMEMessage::SetRFC822HeaderField ( const INetMessageHeader &rHeader, sal_uIntPtr nNewIndex) { OString aName (rHeader.GetName()); @@ -528,8 +492,8 @@ sal_uIntPtr INetRFC822Message::SetHeaderField ( pData = pStop; SetHeaderField_Impl ( INetMessageHeader( ImplINetRFC822MessageHeaderData[nIdx], rHeader.GetValue() ), - m_nIndex[nIdx]); - nNewIndex = m_nIndex[nIdx]; + m_nRFC822Index[nIdx]); + nNewIndex = m_nRFC822Index[nIdx]; break; default: // INETMSG_RFC822_JUNK @@ -541,57 +505,6 @@ sal_uIntPtr INetRFC822Message::SetHeaderField ( return nNewIndex; } -SvStream& INetRFC822Message::operator<< (SvStream& rStrm) const -{ - rStrm.WriteUInt32( m_nDocSize ); - write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, m_aDocName, RTL_TEXTENCODING_UTF8); - - sal_uIntPtr n = m_aHeaderList.size(); - rStrm.WriteUInt32( n ); - - for (sal_uIntPtr i = 0; i < n; i++) - WriteINetMessageHeader( rStrm, *( m_aHeaderList[ i ] ) ); - - for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++) - rStrm.WriteUInt32( m_nIndex[i] ); - - return rStrm; -} - -SvStream& INetRFC822Message::operator>> (SvStream& rStrm) -{ - // Cleanup. - m_nDocSize = 0; - m_xDocLB.Clear(); - ListCleanup_Impl(); - - sal_uInt32 nTemp; - - // Copy. - rStrm.ReadUInt32( nTemp ); - m_nDocSize = nTemp; - m_aDocName = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_UTF8); - - sal_uIntPtr n = 0; - rStrm.ReadUInt32( nTemp ); - n = nTemp; - - for (sal_uIntPtr i = 0; i < n; i++) - { - INetMessageHeader *p = new INetMessageHeader(); - ReadINetMessageHeader( rStrm, *p ); - m_aHeaderList.push_back( p ); - } - - for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++) - { - rStrm.ReadUInt32( nTemp ); - m_nIndex[i] = nTemp; - } - - return rStrm; -} - static const char* ImplINetMIMEMessageHeaderData[] = { "MIME-Version", @@ -615,18 +528,25 @@ enum _ImplINetMIMEMessageHeaderState }; INetMIMEMessage::INetMIMEMessage() - : INetRFC822Message (), - pParent (NULL), - bHeaderParsed (false) + : m_nDocSize(0), + pParent(NULL), + bHeaderParsed(false) { + for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++) + m_nRFC822Index[i] = CONTAINER_ENTRY_NOTFOUND; for (sal_uInt16 i = 0; i < INETMSG_MIME_NUMHDR; i++) - m_nIndex[i] = CONTAINER_ENTRY_NOTFOUND; + m_nMIMEIndex[i] = CONTAINER_ENTRY_NOTFOUND; } INetMIMEMessage::INetMIMEMessage (const INetMIMEMessage& rMsg) - : INetRFC822Message (rMsg) - , pParent(NULL) + : m_nDocSize(rMsg.m_nDocSize), + m_aDocName(rMsg.m_aDocName), + m_xDocLB(rMsg.m_xDocLB), + pParent(NULL) { + ListCopy (rMsg); + for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++) + m_nRFC822Index[i] = rMsg.m_nRFC822Index[i]; CopyImp (rMsg); } @@ -635,9 +555,12 @@ INetMIMEMessage& INetMIMEMessage::operator= ( { if (this != &rMsg) { - // Assign base. - INetRFC822Message::operator= (rMsg); - + m_nDocSize = rMsg.m_nDocSize; + m_aDocName = rMsg.m_aDocName; + m_xDocLB = rMsg.m_xDocLB; + ListCopy (rMsg); + for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++) + m_nRFC822Index[i] = rMsg.m_nRFC822Index[i]; CleanupImp(); CopyImp (rMsg); } @@ -646,6 +569,7 @@ INetMIMEMessage& INetMIMEMessage::operator= ( INetMIMEMessage::~INetMIMEMessage() { + ListCleanup_Impl(); CleanupImp(); } @@ -663,7 +587,7 @@ void INetMIMEMessage::CopyImp (const INetMIMEMessage& rMsg) size_t i; for (i = 0; i < INETMSG_MIME_NUMHDR; i++) - m_nIndex[i] = rMsg.m_nIndex[i]; + m_nMIMEIndex[i] = rMsg.m_nMIMEIndex[i]; m_aBoundary = rMsg.m_aBoundary; @@ -819,14 +743,13 @@ sal_uIntPtr INetMIMEMessage::SetHeaderField ( pData = pStop; SetHeaderField_Impl ( INetMessageHeader( ImplINetMIMEMessageHeaderData[nIdx], rHeader.GetValue()), - m_nIndex[nIdx]); - nNewIndex = m_nIndex[nIdx]; + m_nMIMEIndex[nIdx]); + nNewIndex = m_nMIMEIndex[nIdx]; break; default: // INETMSG_MIME_JUNK pData = pStop; - nNewIndex = INetRFC822Message::SetHeaderField ( - rHeader, nNewIndex); + nNewIndex = SetRFC822HeaderField(rHeader, nNewIndex); break; } } @@ -838,7 +761,7 @@ void INetMIMEMessage::SetMIMEVersion (const OUString& rVersion) SetHeaderField_Impl ( INetMIME::HEADER_FIELD_TEXT, ImplINetMIMEMessageHeaderData[INETMSG_MIME_VERSION], rVersion, - m_nIndex[INETMSG_MIME_VERSION]); + m_nMIMEIndex[INETMSG_MIME_VERSION]); } void INetMIMEMessage::SetContentDisposition (const OUString& rDisposition) @@ -846,7 +769,7 @@ void INetMIMEMessage::SetContentDisposition (const OUString& rDisposition) SetHeaderField_Impl ( INetMIME::HEADER_FIELD_TEXT, ImplINetMIMEMessageHeaderData[INETMSG_MIME_CONTENT_DISPOSITION], rDisposition, - m_nIndex[INETMSG_MIME_CONTENT_DISPOSITION]); + m_nMIMEIndex[INETMSG_MIME_CONTENT_DISPOSITION]); } void INetMIMEMessage::SetContentType (const OUString& rType) @@ -854,7 +777,7 @@ void INetMIMEMessage::SetContentType (const OUString& rType) SetHeaderField_Impl ( INetMIME::HEADER_FIELD_TEXT, ImplINetMIMEMessageHeaderData[INETMSG_MIME_CONTENT_TYPE], rType, - m_nIndex[INETMSG_MIME_CONTENT_TYPE]); + m_nMIMEIndex[INETMSG_MIME_CONTENT_TYPE]); } void INetMIMEMessage::SetContentTransferEncoding ( @@ -863,7 +786,7 @@ void INetMIMEMessage::SetContentTransferEncoding ( SetHeaderField_Impl ( INetMIME::HEADER_FIELD_TEXT, ImplINetMIMEMessageHeaderData[INETMSG_MIME_CONTENT_TRANSFER_ENCODING], rEncoding, - m_nIndex[INETMSG_MIME_CONTENT_TRANSFER_ENCODING]); + m_nMIMEIndex[INETMSG_MIME_CONTENT_TRANSFER_ENCODING]); } OUString INetMIMEMessage::GetDefaultContentType() @@ -959,31 +882,67 @@ bool INetMIMEMessage::AttachChild(INetMIMEMessage& rChildMsg, bool bOwner) return false; } -SvStream& INetMIMEMessage::operator<< (SvStream& rStrm) const +SvStream& operator <<(SvStream& rStrm, const INetMIMEMessage& rMsg) { - INetRFC822Message::operator<< (rStrm); + rStrm.WriteUInt32( rMsg.m_nDocSize ); + write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, rMsg.m_aDocName, RTL_TEXTENCODING_UTF8); + + sal_uIntPtr n = rMsg.m_aHeaderList.size(); + rStrm.WriteUInt32( n ); + + for (sal_uIntPtr i = 0; i < n; i++) + WriteINetMessageHeader( rStrm, *( rMsg.m_aHeaderList[ i ] ) ); + + for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++) + rStrm.WriteUInt32( rMsg.m_nRFC822Index[i] ); for (sal_uInt16 i = 0; i < INETMSG_MIME_NUMHDR; i++) - rStrm.WriteUInt32( m_nIndex[i] ); + rStrm.WriteUInt32( rMsg.m_nMIMEIndex[i] ); - write_uInt16_lenPrefixed_uInt8s_FromOString(rStrm, m_aBoundary); - rStrm.WriteUInt32( aChildren.size() ); + write_uInt16_lenPrefixed_uInt8s_FromOString(rStrm, rMsg.m_aBoundary); + rStrm.WriteUInt32( rMsg.aChildren.size() ); return rStrm; } -SvStream& INetMIMEMessage::operator>> (SvStream& rStrm) +SvStream& operator >>(SvStream& rStrm, INetMIMEMessage& rMsg) { - INetRFC822Message::operator>> (rStrm); + // Cleanup. + rMsg.m_nDocSize = 0; + rMsg.m_xDocLB.Clear(); + rMsg.ListCleanup_Impl(); sal_uInt32 nTemp; + + // Copy. + rStrm.ReadUInt32( nTemp ); + rMsg.m_nDocSize = nTemp; + rMsg.m_aDocName = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_UTF8); + + sal_uIntPtr n = 0; + rStrm.ReadUInt32( nTemp ); + n = nTemp; + + for (sal_uIntPtr i = 0; i < n; i++) + { + INetMessageHeader *p = new INetMessageHeader(); + ReadINetMessageHeader( rStrm, *p ); + rMsg.m_aHeaderList.push_back( p ); + } + + for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++) + { + rStrm.ReadUInt32( nTemp ); + rMsg.m_nRFC822Index[i] = nTemp; + } + for (sal_uInt16 i = 0; i < INETMSG_MIME_NUMHDR; i++) { rStrm.ReadUInt32( nTemp ); - m_nIndex[i] = nTemp; + rMsg.m_nMIMEIndex[i] = nTemp; } - m_aBoundary = read_uInt16_lenPrefixed_uInt8s_ToOString(rStrm); + rMsg.m_aBoundary = read_uInt16_lenPrefixed_uInt8s_ToOString(rStrm); rStrm.ReadUInt32( nTemp ); diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index 87646228127e..a6fbf23480d6 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -485,7 +485,7 @@ INetMessageEncodeQPStream_Impl::~INetMessageEncodeQPStream_Impl(void) int INetMessageEncodeQPStream_Impl::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) { - INetRFC822Message* pMsg = GetSourceMessage(); + INetMIMEMessage* pMsg = GetSourceMessage(); if (pMsg == NULL) return INETSTREAM_STATUS_ERROR; if (pMsg->GetDocumentLB() == NULL) return 0; @@ -693,7 +693,7 @@ INetMessageDecodeQPStream_Impl::~INetMessageDecodeQPStream_Impl(void) int INetMessageDecodeQPStream_Impl::PutMsgLine( const sal_Char* pData, sal_uIntPtr nSize) { - INetRFC822Message* pMsg = GetTargetMessage(); + INetMIMEMessage* pMsg = GetTargetMessage(); if (pMsg == NULL) return INETSTREAM_STATUS_ERROR; SvOpenLockBytes* pLB = PTR_CAST(SvOpenLockBytes, pMsg->GetDocumentLB()); @@ -807,7 +807,7 @@ INetMessageEncode64Stream_Impl::~INetMessageEncode64Stream_Impl(void) int INetMessageEncode64Stream_Impl::GetMsgLine(sal_Char* pData, sal_uIntPtr nSize) { - INetRFC822Message* pMsg = GetSourceMessage(); + INetMIMEMessage* pMsg = GetSourceMessage(); if (pMsg == NULL) return INETSTREAM_STATUS_ERROR; if (pMsg->GetDocumentLB() == NULL) return 0; @@ -993,7 +993,7 @@ INetMessageDecode64Stream_Impl::~INetMessageDecode64Stream_Impl(void) int INetMessageDecode64Stream_Impl::PutMsgLine(const sal_Char* pData, sal_uIntPtr nSize) { - INetRFC822Message* pMsg = GetTargetMessage(); + INetMIMEMessage* pMsg = GetTargetMessage(); if (pMsg == NULL) return INETSTREAM_STATUS_ERROR; SvOpenLockBytes* pLB = PTR_CAST(SvOpenLockBytes, pMsg->GetDocumentLB()); diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index 1fcf878c9552..a4f8c1f81dda 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -196,7 +196,7 @@ void SAL_CALL UcbPropertiesChangeListener_Impl::propertiesChange ( const Sequenc if (aName.compareToIgnoreAsciiCaseAscii("Expires") == 0) { DateTime aExpires (0, 0); - if (INetRFC822Message::ParseDateField (aValue, aExpires)) + if (INetMIMEMessage::ParseDateField (aValue, aExpires)) { aExpires.ConvertToLocalTime(); m_xLockBytes->SetExpireDate_Impl( aExpires ); |