зеркало из https://github.com/mozilla/pjs.git
Switch between MIME & plain based on interface in SMTP Service
This commit is contained in:
Родитель
65ce4ecc0e
Коммит
e1c6b5d1de
|
@ -36,7 +36,7 @@ public:
|
|||
NS_IMETHOD SetBody(nsString& aBody);
|
||||
|
||||
NS_IMETHOD GetSender(nsString& aSender);
|
||||
NS_IMETHOD GetReciepients(nsString& aRecipients);
|
||||
NS_IMETHOD GetRecipients(nsString& aRecipients);
|
||||
NS_IMETHOD GetSubject(nsString& aSubject);
|
||||
NS_IMETHOD GetBody(nsString& aBody);
|
||||
|
||||
|
|
|
@ -41,6 +41,10 @@ public:
|
|||
nsIMessage& aMessage,
|
||||
nsISMTPObserver * aObserver = nsnull);
|
||||
|
||||
NS_IMETHOD SendMail(nsString& aServer,
|
||||
nsIMIMEMessage& aMIMEMessage,
|
||||
nsISMTPObserver * aObserver = nsnull);
|
||||
|
||||
|
||||
protected:
|
||||
~nsSMTPService();
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
NS_IMETHOD SetBody(nsString& aBody) = 0;
|
||||
|
||||
NS_IMETHOD GetSender(nsString& aSender) = 0;
|
||||
NS_IMETHOD GetReciepients(nsString& aRecipients) = 0;
|
||||
NS_IMETHOD GetRecipients(nsString& aRecipients) = 0;
|
||||
NS_IMETHOD GetSubject(nsString& aSubject) = 0;
|
||||
NS_IMETHOD GetBody(nsString& aBody) = 0;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIMessage.h"
|
||||
#include "nsIMIMEMessage.h"
|
||||
#include "nsISMTPObserver.h"
|
||||
|
||||
//b64f8b50-6f77-11d2-8dbc-00805f8a7ab6
|
||||
|
@ -47,6 +48,10 @@ public:
|
|||
nsIMessage& aMessage,
|
||||
nsISMTPObserver * aObserver = nsnull) = 0;
|
||||
|
||||
NS_IMETHOD SendMail(nsString& aServer,
|
||||
nsIMIMEMessage& aMIMEMessage,
|
||||
nsISMTPObserver * aObserver = nsnull) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsISMTPService_h___ */
|
||||
|
|
|
@ -79,7 +79,7 @@ nsresult nsMessage::GetSender(nsString& aSender)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMessage::GetReciepients(nsString& aRecipients)
|
||||
nsresult nsMessage::GetRecipients(nsString& aRecipients)
|
||||
{
|
||||
aRecipients = mRecipients;
|
||||
return NS_OK;
|
||||
|
|
|
@ -25,10 +25,11 @@
|
|||
#include <stdio.h>
|
||||
#include "nsCRT.h"
|
||||
#include "nsSMTPServerCallback.h"
|
||||
#include "nsIMIMEMessage.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kSMTPServiceIID, NS_ISMTP_SERVICE_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIMIMEMessageIID, NS_IMIME_MESSAGE_IID);
|
||||
|
||||
nsSMTPService :: nsSMTPService()
|
||||
{
|
||||
|
@ -58,8 +59,37 @@ nsresult nsSMTPService::SendMail(nsString& aServer,
|
|||
* plain/text mail
|
||||
*/
|
||||
|
||||
nsIMIMEMessage * mime_message = nsnull;
|
||||
|
||||
nsresult res = NS_OK;
|
||||
|
||||
res = aMessage.QueryInterface(kIMIMEMessageIID, (void**)&mime_message);
|
||||
|
||||
if (res == NS_OK)
|
||||
return (SendMail(aServer, *mime_message, aObserver));
|
||||
|
||||
/*
|
||||
* this is not a MIME message. Send as plain text
|
||||
*/
|
||||
|
||||
nsString str_from;
|
||||
nsString str_to;
|
||||
nsString str_subject;
|
||||
nsString str_body;
|
||||
|
||||
aMessage.GetSender(str_from);
|
||||
aMessage.GetRecipients(str_to);
|
||||
aMessage.GetSubject(str_subject);
|
||||
aMessage.GetBody(str_body);
|
||||
|
||||
return (SendMail(aServer, str_from,str_to, str_subject, str_body));
|
||||
|
||||
}
|
||||
|
||||
nsresult nsSMTPService::SendMail(nsString& aServer,
|
||||
nsIMIMEMessage& aMIMEMessage,
|
||||
nsISMTPObserver * aObserver)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче