diff --git a/xpfc/msg/inc/nsMIMEMessage.h b/xpfc/msg/inc/nsMIMEMessage.h index 4be6cdaa2ec..8c50a156eaa 100644 --- a/xpfc/msg/inc/nsMIMEMessage.h +++ b/xpfc/msg/inc/nsMIMEMessage.h @@ -45,6 +45,7 @@ public: NS_IMETHOD AddBodyPart(nsIMIMEBodyPart& aBodyPart); NS_IMETHOD GetBodyType(nsMIMEBodyType& aBodyType) ; + NS_IMETHOD Encode(); protected: ~nsMIMEMessage(); @@ -55,6 +56,7 @@ private: public: mime_message_t * mMimeMessageT; + nsmail_outputstream_t * mMimeMessageStreamT; }; diff --git a/xpfc/msg/public/nsIMIMEBodyPart.h b/xpfc/msg/public/nsIMIMEBodyPart.h index 40844e3f395..7d9d84d490f 100644 --- a/xpfc/msg/public/nsIMIMEBodyPart.h +++ b/xpfc/msg/public/nsIMIMEBodyPart.h @@ -27,18 +27,6 @@ { 0x4804d230, 0x703a, 0x11d2, \ { 0x8d, 0xbc, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } -typedef enum -{ - nsMIMEEncoding_default = 0, - nsMIMEEncoding_quoted_printable = 1, - nsMIMEEncoding_base_64 = 2, - nsMIMEEncoding_binary = 3, - nsMIMEEncoding_e7bit = 4, - nsMIMEEncoding_e8bit = 5, - nsMIMEEncoding_none = 6 -} nsMIMEEncoding; - - class nsIMIMEBodyPart : public nsISupports { diff --git a/xpfc/msg/public/nsIMimeMessage.h b/xpfc/msg/public/nsIMimeMessage.h index da21e610179..94c514bd9cc 100644 --- a/xpfc/msg/public/nsIMimeMessage.h +++ b/xpfc/msg/public/nsIMimeMessage.h @@ -36,6 +36,18 @@ typedef enum nsMIMEBodyType_messagepart = 3 } nsMIMEBodyType; +typedef enum +{ + nsMIMEEncoding_default = 0, + nsMIMEEncoding_quoted_printable = 1, + nsMIMEEncoding_base_64 = 2, + nsMIMEEncoding_binary = 3, + nsMIMEEncoding_e7bit = 4, + nsMIMEEncoding_e8bit = 5, + nsMIMEEncoding_none = 6 +} nsMIMEEncoding; + + class nsIMIMEMessage : public nsISupports { @@ -55,6 +67,8 @@ public: NS_IMETHOD GetBodyType(nsMIMEBodyType& aBodyType) = 0; + NS_IMETHOD Encode() = 0; + }; #endif /* nsIMIMEMessage_h___ */ diff --git a/xpfc/msg/public/nsIMimeService.h b/xpfc/msg/public/nsIMimeService.h index 319f369c003..d2998a4eac4 100644 --- a/xpfc/msg/public/nsIMimeService.h +++ b/xpfc/msg/public/nsIMimeService.h @@ -21,12 +21,15 @@ #include "nsISupports.h" #include "nsString.h" +#include "nsIMIMEMessage.h" //08d3c0f0-6f90-11d2-8dbc-00805f8a7ab6 #define NS_IMIME_SERVICE_IID \ { 0x08d3c0f0, 0x6f90, 0x11d2, \ { 0x8d, 0xbc, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } + + class nsIMIMEService : public nsISupports { diff --git a/xpfc/msg/src/nsMIMEBasicBodyPart.cpp b/xpfc/msg/src/nsMIMEBasicBodyPart.cpp index c52f1b8b3ef..94fdd3d6a51 100644 --- a/xpfc/msg/src/nsMIMEBasicBodyPart.cpp +++ b/xpfc/msg/src/nsMIMEBasicBodyPart.cpp @@ -62,7 +62,7 @@ nsresult nsMIMEBasicBodyPart::SetBody(nsString& aBody) mMimeBasicPart->content_type = MIME_CONTENT_TEXT; mMimeBasicPart->content_subtype = strdup ("plain"); mMimeBasicPart->content_type_params = strdup ("charset=us-ascii"); - mMimeBasicPart->encoding_type = MIME_ENCODING_7BIT; + mMimeBasicPart->encoding_type = MIME_ENCODING_7BIT; //MIME_ENCODING_UNINITIALIZED int ret = mime_basicPart_setDataBuf (mMimeBasicPart, strlen (body), body, TRUE); @@ -70,7 +70,7 @@ nsresult nsMIMEBasicBodyPart::SetBody(nsString& aBody) { delete body; mime_basicPart_free_all(mMimeBasicPart); - free (mMimeBasicPart); + PR_Free (mMimeBasicPart); return ret; } diff --git a/xpfc/msg/src/nsMIMEMessage.cpp b/xpfc/msg/src/nsMIMEMessage.cpp index 77a4cef99be..6b9c971381d 100644 --- a/xpfc/msg/src/nsMIMEMessage.cpp +++ b/xpfc/msg/src/nsMIMEMessage.cpp @@ -30,6 +30,7 @@ nsMIMEMessage :: nsMIMEMessage() : nsMessage() mBodyType = nsMIMEBodyType_empty; mBodyPart = nsnull; mMimeMessageT = nsnull; + mMimeMessageStreamT = nsnull; } nsMIMEMessage :: ~nsMIMEMessage() @@ -86,6 +87,12 @@ nsresult nsMIMEMessage::GetHeader(nsString& aHeaderName, nsString& aHeaderValue) return (NS_OK); } +nsresult nsMIMEMessage::Encode() +{ + mime_message_putByteStream (mMimeMessageT, mMimeMessageStreamT); + return NS_OK; +} + nsresult nsMIMEMessage::AddAttachment(nsString& aAttachment, nsMIMEEncoding aMIMEEncoding) { @@ -120,8 +127,6 @@ nsresult nsMIMEMessage::SetBody(nsString& aBody) basic->Init(); - //mime_message_create(body, nsnull, MIME_ENCODING_UNINITIALIZED, &mMimeMessageT); - mMimeMessageT = (mime_message_t *) mime_malloc (sizeof (mime_message_t)); basic->SetBody(aBody); diff --git a/xpfc/msg/src/nsMIMEService.cpp b/xpfc/msg/src/nsMIMEService.cpp index 9ea515f6006..44cbc08edee 100644 --- a/xpfc/msg/src/nsMIMEService.cpp +++ b/xpfc/msg/src/nsMIMEService.cpp @@ -18,6 +18,8 @@ #include "nsMIMEService.h" #include "nsxpfcCIID.h" +#include "mime.h" +#include "nsMIMEMessage.h" static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kMIMEServiceIID, NS_IMIME_SERVICE_IID);