From b4c8b8c2513af01bd2b2ee60d316a8305f61a9ae Mon Sep 17 00:00:00 2001 From: "spider%netscape.com" Date: Fri, 30 Oct 1998 02:02:52 +0000 Subject: [PATCH] Adding nsIMessage. Updating SMTPService to take an nsIMessage to send git-svn-id: svn://10.0.0.236/trunk@13701 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpfc/core/inc/nsxpfcCIID.h | 4 ++ mozilla/xpfc/core/inc/nsxpfcFactory.h | 2 + mozilla/xpfc/core/src/nsxpfcFactory.cpp | 2 + mozilla/xpfc/msg/inc/manifest.mn | 1 + mozilla/xpfc/msg/inc/nsMessage.h | 48 ++++++++++++++ mozilla/xpfc/msg/inc/nsSMTPService.h | 3 + mozilla/xpfc/msg/public/manifest.mn | 1 + mozilla/xpfc/msg/public/nsIMessage.h | 50 ++++++++++++++ mozilla/xpfc/msg/public/nsISMTPService.h | 2 + mozilla/xpfc/msg/src/manifest.mn | 1 + mozilla/xpfc/msg/src/nsMessage.cpp | 84 ++++++++++++++++++++++++ mozilla/xpfc/msg/src/nsSMTPService.cpp | 5 ++ 12 files changed, 203 insertions(+) create mode 100644 mozilla/xpfc/msg/inc/nsMessage.h create mode 100644 mozilla/xpfc/msg/public/nsIMessage.h create mode 100644 mozilla/xpfc/msg/src/nsMessage.cpp diff --git a/mozilla/xpfc/core/inc/nsxpfcCIID.h b/mozilla/xpfc/core/inc/nsxpfcCIID.h index fbe67cb0a89..4a976f9d298 100644 --- a/mozilla/xpfc/core/inc/nsxpfcCIID.h +++ b/mozilla/xpfc/core/inc/nsxpfcCIID.h @@ -221,6 +221,10 @@ { 0x57c616d0, 0x6f90, 0x11d2, \ {0x8d, 0xbc, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } +//1887e710-6f9a-11d2-8dbc-00805f8a7ab6 +#define NS_MESSAGE_CID \ + { 0x1887e710, 0x6f9a, 0x11d2, \ + {0x8d, 0xbc, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} } #endif diff --git a/mozilla/xpfc/core/inc/nsxpfcFactory.h b/mozilla/xpfc/core/inc/nsxpfcFactory.h index 0e80e9f4982..13f2c61f8a9 100644 --- a/mozilla/xpfc/core/inc/nsxpfcFactory.h +++ b/mozilla/xpfc/core/inc/nsxpfcFactory.h @@ -53,6 +53,7 @@ #include "nsXPFCObserverManager.h" #include "nsSMTPService.h" #include "nsMIMEService.h" +#include "nsMessage.h" #include "nsXPFCSubject.h" #include "nsXPFCCommand.h" #include "nsXPFCCanvas.h" @@ -110,6 +111,7 @@ static NS_DEFINE_IID(kCXPFCCommandServerCID, NS_XPFC_COMMAND_SERVER_CID); 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(kCMIMEServiceCID, NS_MIME_SERVICE_CID); class nsxpfcFactory : public nsIFactory diff --git a/mozilla/xpfc/core/src/nsxpfcFactory.cpp b/mozilla/xpfc/core/src/nsxpfcFactory.cpp index e5fdf9358ef..61f90ef6769 100644 --- a/mozilla/xpfc/core/src/nsxpfcFactory.cpp +++ b/mozilla/xpfc/core/src/nsxpfcFactory.cpp @@ -160,6 +160,8 @@ nsresult nsxpfcFactory::CreateInstance(nsISupports *aOuter, inst = (nsISupports *)new nsSMTPService(); } else if (mClassID.Equals(kCMIMEServiceCID)) { inst = (nsISupports *)new nsMIMEService(); + } else if (mClassID.Equals(kCMessageCID)) { + inst = (nsISupports *)new nsMessage(); } if (inst == NULL) { diff --git a/mozilla/xpfc/msg/inc/manifest.mn b/mozilla/xpfc/msg/inc/manifest.mn index 7069ecaab1a..1bb405ac740 100644 --- a/mozilla/xpfc/msg/inc/manifest.mn +++ b/mozilla/xpfc/msg/inc/manifest.mn @@ -15,6 +15,7 @@ EXPORTS = \ PRIVATE_EXPORTS = \ nsSMTPService.h \ nsMIMEService.h \ + nsMessage.h \ $(NULL) MODULE = xpfc diff --git a/mozilla/xpfc/msg/inc/nsMessage.h b/mozilla/xpfc/msg/inc/nsMessage.h new file mode 100644 index 00000000000..1c9ed6c38af --- /dev/null +++ b/mozilla/xpfc/msg/inc/nsMessage.h @@ -0,0 +1,48 @@ +/* -*- 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 nsMessage_h___ +#define nsMessage_h___ + +#include "nsIMessage.h" + +class nsMessage : public nsIMessage +{ +public: + nsMessage(); + + NS_DECL_ISUPPORTS + + NS_IMETHOD Init() ; + + NS_IMETHOD SetSender(nsString& aSender); + NS_IMETHOD AddRecipient(nsString& aRecipient); + NS_IMETHOD SetSubject(nsString& aSubject); + NS_IMETHOD SetBody(nsString& aBody); + + NS_IMETHOD GetSender(nsString& aSender); + NS_IMETHOD GetReciepients(nsString& aRecipients); + NS_IMETHOD GetSubject(nsString& aSubject); + NS_IMETHOD GetBody(nsString& aBody); + +protected: + ~nsMessage(); + +}; + +#endif /* nsMessage_h___ */ diff --git a/mozilla/xpfc/msg/inc/nsSMTPService.h b/mozilla/xpfc/msg/inc/nsSMTPService.h index dc889ff36c8..196b1caffff 100644 --- a/mozilla/xpfc/msg/inc/nsSMTPService.h +++ b/mozilla/xpfc/msg/inc/nsSMTPService.h @@ -29,7 +29,10 @@ public: NS_DECL_ISUPPORTS NS_IMETHOD Init() ; + NS_IMETHOD SendMail(nsString& aServer, nsString& aFrom, nsString& aTo, nsString& aSubject, nsString& aBody) ; + NS_IMETHOD SendMail(nsString& aServer, nsIMessage& aMessage) ; + protected: ~nsSMTPService(); diff --git a/mozilla/xpfc/msg/public/manifest.mn b/mozilla/xpfc/msg/public/manifest.mn index 7b53e3f2846..31809167cf1 100644 --- a/mozilla/xpfc/msg/public/manifest.mn +++ b/mozilla/xpfc/msg/public/manifest.mn @@ -13,6 +13,7 @@ DEPTH = ../../.. EXPORTS = \ nsISMTPService.h \ nsIMIMEService.h \ + nsIMessage.h \ $(NULL) PRIVATE_EXPORTS = \ diff --git a/mozilla/xpfc/msg/public/nsIMessage.h b/mozilla/xpfc/msg/public/nsIMessage.h new file mode 100644 index 00000000000..8fccc5ebe6b --- /dev/null +++ b/mozilla/xpfc/msg/public/nsIMessage.h @@ -0,0 +1,50 @@ +/* -*- 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 nsIMessage_h___ +#define nsIMessage_h___ + +#include "nsISupports.h" +#include "nsString.h" + +//4ecb61a0-6f98-11d2-8dbc-00805f8a7ab6 +#define NS_IMESSAGE_IID \ +{ 0x4ecb61a0, 0x6f98, 0x11d2, \ +{ 0x8d, 0xbc, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } } + +class nsIMessage : public nsISupports +{ + +public: + + NS_IMETHOD Init() = 0; + + + NS_IMETHOD SetSender(nsString& aSender) = 0; + NS_IMETHOD AddRecipient(nsString& aRecipient) = 0; + NS_IMETHOD SetSubject(nsString& aSubject) = 0; + NS_IMETHOD SetBody(nsString& aBody) = 0; + + NS_IMETHOD GetSender(nsString& aSender) = 0; + NS_IMETHOD GetReciepients(nsString& aRecipients) = 0; + NS_IMETHOD GetSubject(nsString& aSubject) = 0; + NS_IMETHOD GetBody(nsString& aBody) = 0; + +}; + +#endif /* nsIMessage_h___ */ diff --git a/mozilla/xpfc/msg/public/nsISMTPService.h b/mozilla/xpfc/msg/public/nsISMTPService.h index 45aff5ebb66..409cbdf1923 100644 --- a/mozilla/xpfc/msg/public/nsISMTPService.h +++ b/mozilla/xpfc/msg/public/nsISMTPService.h @@ -21,6 +21,7 @@ #include "nsISupports.h" #include "nsString.h" +#include "nsIMessage.h" //b64f8b50-6f77-11d2-8dbc-00805f8a7ab6 #define NS_ISMTP_SERVICE_IID \ @@ -35,6 +36,7 @@ public: NS_IMETHOD Init() = 0; NS_IMETHOD SendMail(nsString& aServer, nsString& aFrom, nsString& aTo, nsString& aSubject, nsString& aBody) = 0; + NS_IMETHOD SendMail(nsString& aServer, nsIMessage& aMessage) = 0; }; diff --git a/mozilla/xpfc/msg/src/manifest.mn b/mozilla/xpfc/msg/src/manifest.mn index 493d158177a..f876c6651f5 100644 --- a/mozilla/xpfc/msg/src/manifest.mn +++ b/mozilla/xpfc/msg/src/manifest.mn @@ -20,6 +20,7 @@ MODULE = xpfc CPPSRCS = \ nsSMTPService.cpp \ nsMIMEService.cpp \ + nsMessage.cpp \ $(NULL) REQUIRES = xpcom raptor netlib msgsdk diff --git a/mozilla/xpfc/msg/src/nsMessage.cpp b/mozilla/xpfc/msg/src/nsMessage.cpp new file mode 100644 index 00000000000..87b4243aec5 --- /dev/null +++ b/mozilla/xpfc/msg/src/nsMessage.cpp @@ -0,0 +1,84 @@ +/* -*- 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 "nsMessage.h" +#include "nsxpfcCIID.h" + +static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +static NS_DEFINE_IID(kMessageIID, NS_IMESSAGE_IID); + +nsMessage :: nsMessage() +{ + NS_INIT_REFCNT(); +} + +nsMessage :: ~nsMessage() +{ +} + +NS_IMPL_ADDREF(nsMessage) +NS_IMPL_RELEASE(nsMessage) +NS_IMPL_QUERY_INTERFACE(nsMessage, kMessageIID) + +nsresult nsMessage::Init() +{ + return NS_OK; +} + +nsresult nsMessage::SetSender(nsString& aSender) +{ + return NS_OK; +} + +nsresult nsMessage::AddRecipient(nsString& aRecipient) +{ + return NS_OK; +} + +nsresult nsMessage::SetSubject(nsString& aSubject) +{ + return NS_OK; +} + +nsresult nsMessage::SetBody(nsString& aBody) +{ + return NS_OK; +} + +nsresult nsMessage::GetSender(nsString& aSender) +{ + return NS_OK; +} + +nsresult nsMessage::GetReciepients(nsString& aRecipients) +{ + return NS_OK; +} + +nsresult nsMessage::GetSubject(nsString& aSubject) +{ + return NS_OK; +} + +nsresult nsMessage::GetBody(nsString& aBody) +{ + return NS_OK; +} + + + diff --git a/mozilla/xpfc/msg/src/nsSMTPService.cpp b/mozilla/xpfc/msg/src/nsSMTPService.cpp index 5c57605539f..9d5c9bb9c55 100644 --- a/mozilla/xpfc/msg/src/nsSMTPService.cpp +++ b/mozilla/xpfc/msg/src/nsSMTPService.cpp @@ -67,6 +67,11 @@ nsresult nsSMTPService::Init() return NS_OK; } +nsresult nsSMTPService::SendMail(nsString& aServer, nsIMessage& aMessage) +{ + return NS_OK; +} + nsresult nsSMTPService::SendMail(nsString& aServer, nsString& aFrom, nsString& aTo,