This commit is contained in:
rhp%netscape.com 1999-07-22 21:35:58 +00:00
Родитель 9dcee4f2d2
Коммит 61ac19e993
2 изменённых файлов: 45 добавлений и 19 удалений

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

@ -118,12 +118,9 @@ nsMsgSendLater::nsMsgSendLater()
nsMsgSendLater::~nsMsgSendLater()
{
if (mEnumerator)
NS_RELEASE(mEnumerator);
if (mTempIFileSpec)
NS_RELEASE(mTempIFileSpec);
if (mSaveListener)
NS_RELEASE(mSaveListener);
NS_IF_RELEASE(mEnumerator);
NS_IF_RELEASE(mTempIFileSpec);
NS_IF_RELEASE(mSaveListener);
PR_FREEIF(m_to);
PR_FREEIF(m_fcc);
PR_FREEIF(m_bcc);
@ -289,7 +286,12 @@ SaveMessageCompleteCallback(nsIURI *aUrl, nsresult aExitCode, void *tagData)
// If the send operation failed..try the next one...
if (NS_FAILED(rv))
{
rv = ptr->StartNextMailFileSend();
if (NS_FAILED(rv))
ptr->NotifyListenersOnStopSending(rv, nsnull, ptr->mTotalSendCount,
ptr->mTotalSentSuccessfully);
}
NS_RELEASE(ptr);
}
@ -300,6 +302,9 @@ SaveMessageCompleteCallback(nsIURI *aUrl, nsresult aExitCode, void *tagData)
// Save failed, but we will still keep trying to send the rest...
rv = ptr->StartNextMailFileSend();
if (NS_FAILED(rv))
ptr->NotifyListenersOnStopSending(rv, nsnull, ptr->mTotalSendCount,
ptr->mTotalSentSuccessfully);
NS_RELEASE(ptr);
}
}
@ -382,7 +387,22 @@ SendOperationListener::OnStopSending(const char *aMsgID, nsresult aStatus, const
prefs->GetBoolPref("mail.really_delete_unsent_messages", &deleteMsgs);
if (deleteMsgs)
{
mSendLater->DeleteCurrentMessage();
//
// Since we are deleting entries from the enumeration set, we need to
// refresh the enumerator
//
NS_IF_RELEASE(mSendLater->mEnumerator);
mSendLater->mEnumerator = nsnull;
nsresult ret = mSendLater->mMessageFolder->GetMessages(&(mSendLater->mEnumerator));
if (NS_FAILED(ret) || (!(mSendLater->mEnumerator)))
mSendLater->mEnumerator = nsnull; // just to be sure!
// Do the first call next time through!
mSendLater->mFirstTime = PR_TRUE;
}
++(mSendLater->mTotalSentSuccessfully);
}
@ -394,6 +414,9 @@ SendOperationListener::OnStopSending(const char *aMsgID, nsresult aStatus, const
// Regardless, we will still keep trying to send the rest...
rv = mSendLater->StartNextMailFileSend();
if (NS_FAILED(rv))
mSendLater->NotifyListenersOnStopSending(rv, nsnull, mSendLater->mTotalSendCount,
mSendLater->mTotalSentSuccessfully);
NS_RELEASE(mSendLater);
}
@ -519,18 +542,22 @@ nsMsgSendLater::StartNextMailFileSend()
char *aMessageURI = nsnull;
//
// First, go to the next entry and check where we are in the
// Now, go to the next entry and check where we are in the
// enumerator!
//
if (mFirstTime)
{
mFirstTime = PR_FALSE;
mEnumerator->First();
if (mEnumerator)
mEnumerator->First();
}
else
mEnumerator->Next();
{
if (mEnumerator)
mEnumerator->Next();
}
if (mEnumerator->IsDone() == NS_OK)
if ( (!mEnumerator) || (mEnumerator->IsDone() == NS_OK) )
{
// Call any listeners on this operation and then exit cleanly
#ifdef NS_DEBUG

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

@ -102,10 +102,6 @@ public:
//
nsresult DriveFakeStream(nsIOutputStream *stream);
// counters
PRUint32 mTotalSentSuccessfully;
PRUint32 mTotalSendCount;
// methods for listener array processing...
NS_IMETHOD SetListenerArray(nsIMsgSendLaterListener **aListener);
NS_IMETHOD AddListener(nsIMsgSendLaterListener *aListener);
@ -117,6 +113,14 @@ public:
NS_IMETHOD NotifyListenersOnStopSending(nsresult aStatus, const PRUnichar *aMsg,
PRUint32 aTotalTried, PRUint32 aSuccessful);
// counters and things for enumeration
PRUint32 mTotalSentSuccessfully;
PRUint32 mTotalSendCount;
nsIEnumerator *mEnumerator;
nsIMsgIdentity *mIdentity;
nsCOMPtr<nsIMsgFolder> mMessageFolder;
PRBool mFirstTime;
// Private Information
private:
nsIMsgSendLaterListener **mListenerArray;
@ -125,8 +129,6 @@ private:
nsMsgSendUnsentMessagesCallback mCompleteCallback;
SendOperationListener *mSendListener;
nsIMsgIdentity *mIdentity;
nsCOMPtr<nsIMsgFolder> mMessageFolder;
nsCOMPtr<nsIMessage> mMessage;
// RICHIE
@ -142,9 +144,6 @@ private:
nsIFileSpec *mTempIFileSpec;
nsOutputFileStream *mOutFile;
nsIEnumerator *mEnumerator;
PRBool mFirstTime;
void *mTagData;
nsMsgDeliveryListener *mSaveListener;