зеркало из https://github.com/mozilla/gecko-dev.git
WIP mime stuff
This commit is contained in:
Родитель
f83469a9ac
Коммит
9c63954911
|
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
||||
|
|
|
@ -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___ */
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче