Bug 473740 Tidy up send later service and drop the nsIMessenger middle-man. r=Neil,sr=bienvenu

This commit is contained in:
Mark Banner 2009-01-19 09:58:21 +00:00
Родитель 7f6f0d59d3
Коммит 5500bbb857
13 изменённых файлов: 150 добавлений и 228 удалений

Просмотреть файл

@ -846,7 +846,12 @@ function IsSendUnsentMsgsEnabled(folderResource)
{
var identity;
if (messenger.sendingUnsentMsgs) // if we're currently sending unsent msgs, disable this cmd.
var msgSendlater =
Components.classes["@mozilla.org/messengercompose/sendlater;1"]
.getService(Components.interfaces.nsIMsgSendLater);
// If we're currently sending unsent msgs, disable this cmd.
if (msgSendlater.sendingMessages)
return false;
try {
if (folderResource) {
@ -875,7 +880,6 @@ function IsSendUnsentMsgsEnabled(folderResource)
identity = am.defaultAccount.defaultIdentity;
}
var msgSendlater = Components.classes["@mozilla.org/messengercompose/sendlater;1"].getService(Components.interfaces.nsIMsgSendLater);
var unsentMsgsFolder = msgSendlater.getUnsentMessagesFolder(identity);
return (unsentMsgsFolder.getTotalMessages(false) > 0);
}

Просмотреть файл

@ -2269,7 +2269,7 @@ function SendUnsentMessages()
if (msgFolder) {
var numMessages = msgFolder.getTotalMessages(false /* include subfolders */);
if(numMessages > 0) {
messenger.sendUnsentMessages(currentIdentity, msgWindow);
msgSendlater.sendUnsentMessages(currentIdentity, msgWindow);
// Right now, all identities point to the same unsent messages
// folder, so to avoid sending multiple copies of the
// unsent messages, we only call messenger.SendUnsentMessages() once.

Просмотреть файл

@ -49,7 +49,7 @@ interface nsIMsgMessageService;
interface nsIFile;
interface nsIUrlListener;
[scriptable, uuid(1B44C6EB-2C14-470F-AA5C-BDDCE89A4ECC)]
[scriptable, uuid(4ef633e5-8723-44fa-aa54-34b56f67481c)]
interface nsIMessenger : nsISupports {
const long eUnknown = 0;
@ -78,7 +78,6 @@ interface nsIMessenger : nsISupports {
unsigned long getRedoTransactionType();
void undo(in nsIMsgWindow msgWindow);
void redo(in nsIMsgWindow msgWindow);
void sendUnsentMessages(in nsIMsgIdentity aIdentity, in nsIMsgWindow aMsgWindow);
void setDocumentCharset(in ACString characterSet);
void saveAs(in ACString aURI, in boolean aAsFile, in nsIMsgIdentity aIdentity, in AString aMsgFilename);
void openAttachment(in ACString contentTpe, in ACString url, in ACString displayName, in ACString messageUri, in boolean isExternalAttachment);
@ -98,8 +97,6 @@ interface nsIMessenger : nsISupports {
// We need to return the actual file path (including the filename).
nsILocalFile saveAttachmentToFolder(in ACString contentType, in ACString url, in ACString displayName, in ACString messageUri, in nsILocalFile aDestFolder);
attribute boolean sendingUnsentMsgs;
readonly attribute ACString lastDisplayedMessageUri;
nsIMsgMessageService messageServiceFromURI(in ACString aUri);

Просмотреть файл

@ -820,7 +820,12 @@ function IsSendUnsentMsgsEnabled(folderResource)
{
var identity;
if (messenger.sendingUnsentMsgs) // if we're currently sending unsent msgs, disable this cmd.
var msgSendlater =
Components.classes["@mozilla.org/messengercompose/sendlater;1"]
.getService(Components.interfaces.nsIMsgSendLater);
// If we're currently sending unsent msgs, disable this cmd.
if (msgSendlater.sendingMessages)
return false;
try {
if (folderResource) {
@ -849,7 +854,6 @@ function IsSendUnsentMsgsEnabled(folderResource)
identity = am.defaultAccount.defaultIdentity;
}
var msgSendlater = Components.classes["@mozilla.org/messengercompose/sendlater;1"].getService(Components.interfaces.nsIMsgSendLater);
var unsentMsgsFolder = msgSendlater.getUnsentMessagesFolder(identity);
return (unsentMsgsFolder.getTotalMessages(false) > 0);
}

Просмотреть файл

@ -2095,7 +2095,7 @@ function SendUnsentMessages()
if(msgFolder) {
numMessages = msgFolder.getTotalMessages(false /* include subfolders */);
if(numMessages > 0) {
messenger.sendUnsentMessages(currentIdentity, msgWindow);
msgSendlater.sendUnsentMessages(currentIdentity, msgWindow);
// right now, all identities point to the same unsent messages
// folder, so to avoid sending multiple copies of the
// unsent messages, we only call messenger.SendUnsentMessages() once

Просмотреть файл

@ -114,8 +114,6 @@
// draft/folders/sendlater/etc
#include "nsIMsgCopyService.h"
#include "nsIMsgCopyServiceListener.h"
#include "nsIMsgSendLater.h"
#include "nsIMsgSendLaterListener.h"
#include "nsIUrlListener.h"
// undo
@ -311,7 +309,6 @@ public:
nsMessenger::nsMessenger()
{
mScriptObject = nsnull;
mSendingUnsentMsgs = PR_FALSE;
mCurHistoryPos = -2; // first message selected goes at position 0.
// InitializeFolderRoot();
}
@ -324,7 +321,6 @@ nsMessenger::~nsMessenger()
NS_IMPL_ISUPPORTS4(nsMessenger, nsIMessenger, nsIObserver, nsISupportsWeakReference, nsIFolderListener)
NS_IMPL_GETSET(nsMessenger, SendingUnsentMsgs, PRBool, mSendingUnsentMsgs)
NS_IMETHODIMP nsMessenger::SetWindow(nsIDOMWindowInternal *aWin, nsIMsgWindow *aMsgWindow)
{
@ -1445,113 +1441,6 @@ nsMessenger::GetLastDisplayedMessageUri(nsACString& aLastDisplayedMessageUri)
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////////
// This is the listener class for the send operation.
////////////////////////////////////////////////////////////////////////////////////
class SendLaterListener: public nsIMsgSendLaterListener
{
public:
SendLaterListener(nsIMessenger *);
virtual ~SendLaterListener(void);
// nsISupports interface
NS_DECL_ISUPPORTS
/* void OnStartSending (in PRUint32 aTotalMessageCount); */
NS_IMETHOD OnStartSending(PRUint32 aTotalMessageCount);
/* void OnProgress (in PRUint32 aCurrentMessage, in PRUint32 aTotalMessage); */
NS_IMETHOD OnProgress(PRUint32 aCurrentMessage, PRUint32 aTotalMessage);
/* void OnStatus (in wstring aMsg); */
NS_IMETHOD OnStatus(const PRUnichar *aMsg);
/* void OnStopSending (in nsresult aStatus, in wstring aMsg, in PRUint32 aTotalTried, in PRUint32 aSuccessful); */
NS_IMETHOD OnStopSending(nsresult aStatus, const PRUnichar *aMsg, PRUint32 aTotalTried, PRUint32 aSuccessful);
protected:
nsWeakPtr m_messenger;
};
NS_IMPL_ISUPPORTS1(SendLaterListener, nsIMsgSendLaterListener)
SendLaterListener::SendLaterListener(nsIMessenger *aMessenger)
{
m_messenger = do_GetWeakReference(aMessenger);
}
SendLaterListener::~SendLaterListener()
{
nsCOMPtr <nsIMessenger> messenger = do_QueryReferent(m_messenger);
// best to be defensive about this, in case OnStopSending doesn't get called.
if (messenger)
messenger->SetSendingUnsentMsgs(PR_FALSE);
m_messenger = nsnull;
}
nsresult
SendLaterListener::OnStartSending(PRUint32 aTotalMessageCount)
{
// this never gets called :-(
nsCOMPtr <nsIMessenger> messenger = do_QueryReferent(m_messenger);
if (messenger)
messenger->SetSendingUnsentMsgs(PR_TRUE);
return NS_OK;
}
nsresult
SendLaterListener::OnProgress(PRUint32 aCurrentMessage, PRUint32 aTotalMessage)
{
return NS_OK;
}
nsresult
SendLaterListener::OnStatus(const PRUnichar *aMsg)
{
return NS_OK;
}
nsresult
SendLaterListener::OnStopSending(nsresult aStatus, const PRUnichar *aMsg, PRUint32 aTotalTried,
PRUint32 aSuccessful)
{
#ifdef NS_DEBUG
if (NS_SUCCEEDED(aStatus))
printf("SendLaterListener::OnStopSending: Tried to send %d messages. %d successful.\n",
aTotalTried, aSuccessful);
#endif
nsCOMPtr <nsIMessenger> messenger = do_QueryReferent(m_messenger);
if (messenger)
messenger->SetSendingUnsentMsgs(PR_FALSE);
return NS_OK;
}
NS_IMETHODIMP
nsMessenger::SendUnsentMessages(nsIMsgIdentity *aIdentity, nsIMsgWindow *aMsgWindow)
{
nsresult rv;
nsCOMPtr<nsIMsgSendLater> pMsgSendLater = do_CreateInstance(kMsgSendLaterCID, &rv);
if (NS_SUCCEEDED(rv) && pMsgSendLater)
{
#ifdef DEBUG
printf("We successfully obtained a nsIMsgSendLater interface....\n");
#endif
SendLaterListener *sendLaterListener = new SendLaterListener(this);
if (!sendLaterListener)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(sendLaterListener);
pMsgSendLater->AddListener(sendLaterListener);
pMsgSendLater->SetMsgWindow(aMsgWindow);
mSendingUnsentMsgs = PR_TRUE;
pMsgSendLater->SendUnsentMessages(aIdentity);
NS_RELEASE(sendLaterListener);
}
return NS_OK;
}
nsSaveMsgListener::nsSaveMsgListener(nsIFile* aFile, nsMessenger *aMessenger, nsIUrlListener *aListener)
{
m_file = do_QueryInterface(aFile);

Просмотреть файл

@ -114,7 +114,6 @@ private:
nsCOMPtr<nsISupports> mSearchContext;
nsCString mLastDisplayURI; // this used when the user attempts to force a charset reload of a message...we need to get the last displayed
// uri so we can re-display it..
PRBool mSendingUnsentMsgs;
nsCString mNavigatingToUri;
nsCStringArray mLoadedMsgHistory;
PRInt32 mCurHistoryPos;

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -204,8 +204,8 @@ nsresult nsMsgOfflineManager::SynchronizeOfflineImapChanges()
nsresult nsMsgOfflineManager::SendUnsentMessages()
{
nsresult rv;
nsCOMPtr<nsIMsgSendLater> pMsgSendLater = do_CreateInstance(kMsgSendLaterCID, &rv);
nsresult rv;
nsCOMPtr<nsIMsgSendLater> pMsgSendLater(do_GetService(kMsgSendLaterCID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgAccountManager> accountManager =
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
@ -253,8 +253,7 @@ nsresult nsMsgOfflineManager::SendUnsentMessages()
if (identityToUse)
{
pMsgSendLater->AddListener(this);
pMsgSendLater->SetMsgWindow(m_window);
rv = pMsgSendLater->SendUnsentMessages(identityToUse);
rv = pMsgSendLater->SendUnsentMessages(identityToUse, m_window);
ShowStatus("sendingUnsent");
// if we succeeded, return - we'll run the next operation when the
// send finishes. Otherwise, advance to the next state.

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mark Banner <bugzilla@standard8.plus.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -36,22 +37,52 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsrootidl.idl"
#include "nsIMsgIdentity.idl"
#include "nsIMsgCompFields.idl"
#include "nsIMsgSendListener.idl"
#include "nsIMsgSendLaterListener.idl"
#include "nsIStreamListener.idl"
interface nsIMsgWindow;
interface nsIMsgIdentity;
interface nsIMsgSendLaterListener;
interface nsIMsgFolder;
[scriptable, uuid(E15C83E8-1CF4-11d3-8EF0-00A024A7D144)]
/**
* nsIMsgSendLater is a service used for sending messages in the background.
* Messages should be saved to an identity's unsent messages folder, and then
* can be sent by calling sendUnsentMessages.
*/
[scriptable, uuid(5ad3e734-b68e-449e-ad8c-c59da94b2661)]
interface nsIMsgSendLater : nsIStreamListener
{
void SendUnsentMessages(in nsIMsgIdentity identity);
attribute nsIMsgWindow msgWindow;
void RemoveListener(in nsIMsgSendLaterListener aListener);
void AddListener(in nsIMsgSendLaterListener aListener);
/**
* Sends any unsent messages in the identity's unsent messages folder.
*
* @param aIdentity The identity to send messages for.
* @param aWindow The window to give status feedback to whilst messages
* are being sent.
*/
void sendUnsentMessages(in nsIMsgIdentity aIdentity,
[optional] in nsIMsgWindow aWindow);
/**
* Adds an listener to the service to receive notifications.
*
* @param aListener The listener to add.
*/
void addListener(in nsIMsgSendLaterListener aListener);
/**
* Removes a listener from the service.
*
* @param aListener The listener to remove.
* @exception NS_ERROR_INVALID_ARG If the listener was not already added to
* the service.
*/
void removeListener(in nsIMsgSendLaterListener aListener);
/**
* Returns the unsent messages folder for the identity.
*/
nsIMsgFolder getUnsentMessagesFolder(in nsIMsgIdentity userIdentity);
/// Returns true if the service is currently sending messages.
readonly attribute boolean sendingMessages;
};

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mark Banner <bugzilla@standard8.plus.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -36,43 +37,43 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsrootidl.idl"
%{C++
%}
[scriptable, uuid(607DA5A8-289D-11d3-82B7-444553540002)]
/**
* Implement this interface and add to nsIMsgSendLater to receive notifications
* of send later actions.
*/
[scriptable, uuid(d61d5224-c55a-4428-9c87-340a9bd0b053)]
interface nsIMsgSendLaterListener : nsISupports {
/**
* Notify the observer that the operation of sending all unset messages has
* started.
*/
void onStartSending(in PRUint32 aTotalMessageCount);
/**
* Notify the observer that the operation of sending all unset messages has
* started
*/
void OnStartSending(in PRUint32 aTotalMessageCount);
/**
* Notify the observer that progress as occurred for send operation.
*/
void onProgress(in PRUint32 aCurrentMessage, in PRUint32 aTotalMessage);
/**
* Notify the observer that progress as occurred for send operation
*/
void OnProgress(in PRUint32 aCurrentMessage, in PRUint32 aTotalMessage);
/**
* Notify the observer with a status message for the send later operation
*/
void OnStatus(in wstring aMsg);
/**
* Notify the observer that the message has been sent. This method is
* called once when the networking library has finished processing the
* message.
*
* This method is called regardless of whether the the operation was successful.
* aMsgID The message id for the mail message
* status Status code for the message send.
* msg A text string describing the error.
* returnFileSpec The returned file spec for save to file operations.
*/
void OnStopSending(in nsresult aStatus, in wstring aMsg,
in PRUint32 aTotalTried, in PRUint32 aSuccessful);
/**
* Notify the observer with a status message for the send later operation.
*/
void onStatus(in wstring aMsg);
/**
* Notify the observer that the message has been sent. This method is
* called once when the networking library has finished processing the
* message.
*
* This method is called regardless of whether the the operation was
* successful.
*
* @param aStatus Status code for the message send.
* @param aMsg A text string describing the error.
* @param aTotalTried Total number of messages that were attempted to be sent.
* @param aSuccessful How many messages were successfully sent.
*/
void onStopSending(in nsresult aStatus, in wstring aMsg,
in PRUint32 aTotalTried, in PRUint32 aSuccessful);
};

Просмотреть файл

@ -36,32 +36,18 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMsgSendLater.h"
#include "nsCOMPtr.h"
#include "nsMsgCopy.h"
#include "nsIMsgSend.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIEnumerator.h"
#include "nsIFile.h"
#include "nsISmtpService.h"
#include "nsIMsgMailNewsUrl.h"
#include "nsIMsgIncomingServer.h"
#include "nsICopyMessageListener.h"
#include "nsIMsgMessageService.h"
#include "nsIMsgMailSession.h"
#include "nsIMsgAccountManager.h"
#include "nsMsgBaseCID.h"
#include "nsMsgCompCID.h"
#include "nsMsgCompUtils.h"
#include "nsMsgUtils.h"
#include "nsMsgFolderFlags.h"
#include "nsISupportsArray.h"
#include "nsMailHeaders.h"
#include "nsMsgPrompts.h"
#include "nsIMsgSendListener.h"
#include "nsIMsgSendLaterListener.h"
#include "nsMsgCopy.h"
#include "nsIPrompt.h"
#include "nsIURI.h"
#include "nsISmtpUrl.h"
#include "nsIChannel.h"
#include "nsNetUtil.h"
@ -80,12 +66,9 @@ NS_IMPL_ISUPPORTS3(nsMsgSendLater,
nsMsgSendLater::nsMsgSendLater()
{
mTempFile = nsnull;
mOutFile = nsnull;
mSendingMessages = PR_FALSE;
mTotalSentSuccessfully = 0;
mTotalSendCount = 0;
mMessageFolder = nsnull;
mMessage = nsnull;
mLeftoverBuffer = nsnull;
m_to = nsnull;
@ -112,7 +95,6 @@ nsMsgSendLater::nsMsgSendLater()
nsMsgSendLater::~nsMsgSendLater()
{
mTempFile = nsnull;
PR_Free(m_to);
PR_Free(m_fcc);
PR_Free(m_bcc);
@ -399,7 +381,7 @@ SendOperationListener::OnStopSending(const char *aMsgID, nsresult aStatus, const
++(mSendLater->mTotalSentSuccessfully);
}
else if (mSendLater)
else
{
mSendLater->NotifyListenersOnStopSending(aStatus, nsnull,
mSendLater->mTotalSendCount,
@ -579,7 +561,10 @@ nsMsgSendLater::StartNextMailFileSend()
#endif
mMessagesToSend->Clear(); // clear out our array
mSendingMessages = PR_FALSE;
NotifyListenersOnStopSending(NS_OK, nsnull, mTotalSendCount, mTotalSentSuccessfully);
// XXX Should we be releasing references so that we don't hold onto items
// unnecessarily.
return NS_OK;
}
@ -675,18 +660,19 @@ nsMsgSendLater::GetUnsentMessagesFolder(nsIMsgIdentity *aIdentity, nsIMsgFolder
//
//
NS_IMETHODIMP
nsMsgSendLater::SendUnsentMessages(nsIMsgIdentity *identity)
nsMsgSendLater::SendUnsentMessages(nsIMsgIdentity *aIdentity,
nsIMsgWindow *aWindow)
{
nsresult rv = GetUnsentMessagesFolder(identity, getter_AddRefs(mMessageFolder));
NS_ENSURE_SUCCESS(rv,rv);
nsresult rv = GetUnsentMessagesFolder(aIdentity,
getter_AddRefs(mMessageFolder));
NS_ENSURE_SUCCESS(rv, rv);
m_window = aWindow;
// ### fix me - if we need to reparse the folder, this will be asynchronous
nsCOMPtr<nsISimpleEnumerator> enumerator;
nsresult ret = mMessageFolder->GetMessages(m_window, getter_AddRefs(enumerator));
if (NS_FAILED(ret) || (!enumerator))
{
return NS_ERROR_FAILURE;
}
rv = mMessageFolder->GetMessages(m_window, getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(rv, rv);
// copy all the elements in the enumerator into our isupports array....
@ -702,6 +688,15 @@ nsMsgSendLater::SendUnsentMessages(nsIMsgIdentity *identity)
// now get an enumerator for our array
mMessagesToSend->Enumerate(getter_AddRefs(mEnumerator));
mSendingMessages = PR_TRUE;
// Notify the listeners that we are starting a send.
PRUint32 count;
rv = mMessagesToSend->Count(&count);
NS_ENSURE_SUCCESS(rv, rv);
NotifyListenersOnStartSending(count);
return StartNextMailFileSend();
}
@ -1101,21 +1096,6 @@ nsMsgSendLater::DeliverQueuedLine(char *line, PRInt32 length)
return NS_OK;
}
NS_IMETHODIMP
nsMsgSendLater::SetMsgWindow(nsIMsgWindow *aMsgWindow)
{
m_window = aMsgWindow;
return NS_OK;
}
NS_IMETHODIMP
nsMsgSendLater::GetMsgWindow(nsIMsgWindow **aMsgWindow)
{
NS_ENSURE_ARG(aMsgWindow);
*aMsgWindow = m_window;
NS_IF_ADDREF(*aMsgWindow);
return NS_OK;
}
NS_IMETHODIMP
nsMsgSendLater::AddListener(nsIMsgSendLaterListener *aListener)
{
@ -1131,6 +1111,14 @@ nsMsgSendLater::RemoveListener(nsIMsgSendLaterListener *aListener)
return mListenerArray.RemoveElement(aListener) ? NS_OK : NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP
nsMsgSendLater::GetSendingMessages(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mSendingMessages;
return NS_OK;
}
#define NOTIFY_LISTENERS(propertyfunc_, params_) \
PR_BEGIN_MACRO \
nsTObserverArray<nsCOMPtr<nsIMsgSendLaterListener> >::ForwardIterator iter(mListenerArray); \

Просмотреть файл

@ -40,7 +40,6 @@
#include "nsIMsgSendLater.h"
#include "nsIMsgIdentity.h"
#include "nsIEnumerator.h"
#include "nsISupportsArray.h"
#include "nsIMsgFolder.h"
@ -154,6 +153,8 @@ private:
char *mLeftoverBuffer;
char *mIdentityKey;
char *mAccountKey;
PRBool mSendingMessages;
};

Просмотреть файл

@ -23,24 +23,36 @@ var testFile = do_get_file("../mailnews/compose/test/unit/data/429891_testcase.e
const kSender = "from@invalid.com";
const kTo = "invalid@invalid.com";
var msgSendLater = Cc["@mozilla.org/messengercompose/sendlater;1"]
.getService(Ci.nsIMsgSendLater);
// This listener handles the post-sending of the actual message and checks the
// sequence and ensures the data is correct.
function msll() {
}
msll.prototype = {
_initialTotal: 0,
// nsIMsgSendLaterListener
OnStartSending: function (aTotal) {
onStartSending: function (aTotal) {
this._initialTotal = 1;
do_check_eq(msgSendLater.sendingMessages, true);
},
OnProgress: function (aCurrentMessage, aTotal) {
onProgress: function (aCurrentMessage, aTotal) {
// XXX Enable this function
},
OnStatus: function (aMsg) {
onStatus: function (aMsg) {
// XXX Do we really need this?
},
OnStopSending: function (aStatus, aMsg, aTotal, aSuccessful) {
onStopSending: function (aStatus, aMsg, aTotal, aSuccessful) {
do_test_finished();
print("msll onStopSending\n");
try {
do_check_eq(aStatus, 0);
do_check_eq(aTotal, 1);
do_check_eq(this._initialTotal, 1);
do_check_eq(msgSendLater.sendingMessages, false);
do_check_transaction(transaction,
["EHLO test",
@ -101,8 +113,8 @@ copyListener.prototype = {
try {
do_check_eq(aStatus, 0);
var msgSendLater = Cc["@mozilla.org/messengercompose/sendlater;1"]
.createInstance(Ci.nsIMsgSendLater);
// Check this is false before we start sending
do_check_eq(msgSendLater.sendingMessages, false);
let folder = msgSendLater.getUnsentMessagesFolder(identity);
@ -167,15 +179,12 @@ function sendMessageLater()
// what the server receives and what we output.
test = "sendMessageLater";
var msgSendLater = Cc["@mozilla.org/messengercompose/sendlater;1"]
.createInstance(Ci.nsIMsgSendLater);
var messageListener = new msll();
msgSendLater.AddListener(messageListener);
msgSendLater.addListener(messageListener);
// Send the unsent message
msgSendLater.SendUnsentMessages(identity);
msgSendLater.sendUnsentMessages(identity);
server.performTest();