mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
one more parameter for SetCopyResponseUid
This commit is contained in:
parent
aa288fc1b6
commit
c255345a3d
@ -57,7 +57,8 @@ public:
|
||||
FolderQueryInfo* aInfo) = 0;
|
||||
NS_IMETHOD SetCopyResponseUid(nsIImapProtocol* aProtocol,
|
||||
nsMsgKeyArray* keyArray,
|
||||
const char *msgIdString) = 0;
|
||||
const char *msgIdString,
|
||||
void* copyState) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -140,7 +140,8 @@ public:
|
||||
PRBool idsAreUids,
|
||||
PRBool isMove,
|
||||
nsIUrlListener* aUrlListener,
|
||||
nsIURI** aURL) = 0;
|
||||
nsIURI** aURL,
|
||||
void* copyState) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -170,6 +170,9 @@ public:
|
||||
NS_IMETHOD SetAllowContentChange(PRBool allowContentChange) = 0;
|
||||
NS_IMETHOD GetAllowContentChange(PRBool *results) = 0;
|
||||
|
||||
NS_IMETHOD SetCopyState(void* copyState) = 0;
|
||||
NS_IMETHOD GetCopyState(void** copyState) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIImapUrl_h___ */
|
||||
|
@ -978,39 +978,44 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsISupportsArray *messages,
|
||||
}
|
||||
if(NS_SUCCEEDED(rv) && trashFolder)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> srcFolder;
|
||||
nsCOMPtr<nsISupports>srcSupport;
|
||||
PRUint32 count = 0;
|
||||
rv = messages->Count(&count);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");
|
||||
|
||||
rv = QueryInterface(nsIMsgFolder::GetIID(),
|
||||
getter_AddRefs(srcFolder));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
srcSupport = do_QueryInterface(srcFolder, &rv);
|
||||
|
||||
nsString2 messageIds("", eOneByte);
|
||||
nsMsgKeyArray srcKeyArray;
|
||||
rv = BuildIdsAndKeyArray(messages, messageIds, srcKeyArray);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = InitCopyState(srcSupport, messages, PR_TRUE);
|
||||
NS_WITH_SERVICE(nsIImapService, imapService, kCImapService, &rv);
|
||||
if (NS_SUCCEEDED(rv) && imapService)
|
||||
rv = imapService->OnlineMessageCopy(m_eventQueue,
|
||||
this, messageIds.GetBuffer(),
|
||||
trashFolder, PR_TRUE, PR_TRUE,
|
||||
this, nsnull);
|
||||
this, nsnull,
|
||||
(void*)m_copyState);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsImapMoveCopyMsgTxn* undoMsgTxn = new nsImapMoveCopyMsgTxn(
|
||||
this, &srcKeyArray, messageIds.GetBuffer(), trashFolder,
|
||||
PR_TRUE, PR_TRUE, m_eventQueue, this);
|
||||
m_pendingUndoTxn = null_nsCOMPtr();
|
||||
|
||||
if (undoMsgTxn)
|
||||
m_copyState->undoMsgTxn = do_QueryInterface(undoMsgTxn, &rv);
|
||||
if (undoMsgTxn)
|
||||
m_pendingUndoTxn = do_QueryInterface(undoMsgTxn, &rv);
|
||||
if (m_pendingUndoTxn)
|
||||
{
|
||||
nsString undoString = count > 1 ? "Undo Delete Messages" :
|
||||
"Undo Delete Message";
|
||||
nsString redoString = count > 1 ? "Redo Delete Messages" :
|
||||
"Redo Delete Message";
|
||||
nsCOMPtr<nsImapMoveCopyMsgTxn> msgTxn = do_QueryInterface(m_pendingUndoTxn, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = msgTxn->SetUndoString(&undoString);
|
||||
rv = msgTxn->SetRedoString(&redoString);
|
||||
}
|
||||
rv = undoMsgTxn->SetUndoString(&undoString);
|
||||
rv = undoMsgTxn->SetRedoString(&redoString);
|
||||
}
|
||||
if (mDatabase)
|
||||
{
|
||||
@ -2369,15 +2374,9 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
||||
}
|
||||
ClearCopyState(aExitCode);
|
||||
}
|
||||
else if (m_pendingUndoTxn && NS_SUCCEEDED(aExitCode))
|
||||
{
|
||||
if (m_transactionManager)
|
||||
m_transactionManager->Do(m_pendingUndoTxn);
|
||||
}
|
||||
m_pendingUndoTxn = null_nsCOMPtr();
|
||||
break;
|
||||
default:
|
||||
m_pendingUndoTxn = null_nsCOMPtr();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// query it for a mailnews interface for now....
|
||||
@ -2449,18 +2448,16 @@ nsImapMailFolder::SetFolderAdminURL(nsIImapProtocol* aProtocol,
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::SetCopyResponseUid(nsIImapProtocol* aProtocol,
|
||||
nsMsgKeyArray* aKeyArray,
|
||||
const char* msgIdString)
|
||||
const char* msgIdString,
|
||||
void* copyState)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsImapMoveCopyMsgTxn> msgTxn;
|
||||
|
||||
if (m_copyState)
|
||||
if (copyState)
|
||||
{
|
||||
msgTxn = do_QueryInterface(m_copyState->undoMsgTxn, &rv);
|
||||
}
|
||||
else if (m_pendingUndoTxn)
|
||||
{
|
||||
msgTxn = do_QueryInterface(m_pendingUndoTxn, &rv);
|
||||
nsImapMailCopyState* mailCopyState = (nsImapMailCopyState*) copyState;
|
||||
msgTxn = do_QueryInterface(mailCopyState->undoMsgTxn, &rv);
|
||||
}
|
||||
if (msgTxn)
|
||||
msgTxn->SetCopyResponseUid(aKeyArray, msgIdString);
|
||||
@ -2733,13 +2730,13 @@ nsImapMailFolder::CopyMessages(nsIMsgFolder* srcFolder,
|
||||
rv = imapService->OnlineMessageCopy(m_eventQueue,
|
||||
srcFolder, messageIds.GetBuffer(),
|
||||
this, PR_TRUE, isMove,
|
||||
urlListener, nsnull);
|
||||
urlListener, nsnull,
|
||||
(void*)m_copyState);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsImapMoveCopyMsgTxn* undoMsgTxn = new nsImapMoveCopyMsgTxn(
|
||||
srcFolder, &srcKeyArray, messageIds.GetBuffer(), this,
|
||||
PR_TRUE, isMove, m_eventQueue, urlListener);
|
||||
m_pendingUndoTxn = null_nsCOMPtr();
|
||||
m_copyState->undoMsgTxn = do_QueryInterface(undoMsgTxn, &rv);
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,8 @@ public:
|
||||
FolderQueryInfo* aInfo);
|
||||
NS_IMETHOD SetCopyResponseUid(nsIImapProtocol* aProtocol,
|
||||
nsMsgKeyArray* keyArray,
|
||||
const char* msgIdString);
|
||||
const char* msgIdString,
|
||||
void* copyState);
|
||||
|
||||
// nsIImapMiscellaneousSink methods
|
||||
NS_IMETHOD AddSearchResult(nsIImapProtocol* aProtocol,
|
||||
|
@ -3303,7 +3303,13 @@ void nsImapProtocol::SetCopyResponseUid(nsMsgKeyArray* aKeyArray,
|
||||
const char *msgIdString)
|
||||
{
|
||||
if (m_imapExtensionSink)
|
||||
m_imapExtensionSink->SetCopyResponseUid(this,aKeyArray, msgIdString);
|
||||
{
|
||||
void* copyState = nsnull;
|
||||
if (m_runningUrl)
|
||||
m_runningUrl->GetCopyState(©State);
|
||||
m_imapExtensionSink->SetCopyResponseUid(this,aKeyArray, msgIdString,
|
||||
copyState);
|
||||
}
|
||||
}
|
||||
|
||||
void nsImapProtocol::CommitNamespacesForHostEvent()
|
||||
|
@ -1109,7 +1109,8 @@ nsImapExtensionSinkProxy::SetFolderAdminURL(nsIImapProtocol* aProtocol,
|
||||
NS_IMETHODIMP
|
||||
nsImapExtensionSinkProxy::SetCopyResponseUid(nsIImapProtocol* aProtocol,
|
||||
nsMsgKeyArray* aKeyArray,
|
||||
const char* msgIdString)
|
||||
const char* msgIdString,
|
||||
void* copyState)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_PRECONDITION (aKeyArray, "Oops... null aKeyArray");
|
||||
@ -1120,7 +1121,8 @@ nsImapExtensionSinkProxy::SetCopyResponseUid(nsIImapProtocol* aProtocol,
|
||||
if (PR_GetCurrentThread() == m_thread)
|
||||
{
|
||||
SetCopyResponseUidProxyEvent *ev =
|
||||
new SetCopyResponseUidProxyEvent(this, aKeyArray, msgIdString);
|
||||
new SetCopyResponseUidProxyEvent(this, aKeyArray, msgIdString,
|
||||
copyState);
|
||||
if(nsnull == ev)
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
@ -1130,7 +1132,8 @@ nsImapExtensionSinkProxy::SetCopyResponseUid(nsIImapProtocol* aProtocol,
|
||||
{
|
||||
res = m_realImapExtensionSink->SetCopyResponseUid(aProtocol,
|
||||
aKeyArray,
|
||||
msgIdString);
|
||||
msgIdString,
|
||||
copyState);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -2881,7 +2884,7 @@ SetFolderAdminURLProxyEvent::HandleEvent()
|
||||
|
||||
SetCopyResponseUidProxyEvent::SetCopyResponseUidProxyEvent(
|
||||
nsImapExtensionSinkProxy* aProxy, nsMsgKeyArray* aKeyArray,
|
||||
const char* msgIdString) :
|
||||
const char* msgIdString, void* copyState) :
|
||||
nsImapExtensionSinkProxyEvent(aProxy), m_msgIdString(msgIdString, eOneByte)
|
||||
{
|
||||
NS_ASSERTION (aKeyArray, "Oops... a null key array");
|
||||
@ -2889,6 +2892,7 @@ SetCopyResponseUidProxyEvent::SetCopyResponseUidProxyEvent(
|
||||
{
|
||||
m_copyKeyArray.CopyArray(aKeyArray);
|
||||
}
|
||||
m_copyState = copyState;
|
||||
}
|
||||
|
||||
SetCopyResponseUidProxyEvent::~SetCopyResponseUidProxyEvent()
|
||||
@ -2899,7 +2903,8 @@ NS_IMETHODIMP
|
||||
SetCopyResponseUidProxyEvent::HandleEvent()
|
||||
{
|
||||
nsresult res = m_proxy->m_realImapExtensionSink->SetCopyResponseUid(
|
||||
m_proxy->m_protocol, &m_copyKeyArray, m_msgIdString.GetBuffer());
|
||||
m_proxy->m_protocol, &m_copyKeyArray, m_msgIdString.GetBuffer(),
|
||||
m_copyState);
|
||||
if (m_notifyCompletion)
|
||||
m_proxy->m_protocol->NotifyFEEventCompletion();
|
||||
return res;
|
||||
|
@ -181,7 +181,8 @@ public:
|
||||
FolderQueryInfo* aInfo);
|
||||
NS_IMETHOD SetCopyResponseUid(nsIImapProtocol* aProtocol,
|
||||
nsMsgKeyArray* aKeyArray,
|
||||
const char* msgIdString);
|
||||
const char* msgIdString,
|
||||
void* copyState);
|
||||
|
||||
nsIImapExtensionSink* m_realImapExtensionSink;
|
||||
};
|
||||
@ -580,11 +581,13 @@ struct SetCopyResponseUidProxyEvent : nsImapExtensionSinkProxyEvent
|
||||
{
|
||||
SetCopyResponseUidProxyEvent(nsImapExtensionSinkProxy* aProxy,
|
||||
nsMsgKeyArray* aKeyArray,
|
||||
const char* msgIdString);
|
||||
const char* msgIdString,
|
||||
void* copyState);
|
||||
virtual ~SetCopyResponseUidProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
nsMsgKeyArray m_copyKeyArray;
|
||||
nsString2 m_msgIdString;
|
||||
void* m_copyState;
|
||||
};
|
||||
|
||||
struct nsImapMiscellaneousSinkProxyEvent : public nsImapEvent
|
||||
|
@ -1010,7 +1010,8 @@ nsImapService::OnlineMessageCopy(nsIEventQueue* aClientEventQueue,
|
||||
PRBool idsAreUids,
|
||||
PRBool isMove,
|
||||
nsIUrlListener* aUrlListener,
|
||||
nsIURI** aURL)
|
||||
nsIURI** aURL,
|
||||
void* copyState)
|
||||
{
|
||||
NS_ASSERTION(aSrcFolder && aDstFolder && messageIds && aClientEventQueue,
|
||||
"Fatal ... missing key parameters");
|
||||
@ -1086,6 +1087,9 @@ nsImapService::OnlineMessageCopy(nsIEventQueue* aClientEventQueue,
|
||||
folderName = "";
|
||||
GetFolderName(aDstFolder, folderName);
|
||||
urlSpec.Append(folderName);
|
||||
|
||||
imapUrl->SetCopyState(copyState);
|
||||
|
||||
nsCOMPtr <nsIURI> url = do_QueryInterface(imapUrl, &rv);
|
||||
if (NS_SUCCEEDED(rv) && url)
|
||||
rv = url->SetSpec(urlSpec.GetBuffer());
|
||||
|
@ -135,7 +135,8 @@ public:
|
||||
PRBool idsAreUids,
|
||||
PRBool isMove,
|
||||
nsIUrlListener* aUrlListener,
|
||||
nsIURI** aURL);
|
||||
nsIURI** aURL,
|
||||
void* copyState);
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// End support of nsIImapService interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -60,6 +60,7 @@ nsImapUrl::nsImapUrl()
|
||||
m_flags = 0;
|
||||
m_userName = nsnull;
|
||||
m_onlineSubDirSeparator = '/';
|
||||
m_copyState = nsnull;
|
||||
}
|
||||
|
||||
nsresult nsImapUrl::Initialize(const char * aUserName)
|
||||
@ -999,6 +1000,24 @@ NS_IMETHODIMP nsImapUrl::SetAllowContentChange(PRBool allowContentChange)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::SetCopyState(void* copyState)
|
||||
{
|
||||
NS_LOCK_INSTANCE();
|
||||
m_copyState = copyState;
|
||||
NS_UNLOCK_INSTANCE();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::GetCopyState(void** copyState)
|
||||
{
|
||||
if (!copyState) return NS_ERROR_NULL_POINTER;
|
||||
NS_LOCK_INSTANCE();
|
||||
*copyState = m_copyState;
|
||||
NS_UNLOCK_INSTANCE();
|
||||
if (*copyState) return NS_OK;
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::GetAllowContentChange(PRBool *result)
|
||||
{
|
||||
if (!result)
|
||||
|
@ -78,6 +78,9 @@ public:
|
||||
NS_IMETHOD SetAllowContentChange(PRBool allowContentChange);
|
||||
NS_IMETHOD GetAllowContentChange(PRBool *results);
|
||||
|
||||
NS_IMETHOD SetCopyState(void* copyState);
|
||||
NS_IMETHOD GetCopyState(void** copyState);
|
||||
|
||||
// nsImapUrl
|
||||
nsImapUrl();
|
||||
virtual ~nsImapUrl();
|
||||
@ -125,6 +128,9 @@ protected:
|
||||
nsCOMPtr<nsIImapMiscellaneousSink> m_imapMiscellaneousSink;
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> m_server;
|
||||
|
||||
// online message copy support; i don't have a better solution yet
|
||||
void* m_copyState;
|
||||
};
|
||||
|
||||
#endif /* nsImapUrl_h___ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user