Adding nsIMIMEMessage interface

git-svn-id: svn://10.0.0.236/trunk@13731 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
spider%netscape.com
1998-10-30 19:09:57 +00:00
parent bef9e12eb4
commit 03dd781fc8
10 changed files with 167 additions and 1 deletions

View File

@@ -226,5 +226,11 @@
{ 0x1887e710, 0x6f9a, 0x11d2, \
{0x8d, 0xbc, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
//8afb9c70-7029-11d2-8dbc-00805f8a7ab6
#define NS_MIME_MESSAGE_CID \
{ 0x8afb9c70, 0x7029, 0x11d2, \
{0x8d, 0xbc, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
#endif

View File

@@ -54,6 +54,7 @@
#include "nsSMTPService.h"
#include "nsMIMEService.h"
#include "nsMessage.h"
#include "nsMIMEMessage.h"
#include "nsXPFCSubject.h"
#include "nsXPFCCommand.h"
#include "nsXPFCCanvas.h"
@@ -112,6 +113,7 @@ static NS_DEFINE_IID(kCXPFCActionCommand, NS_XPFC_ACTION_COMMAND_CID);
static NS_DEFINE_IID(kCUserCID, NS_USER_CID);
static NS_DEFINE_IID(kCSMTPServiceCID, NS_SMTP_SERVICE_CID);
static NS_DEFINE_IID(kCMessageCID, NS_MESSAGE_CID);
static NS_DEFINE_IID(kCMIMEMessageCID, NS_MIME_MESSAGE_CID);
static NS_DEFINE_IID(kCMIMEServiceCID, NS_MIME_SERVICE_CID);
class nsxpfcFactory : public nsIFactory

View File

@@ -162,6 +162,8 @@ nsresult nsxpfcFactory::CreateInstance(nsISupports *aOuter,
inst = (nsISupports *)new nsMIMEService();
} else if (mClassID.Equals(kCMessageCID)) {
inst = (nsISupports *)new nsMessage();
} else if (mClassID.Equals(kCMIMEMessageCID)) {
inst = (nsISupports *)(nsIMIMEMessage*) new nsMIMEMessage();
}
if (inst == NULL) {

View File

@@ -16,6 +16,7 @@ PRIVATE_EXPORTS = \
nsSMTPService.h \
nsMIMEService.h \
nsMessage.h \
nsMIMEMessage.h \
nsSMTPServerCallback.h \
$(NULL)

View File

@@ -0,0 +1,40 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsMIMEMessage_h___
#define nsMIMEMessage_h___
#include "nsMessage.h"
#include "nsIMIMEMessage.h"
class nsMIMEMessage : public nsMessage,
public nsIMIMEMessage
{
public:
nsMIMEMessage();
NS_DECL_ISUPPORTS
NS_IMETHOD Init() ;
protected:
~nsMIMEMessage();
};
#endif /* nsMIMEMessage_h___ */

View File

@@ -15,6 +15,7 @@ EXPORTS = \
nsIMIMEService.h \
nsISMTPObserver.h \
nsIMessage.h \
nsIMIMEMessage.h \
$(NULL)
PRIVATE_EXPORTS = \

View File

@@ -0,0 +1,39 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIMIMEMessage_h___
#define nsIMIMEMessage_h___
#include "nsISupports.h"
#include "nsString.h"
//d69d9a40-7027-11d2-8dbc-00805f8a7ab6
#define NS_IMIME_MESSAGE_IID \
{ 0xd69d9a40, 0x7027, 0x11d2, \
{ 0x8d, 0xbc, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
class nsIMIMEMessage : public nsISupports
{
public:
NS_IMETHOD Init() = 0;
};
#endif /* nsIMIMEMessage_h___ */

View File

@@ -21,6 +21,7 @@ CPPSRCS = \
nsSMTPService.cpp \
nsMIMEService.cpp \
nsMessage.cpp \
nsMIMEMessage.cpp \
nsSMTPServerCallback.cpp \
$(NULL)

View File

@@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsMIMEMessage.h"
#include "nsxpfcCIID.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIMessageIID, NS_IMESSAGE_IID);
static NS_DEFINE_IID(kIMIMEMessageIID, NS_IMIME_MESSAGE_IID);
nsMIMEMessage :: nsMIMEMessage() : nsMessage()
{
NS_INIT_REFCNT();
}
nsMIMEMessage :: ~nsMIMEMessage()
{
}
NS_IMPL_ADDREF(nsMIMEMessage)
NS_IMPL_RELEASE(nsMIMEMessage)
nsresult nsMIMEMessage::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kIMIMEMessageIID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsMessage::QueryInterface(aIID,aInstancePtr));
}
nsresult nsMIMEMessage::Init()
{
return (nsMessage::Init());
}

View File

@@ -52,6 +52,14 @@ nsresult nsSMTPService::SendMail(nsString& aServer,
nsIMessage& aMessage,
nsISMTPObserver * aObserver)
{
/*
* Check to see if nsIMessage supports the MIME interface,
* and if so , send this message as MIME as do regular
* plain/text mail
*/
return NS_OK;
}
@@ -62,6 +70,10 @@ nsresult nsSMTPService::SendMail(nsString& aServer,
nsString& aBody,
nsISMTPObserver * aObserver)
{
/*
* Get a bunch of character strings for passing to SMTP directly
*/
char * from = aFrom.ToNewCString();
char * to = aTo.ToNewCString();
char * header = aSubject.ToNewCString();
@@ -71,7 +83,6 @@ nsresult nsSMTPService::SendMail(nsString& aServer,
data += header;
data += "\r\n";
data += aBody.ToNewCString();
message = data.ToNewCString();
nsString strdomain ;