mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 08:13:35 +00:00
convert some interfaces to use nsisupports proxy
This commit is contained in:
parent
c5c386675e
commit
d23f6bff06
@ -38,10 +38,6 @@ public:
|
||||
return iid;
|
||||
}
|
||||
|
||||
// Tell mail master about a discovered imap mailbox
|
||||
NS_IMETHOD PossibleImapMailbox(nsIImapProtocol* aProtocol,
|
||||
mailbox_spec* aSpec) = 0;
|
||||
NS_IMETHOD MailboxDiscoveryDone(nsIImapProtocol* aProtocol) = 0;
|
||||
// Tell mail master about the newly selected mailbox
|
||||
NS_IMETHOD UpdateImapMailboxInfo(nsIImapProtocol* aProtocol,
|
||||
mailbox_spec* aSpec) = 0;
|
||||
|
@ -64,10 +64,6 @@ public:
|
||||
uid_validity_info* aInfo) = 0;
|
||||
NS_IMETHOD LiteSelectUIDValidity(nsIImapProtocol* aProtocol,
|
||||
PRUint32 uidValidity) = 0;
|
||||
NS_IMETHOD FEAlert(nsIImapProtocol* aProtocol,
|
||||
const PRUnichar* aString) = 0;
|
||||
NS_IMETHOD FEAlertFromServer(nsIImapProtocol* aProtocol,
|
||||
const char* aString) = 0;
|
||||
NS_IMETHOD ProgressStatus(nsIImapProtocol* aProtocol, PRUint32 aMsgId, const char *extraInfo) = 0;
|
||||
NS_IMETHOD PercentProgress(nsIImapProtocol* aProtocol,
|
||||
ProgressInfo* aInfo) = 0;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "nsIImapMessageSink.h"
|
||||
#include "nsIImapExtensionSink.h"
|
||||
#include "nsIImapMiscellaneousSink.h"
|
||||
#include "nsIImapServerSink.h"
|
||||
|
||||
/* 21A89610-DC0D-11d2-806C-006008128C4E */
|
||||
|
||||
@ -140,7 +141,9 @@ public:
|
||||
|
||||
NS_IMETHOD GetImapMiscellaneousSink(nsIImapMiscellaneousSink** aImapMiscellaneousSink) = 0;
|
||||
NS_IMETHOD SetImapMiscellaneousSink(nsIImapMiscellaneousSink* aImapMiscellaneousSink) = 0;
|
||||
|
||||
|
||||
NS_IMETHOD SetImapServerSink(nsIImapServerSink *aImapServerSink) = 0;
|
||||
NS_IMETHOD GetImapServerSink(nsIImapServerSink **aImapServerSink) = 0;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Getters and Setters for the imap url state
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1200,155 +1200,6 @@ NS_IMETHODIMP nsImapMailFolder::GetNewMessages()
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::PossibleImapMailbox(
|
||||
nsIImapProtocol* aProtocol, mailbox_spec* aSpec)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool found = PR_FALSE;
|
||||
nsCOMPtr<nsIMsgImapMailFolder> hostFolder;
|
||||
nsCOMPtr<nsIMsgFolder> aFolder;
|
||||
nsCOMPtr<nsISupports> aItem;
|
||||
nsCOMPtr<nsIEnumerator> aEnumerator;
|
||||
|
||||
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsAutoString folderName = aSpec->allocatedPathName;
|
||||
nsCAutoString uri;
|
||||
uri.Append(kImapRootURI);
|
||||
uri.Append('/');
|
||||
|
||||
char *username;
|
||||
GetUsername(&username);
|
||||
uri.Append(username);
|
||||
uri.Append('@');
|
||||
uri.Append(aSpec->hostName);
|
||||
|
||||
#if 0
|
||||
PRInt32 leafPos = folderName.RFindChar('/');
|
||||
if (leafPos > 0)
|
||||
{
|
||||
uri.Append('/');
|
||||
nsAutoString parentName(folderName);
|
||||
parentName.Truncate(leafPos);
|
||||
uri.Append(parentName);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(uri, getter_AddRefs(res));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
// OK, this is purely temporary - we either need getParent, or
|
||||
// AddSubFolder should be an nsIMsgFolder interface...
|
||||
hostFolder = do_QueryInterface(res, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> a_nsIFolder(do_QueryInterface(hostFolder, &rv));
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> child;
|
||||
|
||||
// nsCString possibleName(aSpec->allocatedPathName);
|
||||
|
||||
uri.Append('/');
|
||||
uri.Append(aSpec->allocatedPathName);
|
||||
a_nsIFolder->GetChildWithURI(uri, PR_TRUE, getter_AddRefs(child));
|
||||
|
||||
if (child)
|
||||
found = PR_TRUE;
|
||||
if (!found)
|
||||
{
|
||||
hostFolder->CreateClientSubfolderInfo(aSpec->allocatedPathName);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::MailboxDiscoveryDone(
|
||||
nsIImapProtocol* aProtocol)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
m_haveDiscoveredAllFolders = PR_TRUE;
|
||||
#if 0
|
||||
if (currentContext->imapURLPane && (currentContext->imapURLPane->GetPaneType() == MSG_SUBSCRIBEPANE))
|
||||
{
|
||||
// Finished discovering folders for the subscribe pane.
|
||||
((MSG_SubscribePane *)(currentContext->imapURLPane))->ReportIMAPFolderDiscoveryFinished();
|
||||
}
|
||||
else
|
||||
{
|
||||
// only do this if we're discovering folders for real (i.e. not subscribe UI)
|
||||
|
||||
|
||||
if (URL_s && URL_s->msg_pane && !URL_s->msg_pane->GetPreImapFolderVerifyUrlExitFunction())
|
||||
{
|
||||
URL_s->msg_pane->SetPreImapFolderVerifyUrlExitFunction(URL_s->pre_exit_fn);
|
||||
URL_s->pre_exit_fn = DeleteNonVerifiedExitFunction;
|
||||
}
|
||||
|
||||
XP_ASSERT(currentContext->imapURLPane);
|
||||
|
||||
// Go through folders and find if there are still any that are left unverified.
|
||||
// If so, manually LIST them to see if we can find out any info about them.
|
||||
char *hostName = NET_ParseURL(URL_s->address, GET_HOST_PART);
|
||||
if (hostName && currentContext->mailMaster && currentContext->imapURLPane)
|
||||
{
|
||||
MSG_FolderInfoContainer *hostContainerInfo = currentContext->mailMaster->GetImapMailFolderTreeForHost(hostName);
|
||||
MSG_IMAPFolderInfoContainer *hostInfo = hostContainerInfo ? hostContainerInfo->GetIMAPFolderInfoContainer() : (MSG_IMAPFolderInfoContainer *)NULL;
|
||||
if (hostInfo)
|
||||
{
|
||||
// for each folder
|
||||
|
||||
int32 numberOfUnverifiedFolders = hostInfo->GetUnverifiedFolders(NULL, 0);
|
||||
if (numberOfUnverifiedFolders > 0)
|
||||
{
|
||||
MSG_IMAPFolderInfoMail **folderList = (MSG_IMAPFolderInfoMail **)XP_ALLOC(sizeof(MSG_IMAPFolderInfoMail*) * numberOfUnverifiedFolders);
|
||||
if (folderList)
|
||||
{
|
||||
int32 numUsed = hostInfo->GetUnverifiedFolders(folderList, numberOfUnverifiedFolders);
|
||||
for (int32 k = 0; k < numUsed; k++)
|
||||
{
|
||||
MSG_IMAPFolderInfoMail *currentFolder = folderList[k];
|
||||
if (currentFolder->GetExplicitlyVerify() ||
|
||||
((currentFolder->GetNumSubFolders() > 0) && !NoDescendantsAreVerified(currentFolder)))
|
||||
{
|
||||
// If there are no subfolders and this is unverified, we don't want to run
|
||||
// this url. That is, we want to undiscover the folder.
|
||||
// If there are subfolders and no descendants are verified, we want to
|
||||
// undiscover all of the folders.
|
||||
// Only if there are subfolders and at least one of them is verified do we want
|
||||
// to refresh that folder's flags, because it won't be going away.
|
||||
currentFolder->SetExplicitlyVerify(FALSE);
|
||||
char *url = CreateIMAPListFolderURL(hostName, currentFolder->GetOnlineName(), currentFolder->GetOnlineHierarchySeparator());
|
||||
if (url)
|
||||
{
|
||||
MSG_UrlQueue::AddUrlToPane(url, NULL, currentContext->imapURLPane);
|
||||
XP_FREE(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
XP_FREE(folderList);
|
||||
}
|
||||
}
|
||||
}
|
||||
XP_FREE(hostName);
|
||||
}
|
||||
else
|
||||
{
|
||||
XP_ASSERT(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxInfo(
|
||||
nsIImapProtocol* aProtocol, mailbox_spec* aSpec)
|
||||
{
|
||||
@ -3096,50 +2947,6 @@ nsImapMailFolder::LiteSelectUIDValidity(nsIImapProtocol* aProtocol,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::FEAlert(nsIImapProtocol* aProtocol,
|
||||
const PRUnichar* aString)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
|
||||
|
||||
rv = dialog->Alert(nsAutoString(aString).GetUnicode());
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::FEAlertFromServer(nsIImapProtocol* aProtocol,
|
||||
const char* aString)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
|
||||
|
||||
const char *serverSaid = aString;
|
||||
if (serverSaid)
|
||||
{
|
||||
// skip over the first two words, I guess.
|
||||
char *whereRealMessage = PL_strchr(serverSaid, ' ');
|
||||
if (whereRealMessage)
|
||||
whereRealMessage++;
|
||||
if (whereRealMessage)
|
||||
whereRealMessage = PL_strchr(whereRealMessage, ' ');
|
||||
if (whereRealMessage)
|
||||
whereRealMessage++;
|
||||
|
||||
PRUnichar *serverSaidPrefix = IMAPGetStringByID(IMAP_SERVER_SAID);
|
||||
if (serverSaidPrefix)
|
||||
{
|
||||
nsAutoString message(serverSaidPrefix);
|
||||
message += whereRealMessage ? whereRealMessage : serverSaid;
|
||||
rv = dialog->Alert(message.GetUnicode());
|
||||
|
||||
PR_Free(serverSaidPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::ProgressStatus(nsIImapProtocol* aProtocol,
|
||||
PRUint32 aMsgId, const char *extraInfo)
|
||||
|
@ -164,10 +164,6 @@ public:
|
||||
NS_DECL_NSIMSGIMAPMAILFOLDER
|
||||
|
||||
// nsIImapMailFolderSink methods
|
||||
// Tell mail master about a discovered imap mailbox
|
||||
NS_IMETHOD PossibleImapMailbox(nsIImapProtocol* aProtocol,
|
||||
mailbox_spec* aSpec);
|
||||
NS_IMETHOD MailboxDiscoveryDone(nsIImapProtocol* aProtocol);
|
||||
// Tell mail master about the newly selected mailbox
|
||||
NS_IMETHOD UpdateImapMailboxInfo(nsIImapProtocol* aProtocol,
|
||||
mailbox_spec* aSpec);
|
||||
@ -284,10 +280,6 @@ public:
|
||||
uid_validity_info* aInfo);
|
||||
NS_IMETHOD LiteSelectUIDValidity(nsIImapProtocol* aProtocol,
|
||||
PRUint32 uidValidity);
|
||||
NS_IMETHOD FEAlert(nsIImapProtocol* aProtocol,
|
||||
const PRUnichar* aString);
|
||||
NS_IMETHOD FEAlertFromServer(nsIImapProtocol* aProtocol,
|
||||
const char* aString);
|
||||
NS_IMETHOD ProgressStatus(nsIImapProtocol* aProtocol,
|
||||
PRUint32 aMsgId, const char *extraInfo);
|
||||
NS_IMETHOD PercentProgress(nsIImapProtocol* aProtocol,
|
||||
|
@ -53,6 +53,10 @@ PRLogModuleInfo *IMAP;
|
||||
#include "nsIImapIncomingServer.h"
|
||||
#include "nsIPref.h"
|
||||
|
||||
#include "nsProxyObjectManager.h"
|
||||
|
||||
|
||||
|
||||
// for temp message hack
|
||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
||||
#define MESSAGE_PATH "/tmp/tempMessage.eml"
|
||||
@ -74,6 +78,7 @@ static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
static NS_DEFINE_CID(kCImapService, NS_IMAPSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
|
||||
|
||||
#define OUTPUT_BUFFER_SIZE (4096*2) // mscott - i should be able to remove this if I can use nsMsgLineBuffer???
|
||||
|
||||
@ -439,6 +444,36 @@ nsImapProtocol::SetupSinkProxy()
|
||||
m_imapMiscellaneousSink = do_QueryInterface(miscSink);
|
||||
}
|
||||
}
|
||||
if (!m_imapServerSink)
|
||||
{
|
||||
nsCOMPtr<nsIImapServerSink> aImapServerSink;
|
||||
res = m_runningUrl->GetImapServerSink(getter_AddRefs(aImapServerSink));
|
||||
if (NS_SUCCEEDED(res) && aImapServerSink)
|
||||
{
|
||||
NS_WITH_SERVICE( nsIProxyObjectManager, proxyManager, kProxyObjectManagerCID, &res);
|
||||
|
||||
if (NS_FAILED(res))
|
||||
return;
|
||||
|
||||
res = proxyManager->GetProxyObject( m_sinkEventQueue,
|
||||
nsCOMTypeInfo<nsIImapServerSink>::GetIID(),
|
||||
aImapServerSink,
|
||||
PROXY_SYNC | PROXY_ALWAYS,
|
||||
getter_AddRefs(m_imapServerSink));
|
||||
// nsImapMiscellaneousSinkProxy * miscSink = new
|
||||
// nsImapMiscellaneousSinkProxy(aImapMiscellaneousSink,
|
||||
// this,
|
||||
// m_sinkEventQueue,
|
||||
// m_thread);
|
||||
// m_imapServerSink = do_QueryInterface(miscSink);
|
||||
// GetProxyObject(nsIEventQueue *destQueue,
|
||||
// REFNSIID aIID,
|
||||
// nsISupports* aObj,
|
||||
// ProxyType proxyType,
|
||||
// void** aProxyObject) = 0;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3580,11 +3615,10 @@ nsImapProtocol::DiscoverMailboxSpec(mailbox_spec * adoptedBoxSpec)
|
||||
|
||||
boxNameCopy = adoptedBoxSpec->allocatedPathName;
|
||||
|
||||
if (m_imapMailFolderSink)
|
||||
if (m_imapServerSink)
|
||||
{
|
||||
m_imapMailFolderSink->PossibleImapMailbox(this,
|
||||
adoptedBoxSpec);
|
||||
WaitForFEEventCompletion();
|
||||
m_imapServerSink->PossibleImapMailbox(boxNameCopy);
|
||||
// WaitForFEEventCompletion();
|
||||
|
||||
PRBool useSubscription = PR_FALSE;
|
||||
|
||||
@ -3673,29 +3707,29 @@ nsImapProtocol::DiscoverMailboxSpec(mailbox_spec * adoptedBoxSpec)
|
||||
void
|
||||
nsImapProtocol::AlertUserEventUsingId(PRUint32 aMessageId)
|
||||
{
|
||||
if (m_imapMiscellaneousSink)
|
||||
if (m_imapServerSink)
|
||||
{
|
||||
PRUnichar *progressString = IMAPGetStringByID(aMessageId);
|
||||
|
||||
m_imapMiscellaneousSink->FEAlert(this, progressString);
|
||||
m_imapServerSink->FEAlert(progressString);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsImapProtocol::AlertUserEvent(const char * message)
|
||||
{
|
||||
if (m_imapMiscellaneousSink)
|
||||
if (m_imapServerSink)
|
||||
{
|
||||
nsAutoString uniString(message);
|
||||
m_imapMiscellaneousSink->FEAlert(this, uniString.GetUnicode());
|
||||
m_imapServerSink->FEAlert(uniString.GetUnicode());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsImapProtocol::AlertUserEventFromServer(const char * aServerEvent)
|
||||
{
|
||||
if (m_imapMiscellaneousSink)
|
||||
m_imapMiscellaneousSink->FEAlertFromServer(this, aServerEvent);
|
||||
if (m_imapServerSink)
|
||||
m_imapServerSink->FEAlertFromServer(aServerEvent);
|
||||
}
|
||||
|
||||
void
|
||||
@ -5255,7 +5289,7 @@ void nsImapProtocol::MailboxDiscoveryFinished()
|
||||
m_hostSessionList->SetHaveWeEverDiscoveredFoldersForHost(GetImapHostName(), GetImapUserName(), PR_TRUE);
|
||||
|
||||
// notify front end that folder discovery is complete....
|
||||
m_imapMailFolderSink->MailboxDiscoveryDone(this);
|
||||
m_imapServerSink->DiscoveryDone();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,6 +321,7 @@ private:
|
||||
|
||||
nsCOMPtr<nsIImapExtensionSink> m_imapExtensionSink;
|
||||
nsCOMPtr<nsIImapMiscellaneousSink> m_imapMiscellaneousSink;
|
||||
nsCOMPtr<nsIImapServerSink> m_imapServerSink;
|
||||
// helper function to setup imap sink interface proxies
|
||||
void SetupSinkProxy();
|
||||
// End thread support stuff
|
||||
|
@ -195,59 +195,6 @@ nsImapMailFolderSinkProxy::~nsImapMailFolderSinkProxy()
|
||||
static NS_DEFINE_IID(kIImapMailFolderSinkIID, NS_IIMAPMAILFOLDERSINK_IID);
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS(nsImapMailFolderSinkProxy, kIImapMailFolderSinkIID);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolderSinkProxy::PossibleImapMailbox(nsIImapProtocol* aProtocol,
|
||||
mailbox_spec* aSpec)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_PRECONDITION (aSpec, "Oops... null mailbox_spec");
|
||||
if(!aSpec)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION (m_protocol == aProtocol, "Ooh ooh, wrong protocol");
|
||||
|
||||
if (PR_GetCurrentThread() == m_thread)
|
||||
{
|
||||
PossibleImapMailboxProxyEvent *ev =
|
||||
new PossibleImapMailboxProxyEvent(this, aSpec);
|
||||
if(nsnull == ev)
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
{
|
||||
ev->SetNotifyCompletion(PR_TRUE);
|
||||
ev->PostEvent(m_eventQueue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res = m_realImapMailFolderSink->PossibleImapMailbox(aProtocol,
|
||||
aSpec);
|
||||
aProtocol->NotifyFEEventCompletion();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolderSinkProxy::MailboxDiscoveryDone(nsIImapProtocol* aProtocol)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_ASSERTION (m_protocol == aProtocol, "Ooh ooh, wrong protocol");
|
||||
|
||||
if (PR_GetCurrentThread() == m_thread)
|
||||
{
|
||||
MailboxDiscoveryDoneProxyEvent *ev =
|
||||
new MailboxDiscoveryDoneProxyEvent(this);
|
||||
if(nsnull == ev)
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
ev->PostEvent(m_eventQueue);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = m_realImapMailFolderSink->MailboxDiscoveryDone(aProtocol);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolderSinkProxy::UpdateImapMailboxInfo(nsIImapProtocol* aProtocol,
|
||||
mailbox_spec* aSpec)
|
||||
@ -1547,58 +1494,6 @@ nsImapMiscellaneousSinkProxy::LiteSelectUIDValidity(nsIImapProtocol* aProtocol,
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMiscellaneousSinkProxy::FEAlert(nsIImapProtocol* aProtocol,
|
||||
const PRUnichar* aString)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_PRECONDITION (aString, "Oops... null aString");
|
||||
if(!aString)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION (m_protocol == aProtocol, "Ooh ooh, wrong protocol");
|
||||
|
||||
if (PR_GetCurrentThread() == m_thread)
|
||||
{
|
||||
FEAlertProxyEvent *ev =
|
||||
new FEAlertProxyEvent(this, aString);
|
||||
if(nsnull == ev)
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
ev->PostEvent(m_eventQueue);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = m_realImapMiscellaneousSink->FEAlert(aProtocol, aString);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMiscellaneousSinkProxy::FEAlertFromServer(nsIImapProtocol* aProtocol,
|
||||
const char* aString)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_PRECONDITION (aString, "Oops... null aString");
|
||||
if(!aString)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION (m_protocol == aProtocol, "Ooh ooh, wrong protocol");
|
||||
|
||||
if (PR_GetCurrentThread() == m_thread)
|
||||
{
|
||||
FEAlertFromServerProxyEvent *ev =
|
||||
new FEAlertFromServerProxyEvent(this, aString);
|
||||
if(nsnull == ev)
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
ev->PostEvent(m_eventQueue);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = m_realImapMiscellaneousSink->FEAlertFromServer(aProtocol, aString);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMiscellaneousSinkProxy::ProgressStatus(nsIImapProtocol* aProtocol,
|
||||
PRUint32 aMsgId, const char *extraInfo)
|
||||
@ -1882,81 +1777,11 @@ nsImapMailFolderSinkProxyEvent::~nsImapMailFolderSinkProxyEvent()
|
||||
NS_IF_RELEASE (m_proxy);
|
||||
}
|
||||
|
||||
PossibleImapMailboxProxyEvent::PossibleImapMailboxProxyEvent(
|
||||
nsImapMailFolderSinkProxy* aProxy, mailbox_spec* aSpec) :
|
||||
nsImapMailFolderSinkProxyEvent(aProxy)
|
||||
{
|
||||
NS_ASSERTION (aSpec, "PossibleImapMailboxProxyEvent: null aSpec");
|
||||
if (aSpec)
|
||||
{
|
||||
m_mailboxSpec = *aSpec;
|
||||
if (aSpec->allocatedPathName)
|
||||
m_mailboxSpec.allocatedPathName =
|
||||
PL_strdup(aSpec->allocatedPathName);
|
||||
#if 0 // mscott - we appear to be creating a new name space on top of the existing one..
|
||||
// i don't really understand what is going on here. but aSpec is pointing to the same
|
||||
// object as m_mailboxSpec. so m_mailboxSpec.namespacesforfolder =new (aspec->namespacesforfolder)
|
||||
// isn't going to fly...
|
||||
if (aSpec->namespaceForFolder)
|
||||
m_mailboxSpec.namespaceForFolder =
|
||||
new nsIMAPNamespace(aSpec->namespaceForFolder->GetType(),
|
||||
aSpec->namespaceForFolder->GetPrefix(),
|
||||
aSpec->namespaceForFolder->GetDelimiter(),
|
||||
aSpec->namespaceForFolder->GetIsNamespaceFromPrefs());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&m_mailboxSpec, 0, sizeof(mailbox_spec));
|
||||
}
|
||||
}
|
||||
|
||||
PossibleImapMailboxProxyEvent::~PossibleImapMailboxProxyEvent()
|
||||
{
|
||||
if (m_mailboxSpec.allocatedPathName)
|
||||
PL_strfree(m_mailboxSpec.allocatedPathName);
|
||||
// mscott - again, i didn't actually copy the namespace over see my comment in the function above...so we
|
||||
// shouldn't delete the name space as this is the original!
|
||||
// if (m_mailboxSpec.namespaceForFolder)
|
||||
// delete m_mailboxSpec.namespaceForFolder;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PossibleImapMailboxProxyEvent::HandleEvent()
|
||||
{
|
||||
nsresult res =
|
||||
m_proxy->m_realImapMailFolderSink->PossibleImapMailbox(
|
||||
m_proxy->m_protocol, &m_mailboxSpec);
|
||||
if (m_notifyCompletion)
|
||||
m_proxy->m_protocol->NotifyFEEventCompletion();
|
||||
return res;
|
||||
}
|
||||
|
||||
MailboxDiscoveryDoneProxyEvent::MailboxDiscoveryDoneProxyEvent(
|
||||
nsImapMailFolderSinkProxy* aProxy) :
|
||||
nsImapMailFolderSinkProxyEvent(aProxy)
|
||||
{
|
||||
}
|
||||
|
||||
MailboxDiscoveryDoneProxyEvent::~MailboxDiscoveryDoneProxyEvent()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MailboxDiscoveryDoneProxyEvent::HandleEvent()
|
||||
{
|
||||
nsresult res = m_proxy->m_realImapMailFolderSink->MailboxDiscoveryDone(
|
||||
m_proxy->m_protocol);
|
||||
if (m_notifyCompletion)
|
||||
m_proxy->m_protocol->NotifyFEEventCompletion();
|
||||
return res;
|
||||
}
|
||||
|
||||
UpdateImapMailboxInfoProxyEvent::UpdateImapMailboxInfoProxyEvent(
|
||||
nsImapMailFolderSinkProxy* aProxy, mailbox_spec* aSpec) :
|
||||
nsImapMailFolderSinkProxyEvent(aProxy)
|
||||
{
|
||||
NS_ASSERTION (aSpec, "PossibleImapMailboxProxyEvent: null aSpec");
|
||||
NS_ASSERTION (aSpec, "UpdateImapMailboxProxyEvent: null aSpec");
|
||||
if (aSpec)
|
||||
{
|
||||
m_mailboxSpec = *aSpec;
|
||||
@ -1998,7 +1823,7 @@ UpdateImapMailboxStatusProxyEvent::UpdateImapMailboxStatusProxyEvent(
|
||||
nsImapMailFolderSinkProxy* aProxy, mailbox_spec* aSpec) :
|
||||
nsImapMailFolderSinkProxyEvent(aProxy)
|
||||
{
|
||||
NS_ASSERTION (aSpec, "PossibleImapMailboxProxyEvent: null aSpec");
|
||||
NS_ASSERTION (aSpec, "UpdateImapMailboxProxyEvent: null aSpec");
|
||||
if (aSpec)
|
||||
{
|
||||
m_mailboxSpec = *aSpec;
|
||||
@ -3373,58 +3198,6 @@ LiteSelectUIDValidityProxyEvent::HandleEvent()
|
||||
return res;
|
||||
}
|
||||
|
||||
FEAlertProxyEvent::FEAlertProxyEvent(
|
||||
nsImapMiscellaneousSinkProxy* aProxy, const PRUnichar* alertString) :
|
||||
nsImapMiscellaneousSinkProxyEvent(aProxy)
|
||||
{
|
||||
NS_ASSERTION (alertString, "Oops... a null alertString");
|
||||
if (alertString)
|
||||
m_alertString = nsCRT::strdup(alertString);
|
||||
else
|
||||
m_alertString = nsnull;
|
||||
}
|
||||
|
||||
FEAlertProxyEvent::~FEAlertProxyEvent()
|
||||
{
|
||||
PR_FREEIF(m_alertString);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FEAlertProxyEvent::HandleEvent()
|
||||
{
|
||||
nsresult res = m_proxy->m_realImapMiscellaneousSink->FEAlert(
|
||||
m_proxy->m_protocol, m_alertString);
|
||||
if (m_notifyCompletion)
|
||||
m_proxy->m_protocol->NotifyFEEventCompletion();
|
||||
return res;
|
||||
}
|
||||
|
||||
FEAlertFromServerProxyEvent::FEAlertFromServerProxyEvent(
|
||||
nsImapMiscellaneousSinkProxy* aProxy, const char* alertString) :
|
||||
nsImapMiscellaneousSinkProxyEvent(aProxy)
|
||||
{
|
||||
NS_ASSERTION (alertString, "Oops... a null alertString");
|
||||
if (alertString)
|
||||
m_alertString = nsCRT::strdup(alertString);
|
||||
else
|
||||
m_alertString = nsnull;
|
||||
}
|
||||
|
||||
FEAlertFromServerProxyEvent::~FEAlertFromServerProxyEvent()
|
||||
{
|
||||
PR_FREEIF (m_alertString);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FEAlertFromServerProxyEvent::HandleEvent()
|
||||
{
|
||||
nsresult res = m_proxy->m_realImapMiscellaneousSink->FEAlertFromServer(
|
||||
m_proxy->m_protocol, m_alertString);
|
||||
if (m_notifyCompletion)
|
||||
m_proxy->m_protocol->NotifyFEEventCompletion();
|
||||
return res;
|
||||
}
|
||||
|
||||
ProgressStatusProxyEvent::ProgressStatusProxyEvent(
|
||||
nsImapMiscellaneousSinkProxy* aProxy, PRUint32 aMsgId, const char *extraInfo) :
|
||||
nsImapMiscellaneousSinkProxyEvent(aProxy)
|
||||
|
@ -72,10 +72,6 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// Tell mail master about a discovered imap mailbox
|
||||
NS_IMETHOD PossibleImapMailbox(nsIImapProtocol* aProtocol,
|
||||
mailbox_spec* aSpec);
|
||||
NS_IMETHOD MailboxDiscoveryDone(nsIImapProtocol* aProtocol);
|
||||
// Tell mail master about the newly selected mailbox
|
||||
NS_IMETHOD UpdateImapMailboxInfo(nsIImapProtocol* aProtocol,
|
||||
mailbox_spec* aSpec);
|
||||
@ -227,11 +223,7 @@ public:
|
||||
uid_validity_info* aInfo);
|
||||
NS_IMETHOD LiteSelectUIDValidity(nsIImapProtocol* aProtocol,
|
||||
PRUint32 uidValidity);
|
||||
NS_IMETHOD FEAlert(nsIImapProtocol* aProtocol,
|
||||
const PRUnichar* aString);
|
||||
NS_IMETHOD FEAlertFromServer(nsIImapProtocol* aProtocol,
|
||||
const char* aString);
|
||||
NS_IMETHOD ProgressStatus(nsIImapProtocol* aProtocol,
|
||||
NS_IMETHOD ProgressStatus(nsIImapProtocol* aProtocol,
|
||||
PRUint32 statusMsgId, const char *extraInfo);
|
||||
NS_IMETHOD PercentProgress(nsIImapProtocol* aProtocol,
|
||||
ProgressInfo* aInfo);
|
||||
@ -292,23 +284,6 @@ struct nsImapMailFolderSinkProxyEvent : public nsImapEvent
|
||||
nsImapMailFolderSinkProxy* m_proxy;
|
||||
};
|
||||
|
||||
struct PossibleImapMailboxProxyEvent : public nsImapMailFolderSinkProxyEvent
|
||||
{
|
||||
PossibleImapMailboxProxyEvent(nsImapMailFolderSinkProxy* aProxy,
|
||||
mailbox_spec* aSpec);
|
||||
virtual ~PossibleImapMailboxProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
|
||||
mailbox_spec m_mailboxSpec;
|
||||
};
|
||||
|
||||
struct MailboxDiscoveryDoneProxyEvent : public nsImapMailFolderSinkProxyEvent
|
||||
{
|
||||
MailboxDiscoveryDoneProxyEvent(nsImapMailFolderSinkProxy* aProxy);
|
||||
virtual ~MailboxDiscoveryDoneProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
};
|
||||
|
||||
struct UpdateImapMailboxInfoProxyEvent : public nsImapMailFolderSinkProxyEvent
|
||||
{
|
||||
UpdateImapMailboxInfoProxyEvent(nsImapMailFolderSinkProxy* aProxy,
|
||||
@ -735,23 +710,6 @@ struct LiteSelectUIDValidityProxyEvent : public nsImapMiscellaneousSinkProxyEven
|
||||
PRUint32 m_uidValidity;
|
||||
};
|
||||
|
||||
struct FEAlertProxyEvent : public nsImapMiscellaneousSinkProxyEvent
|
||||
{
|
||||
FEAlertProxyEvent(nsImapMiscellaneousSinkProxy* aProxy,
|
||||
const PRUnichar* aString);
|
||||
virtual ~FEAlertProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
PRUnichar* m_alertString;
|
||||
};
|
||||
|
||||
struct FEAlertFromServerProxyEvent : public nsImapMiscellaneousSinkProxyEvent
|
||||
{
|
||||
FEAlertFromServerProxyEvent(nsImapMiscellaneousSinkProxy* aProxy,
|
||||
const char* aString);
|
||||
virtual ~FEAlertFromServerProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
char* m_alertString;
|
||||
};
|
||||
|
||||
struct ProgressStatusProxyEvent : public nsImapMiscellaneousSinkProxyEvent
|
||||
{
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIMsgFolder.h"
|
||||
#include "nsIImapIncomingServer.h"
|
||||
#include "nsIImapServerSink.h"
|
||||
|
||||
#include "nsImapUtils.h"
|
||||
|
||||
@ -959,11 +960,20 @@ nsImapService::SetImapUrlSink(nsIMsgFolder* aMsgFolder,
|
||||
{
|
||||
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||
nsISupports* aInst = nsnull;
|
||||
nsCOMPtr <nsIMsgIncomingServer> incomingServer;
|
||||
nsCOMPtr <nsIImapServerSink> imapServerSink;
|
||||
|
||||
NS_ASSERTION (aMsgFolder && aImapUrl, "Oops ... null pointers");
|
||||
if (!aMsgFolder || !aImapUrl)
|
||||
return rv;
|
||||
|
||||
rv = aMsgFolder->GetServer(getter_AddRefs(incomingServer));
|
||||
if (NS_SUCCEEDED(rv) && incomingServer)
|
||||
{
|
||||
imapServerSink = do_QueryInterface(incomingServer);
|
||||
if (imapServerSink)
|
||||
aImapUrl->SetImapServerSink(imapServerSink);
|
||||
}
|
||||
rv = aMsgFolder->QueryInterface(nsIImapLog::GetIID(), (void**)&aInst);
|
||||
if (NS_SUCCEEDED(rv) && aInst)
|
||||
aImapUrl->SetImapLog((nsIImapLog*) aInst);
|
||||
|
@ -181,6 +181,27 @@ NS_IMETHODIMP nsImapUrl::SetImapMessageSink(nsIImapMessageSink * aImapMessageSi
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::GetImapServerSink(nsIImapServerSink ** aImapServerSink)
|
||||
{
|
||||
if (aImapServerSink)
|
||||
{
|
||||
*aImapServerSink = m_imapServerSink;
|
||||
NS_IF_ADDREF(*aImapServerSink);
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::SetImapServerSink(nsIImapServerSink * aImapServerSink)
|
||||
{
|
||||
m_imapServerSink = aImapServerSink;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::GetImapExtensionSink(nsIImapExtensionSink ** aImapExtensionSink)
|
||||
{
|
||||
if (aImapExtensionSink)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsMsgMailNewsUrl.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsIImapServerSink.h"
|
||||
|
||||
class nsImapUrl : public nsIImapUrl, public nsMsgMailNewsUrl, public nsIMsgUriUrl
|
||||
{
|
||||
@ -54,6 +55,9 @@ public:
|
||||
NS_IMETHOD GetImapMiscellaneousSink(nsIImapMiscellaneousSink** aImapMiscellaneousSink);
|
||||
NS_IMETHOD SetImapMiscellaneousSink(nsIImapMiscellaneousSink* aImapMiscellaneousSink);
|
||||
|
||||
NS_IMETHOD GetImapServerSink(nsIImapServerSink** aImapServerSink);
|
||||
NS_IMETHOD SetImapServerSink(nsIImapServerSink* aImapServerSink);
|
||||
|
||||
NS_IMPL_CLASS_GETSET(ImapAction, nsImapAction, m_imapAction);
|
||||
NS_IMETHOD GetRequiredImapState(nsImapState * aImapUrlState);
|
||||
|
||||
@ -138,7 +142,10 @@ protected:
|
||||
nsIImapMessageSink* m_imapMessageSink; // not ref counted
|
||||
nsIImapExtensionSink* m_imapExtensionSink; // not ref counted
|
||||
nsIImapMiscellaneousSink* m_imapMiscellaneousSink; // not ref counted
|
||||
|
||||
|
||||
// I AM using nsCOMPtr because I suspect the above problem has gone away.
|
||||
nsCOMPtr <nsIImapServerSink> m_imapServerSink;
|
||||
|
||||
// online message copy support; i don't have a better solution yet
|
||||
nsISupports* m_copyState; // ** not refcount'd
|
||||
nsIFileSpec* m_fileSpec;
|
||||
|
Loading…
Reference in New Issue
Block a user