follow on work for 209545, get rid of hand-rolled imap proxying code, get rid of more unused code and bogus call to WaitForFEEventCompletion, sr=sspitzer

This commit is contained in:
bienvenu%nventure.com 2005-01-12 16:46:12 +00:00
parent 741f86c939
commit e7a37c276e
3 changed files with 16 additions and 38 deletions

View File

@ -49,7 +49,7 @@ interface nsIMsgFolder;
interface nsIImapHostSessionList;
interface nsIMsgWindow;
[scriptable, uuid(132231ca-c796-11d3-b9f5-00108335942a)]
[scriptable, uuid(0f660d51-e3f1-4f80-86b5-66fa31732f2b)]
interface nsIImapProtocol : nsISupports {
/////////////////////////////////////////////////////////////////////////
/* LoadUrl should really be pushed into a generic protocol interface
@ -81,8 +81,6 @@ interface nsIImapProtocol : nsISupports {
void Initialize(in nsIImapHostSessionList aHostSessionList, in nsIImapIncomingServer aServer,
in nsIEventQueue aSinkEventQueue) ;
void NotifyFEEventCompletion();
void NotifyHdrsToDownload(out unsigned long keys, in unsigned long keyCount);
void NotifyBodysToDownload(out unsigned long keys, in unsigned long count);
// methods to get data from the imap parser flag state.

View File

@ -355,7 +355,6 @@ nsImapProtocol::nsImapProtocol() : nsMsgProtocol(nsnull),
m_retryUrlOnError = PR_FALSE;
m_useIdle = PR_TRUE; // by default, use it
m_ignoreExpunges = PR_FALSE;
m_gotFEEventCompletion = PR_FALSE;
m_useSecAuth = PR_FALSE;
m_connectionStatus = 0;
m_hostSessionList = nsnull;
@ -384,7 +383,6 @@ nsImapProtocol::nsImapProtocol() : nsMsgProtocol(nsnull),
m_pseudoInterruptMonitor = nsnull;
m_dataMemberMonitor = nsnull;
m_threadDeathMonitor = nsnull;
m_eventCompletionMonitor = nsnull;
m_waitForBodyIdsMonitor = nsnull;
m_fetchMsgListMonitor = nsnull;
m_fetchBodyListMonitor = nsnull;
@ -503,7 +501,6 @@ nsresult nsImapProtocol::Initialize(nsIImapHostSessionList * aHostSessionList, n
m_pseudoInterruptMonitor = PR_NewMonitor();
m_dataMemberMonitor = PR_NewMonitor();
m_threadDeathMonitor = PR_NewMonitor();
m_eventCompletionMonitor = PR_NewMonitor();
m_waitForBodyIdsMonitor = PR_NewMonitor();
m_fetchMsgListMonitor = PR_NewMonitor();
m_fetchBodyListMonitor = PR_NewMonitor();
@ -560,11 +557,6 @@ nsImapProtocol::~nsImapProtocol()
PR_DestroyMonitor(m_threadDeathMonitor);
m_threadDeathMonitor = nsnull;
}
if (m_eventCompletionMonitor)
{
PR_DestroyMonitor(m_eventCompletionMonitor);
m_eventCompletionMonitor = nsnull;
}
if (m_waitForBodyIdsMonitor)
{
PR_DestroyMonitor(m_waitForBodyIdsMonitor);
@ -987,24 +979,16 @@ NS_IMETHODIMP nsImapProtocol::OnInputStreamReady(nsIAsyncInputStream *inStr)
return NS_OK;
}
NS_IMETHODIMP
nsImapProtocol::NotifyFEEventCompletion()
void nsImapProtocol::SetResponseTimer(PRUint32 seconds)
{
PR_EnterMonitor(m_eventCompletionMonitor);
PR_Notify(m_eventCompletionMonitor);
m_gotFEEventCompletion = PR_TRUE;
PR_ExitMonitor(m_eventCompletionMonitor);
return NS_OK;
}
void
nsImapProtocol::WaitForFEEventCompletion()
void nsImapProtocol::CancelResponseTimer()
{
}
/* static */ void nsImapProtocol::OnResponseTimeout(nsITimer *timer, void *aImapProtocol)
{
PR_EnterMonitor(m_eventCompletionMonitor);
if (!m_gotFEEventCompletion)
PR_Wait(m_eventCompletionMonitor, PR_INTERVAL_NO_TIMEOUT);
m_gotFEEventCompletion = PR_FALSE;
PR_ExitMonitor(m_eventCompletionMonitor);
}
NS_IMETHODIMP
@ -1054,11 +1038,6 @@ nsImapProtocol::TellThreadToDie(PRBool isSafeToClose)
m_threadShouldDie = PR_TRUE;
PR_ExitMonitor(m_threadDeathMonitor);
PR_EnterMonitor(m_eventCompletionMonitor);
PR_NotifyAll(m_eventCompletionMonitor);
PR_ExitMonitor(m_eventCompletionMonitor);
PR_EnterMonitor(m_dataAvailableMonitor);
PR_Notify(m_dataAvailableMonitor);
PR_ExitMonitor(m_dataAvailableMonitor);
@ -5208,10 +5187,8 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
{
nsMsgKey newKey = GetServerStateParser().CurrentResponseUID();
if (m_imapMailFolderSink)
{
m_imapMailFolderSink->SetAppendMsgUid(newKey, m_runningUrl);
WaitForFEEventCompletion();
}
nsXPIDLCString oldMsgId;
rv = m_runningUrl->CreateListOfMessageIdsString(getter_Copies(oldMsgId));
if (NS_SUCCEEDED(rv) && !oldMsgId.IsEmpty())

View File

@ -86,6 +86,7 @@
#include "nsIImapHeaderXferInfo.h"
#include "nsMsgLineBuffer.h"
#include "nsIAsyncInputStream.h"
#include "nsITimer.h"
class nsIMAPMessagePartIDArray;
class nsIMsgIncomingServer;
@ -173,8 +174,6 @@ public:
NS_IMETHOD CanHandleUrl(nsIImapUrl * aImapUrl, PRBool * aCanRunUrl,
PRBool * hasToWait);
NS_IMETHOD Initialize(nsIImapHostSessionList * aHostSessionList, nsIImapIncomingServer *aServer, nsIEventQueue * aSinkEventQueue);
// Notify FE Event has been completed
NS_IMETHOD NotifyFEEventCompletion();
NS_IMETHOD GetRunningImapURL(nsIImapUrl **aImapUrl);
////////////////////////////////////////////////////////////////////////////////////////
@ -351,7 +350,6 @@ public:
void RefreshFolderACLView(const char *mailboxName, nsIMAPNamespace *nsForMailbox);
nsresult SetFolderAdminUrl(const char *mailboxName);
void WaitForFEEventCompletion();
void HandleMemoryFailure();
void HandleCurrentUrlError();
@ -365,7 +363,6 @@ private:
// the following flag is used to determine when a url is currently being run. It is cleared when we
// finish processng a url and it is set whenever we call Load on a url
PRBool m_urlInProgress;
PRBool m_gotFEEventCompletion;
nsCOMPtr<nsIImapUrl> m_runningUrl; // the nsIImapURL that is currently running
nsImapAction m_imapAction; // current imap action associated with this connnection...
@ -397,7 +394,6 @@ private:
PRMonitor *m_pseudoInterruptMonitor;
PRMonitor *m_dataMemberMonitor;
PRMonitor *m_threadDeathMonitor;
PRMonitor *m_eventCompletionMonitor;
PRMonitor *m_waitForBodyIdsMonitor;
PRMonitor *m_fetchMsgListMonitor;
PRMonitor *m_fetchBodyListMonitor;
@ -597,6 +593,13 @@ private:
nsIImapHostSessionList * m_hostSessionList;
// Response timer to drop hung connections
nsCOMPtr<nsITimer> m_responseTimer;
void SetResponseTimer(PRUint32 seconds);
void CancelResponseTimer();
static void OnResponseTimeout(nsITimer *timer, void *aImapProtocol);
PRBool m_fromHeaderSeen;
// these settings allow clients to override various pieces of the connection info from the url