mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
120076 r=bienvenu sr=mscott a=roc+moz. Undo delete for local msgs should
also update popstate.dat. also fixing one js error from last checkin.
This commit is contained in:
parent
21048cb4cf
commit
07b150e77c
@ -24,6 +24,10 @@
|
||||
|
||||
/* This is where functions related to the 3 pane window are kept */
|
||||
|
||||
// from MailNewsTypes.h
|
||||
const nsMsgViewIndex_None = 0xFFFFFFFF;
|
||||
|
||||
|
||||
var gFolderOutliner;
|
||||
var gMessagePane;
|
||||
var gMessagePaneFrame;
|
||||
|
@ -232,8 +232,6 @@ function CrossFolderNavigation(type, supportsFolderPane )
|
||||
return folder;
|
||||
}
|
||||
|
||||
// from MailNewsTypes.h
|
||||
const nsMsgViewIndex_None = 0xFFFFFFFF;
|
||||
|
||||
function ScrollToMessage(type, wrap, selectMessage)
|
||||
{
|
||||
|
@ -36,6 +36,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
interface nsIMsgWindow;
|
||||
interface nsIUrlListener;
|
||||
interface nsIMsgDatabase;
|
||||
@ -57,4 +58,5 @@ interface nsIMsgLocalMailFolder : nsISupports {
|
||||
void copyFolderLocal(in nsIMsgFolder srcFolder, in boolean isMove, in nsIMsgWindow msgWindow, in nsIMsgCopyServiceListener listener );
|
||||
void doNextSubFolder(in nsIMsgFolder srcFolder, in nsIMsgWindow msgWindow, in nsIMsgCopyServiceListener listener );
|
||||
attribute boolean checkForNewMessagesAfterParsing;
|
||||
[noscript] void markMsgsOnPop3Server(in nsISupportsArray messages, in boolean deleteMsgs);
|
||||
};
|
||||
|
@ -107,7 +107,7 @@ static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
|
||||
extern char* ReadPopData(const char *hostname, const char* username, nsIFileSpec* mailDirectory);
|
||||
extern void SavePopData(char *data, nsIFileSpec* maildirectory);
|
||||
extern void net_pop3_delete_if_in_server(char *data, char *uidl, PRBool *changed);
|
||||
extern void net_pop3_mark_if_in_server(char *data, char *uidl, PRBool deleteChar, PRBool *changed);
|
||||
extern void KillPopData(char* data);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -150,7 +150,6 @@ nsMsgLocalMailFolder::nsMsgLocalMailFolder(void)
|
||||
: mHaveReadNameFromDB(PR_FALSE), mGettingMail(PR_FALSE),
|
||||
mInitialized(PR_FALSE), mCopyState(nsnull), mType(nsnull),
|
||||
mCheckForNewMessagesAfterParsing(PR_FALSE)
|
||||
|
||||
{
|
||||
// NS_INIT_REFCNT(); done by superclass
|
||||
}
|
||||
@ -1606,7 +1605,7 @@ nsMsgLocalMailFolder::DeleteMessages(nsISupportsArray *messages,
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsISupports> msgSupport;
|
||||
DeleteMsgsOnPop3Server(messages);
|
||||
MarkMsgsOnPop3Server(messages, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
EnableNotifications(allMessageCountNotifications, PR_FALSE);
|
||||
@ -2878,7 +2877,8 @@ nsresult nsMsgLocalMailFolder::CopyMessageTo(nsISupports *message,
|
||||
// read the message headers and see if we have it, then mark the message for deletion from the server.
|
||||
// The next time we look at mail the message will be deleted from the server.
|
||||
|
||||
nsresult nsMsgLocalMailFolder::DeleteMsgsOnPop3Server(nsISupportsArray *messages)
|
||||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::MarkMsgsOnPop3Server(nsISupportsArray *messages, PRBool deleteMsgs)
|
||||
{
|
||||
char *uidl;
|
||||
char *header = NULL;
|
||||
@ -2983,7 +2983,7 @@ nsresult nsMsgLocalMailFolder::DeleteMsgsOnPop3Server(nsISupportsArray *messages
|
||||
lastChar --;
|
||||
}
|
||||
|
||||
net_pop3_delete_if_in_server(popData, uidl, &changed);
|
||||
net_pop3_mark_if_in_server(popData, uidl, deleteMsgs, &changed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,6 @@ protected:
|
||||
nsCOMPtr<nsIMsgStringService> mMsgStringService;
|
||||
|
||||
nsresult setSubfolderFlag(PRUnichar *aFolderName, PRUint32 flags);
|
||||
nsresult DeleteMsgsOnPop3Server(nsISupportsArray *messages);
|
||||
};
|
||||
|
||||
#endif // nsMsgLocalMailFolder_h__
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsMsgImapCID.h"
|
||||
#include "nsIImapService.h"
|
||||
#include "nsIUrlListener.h"
|
||||
#include "nsIMsgLocalMailFolder.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
|
||||
static NS_DEFINE_CID(kMailboxServiceCID, NS_IMAILBOXSERVICE_IID);
|
||||
@ -255,6 +256,9 @@ nsLocalMoveCopyMsgTxn::UndoTransaction()
|
||||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> srcMessages;
|
||||
NS_NewISupportsArray(getter_AddRefs(srcMessages));
|
||||
nsCOMPtr <nsISupports> msgSupports;
|
||||
for (i=0; i<count; i++)
|
||||
{
|
||||
rv = dstDB->GetMsgHdrForKey(m_dstKeyArray.GetAt(i),
|
||||
@ -268,9 +272,16 @@ nsLocalMoveCopyMsgTxn::UndoTransaction()
|
||||
NS_ASSERTION(newHdr,
|
||||
"fatal ... cannot create new msg header\n");
|
||||
if (NS_SUCCEEDED(rv) && newHdr)
|
||||
srcDB->UndoDelete(newHdr);
|
||||
{
|
||||
srcDB->UndoDelete(newHdr);
|
||||
msgSupports =do_QueryInterface(newHdr);
|
||||
srcMessages->AppendElement(msgSupports);
|
||||
}
|
||||
}
|
||||
}
|
||||
nsCOMPtr <nsIMsgLocalMailFolder> localFolder = do_QueryInterface(srcFolder);
|
||||
if (localFolder)
|
||||
localFolder->MarkMsgsOnPop3Server(srcMessages, PR_FALSE /*deleteMsgs*/);
|
||||
}
|
||||
srcDB->SetSummaryValid(PR_TRUE);
|
||||
srcDB->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
@ -306,6 +317,9 @@ nsLocalMoveCopyMsgTxn::RedoTransaction()
|
||||
nsCOMPtr<nsIMsgDBHdr> oldHdr;
|
||||
nsCOMPtr<nsIMsgDBHdr> newHdr;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> srcMessages;
|
||||
NS_NewISupportsArray(getter_AddRefs(srcMessages));
|
||||
nsCOMPtr <nsISupports> msgSupports;
|
||||
|
||||
for (i=0; i<count; i++)
|
||||
{
|
||||
@ -315,6 +329,9 @@ nsLocalMoveCopyMsgTxn::RedoTransaction()
|
||||
|
||||
if (NS_SUCCEEDED(rv) && oldHdr)
|
||||
{
|
||||
msgSupports =do_QueryInterface(oldHdr);
|
||||
srcMessages->AppendElement(msgSupports);
|
||||
|
||||
rv = dstDB->CopyHdrFromExistingHdr(m_dstKeyArray.GetAt(i),
|
||||
oldHdr, PR_TRUE,
|
||||
getter_AddRefs(newHdr));
|
||||
@ -340,6 +357,10 @@ nsLocalMoveCopyMsgTxn::RedoTransaction()
|
||||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr <nsIMsgLocalMailFolder> localFolder = do_QueryInterface(srcFolder);
|
||||
if (localFolder)
|
||||
localFolder->MarkMsgsOnPop3Server(srcMessages, PR_TRUE /*deleteMsgs*/);
|
||||
|
||||
rv = srcDB->DeleteMessages(&m_srcKeyArray, nsnull);
|
||||
srcDB->SetSummaryValid(PR_TRUE);
|
||||
srcDB->Commit(nsMsgDBCommitType::kLargeCommit);
|
||||
|
@ -323,7 +323,7 @@ our state file, mark any messages we have for deletion and then re-save the stat
|
||||
*/
|
||||
extern char* ReadPopData(const char *hostname, const char* username, nsIFileSpec* maildirectory);
|
||||
extern void SavePopData(char *data, nsIFileSpec* maildirectory);
|
||||
extern void net_pop3_delete_if_in_server(char *data, char *uidl, PRBool *changed);
|
||||
extern void net_pop3_mark_if_in_server(char *data, char *uidl, PRBool deleteChar, PRBool *changed);
|
||||
extern void KillPopData(char* data);
|
||||
static void net_pop3_free_state(Pop3UidlHost* host);
|
||||
|
||||
@ -356,7 +356,7 @@ message is not found, then the message was downloaded completly and already dele
|
||||
from the server. So this only applies to messages kept on the server or too big
|
||||
for download. */
|
||||
|
||||
void net_pop3_delete_if_in_server(char *data, char *uidl, PRBool *changed)
|
||||
void net_pop3_mark_if_in_server(char *data, char *uidl, PRBool deleteChar, PRBool *changed)
|
||||
{
|
||||
Pop3UidlHost *host = (Pop3UidlHost*) data;
|
||||
|
||||
@ -364,7 +364,7 @@ void net_pop3_delete_if_in_server(char *data, char *uidl, PRBool *changed)
|
||||
return;
|
||||
if (PL_HashTableLookup (host->hash, (const void*) uidl))
|
||||
{
|
||||
PL_HashTableAdd(host->hash, uidl, (void*) DELETE_CHAR);
|
||||
PL_HashTableAdd(host->hash, uidl, deleteChar ? (void*) DELETE_CHAR : (void*) KEEP);
|
||||
*changed = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user