mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
138342 r=cavin sr=bienvenu fixing undo of moving msgs from imap to local
This commit is contained in:
parent
df3886396d
commit
4d96ee8438
@ -105,17 +105,29 @@ nsMsgTxn::SetTransactionType(PRUint32 txnType)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//none of the callers pass null aFolder
|
||||
/*none of the callers pass null aFolder,
|
||||
we always initialize aResult (before we pass in) for the case where the key is not in the db*/
|
||||
nsresult
|
||||
nsMsgTxn::CheckForToggleDelete(nsIMsgFolder *aFolder, const nsMsgKey &aMsgKey, PRBool *aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_ENSURE_ARG(aResult);
|
||||
nsCOMPtr<nsIMsgDBHdr> message;
|
||||
nsresult rv = aFolder->GetMessageHeader(aMsgKey, getter_AddRefs(message));
|
||||
PRUint32 flags;
|
||||
if (NS_SUCCEEDED(rv) && message)
|
||||
nsCOMPtr<nsIMsgDatabase> db;
|
||||
aFolder->GetMsgDatabase(nsnull,getter_AddRefs(db));
|
||||
if (db)
|
||||
{
|
||||
message->GetFlags(&flags);
|
||||
*aResult = (flags & MSG_FLAG_IMAP_DELETED) != 0;
|
||||
PRBool containsKey;
|
||||
rv = db->ContainsKey(aMsgKey, &containsKey);
|
||||
if (NS_FAILED(rv) || !containsKey) // the message has been deleted from db, so we cannot do toggle here
|
||||
return NS_OK;
|
||||
rv = db->GetMsgHdrForKey(aMsgKey, getter_AddRefs(message));
|
||||
PRUint32 flags;
|
||||
if (NS_SUCCEEDED(rv) && message)
|
||||
{
|
||||
message->GetFlags(&flags);
|
||||
*aResult = (flags & MSG_FLAG_IMAP_DELETED) != 0;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user