зеркало из https://github.com/mozilla/pjs.git
Bug 435290 Remove nsISupportsArray instances from parts of base, local, and imap. p=Siddharth Agarwal <sid1337@gmail.com>,r=bienvenu,Neil,sr=Neil
This commit is contained in:
Родитель
ef495feb9b
Коммит
c1fb057379
|
@ -927,9 +927,9 @@ function MsgDeleteFolder()
|
|||
{
|
||||
if (gCurrentVirtualFolderUri == folderResource.Value)
|
||||
gCurrentVirtualFolderUri = null;
|
||||
var array = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
array.AppendElement(folder);
|
||||
var array = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
array.appendElement(folder, false);
|
||||
folder.parent.deleteSubFolders(array, msgWindow);
|
||||
continue;
|
||||
}
|
||||
|
@ -959,9 +959,9 @@ function MsgDeleteFolder()
|
|||
}
|
||||
else
|
||||
{
|
||||
var array = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
array.AppendElement(selectedFolder);
|
||||
var array = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
array.appendElement(selectedFolder, false);
|
||||
selectedFolder.parent.deleteSubFolders(array, msgWindow);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -568,8 +568,8 @@ function getJunkmailComponent()
|
|||
function messageClassifier(aFolder)
|
||||
{
|
||||
this.mFolder = aFolder;
|
||||
this.mJunkMsgHdrs = Components.classes["@mozilla.org/supports-array;1"].
|
||||
createInstance(Components.interfaces.nsISupportsArray);
|
||||
this.mJunkMsgHdrs = Components.classes["@mozilla.org/array;1"].
|
||||
createInstance(Components.interfaces.nsIMutableArray);
|
||||
this.mMessages = new Array();
|
||||
this.mPendingMessageCount = 0;
|
||||
}
|
||||
|
@ -629,7 +629,7 @@ messageClassifier.prototype =
|
|||
db.setStringProperty(msgHdr.messageKey, "junkpercent", aJunkPercent);
|
||||
|
||||
if (aClassification == nsIJunkMailPlugin.JUNK)
|
||||
this.mJunkMsgHdrs.AppendElement(msgHdr);
|
||||
this.mJunkMsgHdrs.appendElement(msgHdr, false);
|
||||
|
||||
this.mPendingMessageCount--;
|
||||
if (this.mPendingMessageCount == 0)
|
||||
|
@ -747,16 +747,16 @@ function deleteAllInFolder(commandName)
|
|||
while (iter.hasMoreElements())
|
||||
folder.propagateDelete(iter.getNext(), true, msgWindow);
|
||||
|
||||
var children = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
var children = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
|
||||
// Delete messages.
|
||||
iter = folder.getMessages(msgWindow);
|
||||
while (iter.hasMoreElements()) {
|
||||
children.AppendElement(iter.getNext());
|
||||
children.appendElement(iter.getNext(), false);
|
||||
}
|
||||
folder.deleteMessages(children, msgWindow, true, false, null, false);
|
||||
children.Clear();
|
||||
children.clear();
|
||||
}
|
||||
|
||||
function deleteJunkInFolder()
|
||||
|
|
|
@ -473,8 +473,8 @@ function RemoveAllMessageTags()
|
|||
if (!selectedMsgUris.length)
|
||||
return;
|
||||
|
||||
var messages = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
var messages = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
|
||||
.getService(Components.interfaces.nsIMsgTagService);
|
||||
var tagArray = tagService.getAllTags({});
|
||||
|
@ -503,10 +503,10 @@ function RemoveAllMessageTags()
|
|||
{
|
||||
if (prevHdrFolder)
|
||||
prevHdrFolder.removeKeywordsFromMessages(messages, allKeys);
|
||||
messages.Clear();
|
||||
messages.clear();
|
||||
prevHdrFolder = msgHdr.folder;
|
||||
}
|
||||
messages.AppendElement(msgHdr);
|
||||
messages.appendElement(msgHdr, false);
|
||||
}
|
||||
if (prevHdrFolder)
|
||||
prevHdrFolder.removeKeywordsFromMessages(messages, allKeys);
|
||||
|
@ -548,10 +548,10 @@ function ToggleMessageTagMenu(target)
|
|||
|
||||
function ToggleMessageTag(key, addKey)
|
||||
{
|
||||
var messages = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
var msg = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
var messages = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
var msg = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
var selectedMsgUris = GetSelectedMessages();
|
||||
var toggler = addKey ? "addKeywordsToMessages" : "removeKeywordsFromMessages";
|
||||
var prevHdrFolder = null;
|
||||
|
@ -568,8 +568,8 @@ function ToggleMessageTag(key, addKey)
|
|||
// Since we touch all these messages anyway, migrate the label now.
|
||||
// If we don't, the thread tree won't always show the correct tag state,
|
||||
// because resetting a label doesn't update the tree anymore...
|
||||
msg.Clear();
|
||||
msg.AppendElement(msgHdr);
|
||||
msg.clear();
|
||||
msg.appendElement(msgHdr, false);
|
||||
msgHdr.folder.addKeywordsToMessages(msg, "$label" + msgHdr.label);
|
||||
msgHdr.label = 0; // remove legacy label
|
||||
}
|
||||
|
@ -577,10 +577,10 @@ function ToggleMessageTag(key, addKey)
|
|||
{
|
||||
if (prevHdrFolder)
|
||||
prevHdrFolder[toggler](messages, key);
|
||||
messages.Clear();
|
||||
messages.clear();
|
||||
prevHdrFolder = msgHdr.folder;
|
||||
}
|
||||
messages.AppendElement(msgHdr);
|
||||
messages.appendElement(msgHdr, false);
|
||||
}
|
||||
if (prevHdrFolder)
|
||||
prevHdrFolder[toggler](messages, key);
|
||||
|
@ -2751,8 +2751,8 @@ function OnMsgLoaded(aUrl)
|
|||
}
|
||||
if (copyToOfflineFolder)
|
||||
{
|
||||
var messages = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
messages.AppendElement(msgHdr);
|
||||
var messages = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
|
||||
messages.appendElement(msgHdr, false);
|
||||
|
||||
res = outputPFC.copyMessages(currentMsgFolder, messages, false /*isMove*/, msgWindow /* nsIMsgWindow */, null /* listener */, false /* isFolder */, false /*allowUndo*/ );
|
||||
}
|
||||
|
|
|
@ -2412,9 +2412,9 @@ function RemoveDraft()
|
|||
const MSG_FOLDER_FLAG_DRAFTS = 0x0400;
|
||||
if (folder.flags & MSG_FOLDER_FLAG_DRAFTS)
|
||||
{
|
||||
var msgs = Components.classes["@mozilla.org/supports-array;1"].
|
||||
createInstance(Components.interfaces.nsISupportsArray);
|
||||
msgs.AppendElement(folder.GetMessageHeader(msgKey));
|
||||
var msgs = Components.classes["@mozilla.org/array;1"].
|
||||
createInstance(Components.interfaces.nsIMutableArray);
|
||||
msgs.appendElement(folder.GetMessageHeader(msgKey), false);
|
||||
folder.deleteMessages(msgs, null, true, false, null, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "nsISupports.idl"
|
||||
#include "nsIMsgFolder.idl"
|
||||
#include "nsIMsgCopyServiceListener.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
interface nsIMsgDBHdr;
|
||||
%{C++
|
||||
|
@ -49,15 +48,16 @@ interface nsIMsgDBHdr;
|
|||
interface nsITransactionManager;
|
||||
interface nsIMsgWindow;
|
||||
interface nsIFile;
|
||||
interface nsIArray;
|
||||
|
||||
[scriptable, uuid(f0ee3821-e382-43de-9b71-bd9a4a594fcb)]
|
||||
[scriptable, uuid(4010d881-6c83-4f8d-9332-d44564cee14a)]
|
||||
interface nsIMsgCopyService : nsISupports {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void CopyMessages(in nsIMsgFolder srcFolder,
|
||||
in nsISupportsArray messages,
|
||||
in nsIArray messages,
|
||||
in nsIMsgFolder dstFolder,
|
||||
in boolean isMove,
|
||||
in nsIMsgCopyServiceListener listener,
|
||||
|
@ -67,11 +67,11 @@ interface nsIMsgCopyService : nsISupports {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
void CopyFolders( in nsISupportsArray folders,
|
||||
in nsIMsgFolder dstFolder,
|
||||
in boolean isMove,
|
||||
in nsIMsgCopyServiceListener listener,
|
||||
in nsIMsgWindow msgWindow);
|
||||
void CopyFolders(in nsIArray folders,
|
||||
in nsIMsgFolder dstFolder,
|
||||
in boolean isMove,
|
||||
in nsIMsgCopyServiceListener listener,
|
||||
in nsIMsgWindow msgWindow);
|
||||
|
||||
void CopyFileMessage(in nsIFile aFile,
|
||||
in nsIMsgFolder dstFolder,
|
||||
|
|
|
@ -60,13 +60,14 @@ interface nsIOutputStream;
|
|||
interface nsIInputStream;
|
||||
interface nsILocalFile;
|
||||
interface nsIMsgIdentity;
|
||||
interface nsIArray;
|
||||
|
||||
typedef long nsMsgBiffState;
|
||||
|
||||
// enumerated type for determining if a message has been replied to, forwarded, etc.
|
||||
typedef long nsMsgDispositionState;
|
||||
|
||||
[scriptable, uuid(2197fbda-e628-4df0-bc75-685406baa398)]
|
||||
[scriptable, uuid(9a3f400b-d3b7-494f-acf9-082f2008dffc)]
|
||||
interface nsIMsgFolder : nsISupports {
|
||||
|
||||
const nsMsgBiffState nsMsgBiffState_NewMail = 0; // User has new mail waiting.
|
||||
|
@ -139,7 +140,7 @@ interface nsIMsgFolder : nsISupports {
|
|||
void ForceDBClosed ();
|
||||
void Delete ();
|
||||
|
||||
void deleteSubFolders(in nsISupportsArray folders, in nsIMsgWindow msgWindow);
|
||||
void deleteSubFolders(in nsIArray folders, in nsIMsgWindow msgWindow);
|
||||
void propagateDelete(in nsIMsgFolder folder, in boolean deleteStorage,
|
||||
in nsIMsgWindow msgWindow);
|
||||
void recursiveDelete(in boolean deleteStorage, in nsIMsgWindow msgWindow);
|
||||
|
@ -329,12 +330,12 @@ interface nsIMsgFolder : nsISupports {
|
|||
|
||||
ACString getUriForMsg(in nsIMsgDBHdr msgHdr);
|
||||
|
||||
void deleteMessages(in nsISupportsArray messages,
|
||||
void deleteMessages(in nsIArray messages,
|
||||
in nsIMsgWindow msgWindow,
|
||||
in boolean deleteStorage, in boolean isMove,
|
||||
in nsIMsgCopyServiceListener listener, in boolean allowUndo);
|
||||
|
||||
void copyMessages(in nsIMsgFolder srcFolder, in nsISupportsArray messages,
|
||||
void copyMessages(in nsIMsgFolder srcFolder, in nsIArray messages,
|
||||
in boolean isMove, in nsIMsgWindow msgWindow,
|
||||
in nsIMsgCopyServiceListener listener, in boolean isFolder,
|
||||
in boolean allowUndo);
|
||||
|
@ -395,11 +396,11 @@ interface nsIMsgFolder : nsISupports {
|
|||
void addMessageDispositionState(in nsIMsgDBHdr aMessage,
|
||||
in nsMsgDispositionState aDispositionFlag);
|
||||
|
||||
void markMessagesRead(in nsISupportsArray messages, in boolean markRead);
|
||||
void markMessagesRead(in nsIArray messages, in boolean markRead);
|
||||
void markAllMessagesRead();
|
||||
void markMessagesFlagged(in nsISupportsArray messages, in boolean markFlagged);
|
||||
void markMessagesFlagged(in nsIArray messages, in boolean markFlagged);
|
||||
void markThreadRead(in nsIMsgThread thread);
|
||||
void setLabelForMessages(in nsISupportsArray messages, in nsMsgLabelValue label);
|
||||
void setLabelForMessages(in nsIArray messages, in nsMsgLabelValue label);
|
||||
nsIMsgDatabase getMsgDatabase(in nsIMsgWindow msgWindow);
|
||||
void setMsgDatabase (in nsIMsgDatabase msgDatabase);
|
||||
nsIMsgDatabase getDBFolderInfoAndDB(out nsIDBFolderInfo folderInfo);
|
||||
|
@ -549,7 +550,7 @@ interface nsIMsgFolder : nsISupports {
|
|||
void copyDataToOutputStreamForAppend(in nsIInputStream aIStream,
|
||||
in long aLength, in nsIOutputStream outputStream);
|
||||
void copyDataDone();
|
||||
void setJunkScoreForMessages(in nsISupportsArray aMessages, in ACString aJunkScore);
|
||||
void setJunkScoreForMessages(in nsIArray aMessages, in ACString aJunkScore);
|
||||
void applyRetentionSettings();
|
||||
|
||||
/**
|
||||
|
@ -574,8 +575,8 @@ interface nsIMsgFolder : nsISupports {
|
|||
// used to set/clear tags - we could have a single method to setKeywords which
|
||||
// would figure out the diffs, but these methods might be more convenient.
|
||||
// keywords are space delimited, in the case of multiple keywords
|
||||
void addKeywordsToMessages(in nsISupportsArray aMessages, in ACString aKeywords);
|
||||
void removeKeywordsFromMessages(in nsISupportsArray aMessages, in ACString aKeywords);
|
||||
void addKeywordsToMessages(in nsIArray aMessages, in ACString aKeywords);
|
||||
void removeKeywordsFromMessages(in nsIArray aMessages, in ACString aKeywords);
|
||||
/**
|
||||
* Extract the message preview text from aStream, storing it as a string property
|
||||
* on aMsgHdr.
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIMsgFolder;
|
||||
interface nsISupportsArray;
|
||||
interface nsIArray;
|
||||
|
||||
// This is similar to nsIFolderListener, but with slightly different semantics,
|
||||
// especially w.r.t. moving messages and folders. Some listeners want to know
|
||||
|
@ -48,14 +48,14 @@ interface nsISupportsArray;
|
|||
// point since there are lots of extensions that rely on it. Eventually,
|
||||
// these two interfaces should be combined somehow.
|
||||
|
||||
[scriptable, uuid(1202F417-4580-4F02-89E5-151BA2C6E3C7)]
|
||||
[scriptable, uuid(4b89a390-0bd4-4b50-a87a-c31ddfde58f7)]
|
||||
interface nsIMsgFolderListener : nsISupports {
|
||||
// new msg or folder added
|
||||
void itemAdded(in nsISupports aItem);
|
||||
// folder or msg deleted (no trash)
|
||||
void itemDeleted(in nsISupports aItem);
|
||||
void itemMoveCopyCompleted(in boolean aMove,
|
||||
in nsISupportsArray aSrcItems,
|
||||
in nsIArray aSrcItems,
|
||||
in nsIMsgFolder aDestFolder);
|
||||
|
||||
void folderRenamed(in nsIMsgFolder aOrigFolder, in nsIMsgFolder aNewFolder);
|
||||
|
|
|
@ -39,21 +39,21 @@
|
|||
|
||||
interface nsIMsgFolder;
|
||||
interface nsIMsgFolderListener;
|
||||
interface nsISupportsArray;
|
||||
interface nsIArray;
|
||||
|
||||
|
||||
[scriptable, uuid(4264C2DC-96AC-48B7-9822-DD4396EBB674)]
|
||||
[scriptable, uuid(d96b19df-a11d-4df2-90b7-ce553176c621)]
|
||||
interface nsIMsgFolderNotificationService : nsISupports {
|
||||
readonly attribute boolean hasListeners;
|
||||
void addListener(in nsIMsgFolderListener aListener);
|
||||
void removeListener(in nsIMsgFolderListener aListener);
|
||||
|
||||
void notifyItemAdded(in nsISupports aItem);
|
||||
// for the convenience of the callers, we allow this to be an nsISupportsArray of items,
|
||||
// for the convenience of the callers, we allow this to be an nsIArray of items,
|
||||
// or an individual nsISupports.
|
||||
void notifyItemDeleted(in nsISupports aItem);
|
||||
void notifyItemMoveCopyCompleted(in boolean aMove,
|
||||
in nsISupportsArray aSrcItems,
|
||||
in nsIArray aSrcItems,
|
||||
in nsIMsgFolder aDestFolder);
|
||||
|
||||
void notifyFolderRenamed(in nsIMsgFolder aOrigFolder, in nsIMsgFolder aNewFolder);
|
||||
|
|
|
@ -936,9 +936,9 @@ function MsgDeleteFolder()
|
|||
{
|
||||
if (gCurrentVirtualFolderUri == folderResource.Value)
|
||||
gCurrentVirtualFolderUri = null;
|
||||
var array = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
array.AppendElement(folder);
|
||||
var array = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
array.appendElement(folder, false);
|
||||
folder.parent.deleteSubFolders(array, msgWindow);
|
||||
continue;
|
||||
}
|
||||
|
@ -965,9 +965,9 @@ function MsgDeleteFolder()
|
|||
}
|
||||
else
|
||||
{
|
||||
var array = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
array.AppendElement(selectedFolder);
|
||||
var array = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
array.appendElement(selectedFolder, false);
|
||||
selectedFolder.parent.deleteSubFolders(array, msgWindow);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,56 +39,21 @@
|
|||
var gPromptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
function DoRDFCommand(dataSource, command, srcArray, argumentArray)
|
||||
function GetNewMessages(selectedFolders, server)
|
||||
{
|
||||
var commandResource = RDF.GetResource(command);
|
||||
if (commandResource) {
|
||||
try {
|
||||
if (!argumentArray)
|
||||
argumentArray = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
if (!selectedFolders.length)
|
||||
return;
|
||||
|
||||
if (argumentArray)
|
||||
argumentArray.AppendElement(msgWindow);
|
||||
dataSource.DoCommand(srcArray, commandResource, argumentArray);
|
||||
}
|
||||
catch(e) {
|
||||
if (command == "http://home.netscape.com/NC-rdf#NewFolder") {
|
||||
throw(e); // so that the dialog does not automatically close.
|
||||
}
|
||||
dump("Exception : In mail commands" + e + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
var msgFolder = selectedFolders[0];
|
||||
|
||||
function GetNewMessages(selectedFolders, server, compositeDataSource)
|
||||
{
|
||||
var numFolders = selectedFolders.length;
|
||||
if (numFolders > 0)
|
||||
// Whenever we do get new messages, clear the old new messages.
|
||||
if (msgFolder)
|
||||
{
|
||||
var msgFolder = selectedFolders[0];
|
||||
|
||||
// Whenever we do get new messages, clear the old new messages.
|
||||
if (msgFolder)
|
||||
{
|
||||
var nsIMsgFolder = Components.interfaces.nsIMsgFolder;
|
||||
msgFolder.biffState = nsIMsgFolder.nsMsgBiffState_NoMail;
|
||||
msgFolder.clearNewMessages();
|
||||
}
|
||||
|
||||
if (compositeDataSource)
|
||||
{
|
||||
var folderResource = msgFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
var folderArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
folderArray.AppendElement(folderResource);
|
||||
var serverArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
serverArray.AppendElement(server);
|
||||
DoRDFCommand(compositeDataSource, "http://home.netscape.com/NC-rdf#GetNewMessages", folderArray, serverArray);
|
||||
}
|
||||
}
|
||||
else {
|
||||
dump("Nothing was selected\n");
|
||||
var nsIMsgFolder = Components.interfaces.nsIMsgFolder;
|
||||
msgFolder.biffState = nsIMsgFolder.nsMsgBiffState_NoMail;
|
||||
msgFolder.clearNewMessages();
|
||||
}
|
||||
server.getNewMessages(msgFolder, msgWindow, null);
|
||||
}
|
||||
|
||||
function getBestIdentity(identities, optionalHint)
|
||||
|
@ -352,25 +317,13 @@ function CreateNewSubfolder(chromeWindowURL, preselectedMsgFolder,
|
|||
okCallback:callBackFunctionName});
|
||||
}
|
||||
|
||||
function NewFolder(name,uri)
|
||||
function NewFolder(name, uri)
|
||||
{
|
||||
// dump("uri,name = " + uri + "," + name + "\n");
|
||||
if (uri && (uri != "") && name && (name != "")) {
|
||||
var selectedFolderResource = RDF.GetResource(uri);
|
||||
// dump("selectedFolder = " + uri + "\n");
|
||||
var compositeDataSource = GetCompositeDataSource("NewFolder");
|
||||
var folderArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
var nameArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
if (!uri || !name)
|
||||
return;
|
||||
|
||||
folderArray.AppendElement(selectedFolderResource);
|
||||
|
||||
var nameLiteral = RDF.GetLiteral(name);
|
||||
nameArray.AppendElement(nameLiteral);
|
||||
DoRDFCommand(compositeDataSource, "http://home.netscape.com/NC-rdf#NewFolder", folderArray, nameArray);
|
||||
}
|
||||
else {
|
||||
dump("no name or nothing selected\n");
|
||||
}
|
||||
var folder = RDF.GetResource(uri).QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
folder.createSubfolder(name, msgWindow);
|
||||
}
|
||||
|
||||
function UnSubscribe(folder)
|
||||
|
@ -473,15 +426,6 @@ function MarkSelectedMessagesFlagged(markFlagged)
|
|||
gDBView.doCommand(markFlagged ? nsMsgViewCommandType.flagMessages : nsMsgViewCommandType.unflagMessages);
|
||||
}
|
||||
|
||||
function MarkAllMessagesRead(compositeDataSource, folder)
|
||||
{
|
||||
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
var folderArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
folderArray.AppendElement(folderResource);
|
||||
|
||||
DoRDFCommand(compositeDataSource, "http://home.netscape.com/NC-rdf#MarkAllMessagesRead", folderArray, null);
|
||||
}
|
||||
|
||||
function DownloadFlaggedMessages(compositeDataSource, folder)
|
||||
{
|
||||
dump("fix DownloadFlaggedMessages()\n");
|
||||
|
@ -598,8 +542,10 @@ function performActionsOnJunkMsgs(aIndices)
|
|||
MarkSelectedMessagesRead(true);
|
||||
if (actionParams.junkTargetFolder)
|
||||
{
|
||||
SetNextMessageAfterDelete();
|
||||
gDBView.doCommandWithFolder(nsMsgViewCommandType.moveMessages, actionParams.junkTargetFolder);
|
||||
var copyService = Components.classes["@mozilla.org/messenger/messagecopyservice;1"].
|
||||
getService(Components.interfaces.nsIMsgCopyService);
|
||||
copyService.CopyMessages(aFolder, aMsgHdrs, actionParams.junkTargetFolder, true /* isMove */, null,
|
||||
msgWindow, true /* allow undo */);
|
||||
}
|
||||
|
||||
treeSelection.clearSelection();
|
||||
|
@ -750,26 +696,21 @@ function deleteAllInFolder(commandName)
|
|||
if (!confirmToProceed(commandName))
|
||||
return;
|
||||
|
||||
var children = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
|
||||
// Delete sub-folders.
|
||||
var iter = folder.subFolders;
|
||||
while (iter.hasMoreElements())
|
||||
children.AppendElement(iter.getNext());
|
||||
|
||||
for (var i = 0; i < children.Count(); ++i)
|
||||
folder.propagateDelete(children.GetElementAt(i), true, msgWindow);
|
||||
|
||||
children.Clear();
|
||||
folder.propagateDelete(iter.getNext(), true, msgWindow);
|
||||
|
||||
var children = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
|
||||
// Delete messages.
|
||||
iter = folder.getMessages(msgWindow);
|
||||
while (iter.hasMoreElements()) {
|
||||
children.AppendElement(iter.getNext());
|
||||
children.appendElement(iter.getNext(), false);
|
||||
}
|
||||
folder.deleteMessages(children, msgWindow, true, false, null, false);
|
||||
children.Clear();
|
||||
children.clear();
|
||||
}
|
||||
|
||||
function deleteJunkInFolder()
|
||||
|
|
|
@ -478,8 +478,8 @@ function RemoveAllMessageTags()
|
|||
if (!selectedMsgUris.length)
|
||||
return;
|
||||
|
||||
var messages = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
var messages = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
|
||||
.getService(Components.interfaces.nsIMsgTagService);
|
||||
var tagArray = tagService.getAllTags({});
|
||||
|
@ -508,10 +508,10 @@ function RemoveAllMessageTags()
|
|||
{
|
||||
if (prevHdrFolder)
|
||||
prevHdrFolder.removeKeywordsFromMessages(messages, allKeys);
|
||||
messages.Clear();
|
||||
messages.clear();
|
||||
prevHdrFolder = msgHdr.folder;
|
||||
}
|
||||
messages.AppendElement(msgHdr);
|
||||
messages.appendElement(msgHdr, false);
|
||||
}
|
||||
if (prevHdrFolder)
|
||||
prevHdrFolder.removeKeywordsFromMessages(messages, allKeys);
|
||||
|
@ -574,10 +574,10 @@ function ToggleMessageTagMenu(target)
|
|||
|
||||
function ToggleMessageTag(key, addKey)
|
||||
{
|
||||
var messages = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
var msg = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
var messages = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
var msg = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
var selectedMsgUris = GetSelectedMessages();
|
||||
var toggler = addKey ? "addKeywordsToMessages" : "removeKeywordsFromMessages";
|
||||
var prevHdrFolder = null;
|
||||
|
@ -594,8 +594,8 @@ function ToggleMessageTag(key, addKey)
|
|||
// Since we touch all these messages anyway, migrate the label now.
|
||||
// If we don't, the thread tree won't always show the correct tag state,
|
||||
// because resetting a label doesn't update the tree anymore...
|
||||
msg.Clear();
|
||||
msg.AppendElement(msgHdr);
|
||||
msg.clear();
|
||||
msg.appendElement(msgHdr, false);
|
||||
msgHdr.folder.addKeywordsToMessages(msg, "$label" + msgHdr.label);
|
||||
msgHdr.label = 0; // remove legacy label
|
||||
}
|
||||
|
@ -603,10 +603,10 @@ function ToggleMessageTag(key, addKey)
|
|||
{
|
||||
if (prevHdrFolder)
|
||||
prevHdrFolder[toggler](messages, key);
|
||||
messages.Clear();
|
||||
messages.clear();
|
||||
prevHdrFolder = msgHdr.folder;
|
||||
}
|
||||
messages.AppendElement(msgHdr);
|
||||
messages.appendElement(msgHdr, false);
|
||||
}
|
||||
if (prevHdrFolder)
|
||||
prevHdrFolder[toggler](messages, key);
|
||||
|
@ -874,11 +874,7 @@ function GetMessagesForInboxOnServer(server)
|
|||
var inboxFolder = GetInboxFolder(server);
|
||||
if (!inboxFolder) return;
|
||||
|
||||
var folders = new Array(1);
|
||||
folders[0] = inboxFolder;
|
||||
|
||||
var compositeDataSource = GetCompositeDataSource("GetNewMessages");
|
||||
GetNewMessages(folders, server, compositeDataSource);
|
||||
GetNewMessages([inboxFolder], server);
|
||||
}
|
||||
|
||||
function MsgGetMessage()
|
||||
|
@ -1494,11 +1490,10 @@ function MsgMarkReadByDate()
|
|||
|
||||
function MsgMarkAllRead()
|
||||
{
|
||||
var compositeDataSource = GetCompositeDataSource("MarkAllMessagesRead");
|
||||
var folder = GetMsgFolderFromUri(GetSelectedFolderURI(), true);
|
||||
|
||||
if(folder)
|
||||
MarkAllMessagesRead(compositeDataSource, folder);
|
||||
folder.markAllMessagesRead();
|
||||
}
|
||||
|
||||
function MsgDownloadFlagged()
|
||||
|
@ -2063,8 +2058,7 @@ function GetFolderMessages()
|
|||
var folders = new Array(1);
|
||||
folders[0] = folder;
|
||||
|
||||
var compositeDataSource = GetCompositeDataSource("GetNewMessages");
|
||||
GetNewMessages(folders, folder.server, compositeDataSource);
|
||||
GetNewMessages(folders, folder.server);
|
||||
}
|
||||
|
||||
function SendUnsentMessages()
|
||||
|
@ -2540,8 +2534,8 @@ function OnMsgLoaded(aUrl)
|
|||
}
|
||||
if (copyToOfflineFolder)
|
||||
{
|
||||
var messages = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
messages.AppendElement(msgHdr);
|
||||
var messages = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
|
||||
messages.appendElement(msgHdr, false);
|
||||
|
||||
res = outputPFC.copyMessages(currentMsgFolder, messages, false /*isMove*/, msgWindow /* nsIMsgWindow */, null /* listener */, false /* isFolder */, false /*allowUndo*/ );
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ function markInDatabase( lower, upper )
|
|||
}
|
||||
|
||||
// the headers which are going to be marked
|
||||
var headers = Components.classes["@mozilla.org/supports-array;1"].createInstance( Components.interfaces.nsISupportsArray );
|
||||
var headers = Components.classes["@mozilla.org/array;1"].createInstance( Components.interfaces.nsIMutableArray );
|
||||
|
||||
// create an enumerator for all messages in the database
|
||||
var enumerator = messageDatabase.EnumerateMessages();
|
||||
|
@ -134,7 +134,7 @@ function markInDatabase( lower, upper )
|
|||
var messageDate = header.date;
|
||||
|
||||
if ( ( lower <= messageDate ) && ( messageDate < upper ) )
|
||||
headers.AppendElement( header );
|
||||
headers.appendElement( header, false );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -142,6 +142,6 @@ function markInDatabase( lower, upper )
|
|||
}
|
||||
}
|
||||
|
||||
if ( headers.Count() )
|
||||
if ( headers.length )
|
||||
messageFolder.markMessagesRead( headers, true );
|
||||
}
|
||||
|
|
|
@ -44,9 +44,6 @@ const nsMsgViewIndex_None = 0xFFFFFFFF;
|
|||
|
||||
/* globals for a particular window */
|
||||
|
||||
var compositeDataSourceContractID = datasourceContractIDPrefix + "composite-datasource";
|
||||
|
||||
var gCompositeDataSource;
|
||||
var gCurrentMessageUri;
|
||||
var gCurrentFolderUri;
|
||||
var gThreadPaneCommandUpdater = null;
|
||||
|
@ -261,7 +258,6 @@ function OnLoadMessageWindow()
|
|||
{
|
||||
AddMailOfflineObserver();
|
||||
CreateMailWindowGlobals();
|
||||
CreateMessageWindowGlobals();
|
||||
AddToolBarPrefListener();
|
||||
ShowHideToolBarButtons()
|
||||
verifyAccounts(null);
|
||||
|
@ -269,7 +265,6 @@ function OnLoadMessageWindow()
|
|||
InitMsgWindow();
|
||||
|
||||
messenger.setWindow(window, msgWindow);
|
||||
InitializeDataSources();
|
||||
// FIX ME - later we will be able to use onload from the overlay
|
||||
OnLoadMsgHeaderPane();
|
||||
|
||||
|
@ -424,20 +419,6 @@ function OnUnloadMessageWindow()
|
|||
OnMailWindowUnload();
|
||||
}
|
||||
|
||||
function CreateMessageWindowGlobals()
|
||||
{
|
||||
gCompositeDataSource = Components.classes[compositeDataSourceContractID].createInstance();
|
||||
gCompositeDataSource = gCompositeDataSource.QueryInterface(Components.interfaces.nsIRDFCompositeDataSource);
|
||||
}
|
||||
|
||||
function InitializeDataSources()
|
||||
{
|
||||
AddDataSources();
|
||||
//Now add datasources to composite datasource
|
||||
gCompositeDataSource.AddDataSource(accountManagerDataSource);
|
||||
gCompositeDataSource.AddDataSource(folderDataSource);
|
||||
}
|
||||
|
||||
function GetSelectedMsgFolders()
|
||||
{
|
||||
var folderArray = new Array(1);
|
||||
|
@ -508,11 +489,6 @@ function ClearMessageSelection()
|
|||
UpdateMailToolbar("clear msg, std alone window");
|
||||
}
|
||||
|
||||
function GetCompositeDataSource(command)
|
||||
{
|
||||
return gCompositeDataSource;
|
||||
}
|
||||
|
||||
function SetNextMessageAfterDelete()
|
||||
{
|
||||
gNextMessageViewIndexAfterDelete = gDBView.msgToSelectAfterDelete;
|
||||
|
|
|
@ -261,7 +261,7 @@ function DropOnFolderTree(row, orientation)
|
|||
trans.addDataFlavor("text/x-moz-newsfolder");
|
||||
trans.addDataFlavor("text/x-moz-url");
|
||||
|
||||
var list = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
var list = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
|
||||
|
||||
var dropMessage;
|
||||
var sourceUri;
|
||||
|
@ -346,18 +346,18 @@ function DropOnFolderTree(row, orientation)
|
|||
if (dropMessage) {
|
||||
// from the message uri, get the appropriate messenger service
|
||||
// and then from that service, get the msgDbHdr
|
||||
list.AppendElement(messenger.msgHdrFromURI(sourceUri));
|
||||
list.appendElement(messenger.msgHdrFromURI(sourceUri), false);
|
||||
}
|
||||
else {
|
||||
// Prevent dropping of a node before, after, or on itself
|
||||
if (sourceResource == targetResource)
|
||||
continue;
|
||||
|
||||
list.AppendElement(sourceResource);
|
||||
list.appendElement(sourceResource, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (list.Count() < 1)
|
||||
if (list.length < 1)
|
||||
return false;
|
||||
|
||||
var isSourceNews = false;
|
||||
|
@ -366,7 +366,7 @@ function DropOnFolderTree(row, orientation)
|
|||
var cs = Components.classes["@mozilla.org/messenger/messagecopyservice;1"]
|
||||
.getService(Components.interfaces.nsIMsgCopyService);
|
||||
if (dropMessage) {
|
||||
var sourceMsgHdr = list.GetElementAt(0).QueryInterface(Components.interfaces.nsIMsgDBHdr);
|
||||
var sourceMsgHdr = list.queryElementAt(0, Components.interfaces.nsIMsgDBHdr);
|
||||
sourceFolder = sourceMsgHdr.folder;
|
||||
sourceResource = sourceFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
sourceServer = sourceFolder.server;
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#include "nsMsgCompCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMsgFilterService, nsIMsgFilterService)
|
||||
|
||||
|
@ -296,7 +298,7 @@ protected:
|
|||
PRUint32 m_numFilters;
|
||||
PRUint32 m_numFolders;
|
||||
nsTArray<nsMsgKey> m_searchHits;
|
||||
nsCOMPtr <nsISupportsArray> m_searchHitHdrs;
|
||||
nsCOMPtr<nsIMutableArray> m_searchHitHdrs;
|
||||
nsCOMPtr <nsIMsgSearchSession> m_searchSession;
|
||||
};
|
||||
|
||||
|
@ -313,7 +315,7 @@ nsMsgFilterAfterTheFact::nsMsgFilterAfterTheFact(nsIMsgWindow *aMsgWindow, nsIMs
|
|||
|
||||
NS_ADDREF(this); // we own ourselves, and will release ourselves when execution is done.
|
||||
|
||||
NS_NewISupportsArray(getter_AddRefs(m_searchHitHdrs));
|
||||
m_searchHitHdrs = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
}
|
||||
|
||||
nsMsgFilterAfterTheFact::~nsMsgFilterAfterTheFact()
|
||||
|
@ -411,7 +413,7 @@ NS_IMETHODIMP nsMsgFilterAfterTheFact::OnSearchHit(nsIMsgDBHdr *header, nsIMsgFo
|
|||
nsMsgKey msgKey;
|
||||
header->GetMessageKey(&msgKey);
|
||||
m_searchHits.AppendElement(msgKey);
|
||||
m_searchHitHdrs->AppendElement(header);
|
||||
m_searchHitHdrs->AppendElement(header, PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -684,7 +686,7 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter()
|
|||
// This action ignores the deleteMailLeftOnServer preference
|
||||
localFolder->MarkMsgsOnPop3Server(m_searchHitHdrs, POP3_FORCE_DEL);
|
||||
|
||||
nsCOMPtr <nsISupportsArray> partialMsgs;
|
||||
nsCOMPtr<nsIMutableArray> partialMsgs;
|
||||
// Delete the partial headers. They're useless now
|
||||
// that the server copy is being deleted.
|
||||
for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
|
||||
|
@ -698,9 +700,9 @@ nsresult nsMsgFilterAfterTheFact::ApplyFilter()
|
|||
if (flags & MSG_FLAG_PARTIAL)
|
||||
{
|
||||
if (!partialMsgs)
|
||||
partialMsgs = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
partialMsgs = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
partialMsgs->AppendElement(msgHdr);
|
||||
partialMsgs->AppendElement(msgHdr, PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "MoreFilesX.h"
|
||||
#endif
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
// necko
|
||||
#include "nsMimeTypes.h"
|
||||
|
@ -2591,10 +2592,11 @@ nsDelAttachListener::OnStartRunningUrl(nsIURI * aUrl)
|
|||
|
||||
nsresult nsDelAttachListener::DeleteOriginalMessage()
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
nsresult rv = NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = messageArray->AppendElement(mOriginalMessage);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = messageArray->AppendElement(mOriginalMessage, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
nsCOMPtr<nsIMsgCopyServiceListener> listenerCopyService;
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include "nsIFile.h"
|
||||
#include "nsIMsgFolderNotificationService.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
// ******************** nsCopySource ******************
|
||||
//
|
||||
|
@ -49,17 +51,15 @@
|
|||
nsCopySource::nsCopySource() : m_processed(PR_FALSE)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsCopySource);
|
||||
nsresult rv;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(m_messageArray));
|
||||
m_messageArray = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
}
|
||||
|
||||
nsCopySource::nsCopySource(nsIMsgFolder* srcFolder) :
|
||||
m_processed(PR_FALSE)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsCopySource);
|
||||
nsresult rv;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(m_messageArray));
|
||||
m_msgFolder = do_QueryInterface(srcFolder, &rv);
|
||||
m_messageArray = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
m_msgFolder = srcFolder;
|
||||
}
|
||||
|
||||
nsCopySource::~nsCopySource()
|
||||
|
@ -69,9 +69,7 @@ nsCopySource::~nsCopySource()
|
|||
|
||||
void nsCopySource::AddMessage(nsIMsgDBHdr* aMsg)
|
||||
{
|
||||
nsCOMPtr<nsISupports> supports(do_QueryInterface(aMsg));
|
||||
if(supports)
|
||||
m_messageArray->AppendElement(supports);
|
||||
m_messageArray->AppendElement(aMsg, PR_FALSE);
|
||||
}
|
||||
|
||||
// ************ nsCopyRequest *****************
|
||||
|
@ -191,19 +189,19 @@ nsMsgCopyService::ClearRequest(nsCopyRequest* aRequest, nsresult rv)
|
|||
notifier->GetHasListeners(&hasListeners);
|
||||
if (hasListeners)
|
||||
{
|
||||
nsCOMPtr <nsISupportsArray> supportsArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
if (supportsArray)
|
||||
nsCOMPtr<nsIMutableArray> folderArray(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
if (folderArray)
|
||||
{
|
||||
// Iterate over the copy sources and append their message arrays to this supports array
|
||||
// Iterate over the copy sources and append their message arrays to this mutable array
|
||||
// or in the case of folders, the source folder.
|
||||
PRInt32 cnt, i;
|
||||
cnt = aRequest->m_copySourceArray.Count();
|
||||
for (i=0; i < cnt; i++)
|
||||
{
|
||||
nsCopySource *copySource = (nsCopySource*) aRequest->m_copySourceArray.ElementAt(i);
|
||||
supportsArray->AppendElement(copySource->m_msgFolder);
|
||||
folderArray->AppendElement(copySource->m_msgFolder, PR_FALSE);
|
||||
}
|
||||
notifier->NotifyItemMoveCopyCompleted(aRequest->m_isMoveOrDraftOrTemplate, supportsArray, aRequest->m_dstFolder);
|
||||
notifier->NotifyItemMoveCopyCompleted(aRequest->m_isMoveOrDraftOrTemplate, folderArray, aRequest->m_dstFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -428,7 +426,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgCopyService, nsIMsgCopyService)
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsMsgCopyService::CopyMessages(nsIMsgFolder* srcFolder, /* UI src folder */
|
||||
nsISupportsArray* messages,
|
||||
nsIArray* messages,
|
||||
nsIMsgFolder* dstFolder,
|
||||
PRBool isMove,
|
||||
nsIMsgCopyServiceListener* listener,
|
||||
|
@ -441,7 +439,7 @@ nsMsgCopyService::CopyMessages(nsIMsgFolder* srcFolder, /* UI src folder */
|
|||
|
||||
nsCopyRequest* copyRequest;
|
||||
nsCopySource* copySource = nsnull;
|
||||
nsCOMPtr<nsISupportsArray> msgArray;
|
||||
nsCOMArray<nsIMsgDBHdr> msgArray;
|
||||
PRUint32 cnt;
|
||||
nsCOMPtr<nsIMsgDBHdr> msg;
|
||||
nsCOMPtr<nsIMsgFolder> curFolder;
|
||||
|
@ -465,27 +463,21 @@ nsMsgCopyService::CopyMessages(nsIMsgFolder* srcFolder, /* UI src folder */
|
|||
if (NS_FAILED(rv))
|
||||
goto done;
|
||||
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(msgArray));
|
||||
if (NS_FAILED(rv))
|
||||
goto done;
|
||||
|
||||
messages->Count(&cnt);
|
||||
messages->GetLength(&cnt);
|
||||
|
||||
// duplicate the message array so we could sort the messages by it's
|
||||
// folder easily
|
||||
msgArray->AppendElements(messages);
|
||||
for (PRUint32 i = 0; i < cnt; i++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> currMsg = do_QueryElementAt(messages, i);
|
||||
msgArray.AppendObject(currMsg);
|
||||
}
|
||||
|
||||
rv = msgArray->Count(&cnt);
|
||||
if (NS_FAILED(rv))
|
||||
goto done;
|
||||
cnt = msgArray.Count();
|
||||
|
||||
while (cnt-- > 0)
|
||||
{
|
||||
msg = do_QueryElementAt(msgArray, cnt, &rv);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
goto done;
|
||||
|
||||
msg = msgArray[cnt];
|
||||
rv = msg->GetFolder(getter_AddRefs(curFolder));
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -503,12 +495,12 @@ nsMsgCopyService::CopyMessages(nsIMsgFolder* srcFolder, /* UI src folder */
|
|||
if (curFolder == copySource->m_msgFolder)
|
||||
{
|
||||
copySource->AddMessage(msg);
|
||||
msgArray->RemoveElementAt(cnt);
|
||||
msgArray.RemoveObjectAt(cnt);
|
||||
}
|
||||
|
||||
if (cnt == 0)
|
||||
{
|
||||
rv = msgArray->Count(&cnt);
|
||||
cnt = msgArray.Count();
|
||||
if (cnt > 0)
|
||||
copySource = nsnull; // * force to create a new one and
|
||||
// * continue grouping the messages
|
||||
|
@ -527,39 +519,37 @@ done:
|
|||
else
|
||||
rv = DoCopy(copyRequest);
|
||||
|
||||
msgArray->Clear();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgCopyService::CopyFolders( nsISupportsArray* folders,
|
||||
nsIMsgFolder* dstFolder,
|
||||
PRBool isMove,
|
||||
nsIMsgCopyServiceListener* listener,
|
||||
nsIMsgWindow* window)
|
||||
nsMsgCopyService::CopyFolders(nsIArray* folders,
|
||||
nsIMsgFolder* dstFolder,
|
||||
PRBool isMove,
|
||||
nsIMsgCopyServiceListener* listener,
|
||||
nsIMsgWindow* window)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(folders);
|
||||
NS_ENSURE_ARG_POINTER(dstFolder);
|
||||
nsCopyRequest* copyRequest;
|
||||
nsCopySource* copySource = nsnull;
|
||||
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||
nsresult rv;
|
||||
PRUint32 cnt;
|
||||
nsCOMPtr<nsIMsgFolder> curFolder;
|
||||
nsCOMPtr<nsISupports> support;
|
||||
|
||||
if (!folders || !dstFolder) return rv;
|
||||
|
||||
rv = folders->Count(&cnt); //if cnt is zero it cannot to get this point, will be detected earlier
|
||||
if ( cnt > 1)
|
||||
rv = folders->GetLength(&cnt); //if cnt is zero it cannot to get this point, will be detected earlier
|
||||
if (cnt > 1)
|
||||
NS_ASSERTION((NS_SUCCEEDED(rv)),"More than one folders to copy");
|
||||
|
||||
support = getter_AddRefs(folders->ElementAt(0));
|
||||
support = do_QueryElementAt(folders, 0);
|
||||
|
||||
copyRequest = new nsCopyRequest();
|
||||
if (!copyRequest) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = copyRequest->Init(nsCopyFoldersType, support, dstFolder,
|
||||
isMove, 0 /* new msg flags, not used */ , listener, window, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
curFolder = do_QueryInterface(support, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsIMsgFolder.h"
|
||||
#include "nsIMsgHdr.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
typedef enum _nsCopyRequestType
|
||||
{
|
||||
|
@ -63,7 +64,7 @@ public:
|
|||
void AddMessage(nsIMsgDBHdr* aMsg);
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> m_msgFolder;
|
||||
nsCOMPtr<nsISupportsArray> m_messageArray;
|
||||
nsCOMPtr<nsIMutableArray> m_messageArray;
|
||||
PRBool m_processed;
|
||||
};
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsITreeColumns.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
nsrefcnt nsMsgDBView::gInstanceCount = 0;
|
||||
|
||||
|
@ -2435,8 +2436,7 @@ nsMsgDBView::CopyMessages(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32
|
|||
|
||||
nsresult rv;
|
||||
NS_ENSURE_ARG_POINTER(destFolder);
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
for (nsMsgViewIndex index = 0; index < (nsMsgViewIndex) numIndices; index++)
|
||||
{
|
||||
nsMsgKey key;
|
||||
|
@ -2448,7 +2448,7 @@ nsMsgDBView::CopyMessages(nsIMsgWindow *window, nsMsgViewIndex *indices, PRInt32
|
|||
rv = m_db->GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
|
||||
if (NS_SUCCEEDED(rv) && msgHdr)
|
||||
{
|
||||
messageArray->AppendElement(msgHdr);
|
||||
messageArray->AppendElement(msgHdr, PR_FALSE);
|
||||
// if we are deleting rows, save off the keys
|
||||
if (m_deletingRows)
|
||||
mIndicesToNoteChange.AppendElement(indices[index]);
|
||||
|
@ -2697,8 +2697,7 @@ nsresult nsMsgDBView::DeleteMessages(nsIMsgWindow *window, nsMsgViewIndex *indic
|
|||
m_deletingRows = PR_TRUE;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
for (nsMsgViewIndex index = 0; index < (nsMsgViewIndex) numIndices; index++)
|
||||
{
|
||||
if (m_flags[indices[index]] & MSG_VIEW_FLAG_DUMMY)
|
||||
|
@ -2708,7 +2707,7 @@ nsresult nsMsgDBView::DeleteMessages(nsIMsgWindow *window, nsMsgViewIndex *indic
|
|||
rv = m_db->GetMsgHdrForKey(key, getter_AddRefs(msgHdr));
|
||||
if (NS_SUCCEEDED(rv) && msgHdr)
|
||||
{
|
||||
messageArray->AppendElement(msgHdr);
|
||||
messageArray->AppendElement(msgHdr, PR_FALSE);
|
||||
// if we are deleting rows, save off the keys
|
||||
if (m_deletingRows)
|
||||
mIndicesToNoteChange.AppendElement(indices[index]);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
* David Bienvenu <bienvenu@nventure.com>
|
||||
* Siddharth Agarwal <sid1337@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -69,6 +70,8 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsArrayEnumerator.h"
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
#define MESSENGER_STRING_URL "chrome://messenger/locale/messenger.properties"
|
||||
|
||||
|
@ -378,7 +381,7 @@ nsresult nsMsgFolderDataSource::CreateArcsOutEnumerator()
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = getFolderArcLabelsOut(getter_AddRefs(kFolderArcsOutArray));
|
||||
rv = getFolderArcLabelsOut(kFolderArcsOutArray);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
return rv;
|
||||
|
@ -585,13 +588,11 @@ NS_IMETHODIMP nsMsgFolderDataSource::ArcLabelsOut(nsIRDFResource* source,
|
|||
nsISimpleEnumerator** labels)
|
||||
{
|
||||
nsresult rv = NS_RDF_NO_VALUE;
|
||||
nsCOMPtr<nsISupportsArray> arcsArray;
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(source, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
arcsArray = kFolderArcsOutArray;
|
||||
rv = NS_NewArrayEnumerator(labels, arcsArray);
|
||||
rv = NS_NewArrayEnumerator(labels, kFolderArcsOutArray);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -602,43 +603,38 @@ NS_IMETHODIMP nsMsgFolderDataSource::ArcLabelsOut(nsIRDFResource* source,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMsgFolderDataSource::getFolderArcLabelsOut(nsISupportsArray **arcs)
|
||||
nsMsgFolderDataSource::getFolderArcLabelsOut(nsCOMArray<nsIRDFResource> &aArcs)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = NS_NewISupportsArray(arcs);
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
(*arcs)->AppendElement(kNC_Name);
|
||||
(*arcs)->AppendElement(kNC_Open);
|
||||
(*arcs)->AppendElement(kNC_FolderTreeName);
|
||||
(*arcs)->AppendElement(kNC_FolderTreeSimpleName);
|
||||
(*arcs)->AppendElement(kNC_SpecialFolder);
|
||||
(*arcs)->AppendElement(kNC_ServerType);
|
||||
(*arcs)->AppendElement(kNC_IsDeferred);
|
||||
(*arcs)->AppendElement(kNC_CanCreateFoldersOnServer);
|
||||
(*arcs)->AppendElement(kNC_CanFileMessagesOnServer);
|
||||
(*arcs)->AppendElement(kNC_IsServer);
|
||||
(*arcs)->AppendElement(kNC_IsSecure);
|
||||
(*arcs)->AppendElement(kNC_CanSubscribe);
|
||||
(*arcs)->AppendElement(kNC_SupportsOffline);
|
||||
(*arcs)->AppendElement(kNC_CanFileMessages);
|
||||
(*arcs)->AppendElement(kNC_CanCreateSubfolders);
|
||||
(*arcs)->AppendElement(kNC_CanRename);
|
||||
(*arcs)->AppendElement(kNC_CanCompact);
|
||||
(*arcs)->AppendElement(kNC_TotalMessages);
|
||||
(*arcs)->AppendElement(kNC_TotalUnreadMessages);
|
||||
(*arcs)->AppendElement(kNC_FolderSize);
|
||||
(*arcs)->AppendElement(kNC_Charset);
|
||||
(*arcs)->AppendElement(kNC_BiffState);
|
||||
(*arcs)->AppendElement(kNC_Child);
|
||||
(*arcs)->AppendElement(kNC_NoSelect);
|
||||
(*arcs)->AppendElement(kNC_VirtualFolder);
|
||||
(*arcs)->AppendElement(kNC_InVFEditSearchScope);
|
||||
(*arcs)->AppendElement(kNC_ImapShared);
|
||||
(*arcs)->AppendElement(kNC_Synchronize);
|
||||
(*arcs)->AppendElement(kNC_SyncDisabled);
|
||||
(*arcs)->AppendElement(kNC_CanSearchMessages);
|
||||
aArcs.AppendObject(kNC_Name);
|
||||
aArcs.AppendObject(kNC_Open);
|
||||
aArcs.AppendObject(kNC_FolderTreeName);
|
||||
aArcs.AppendObject(kNC_FolderTreeSimpleName);
|
||||
aArcs.AppendObject(kNC_SpecialFolder);
|
||||
aArcs.AppendObject(kNC_ServerType);
|
||||
aArcs.AppendObject(kNC_IsDeferred);
|
||||
aArcs.AppendObject(kNC_CanCreateFoldersOnServer);
|
||||
aArcs.AppendObject(kNC_CanFileMessagesOnServer);
|
||||
aArcs.AppendObject(kNC_IsServer);
|
||||
aArcs.AppendObject(kNC_IsSecure);
|
||||
aArcs.AppendObject(kNC_CanSubscribe);
|
||||
aArcs.AppendObject(kNC_SupportsOffline);
|
||||
aArcs.AppendObject(kNC_CanFileMessages);
|
||||
aArcs.AppendObject(kNC_CanCreateSubfolders);
|
||||
aArcs.AppendObject(kNC_CanRename);
|
||||
aArcs.AppendObject(kNC_CanCompact);
|
||||
aArcs.AppendObject(kNC_TotalMessages);
|
||||
aArcs.AppendObject(kNC_TotalUnreadMessages);
|
||||
aArcs.AppendObject(kNC_FolderSize);
|
||||
aArcs.AppendObject(kNC_Charset);
|
||||
aArcs.AppendObject(kNC_BiffState);
|
||||
aArcs.AppendObject(kNC_Child);
|
||||
aArcs.AppendObject(kNC_NoSelect);
|
||||
aArcs.AppendObject(kNC_VirtualFolder);
|
||||
aArcs.AppendObject(kNC_InVFEditSearchScope);
|
||||
aArcs.AppendObject(kNC_ImapShared);
|
||||
aArcs.AppendObject(kNC_Synchronize);
|
||||
aArcs.AppendObject(kNC_SyncDisabled);
|
||||
aArcs.AppendObject(kNC_CanSearchMessages);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -683,16 +679,16 @@ nsMsgFolderDataSource::GetAllCmds(nsIRDFResource* source,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolderDataSource::IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
||||
nsMsgFolderDataSource::IsCommandEnabled(nsIArray/*<nsIRDFResource>*/* aSources,
|
||||
nsIRDFResource* aCommand,
|
||||
nsISupportsArray/*<nsIRDFResource>*/* aArguments,
|
||||
nsIArray/*<nsIRDFResource>*/* aArguments,
|
||||
PRBool* aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgFolder> folder;
|
||||
|
||||
PRUint32 cnt;
|
||||
rv = aSources->Count(&cnt);
|
||||
rv = aSources->GetLength(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
for (PRUint32 i = 0; i < cnt; i++)
|
||||
{
|
||||
|
@ -725,9 +721,9 @@ nsMsgFolderDataSource::IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/* aS
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgFolderDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
||||
nsMsgFolderDataSource::DoCommand(nsIArray/*<nsIRDFResource>*/* aSources,
|
||||
nsIRDFResource* aCommand,
|
||||
nsISupportsArray/*<nsIRDFResource>*/* aArguments)
|
||||
nsIMutableArray/*<nsIRDFResource>*/* aArguments)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
|
@ -738,7 +734,7 @@ nsMsgFolderDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
|||
if (aArguments)
|
||||
{
|
||||
PRUint32 numArgs;
|
||||
aArguments->Count(&numArgs);
|
||||
aArguments->GetLength(&numArgs);
|
||||
if (numArgs > 1)
|
||||
window = do_QueryElementAt(aArguments, numArgs - 1);
|
||||
}
|
||||
|
@ -750,7 +746,7 @@ nsMsgFolderDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
|||
PRUint32 cnt = 0;
|
||||
PRUint32 i = 0;
|
||||
|
||||
rv = aSources->Count(&cnt);
|
||||
rv = aSources->GetLength(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
for ( ; i < cnt; i++)
|
||||
|
@ -1902,39 +1898,32 @@ nsMsgFolderDataSource::createFolderChildNode(nsIMsgFolder *folder,
|
|||
}
|
||||
|
||||
|
||||
nsresult nsMsgFolderDataSource::DoCopyToFolder(nsIMsgFolder *dstFolder, nsISupportsArray *arguments,
|
||||
nsresult nsMsgFolderDataSource::DoCopyToFolder(nsIMsgFolder *dstFolder, nsIArray *arguments,
|
||||
nsIMsgWindow *msgWindow, PRBool isMove)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 itemCount;
|
||||
rv = arguments->Count(&itemCount);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = arguments->GetLength(&itemCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
//need source folder and at least one item to copy
|
||||
if(itemCount < 2)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> srcFolder(do_QueryElementAt(arguments, 0));
|
||||
if(!srcFolder)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
arguments->RemoveElementAt(0);
|
||||
itemCount--;
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
|
||||
for(PRUint32 i = 0; i < itemCount; i++)
|
||||
// Remove first element
|
||||
for(PRUint32 i = 1; i < itemCount; i++)
|
||||
{
|
||||
|
||||
nsCOMPtr<nsISupports> supports = getter_AddRefs(arguments->ElementAt(i));
|
||||
nsCOMPtr<nsIMsgDBHdr> message(do_QueryInterface(supports));
|
||||
nsCOMPtr<nsIMsgDBHdr> message(do_QueryElementAt(arguments, i));
|
||||
if (message)
|
||||
{
|
||||
messageArray->AppendElement(supports);
|
||||
messageArray->AppendElement(message, PR_FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Call copyservice with dstFolder, srcFolder, messages, isMove, and txnManager
|
||||
|
@ -1946,13 +1935,13 @@ nsresult nsMsgFolderDataSource::DoCopyToFolder(nsIMsgFolder *dstFolder, nsISuppo
|
|||
nsnull, msgWindow, PR_TRUE/* allowUndo */);
|
||||
}
|
||||
|
||||
nsresult nsMsgFolderDataSource::DoFolderCopyToFolder(nsIMsgFolder *dstFolder, nsISupportsArray *arguments,
|
||||
nsresult nsMsgFolderDataSource::DoFolderCopyToFolder(nsIMsgFolder *dstFolder, nsIArray *arguments,
|
||||
nsIMsgWindow *msgWindow, PRBool isMoveFolder)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 itemCount;
|
||||
rv = arguments->Count(&itemCount);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = arguments->GetLength(&itemCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
//need at least one item to copy
|
||||
if(itemCount < 1)
|
||||
|
@ -1988,42 +1977,40 @@ nsresult nsMsgFolderDataSource::DoFolderCopyToFolder(nsIMsgFolder *dstFolder, ns
|
|||
//return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMsgFolderDataSource::DoDeleteFromFolder(
|
||||
nsIMsgFolder *folder, nsISupportsArray *arguments,
|
||||
nsresult nsMsgFolderDataSource::DoDeleteFromFolder(nsIMsgFolder *folder, nsIArray *arguments,
|
||||
nsIMsgWindow *msgWindow, PRBool reallyDelete)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 itemCount;
|
||||
rv = arguments->Count(&itemCount);
|
||||
rv = arguments->GetLength(&itemCount);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> messageArray, folderArray;
|
||||
NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
NS_NewISupportsArray(getter_AddRefs(folderArray));
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
nsCOMPtr<nsIMutableArray> folderArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
|
||||
//Split up deleted items into different type arrays to be passed to the folder
|
||||
//for deletion.
|
||||
for(PRUint32 item = 0; item < itemCount; item++)
|
||||
{
|
||||
nsCOMPtr<nsISupports> supports = getter_AddRefs(arguments->ElementAt(item));
|
||||
nsCOMPtr<nsISupports> supports(do_QueryElementAt(arguments, item));
|
||||
nsCOMPtr<nsIMsgDBHdr> deletedMessage(do_QueryInterface(supports));
|
||||
nsCOMPtr<nsIMsgFolder> deletedFolder(do_QueryInterface(supports));
|
||||
if (deletedMessage)
|
||||
{
|
||||
messageArray->AppendElement(supports);
|
||||
messageArray->AppendElement(supports, PR_FALSE);
|
||||
}
|
||||
else if(deletedFolder)
|
||||
{
|
||||
folderArray->AppendElement(supports);
|
||||
folderArray->AppendElement(supports, PR_FALSE);
|
||||
}
|
||||
}
|
||||
PRUint32 cnt;
|
||||
rv = messageArray->Count(&cnt);
|
||||
rv = messageArray->GetLength(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (cnt > 0)
|
||||
rv = folder->DeleteMessages(messageArray, msgWindow, reallyDelete, PR_FALSE, nsnull, PR_TRUE /*allowUndo*/);
|
||||
|
||||
rv = folderArray->Count(&cnt);
|
||||
rv = folderArray->GetLength(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (cnt > 0)
|
||||
{
|
||||
|
@ -2059,7 +2046,7 @@ nsresult nsMsgFolderDataSource::DoDeleteFromFolder(
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMsgFolderDataSource::DoNewFolder(nsIMsgFolder *folder, nsISupportsArray *arguments, nsIMsgWindow *window)
|
||||
nsresult nsMsgFolderDataSource::DoNewFolder(nsIMsgFolder *folder, nsIArray *arguments, nsIMsgWindow *window)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIRDFLiteral> literal = do_QueryElementAt(arguments, 0, &rv);
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
#include "nsITransactionManager.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIMutableArray.h"
|
||||
/**
|
||||
* The mail data source.
|
||||
*/
|
||||
|
@ -110,14 +111,14 @@ public:
|
|||
NS_IMETHOD GetAllCmds(nsIRDFResource* source,
|
||||
nsISimpleEnumerator/*<nsIRDFResource>*/** commands);
|
||||
|
||||
NS_IMETHOD IsCommandEnabled(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
||||
NS_IMETHOD IsCommandEnabled(nsIArray/*<nsIRDFResource>*/* aSources,
|
||||
nsIRDFResource* aCommand,
|
||||
nsISupportsArray/*<nsIRDFResource>*/* aArguments,
|
||||
nsIArray/*<nsIRDFResource>*/* aArguments,
|
||||
PRBool* aResult);
|
||||
|
||||
NS_IMETHOD DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
|
||||
NS_IMETHOD DoCommand(nsIArray/*<nsIRDFResource>*/* aSources,
|
||||
nsIRDFResource* aCommand,
|
||||
nsISupportsArray/*<nsIRDFResource>*/* aArguments);
|
||||
nsIMutableArray/*<nsIRDFResource>*/* aArguments);
|
||||
protected:
|
||||
|
||||
nsresult GetSenderName(nsAutoString& sender, nsAutoString *senderUserName);
|
||||
|
@ -175,18 +176,18 @@ protected:
|
|||
nsIRDFNode **target);
|
||||
nsresult createFolderChildNode(nsIMsgFolder *folder, nsIRDFNode **target);
|
||||
|
||||
nsresult getFolderArcLabelsOut(nsISupportsArray **arcs);
|
||||
nsresult getFolderArcLabelsOut(nsCOMArray<nsIRDFResource> &aArcs);
|
||||
|
||||
nsresult DoDeleteFromFolder(nsIMsgFolder *folder,
|
||||
nsISupportsArray *arguments, nsIMsgWindow *msgWindow, PRBool reallyDelete);
|
||||
nsIArray *arguments, nsIMsgWindow *msgWindow, PRBool reallyDelete);
|
||||
|
||||
nsresult DoCopyToFolder(nsIMsgFolder *dstFolder, nsISupportsArray *arguments,
|
||||
nsresult DoCopyToFolder(nsIMsgFolder *dstFolder, nsIArray *arguments,
|
||||
nsIMsgWindow *msgWindow, PRBool isMove);
|
||||
|
||||
nsresult DoFolderCopyToFolder(nsIMsgFolder *dstFolder, nsISupportsArray *arguments,
|
||||
nsresult DoFolderCopyToFolder(nsIMsgFolder *dstFolder, nsIArray *arguments,
|
||||
nsIMsgWindow *msgWindow, PRBool isMoveFolder);
|
||||
|
||||
nsresult DoNewFolder(nsIMsgFolder *folder, nsISupportsArray *arguments,
|
||||
nsresult DoNewFolder(nsIMsgFolder *folder, nsIArray *arguments,
|
||||
nsIMsgWindow *window);
|
||||
|
||||
nsresult DoFolderAssert(nsIMsgFolder *folder, nsIRDFResource *property, nsIRDFNode *target);
|
||||
|
@ -292,7 +293,7 @@ protected:
|
|||
static nsIAtom* kCanFileMessagesAtom;
|
||||
static nsIAtom* kInVFEditSearchScopeAtom;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> kFolderArcsOutArray;
|
||||
nsCOMArray<nsIRDFResource> kFolderArcsOutArray;
|
||||
|
||||
static PRUnichar* kKiloByteString;
|
||||
static PRUnichar* kMegaByteString;
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
|
||||
#include "msgCore.h"
|
||||
#include "nsMsgFolderNotificationService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIArray.h"
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
//
|
||||
// nsMsgFolderNotificationService
|
||||
|
@ -103,20 +104,22 @@ NS_IMETHODIMP nsMsgFolderNotificationService::NotifyItemDeleted(nsISupports *aIt
|
|||
PRInt32 count = m_listeners.Count();
|
||||
|
||||
// this might be an array of items - use QI to find out.
|
||||
nsCOMPtr <nsISupportsArray> itemArray = do_QueryInterface(aItem);
|
||||
nsCOMPtr <nsIArray> itemArray = do_QueryInterface(aItem);
|
||||
for(PRInt32 i = 0; i < count; i++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolderListener> listener = m_listeners[i];
|
||||
NS_ASSERTION(listener, "listener is null");
|
||||
if (!listener)
|
||||
if (!listener)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (itemArray)
|
||||
{
|
||||
PRUint32 cnt;
|
||||
itemArray->Count(&cnt);
|
||||
for (PRUint32 i = 0; i < cnt; i++)
|
||||
PRUint32 len;
|
||||
itemArray->GetLength(&len);
|
||||
for (PRUint32 i = 0; i < len; i++)
|
||||
{
|
||||
nsCOMPtr <nsISupports> supports = do_QueryElementAt(itemArray, i);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISupports> supports = do_QueryElementAt(itemArray, i, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (supports)
|
||||
listener->ItemDeleted(supports);
|
||||
}
|
||||
|
@ -129,7 +132,7 @@ NS_IMETHODIMP nsMsgFolderNotificationService::NotifyItemDeleted(nsISupports *aIt
|
|||
}
|
||||
|
||||
/* void notifyItemMoveCopyCompleted (in boolean aMove, in nsISupportsArray aSrcItems, in nsIMsgFolder aDestFolder); */
|
||||
NS_IMETHODIMP nsMsgFolderNotificationService::NotifyItemMoveCopyCompleted(PRBool aMove, nsISupportsArray *aSrcItems, nsIMsgFolder *aDestFolder)
|
||||
NS_IMETHODIMP nsMsgFolderNotificationService::NotifyItemMoveCopyCompleted(PRBool aMove, nsIArray *aSrcItems, nsIMsgFolder *aDestFolder)
|
||||
{
|
||||
PRInt32 count = m_listeners.Count();
|
||||
|
||||
|
|
|
@ -441,13 +441,13 @@ nsresult nsMsgPurgeService::SearchFolderToPurge(nsIMsgFolder *folder, PRInt32 pu
|
|||
// create mHdrsToDelete array (if not previously created)
|
||||
if (!mHdrsToDelete)
|
||||
{
|
||||
mHdrsToDelete = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
mHdrsToDelete = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else
|
||||
{
|
||||
PRUint32 count;
|
||||
mHdrsToDelete->Count(&count);
|
||||
mHdrsToDelete->GetLength(&count);
|
||||
NS_ASSERTION(count == 0, "mHdrsToDelete is not empty");
|
||||
if (count > 0)
|
||||
mHdrsToDelete->Clear(); // this shouldn't happen
|
||||
|
@ -499,7 +499,7 @@ NS_IMETHODIMP nsMsgPurgeService::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder
|
|||
|
||||
if (atoi(junkScoreStr.get()) == nsIJunkMailPlugin::IS_SPAM_SCORE) {
|
||||
PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("added message to delete"));
|
||||
return mHdrsToDelete->AppendElement(aMsgHdr);
|
||||
return mHdrsToDelete->AppendElement(aMsgHdr, PR_FALSE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ NS_IMETHODIMP nsMsgPurgeService::OnSearchDone(nsresult status)
|
|||
if (NS_SUCCEEDED(status))
|
||||
{
|
||||
PRUint32 count;
|
||||
mHdrsToDelete->Count(&count);
|
||||
mHdrsToDelete->GetLength(&count);
|
||||
PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("%d messages to delete", count));
|
||||
|
||||
if (count > 0) {
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "nsIMsgFolder.h"
|
||||
#include "nsIMsgFolderCache.h"
|
||||
#include "nsIMsgFolderCacheElement.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
class nsMsgPurgeService
|
||||
: public nsIMsgPurgeService,
|
||||
|
@ -76,7 +77,7 @@ protected:
|
|||
nsCOMPtr<nsITimer> mPurgeTimer;
|
||||
nsCOMPtr<nsIMsgSearchSession> mSearchSession;
|
||||
nsCOMPtr<nsIMsgFolder> mSearchFolder;
|
||||
nsCOMPtr<nsISupportsArray> mHdrsToDelete;
|
||||
nsCOMPtr<nsIMutableArray> mHdrsToDelete;
|
||||
nsVoidArray mPurgeArray;
|
||||
PRBool mHaveShutdown;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "nsITreeColumns.h"
|
||||
#include "nsIMsgMessageService.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
nsMsgSearchDBView::nsMsgSearchDBView()
|
||||
{
|
||||
|
@ -456,8 +457,7 @@ nsMsgSearchDBView::GetFoldersAndHdrsForSelection(nsMsgViewIndex *indices, PRInt3
|
|||
{
|
||||
nsCOMPtr <nsIMsgFolder> curFolder =
|
||||
do_QueryElementAt(m_uniqueFoldersSelected, folderIndex, &rv);
|
||||
nsCOMPtr <nsISupportsArray> msgHdrsForOneFolder;
|
||||
NS_NewISupportsArray(getter_AddRefs(msgHdrsForOneFolder));
|
||||
nsCOMPtr<nsIMutableArray> msgHdrsForOneFolder(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
for (nsMsgViewIndex i = 0; i < (nsMsgViewIndex) numIndices; i++)
|
||||
{
|
||||
nsCOMPtr <nsIMsgFolder> msgFolder = do_QueryElementAt(m_folders,
|
||||
|
@ -468,7 +468,7 @@ nsMsgSearchDBView::GetFoldersAndHdrsForSelection(nsMsgViewIndex *indices, PRInt3
|
|||
rv = GetMsgHdrForViewIndex(indices[i],getter_AddRefs(msgHdr));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
nsCOMPtr <nsISupports> hdrSupports = do_QueryInterface(msgHdr);
|
||||
msgHdrsForOneFolder->AppendElement(hdrSupports);
|
||||
msgHdrsForOneFolder->AppendElement(hdrSupports, PR_FALSE);
|
||||
}
|
||||
}
|
||||
nsCOMPtr <nsISupports> supports = do_QueryInterface(msgHdrsForOneFolder, &rv);
|
||||
|
@ -545,7 +545,7 @@ nsresult nsMsgSearchDBView::ProcessRequestsInOneFolder(nsIMsgWindow *window)
|
|||
nsCOMPtr<nsIMsgFolder> curFolder =
|
||||
do_QueryElementAt(m_uniqueFoldersSelected, mCurIndex);
|
||||
NS_ASSERTION(curFolder, "curFolder is null");
|
||||
nsCOMPtr <nsISupportsArray> messageArray =
|
||||
nsCOMPtr<nsIMutableArray> messageArray =
|
||||
do_QueryElementAt(m_hdrsForEachFolder, mCurIndex);
|
||||
NS_ASSERTION(messageArray, "messageArray is null");
|
||||
|
||||
|
@ -581,7 +581,7 @@ nsresult nsMsgSearchDBView::ProcessRequestsInAllFolders(nsIMsgWindow *window)
|
|||
do_QueryElementAt(m_uniqueFoldersSelected, folderIndex);
|
||||
NS_ASSERTION (curFolder, "curFolder is null");
|
||||
|
||||
nsCOMPtr <nsISupportsArray> messageArray =
|
||||
nsCOMPtr<nsIMutableArray> messageArray =
|
||||
do_QueryElementAt(m_hdrsForEachFolder, folderIndex);
|
||||
NS_ASSERTION(messageArray, "messageArray is null");
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "nsIMsgImapMailFolder.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsImapMoveCoalescer, nsIUrlListener)
|
||||
|
||||
|
@ -112,16 +114,14 @@ nsresult nsImapMoveCoalescer::PlaybackMoves(PRBool doNewMailNotification /* = PR
|
|||
if (numKeysToAdd == 0)
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> messages;
|
||||
NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
nsCOMPtr<nsIMutableArray> messages(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
for (PRUint32 keyIndex = 0; keyIndex < keysToAdd.Length(); keyIndex++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> mailHdr = nsnull;
|
||||
rv = m_sourceFolder->GetMessageHeader(keysToAdd.ElementAt(keyIndex), getter_AddRefs(mailHdr));
|
||||
if (NS_SUCCEEDED(rv) && mailHdr)
|
||||
{
|
||||
nsCOMPtr<nsISupports> iSupports = do_QueryInterface(mailHdr);
|
||||
messages->AppendElement(iSupports);
|
||||
messages->AppendElement(mailHdr, PR_FALSE);
|
||||
PRBool isRead = PR_FALSE;
|
||||
mailHdr->GetIsRead(&isRead);
|
||||
if (!isRead)
|
||||
|
|
|
@ -88,6 +88,8 @@
|
|||
#include "nsArrayEnumerator.h"
|
||||
#include <time.h>
|
||||
#include "nsIMsgFolderNotificationService.h"
|
||||
#include "nsIArray.h"
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
#define oneHour 3600000000U
|
||||
#include "nsMsgUtils.h"
|
||||
|
@ -2762,11 +2764,11 @@ NS_IMETHODIMP nsMsgDBFolder::Delete()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::DeleteSubFolders(nsISupportsArray *folders,
|
||||
NS_IMETHODIMP nsMsgDBFolder::DeleteSubFolders(nsIArray *folders,
|
||||
nsIMsgWindow *msgWindow)
|
||||
{
|
||||
PRUint32 count;
|
||||
nsresult rv = folders->Count(&count);
|
||||
nsresult rv = folders->GetLength(&count);
|
||||
for(PRUint32 i = 0; i < count; i++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryElementAt(folders, i, &rv));
|
||||
|
@ -3902,14 +3904,13 @@ nsMsgDBFolder::GetFilePath(nsILocalFile * *aFile)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::MarkMessagesRead(nsISupportsArray *messages, PRBool markRead)
|
||||
nsMsgDBFolder::MarkMessagesRead(nsIArray *messages, PRBool markRead)
|
||||
{
|
||||
PRUint32 count;
|
||||
nsresult rv;
|
||||
|
||||
rv = messages->Count(&count);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = messages->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for(PRUint32 i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -3923,14 +3924,13 @@ nsMsgDBFolder::MarkMessagesRead(nsISupportsArray *messages, PRBool markRead)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::MarkMessagesFlagged(nsISupportsArray *messages, PRBool markFlagged)
|
||||
nsMsgDBFolder::MarkMessagesFlagged(nsIArray *messages, PRBool markFlagged)
|
||||
{
|
||||
PRUint32 count;
|
||||
nsresult rv;
|
||||
|
||||
rv = messages->Count(&count);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = messages->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for(PRUint32 i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -3944,14 +3944,14 @@ nsMsgDBFolder::MarkMessagesFlagged(nsISupportsArray *messages, PRBool markFlagge
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::SetLabelForMessages(nsISupportsArray *aMessages, nsMsgLabelValue aLabel)
|
||||
nsMsgDBFolder::SetLabelForMessages(nsIArray *aMessages, nsMsgLabelValue aLabel)
|
||||
{
|
||||
NS_ENSURE_ARG(aMessages);
|
||||
GetDatabase(nsnull);
|
||||
if (mDatabase)
|
||||
{
|
||||
PRUint32 count;
|
||||
nsresult rv = aMessages->Count(&count);
|
||||
nsresult rv = aMessages->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
for(PRUint32 i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -3967,7 +3967,7 @@ nsMsgDBFolder::SetLabelForMessages(nsISupportsArray *aMessages, nsMsgLabelValue
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::SetJunkScoreForMessages(nsISupportsArray *aMessages, const nsACString& junkScore)
|
||||
nsMsgDBFolder::SetJunkScoreForMessages(nsIArray *aMessages, const nsACString& junkScore)
|
||||
{
|
||||
NS_ENSURE_ARG(aMessages);
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -3975,7 +3975,7 @@ nsMsgDBFolder::SetJunkScoreForMessages(nsISupportsArray *aMessages, const nsACSt
|
|||
if (mDatabase)
|
||||
{
|
||||
PRUint32 count;
|
||||
nsresult rv = aMessages->Count(&count);
|
||||
nsresult rv = aMessages->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for(PRUint32 i = 0; i < count; i++)
|
||||
|
@ -4025,7 +4025,7 @@ nsresult nsMsgDBFolder::ApplyRetentionSettings(PRBool deleteViaFolder)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::DeleteMessages(nsISupportsArray *messages,
|
||||
nsMsgDBFolder::DeleteMessages(nsIArray *messages,
|
||||
nsIMsgWindow *msgWindow,
|
||||
PRBool deleteStorage,
|
||||
PRBool isMove,
|
||||
|
@ -4037,7 +4037,7 @@ nsMsgDBFolder::DeleteMessages(nsISupportsArray *messages,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::CopyMessages(nsIMsgFolder* srcFolder,
|
||||
nsISupportsArray *messages,
|
||||
nsIArray *messages,
|
||||
PRBool isMove,
|
||||
nsIMsgWindow *window,
|
||||
nsIMsgCopyServiceListener* listener,
|
||||
|
@ -4918,7 +4918,7 @@ void nsMsgDBFolder::SetMRUTime()
|
|||
SetStringProperty(MRU_TIME_PROPERTY, nowStr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::AddKeywordsToMessages(nsISupportsArray *aMessages, const nsACString& aKeywords)
|
||||
NS_IMETHODIMP nsMsgDBFolder::AddKeywordsToMessages(nsIArray *aMessages, const nsACString& aKeywords)
|
||||
{
|
||||
NS_ENSURE_ARG(aMessages);
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -4926,7 +4926,7 @@ NS_IMETHODIMP nsMsgDBFolder::AddKeywordsToMessages(nsISupportsArray *aMessages,
|
|||
if (mDatabase)
|
||||
{
|
||||
PRUint32 count;
|
||||
nsresult rv = aMessages->Count(&count);
|
||||
nsresult rv = aMessages->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCString keywords;
|
||||
|
||||
|
@ -4960,7 +4960,7 @@ NS_IMETHODIMP nsMsgDBFolder::AddKeywordsToMessages(nsISupportsArray *aMessages,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::RemoveKeywordsFromMessages(nsISupportsArray *aMessages, const nsACString& aKeywords)
|
||||
NS_IMETHODIMP nsMsgDBFolder::RemoveKeywordsFromMessages(nsIArray *aMessages, const nsACString& aKeywords)
|
||||
{
|
||||
NS_ENSURE_ARG(aMessages);
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -4968,7 +4968,7 @@ NS_IMETHODIMP nsMsgDBFolder::RemoveKeywordsFromMessages(nsISupportsArray *aMessa
|
|||
if (mDatabase)
|
||||
{
|
||||
PRUint32 count;
|
||||
nsresult rv = aMessages->Count(&count);
|
||||
nsresult rv = aMessages->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCString keywords;
|
||||
// If the tag is also a label, we should remove the label too...
|
||||
|
|
|
@ -2433,9 +2433,9 @@ function RemoveDraft()
|
|||
try {
|
||||
if (folder instanceof Components.interfaces.nsIMsgFolder)
|
||||
{
|
||||
var msgs = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
msgs.AppendElement(folder.GetMessageHeader(msgKey));
|
||||
var msgs = Components.classes["@mozilla.org/array;1"]
|
||||
.createInstance(Components.interfaces.nsIMutableArray);
|
||||
msgs.appendElement(folder.GetMessageHeader(msgKey), false);
|
||||
folder.deleteMessages(msgs, null, true, false, null, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
#include "nsIMsgProgress.h"
|
||||
#include "nsMsgFolderFlags.h"
|
||||
#include "nsIMsgDatabase.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
static void GetReplyHeaderInfo(PRInt32* reply_header_type,
|
||||
nsString& reply_header_locale,
|
||||
|
@ -3484,16 +3485,15 @@ nsMsgComposeSendListener::RemoveCurrentDraftMessage(nsIMsgCompose *compObj, PRBo
|
|||
// only do this if it's a drafts or templates folder.
|
||||
if (folderFlags & MSG_FOLDER_FLAG_DRAFTS)
|
||||
{ // build the msg arrary
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveCurrentDraftMessage can't allocate support array.");
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveCurrentDraftMessage can't allocate array.");
|
||||
|
||||
//nsCOMPtr<nsISupports> msgSupport = do_QueryInterface(msgDBHdr, &rv);
|
||||
//NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveCurrentDraftMessage can't get msg header interface pointer.");
|
||||
if (NS_SUCCEEDED(rv) && messageArray)
|
||||
{
|
||||
// ready to delete the msg
|
||||
rv = messageArray->AppendElement(msgDBHdr);
|
||||
rv = messageArray->AppendElement(msgDBHdr, PR_FALSE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "RemoveCurrentDraftMessage can't append msg header to array.");
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = msgFolder->DeleteMessages(messageArray, nsnull, PR_TRUE, PR_FALSE, nsnull, PR_FALSE /*allowUndo*/);
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "nsIMimeConverter.h"
|
||||
#include "nsMsgMimeCID.h"
|
||||
#include "nsComposeStrings.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS3(nsMsgSendLater,
|
||||
nsIMsgSendLater,
|
||||
|
@ -744,12 +745,11 @@ nsresult
|
|||
nsMsgSendLater::DeleteCurrentMessage()
|
||||
{
|
||||
// Get the composition fields interface
|
||||
nsCOMPtr<nsISupportsArray> msgArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
nsCOMPtr<nsIMutableArray> msgArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
if (!msgArray)
|
||||
return NS_ERROR_FACTORY_NOT_LOADED;
|
||||
|
||||
nsCOMPtr<nsISupports> msgSupport = do_QueryInterface(mMessage);
|
||||
msgArray->InsertElementAt(msgSupport, 0);
|
||||
msgArray->InsertElementAt(mMessage, 0, PR_FALSE);
|
||||
nsresult res = mMessageFolder->DeleteMessages(msgArray, nsnull, PR_TRUE, PR_FALSE, nsnull, PR_FALSE /*allowUndo*/);
|
||||
if (NS_FAILED(res))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsIDBChangeAnnouncer.h"
|
||||
#include "nsMsgMessageFlags.h"
|
||||
#include "nsIMsgFolder.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsDBFolderInfo.h"
|
||||
#include "nsICollation.h"
|
||||
#include "nsIMimeConverter.h"
|
||||
|
@ -225,9 +225,9 @@ protected:
|
|||
nsCOMPtr <nsIMsgDownloadSettings> m_downloadSettings;
|
||||
|
||||
nsresult PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs, PRBool keepUnreadMessagesOnly,
|
||||
nsISupportsArray *hdrsToDelete);
|
||||
nsIMutableArray *hdrsToDelete);
|
||||
nsresult PurgeExcessMessages(PRUint32 numHeadersToKeep, PRBool keepUnreadMessagesOnly,
|
||||
nsISupportsArray *hdrsToDelete);
|
||||
nsIMutableArray *hdrsToDelete);
|
||||
|
||||
// mdb bookkeeping stuff
|
||||
virtual nsresult InitExistingDB();
|
||||
|
|
|
@ -68,6 +68,8 @@
|
|||
#include "nsIMsgFolderCacheElement.h"
|
||||
#include "MailNewsTypes2.h"
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsIMsgFolderNotificationService.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
#include "nsICollation.h"
|
||||
|
||||
|
@ -4523,10 +4525,10 @@ NS_IMETHODIMP nsMsgDatabase::ApplyRetentionSettings(nsIMsgRetentionSettings *aMs
|
|||
NS_ENSURE_ARG_POINTER(aMsgRetentionSettings);
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr <nsISupportsArray> msgHdrsToDelete;
|
||||
nsCOMPtr <nsIMutableArray> msgHdrsToDelete;
|
||||
if (aDeleteViaFolder)
|
||||
{
|
||||
msgHdrsToDelete = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
msgHdrsToDelete = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsMsgRetainByPreference retainByPreference;
|
||||
|
@ -4568,7 +4570,7 @@ NS_IMETHODIMP nsMsgDatabase::ApplyRetentionSettings(nsIMsgRetentionSettings *aMs
|
|||
if (msgHdrsToDelete)
|
||||
{
|
||||
PRUint32 count;
|
||||
msgHdrsToDelete->Count(&count);
|
||||
msgHdrsToDelete->GetLength(&count);
|
||||
if (count > 0)
|
||||
rv = m_folder->DeleteMessages(msgHdrsToDelete, nsnull, PR_TRUE, PR_FALSE, nsnull, PR_FALSE);
|
||||
}
|
||||
|
@ -4577,7 +4579,7 @@ NS_IMETHODIMP nsMsgDatabase::ApplyRetentionSettings(nsIMsgRetentionSettings *aMs
|
|||
|
||||
nsresult nsMsgDatabase::PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs,
|
||||
PRBool keepUnreadMessagesOnly,
|
||||
nsISupportsArray *hdrsToDelete)
|
||||
nsIMutableArray *hdrsToDelete)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsMsgHdr *pHeader;
|
||||
|
@ -4630,7 +4632,7 @@ nsresult nsMsgDatabase::PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs,
|
|||
pHeader->GetMessageKey(&msgKey);
|
||||
keysToDelete.AppendElement(msgKey);
|
||||
if (hdrsToDelete)
|
||||
hdrsToDelete->AppendElement(pHeader);
|
||||
hdrsToDelete->AppendElement(pHeader, PR_FALSE);
|
||||
}
|
||||
NS_RELEASE(pHeader);
|
||||
}
|
||||
|
@ -4648,7 +4650,7 @@ nsresult nsMsgDatabase::PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs,
|
|||
}
|
||||
|
||||
nsresult nsMsgDatabase::PurgeExcessMessages(PRUint32 numHeadersToKeep, PRBool keepUnreadMessagesOnly,
|
||||
nsISupportsArray *hdrsToDelete)
|
||||
nsIMutableArray *hdrsToDelete)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsMsgHdr *pHeader;
|
||||
|
@ -4692,7 +4694,7 @@ nsresult nsMsgDatabase::PurgeExcessMessages(PRUint32 numHeadersToKeep, PRBool ke
|
|||
keysToDelete.AppendElement(msgKey);
|
||||
numHdrs--;
|
||||
if (hdrsToDelete)
|
||||
hdrsToDelete->AppendElement(pHeader);
|
||||
hdrsToDelete->AppendElement(pHeader, PR_FALSE);
|
||||
}
|
||||
NS_RELEASE(pHeader);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
* Lorenzo Colitti <lorenzo@colitti.com>
|
||||
* Karsten Düsterloh <mnyromyr@tprac.de>
|
||||
* Siddharth Agarwal <sid1337@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -119,6 +120,8 @@
|
|||
#include "nsIExternalProtocolService.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "prprf.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsArrayEnumerator.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
@ -955,11 +958,11 @@ NS_IMETHODIMP nsImapMailFolder::List()
|
|||
NS_IMETHODIMP nsImapMailFolder::RemoveSubFolder (nsIMsgFolder *which)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISupportsArray> folders = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
nsCOMPtr<nsIMutableArray> folders(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
NS_ENSURE_TRUE(folders, rv);
|
||||
nsCOMPtr<nsISupports> folderSupport = do_QueryInterface(which, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
folders->AppendElement(folderSupport);
|
||||
folders->AppendElement(folderSupport, PR_FALSE);
|
||||
rv = nsMsgDBFolder::DeleteSubFolders(folders, nsnull);
|
||||
which->Delete();
|
||||
return rv;
|
||||
|
@ -1683,7 +1686,7 @@ nsImapMailFolder::AddMessageDispositionState(nsIMsgDBHdr *aMessage, nsMsgDisposi
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::MarkMessagesRead(nsISupportsArray *messages, PRBool markRead)
|
||||
nsImapMailFolder::MarkMessagesRead(nsIArray *messages, PRBool markRead)
|
||||
{
|
||||
// tell the folder to do it, which will mark them read in the db.
|
||||
nsresult rv = nsMsgDBFolder::MarkMessagesRead(messages, markRead);
|
||||
|
@ -1703,7 +1706,7 @@ nsImapMailFolder::MarkMessagesRead(nsISupportsArray *messages, PRBool markRead)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::SetLabelForMessages(nsISupportsArray *aMessages, nsMsgLabelValue aLabel)
|
||||
nsImapMailFolder::SetLabelForMessages(nsIArray *aMessages, nsMsgLabelValue aLabel)
|
||||
{
|
||||
NS_ENSURE_ARG(aMessages);
|
||||
|
||||
|
@ -1790,7 +1793,7 @@ NS_IMETHODIMP nsImapMailFolder::WriteToFolderCacheElem(nsIMsgFolderCacheElement
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::MarkMessagesFlagged(nsISupportsArray *messages, PRBool markFlagged)
|
||||
nsImapMailFolder::MarkMessagesFlagged(nsIArray *messages, PRBool markFlagged)
|
||||
{
|
||||
nsresult rv;
|
||||
// tell the folder to do it, which will mark them read in the db.
|
||||
|
@ -1887,7 +1890,7 @@ nsImapMailFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgDatab
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsImapMailFolder::BuildIdsAndKeyArray(nsISupportsArray* messages,
|
||||
nsImapMailFolder::BuildIdsAndKeyArray(nsIArray* messages,
|
||||
nsCString& msgIds,
|
||||
nsTArray<nsMsgKey>& keyArray)
|
||||
{
|
||||
|
@ -1895,7 +1898,7 @@ nsImapMailFolder::BuildIdsAndKeyArray(nsISupportsArray* messages,
|
|||
nsresult rv;
|
||||
PRUint32 count = 0;
|
||||
PRUint32 i;
|
||||
rv = messages->Count(&count);
|
||||
rv = messages->GetLength(&count);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// build up message keys.
|
||||
|
@ -1976,7 +1979,7 @@ nsresult nsImapMailFolder::MarkMessagesImapDeleted(nsTArray<nsMsgKey> *keyArray,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsISupportsArray *messages,
|
||||
NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsIArray *messages,
|
||||
nsIMsgWindow *msgWindow,
|
||||
PRBool deleteStorage, PRBool isMove,
|
||||
nsIMsgCopyServiceListener* listener,
|
||||
|
@ -2058,7 +2061,7 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsISupportsArray *messages,
|
|||
if (deleteModel == nsMsgImapDeleteModels::IMAPDelete && !deleteStorage)
|
||||
{
|
||||
PRUint32 cnt, flags;
|
||||
rv = messages->Count(&cnt);
|
||||
rv = messages->GetLength(&cnt);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
deleteMsgs = PR_FALSE;
|
||||
for (PRUint32 i=0; i <cnt; i++)
|
||||
|
@ -2107,7 +2110,7 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsISupportsArray *messages,
|
|||
nsCOMPtr<nsIMsgFolder> srcFolder;
|
||||
nsCOMPtr<nsISupports>srcSupport;
|
||||
PRUint32 count = 0;
|
||||
rv = messages->Count(&count);
|
||||
rv = messages->GetLength(&count);
|
||||
|
||||
rv = QueryInterface(NS_GET_IID(nsIMsgFolder), getter_AddRefs(srcFolder));
|
||||
nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID, &rv);
|
||||
|
@ -2142,7 +2145,7 @@ nsImapMailFolder::TrashOrDescendentOfTrash(nsIMsgFolder* folder)
|
|||
return PR_FALSE;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::DeleteSubFolders(nsISupportsArray* folders, nsIMsgWindow *msgWindow)
|
||||
nsImapMailFolder::DeleteSubFolders(nsIMutableArray* folders, nsIMsgWindow *msgWindow)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> curFolder;
|
||||
nsCOMPtr<nsIUrlListener> urlListener;
|
||||
|
@ -2155,7 +2158,7 @@ nsImapMailFolder::DeleteSubFolders(nsISupportsArray* folders, nsIMsgWindow *msgW
|
|||
PRBool confirmed = PR_FALSE;
|
||||
PRBool confirmDeletion = PR_TRUE;
|
||||
|
||||
(void) folders->Count(&folderCount);
|
||||
folders->GetLength(&folderCount);
|
||||
|
||||
for (i = folderCount - 1; i >= 0; i--)
|
||||
{
|
||||
|
@ -3082,9 +3085,9 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindo
|
|||
msgHdr->OrFlags(MSG_FLAG_MDN_REPORT_SENT, &newFlags);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsArray> messageArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
NS_ENSURE_TRUE(messageArray, rv);
|
||||
messageArray->AppendElement(msgHdr);
|
||||
messageArray->AppendElement(msgHdr, PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> dstFolder;
|
||||
rv = GetExistingFolder(actionTargetFolderUri, getter_AddRefs(dstFolder));
|
||||
|
@ -3146,9 +3149,9 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindo
|
|||
{
|
||||
nsCString keyword;
|
||||
filterAction->GetStrValue(keyword);
|
||||
nsCOMPtr<nsISupportsArray> messageArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
NS_ENSURE_TRUE(messageArray, rv);
|
||||
messageArray->AppendElement(msgHdr);
|
||||
messageArray->AppendElement(msgHdr, PR_FALSE);
|
||||
AddKeywordsToMessages(messageArray, keyword);
|
||||
break;
|
||||
}
|
||||
|
@ -3762,7 +3765,7 @@ nsImapMailFolder::SetupMsgWriteStream(nsIFile * aFile, PRBool addDummyEnvelope)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *window)
|
||||
NS_IMETHODIMP nsImapMailFolder::DownloadMessagesForOffline(nsIArray *messages, nsIMsgWindow *window)
|
||||
{
|
||||
nsCAutoString messageIds;
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
|
@ -5756,7 +5759,7 @@ nsImapMailFolder::SetUrlState(nsIImapProtocol* aProtocol,
|
|||
// used when copying from local mail folder, or other imap server)
|
||||
nsresult
|
||||
nsImapMailFolder::CopyMessagesWithStream(nsIMsgFolder* srcFolder,
|
||||
nsISupportsArray* messages,
|
||||
nsIArray* messages,
|
||||
PRBool isMove,
|
||||
PRBool isCrossServerOp,
|
||||
nsIMsgWindow *msgWindow,
|
||||
|
@ -5954,7 +5957,7 @@ nsresult nsImapMailFolder::CopyOfflineMsgBody(nsIMsgFolder *srcFolder, nsIMsgDBH
|
|||
// We are either offline, or doing a pseudo-offline delete (where we do an offline
|
||||
// delete, load the next message, then playback the offline delete).
|
||||
nsresult nsImapMailFolder::CopyMessagesOffline(nsIMsgFolder* srcFolder,
|
||||
nsISupportsArray* messages,
|
||||
nsIArray* messages,
|
||||
PRBool isMove,
|
||||
nsIMsgWindow *msgWindow,
|
||||
nsIMsgCopyServiceListener* listener)
|
||||
|
@ -5968,7 +5971,7 @@ nsresult nsImapMailFolder::CopyMessagesOffline(nsIMsgFolder* srcFolder,
|
|||
PRBool deleteToTrash = PR_FALSE;
|
||||
PRBool deleteImmediately = PR_FALSE;
|
||||
PRUint32 srcCount;
|
||||
messages->Count(&srcCount);
|
||||
messages->GetLength(&srcCount);
|
||||
nsCOMPtr<nsIImapIncomingServer> imapServer;
|
||||
rv = GetImapIncomingServer(getter_AddRefs(imapServer));
|
||||
|
||||
|
@ -6211,7 +6214,7 @@ nsresult nsImapMailFolder::CopyMessagesOffline(nsIMsgFolder* srcFolder,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::CopyMessages(nsIMsgFolder* srcFolder,
|
||||
nsISupportsArray* messages,
|
||||
nsIArray* messages,
|
||||
PRBool isMove,
|
||||
nsIMsgWindow *msgWindow,
|
||||
nsIMsgCopyServiceListener* listener,
|
||||
|
@ -6256,7 +6259,7 @@ nsImapMailFolder::CopyMessages(nsIMsgFolder* srcFolder,
|
|||
|
||||
PRUint32 i;
|
||||
|
||||
rv = messages->Count(&count);
|
||||
rv = messages->GetLength(&count);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// make sure database is open to set special flags below
|
||||
|
@ -6511,8 +6514,8 @@ nsImapFolderCopyState::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
|||
|
||||
nsCOMPtr<nsISimpleEnumerator> messages;
|
||||
rv = m_srcFolder->GetMessages(m_msgWindow, getter_AddRefs(messages));
|
||||
nsCOMPtr<nsISupportsArray> msgSupportsArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_TRUE(msgSupportsArray, rv);
|
||||
nsCOMPtr<nsIMutableArray> msgArray(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
NS_ENSURE_TRUE(msgArray, rv);
|
||||
PRBool hasMoreElements;
|
||||
nsCOMPtr<nsISupports> aSupport;
|
||||
|
||||
|
@ -6525,14 +6528,14 @@ nsImapFolderCopyState::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
|||
while (hasMoreElements && NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = messages->GetNext(getter_AddRefs(aSupport));
|
||||
rv = msgSupportsArray->AppendElement(aSupport);
|
||||
rv = msgArray->AppendElement(aSupport, PR_FALSE);
|
||||
messages->HasMoreElements(&hasMoreElements);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = copyService->CopyMessages(m_srcFolder,
|
||||
msgSupportsArray, newMsgFolder,
|
||||
msgArray, newMsgFolder,
|
||||
m_isMoveFolder,
|
||||
this,
|
||||
m_msgWindow,
|
||||
|
@ -6721,7 +6724,7 @@ nsImapMailFolder::CopyFileMessage(nsIFile* file,
|
|||
nsMsgKey key = 0xffffffff;
|
||||
nsCAutoString messageId;
|
||||
nsCOMPtr<nsIUrlListener> urlListener;
|
||||
nsCOMPtr<nsISupportsArray> messages = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
nsCOMPtr<nsIMutableArray> messages(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
nsCOMPtr<nsISupports> srcSupport = do_QueryInterface(file, &rv);
|
||||
|
||||
if (!messages)
|
||||
|
@ -6865,7 +6868,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsImapMailCopyState, nsImapMailCopyState)
|
|||
|
||||
nsresult
|
||||
nsImapMailFolder::InitCopyState(nsISupports* srcSupport,
|
||||
nsISupportsArray* messages,
|
||||
nsIArray* messages,
|
||||
PRBool isMove,
|
||||
PRBool selectedState,
|
||||
PRBool acrossServers,
|
||||
|
@ -6887,8 +6890,8 @@ nsImapMailFolder::InitCopyState(nsISupports* srcSupport,
|
|||
m_copyState->m_srcSupport = do_QueryInterface(srcSupport, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
m_copyState->m_messages = do_QueryInterface(messages, &rv);
|
||||
rv = messages->Count(&m_copyState->m_totalCount);
|
||||
m_copyState->m_messages = messages;
|
||||
rv = messages->GetLength(&m_copyState->m_totalCount);
|
||||
if (!m_copyState->m_isCrossServerOp)
|
||||
{
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -7558,7 +7561,7 @@ nsImapMailFolder::PlaybackCoalescedOperations()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::SetJunkScoreForMessages(nsISupportsArray *aMessages, const nsACString& aJunkScore)
|
||||
nsImapMailFolder::SetJunkScoreForMessages(nsIArray *aMessages, const nsACString& aJunkScore)
|
||||
{
|
||||
NS_ENSURE_ARG(aMessages);
|
||||
|
||||
|
@ -7626,8 +7629,8 @@ nsImapMailFolder::OnMessageClassified(const char * aMsgURI,
|
|||
if (markAsReadOnSpam)
|
||||
{
|
||||
if (!m_junkMessagesToMarkAsRead)
|
||||
m_junkMessagesToMarkAsRead = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
m_junkMessagesToMarkAsRead->AppendElement(msgHdr);
|
||||
m_junkMessagesToMarkAsRead = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
m_junkMessagesToMarkAsRead->AppendElement(msgHdr, PR_FALSE);
|
||||
}
|
||||
|
||||
PRBool willMoveMessage = PR_FALSE;
|
||||
|
@ -7683,12 +7686,12 @@ nsImapMailFolder::OnMessageClassified(const char * aMsgURI,
|
|||
if (m_junkMessagesToMarkAsRead)
|
||||
{
|
||||
PRUint32 count;
|
||||
m_junkMessagesToMarkAsRead->Count(&count);
|
||||
m_junkMessagesToMarkAsRead->GetLength(&count);
|
||||
if (count > 0)
|
||||
{
|
||||
rv = MarkMessagesRead(m_junkMessagesToMarkAsRead, true);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
m_junkMessagesToMarkAsRead->SizeTo(0);
|
||||
m_junkMessagesToMarkAsRead->Clear();
|
||||
}
|
||||
}
|
||||
PRBool pendingMoves = m_moveCoalescer && m_moveCoalescer->HasPendingMoves();
|
||||
|
@ -7843,7 +7846,7 @@ NS_IMETHODIMP nsImapMailFolder::FetchMsgPreviewText(nsMsgKey *aKeysToFetch, PRUi
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::AddKeywordsToMessages(nsISupportsArray *aMessages, const nsACString& aKeywords)
|
||||
NS_IMETHODIMP nsImapMailFolder::AddKeywordsToMessages(nsIArray *aMessages, const nsACString& aKeywords)
|
||||
{
|
||||
nsresult rv = nsMsgDBFolder::AddKeywordsToMessages(aMessages, aKeywords);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -7859,7 +7862,7 @@ NS_IMETHODIMP nsImapMailFolder::AddKeywordsToMessages(nsISupportsArray *aMessage
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::RemoveKeywordsFromMessages(nsISupportsArray *aMessages, const nsACString& aKeywords)
|
||||
NS_IMETHODIMP nsImapMailFolder::RemoveKeywordsFromMessages(nsIArray *aMessages, const nsACString& aKeywords)
|
||||
{
|
||||
nsresult rv = nsMsgDBFolder::RemoveKeywordsFromMessages(aMessages, aKeywords);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "nsIEventTarget.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
class nsImapMoveCoalescer;
|
||||
class nsIMsgIdentity;
|
||||
|
@ -86,7 +87,7 @@ public:
|
|||
virtual ~nsImapMailCopyState();
|
||||
|
||||
nsCOMPtr<nsISupports> m_srcSupport; // source file spec or folder
|
||||
nsCOMPtr<nsISupportsArray> m_messages; // array of source messages
|
||||
nsCOMPtr<nsIArray> m_messages; // array of source messages
|
||||
nsRefPtr<nsMsgTxn> m_undoMsgTxn; // undo object with this copy operation
|
||||
nsCOMPtr<nsIMsgDBHdr> m_message; // current message to be copied
|
||||
nsCOMPtr<nsIMsgCopyServiceListener> m_listener; // listener of this copy
|
||||
|
@ -246,24 +247,24 @@ public:
|
|||
NS_IMETHOD GetCanSubscribe(PRBool *aResult);
|
||||
|
||||
NS_IMETHOD AddMessageDispositionState(nsIMsgDBHdr *aMessage, nsMsgDispositionState aDispositionFlag);
|
||||
NS_IMETHOD MarkMessagesRead(nsISupportsArray *messages, PRBool markRead);
|
||||
NS_IMETHOD MarkMessagesRead(nsIArray *messages, PRBool markRead);
|
||||
NS_IMETHOD MarkAllMessagesRead(void);
|
||||
NS_IMETHOD MarkMessagesFlagged(nsISupportsArray *messages, PRBool markFlagged);
|
||||
NS_IMETHOD MarkMessagesFlagged(nsIArray *messages, PRBool markFlagged);
|
||||
NS_IMETHOD MarkThreadRead(nsIMsgThread *thread);
|
||||
NS_IMETHOD SetLabelForMessages(nsISupportsArray *aMessages, nsMsgLabelValue aLabel);
|
||||
NS_IMETHOD SetJunkScoreForMessages(nsISupportsArray *aMessages, const nsACString& aJunkScore);
|
||||
NS_IMETHOD DeleteSubFolders(nsISupportsArray *folders, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD SetLabelForMessages(nsIArray *aMessages, nsMsgLabelValue aLabel);
|
||||
NS_IMETHOD SetJunkScoreForMessages(nsIArray *aMessages, const nsACString& aJunkScore);
|
||||
NS_IMETHOD DeleteSubFolders(nsIMutableArray *folders, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD ReadFromFolderCacheElem(nsIMsgFolderCacheElement *element);
|
||||
NS_IMETHOD WriteToFolderCacheElem(nsIMsgFolderCacheElement *element);
|
||||
|
||||
NS_IMETHOD GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo,
|
||||
nsIMsgDatabase **db);
|
||||
NS_IMETHOD DeleteMessages(nsISupportsArray *messages,
|
||||
NS_IMETHOD DeleteMessages(nsIArray *messages,
|
||||
nsIMsgWindow *msgWindow, PRBool
|
||||
deleteStorage, PRBool isMove,
|
||||
nsIMsgCopyServiceListener* listener, PRBool allowUndo);
|
||||
NS_IMETHOD CopyMessages(nsIMsgFolder *srcFolder,
|
||||
nsISupportsArray* messages,
|
||||
nsIArray* messages,
|
||||
PRBool isMove, nsIMsgWindow *msgWindow,
|
||||
nsIMsgCopyServiceListener* listener, PRBool isFolder,
|
||||
PRBool allowUndo);
|
||||
|
@ -282,7 +283,7 @@ public:
|
|||
|
||||
NS_IMETHOD Shutdown(PRBool shutdownChildren);
|
||||
|
||||
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD DownloadMessagesForOffline(nsIArray *messages, nsIMsgWindow *msgWindow);
|
||||
|
||||
NS_IMETHOD DownloadAllForOffline(nsIUrlListener *listener, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD GetCanFileMessages(PRBool *aCanFileMessages);
|
||||
|
@ -291,8 +292,8 @@ public:
|
|||
PRBool aLocalOnly, nsIUrlListener *aUrlListener,
|
||||
PRBool *aAsyncResults);
|
||||
|
||||
NS_IMETHOD AddKeywordsToMessages(nsISupportsArray *aMessages, const nsACString& aKeywords);
|
||||
NS_IMETHOD RemoveKeywordsFromMessages(nsISupportsArray *aMessages, const nsACString& aKeywords);
|
||||
NS_IMETHOD AddKeywordsToMessages(nsIArray *aMessages, const nsACString& aKeywords);
|
||||
NS_IMETHOD RemoveKeywordsFromMessages(nsIArray *aMessages, const nsACString& aKeywords);
|
||||
|
||||
NS_DECL_NSIMSGIMAPMAILFOLDER
|
||||
NS_DECL_NSIIMAPMAILFOLDERSINK
|
||||
|
@ -375,7 +376,7 @@ protected:
|
|||
nsresult GetBodysToDownload(nsTArray<nsMsgKey> *keysOfMessagesToDownload);
|
||||
// Uber message copy service
|
||||
nsresult CopyMessagesWithStream(nsIMsgFolder* srcFolder,
|
||||
nsISupportsArray* messages,
|
||||
nsIArray* messages,
|
||||
PRBool isMove,
|
||||
PRBool isCrossServerOp,
|
||||
nsIMsgWindow *msgWindow,
|
||||
|
@ -383,7 +384,7 @@ protected:
|
|||
nsresult CopyStreamMessage(nsIMsgDBHdr* message, nsIMsgFolder* dstFolder,
|
||||
nsIMsgWindow *msgWindow, PRBool isMove);
|
||||
nsresult InitCopyState(nsISupports* srcSupport,
|
||||
nsISupportsArray* messages,
|
||||
nsIArray* messages,
|
||||
PRBool isMove,
|
||||
PRBool selectedState,
|
||||
PRBool acrossServers,
|
||||
|
@ -392,7 +393,7 @@ protected:
|
|||
nsIMsgWindow *msgWindow,
|
||||
PRBool allowUndo);
|
||||
nsresult OnCopyCompleted(nsISupports *srcSupport, nsresult exitCode);
|
||||
nsresult BuildIdsAndKeyArray(nsISupportsArray* messages, nsCString& msgIds, nsTArray<nsMsgKey>& keyArray);
|
||||
nsresult BuildIdsAndKeyArray(nsIArray* messages, nsCString& msgIds, nsTArray<nsMsgKey>& keyArray);
|
||||
nsresult GetMoveCoalescer();
|
||||
nsresult PlaybackCoalescedOperations();
|
||||
virtual nsresult CreateBaseMessageURI(const nsACString& aURI);
|
||||
|
@ -400,7 +401,7 @@ protected:
|
|||
nsresult GetClearedOriginalOp(nsIMsgOfflineImapOperation *op, nsIMsgOfflineImapOperation **originalOp, nsIMsgDatabase **originalDB);
|
||||
nsresult GetOriginalOp(nsIMsgOfflineImapOperation *op, nsIMsgOfflineImapOperation **originalOp, nsIMsgDatabase **originalDB);
|
||||
nsresult CopyMessagesOffline(nsIMsgFolder* srcFolder,
|
||||
nsISupportsArray* messages,
|
||||
nsIArray* messages,
|
||||
PRBool isMove,
|
||||
nsIMsgWindow *msgWindow,
|
||||
nsIMsgCopyServiceListener* listener);
|
||||
|
@ -420,7 +421,7 @@ protected:
|
|||
PRInt32 m_numFilterClassifyRequests;
|
||||
PRBool m_msgMovedByFilter;
|
||||
nsImapMoveCoalescer *m_moveCoalescer; // strictly owned by the nsImapMailFolder
|
||||
nsCOMPtr <nsISupportsArray> m_junkMessagesToMarkAsRead;
|
||||
nsCOMPtr<nsIMutableArray> m_junkMessagesToMarkAsRead;
|
||||
nsMsgKey m_curMsgUid;
|
||||
PRUint32 m_uidValidity;
|
||||
PRInt32 m_numStatusRecentMessages; // used to store counts from Status command
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "nsIMsgCopyService.h"
|
||||
#include "nsImapProtocol.h"
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
|
@ -531,10 +532,9 @@ void nsImapOfflineSync::ProcessMoveOperation(nsIMsgOfflineImapOperation *op)
|
|||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr <nsISupportsArray> messages = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
if (messages && NS_SUCCEEDED(rv))
|
||||
nsCOMPtr<nsIMutableArray> messages(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
for (PRUint32 keyIndex = 0; keyIndex < matchingFlagKeys.Length(); keyIndex++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> mailHdr = nsnull;
|
||||
|
@ -559,9 +559,7 @@ void nsImapOfflineSync::ProcessMoveOperation(nsIMsgOfflineImapOperation *op)
|
|||
mailHdr->SetFlags(msgFlags);
|
||||
mailHdr->SetMessageSize(msgSize);
|
||||
}
|
||||
nsCOMPtr<nsISupports> iSupports;
|
||||
iSupports = do_QueryInterface(mailHdr);
|
||||
messages->AppendElement(iSupports);
|
||||
messages->AppendElement(mailHdr, PR_FALSE);
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID, &rv);
|
||||
|
@ -646,19 +644,16 @@ void nsImapOfflineSync::ProcessCopyOperation(nsIMsgOfflineImapOperation *current
|
|||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr <nsISupportsArray> messages = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
|
||||
nsCOMPtr<nsIMutableArray> messages(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
|
||||
if (messages && NS_SUCCEEDED(rv))
|
||||
{
|
||||
NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
for (PRUint32 keyIndex = 0; keyIndex < matchingFlagKeys.Length(); keyIndex++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> mailHdr = nsnull;
|
||||
rv = m_currentFolder->GetMessageHeader(matchingFlagKeys.ElementAt(keyIndex), getter_AddRefs(mailHdr));
|
||||
if (NS_SUCCEEDED(rv) && mailHdr)
|
||||
{
|
||||
nsCOMPtr<nsISupports> iSupports;
|
||||
iSupports = do_QueryInterface(mailHdr);
|
||||
messages->AppendElement(iSupports);
|
||||
messages->AppendElement(mailHdr, PR_FALSE);
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID, &rv);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
interface nsIArray;
|
||||
interface nsIMsgWindow;
|
||||
interface nsIUrlListener;
|
||||
interface nsIMsgDatabase;
|
||||
|
@ -56,7 +56,7 @@ interface nsIMsgCopyServiceListener;
|
|||
struct nsLocalFolderScanState;
|
||||
%}
|
||||
|
||||
[scriptable, uuid(260398bd-9152-4b10-af4e-3126dcd37837)]
|
||||
[scriptable, uuid(dd95a709-3996-4573-84a8-aa936d0dc00c)]
|
||||
interface nsIMsgLocalMailFolder : nsISupports {
|
||||
/**
|
||||
* set the default flags on the subfolders of this folder, such as
|
||||
|
@ -82,7 +82,7 @@ interface nsIMsgLocalMailFolder : nsISupports {
|
|||
void copyAllSubFolders(in nsIMsgFolder srcFolder, in nsIMsgWindow msgWindow, in nsIMsgCopyServiceListener listener );
|
||||
void onCopyCompleted(in nsISupports aSrcSupport, in boolean aMoveCopySucceeded);
|
||||
attribute boolean checkForNewMessagesAfterParsing;
|
||||
[noscript] void markMsgsOnPop3Server(in nsISupportsArray aMessages, in PRInt32 aMark);
|
||||
void markMsgsOnPop3Server(in nsIArray aMessages, in PRInt32 aMark);
|
||||
void refreshSizeOnDisk(); // file size on disk has possibly changed - update and notify
|
||||
|
||||
// this adds a message to the end of the folder, parsing it as it goes, and
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
* Howard Chu <hyc@highlandsun.com>
|
||||
* William Bonnet <wbonnet@on-x.com>
|
||||
* Siddharth Agarwal <sid1337@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -56,6 +57,7 @@
|
|||
#include "nsMsgMessageFlags.h"
|
||||
#include "prprf.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIArray.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsIMailboxService.h"
|
||||
|
@ -107,6 +109,7 @@
|
|||
#include "nsIMsgFolderNotificationService.h"
|
||||
#include "nsReadLine.h"
|
||||
#include "nsLocalStrings.h"
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
static NS_DEFINE_CID(kMailboxServiceCID, NS_MAILBOXSERVICE_CID);
|
||||
|
||||
|
@ -975,7 +978,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Delete()
|
|||
return (isDirectory) ? pathFile->Remove(PR_TRUE) : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgLocalMailFolder::DeleteSubFolders(nsISupportsArray *folders, nsIMsgWindow *msgWindow)
|
||||
NS_IMETHODIMP nsMsgLocalMailFolder::DeleteSubFolders(nsIArray *folders, nsIMsgWindow *msgWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool isChildOfTrash;
|
||||
|
@ -1375,7 +1378,7 @@ nsMsgLocalMailFolder::GetTrashFolder(nsIMsgFolder** result)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::DeleteMessages(nsISupportsArray *messages,
|
||||
nsMsgLocalMailFolder::DeleteMessages(nsIArray *messages,
|
||||
nsIMsgWindow *msgWindow,
|
||||
PRBool deleteStorage, PRBool isMove,
|
||||
nsIMsgCopyServiceListener* listener, PRBool allowUndo)
|
||||
|
@ -1383,9 +1386,8 @@ nsMsgLocalMailFolder::DeleteMessages(nsISupportsArray *messages,
|
|||
NS_ENSURE_ARG_POINTER(messages);
|
||||
|
||||
PRUint32 messageCount;
|
||||
nsresult rv = messages->Count(&messageCount);
|
||||
if (!messageCount)
|
||||
return rv;
|
||||
nsresult rv = messages->GetLength(&messageCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// shift delete case - (delete to trash is handled in EndMove)
|
||||
// this is also the case when applying retention settings.
|
||||
|
@ -1431,7 +1433,7 @@ nsMsgLocalMailFolder::DeleteMessages(nsISupportsArray *messages,
|
|||
{
|
||||
for(PRUint32 i = 0; i < messageCount; i++)
|
||||
{
|
||||
msgSupport = getter_AddRefs(messages->ElementAt(i));
|
||||
msgSupport = do_QueryElementAt(messages, i, &rv);
|
||||
if (msgSupport)
|
||||
DeleteMessage(msgSupport, msgWindow, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
|
@ -1454,7 +1456,7 @@ nsMsgLocalMailFolder::DeleteMessages(nsISupportsArray *messages,
|
|||
|
||||
nsresult
|
||||
nsMsgLocalMailFolder::InitCopyState(nsISupports* aSupport,
|
||||
nsISupportsArray* messages,
|
||||
nsIArray* messages,
|
||||
PRBool isMove,
|
||||
nsIMsgCopyServiceListener* listener,
|
||||
nsIMsgWindow *msgWindow, PRBool isFolder,
|
||||
|
@ -1504,14 +1506,13 @@ nsMsgLocalMailFolder::InitCopyState(nsISupports* aSupport,
|
|||
seekableStream->Seek(nsISeekableStream::NS_SEEK_END, 0);
|
||||
mCopyState->m_srcSupport = do_QueryInterface(aSupport, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mCopyState->m_messages = do_QueryInterface(messages, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mCopyState->m_messages = messages;
|
||||
mCopyState->m_curCopyIndex = 0;
|
||||
mCopyState->m_isMove = isMove;
|
||||
mCopyState->m_isFolder = isFolder;
|
||||
mCopyState->m_allowUndo = allowUndo;
|
||||
mCopyState->m_msgWindow = msgWindow;
|
||||
rv = messages->Count(&mCopyState->m_totalMsgCount);
|
||||
rv = messages->GetLength(&mCopyState->m_totalMsgCount);
|
||||
if (listener)
|
||||
mCopyState->m_listener = do_QueryInterface(listener, &rv);
|
||||
mCopyState->m_copyingMultipleMessages = PR_FALSE;
|
||||
|
@ -1552,15 +1553,11 @@ nsMsgLocalMailFolder::OnCopyCompleted(nsISupports *srcSupport, PRBool moveCopySu
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMsgLocalMailFolder::SortMessagesBasedOnKey(nsISupportsArray *messages, nsTArray<nsMsgKey> &aKeyArray, nsIMsgFolder *srcFolder)
|
||||
nsMsgLocalMailFolder::SortMessagesBasedOnKey(nsTArray<nsMsgKey> &aKeyArray, nsIMsgFolder *srcFolder, nsIMutableArray* messages)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 numMessages = 0;
|
||||
rv = messages->Count(&numMessages);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
NS_ASSERTION ((numMessages == aKeyArray.Length()), "message array and key array size are not same");
|
||||
rv = messages->Clear();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
PRUint32 numMessages = aKeyArray.Length();
|
||||
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
nsCOMPtr<nsIDBFolderInfo> folderInfo;
|
||||
nsCOMPtr<nsIMsgDatabase> db;
|
||||
|
@ -1571,13 +1568,13 @@ nsMsgLocalMailFolder::SortMessagesBasedOnKey(nsISupportsArray *messages, nsTArra
|
|||
rv = db->GetMsgHdrForKey(aKeyArray[i], getter_AddRefs(msgHdr));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
if (msgHdr)
|
||||
messages->AppendElement(msgHdr);
|
||||
messages->AppendElement(msgHdr, PR_FALSE);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::CopyMessages(nsIMsgFolder* srcFolder, nsISupportsArray*
|
||||
nsMsgLocalMailFolder::CopyMessages(nsIMsgFolder* srcFolder, nsIArray*
|
||||
messages, PRBool isMove,
|
||||
nsIMsgWindow *msgWindow,
|
||||
nsIMsgCopyServiceListener* listener,
|
||||
|
@ -1614,7 +1611,7 @@ nsMsgLocalMailFolder::CopyMessages(nsIMsgFolder* srcFolder, nsISupportsArray*
|
|||
if (WeAreOffline() && (protocolType.LowerCaseEqualsLiteral("imap") || protocolType.LowerCaseEqualsLiteral("news")))
|
||||
{
|
||||
PRUint32 numMessages = 0;
|
||||
messages->Count(&numMessages);
|
||||
messages->GetLength(&numMessages);
|
||||
for (PRUint32 i = 0; i < numMessages; i++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> message;
|
||||
|
@ -1639,7 +1636,34 @@ nsMsgLocalMailFolder::CopyMessages(nsIMsgFolder* srcFolder, nsISupportsArray*
|
|||
// don't update the counts in the dest folder until it is all over
|
||||
EnableNotifications(allMessageCountNotifications, PR_FALSE, PR_FALSE /*dbBatching*/); //dest folder doesn't need db batching
|
||||
|
||||
rv = InitCopyState(srcSupport, messages, isMove, listener, msgWindow, isFolder, allowUndo);
|
||||
// sort the message array by key
|
||||
PRUint32 numMsgs = 0;
|
||||
messages->GetLength(&numMsgs);
|
||||
nsTArray<nsMsgKey> keyArray(numMsgs);
|
||||
if (numMsgs > 1)
|
||||
{
|
||||
for (PRUint32 i = 0; i < numMsgs; i++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> aMessage = do_QueryElementAt(messages, i, &rv);
|
||||
if(NS_SUCCEEDED(rv) && aMessage)
|
||||
{
|
||||
nsMsgKey key;
|
||||
aMessage->GetMessageKey(&key);
|
||||
keyArray.AppendElement(key);
|
||||
}
|
||||
}
|
||||
|
||||
keyArray.Sort();
|
||||
|
||||
nsCOMPtr<nsIMutableArray> sortedMsgs(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
rv = SortMessagesBasedOnKey(keyArray, srcFolder, sortedMsgs);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = InitCopyState(srcSupport, sortedMsgs, isMove, listener, msgWindow, isFolder, allowUndo);
|
||||
}
|
||||
else
|
||||
rv = InitCopyState(srcSupport, messages, isMove, listener, msgWindow, isFolder, allowUndo);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
ThrowAlertMsg("operationFailedFolderBusy", msgWindow);
|
||||
|
@ -1690,12 +1714,11 @@ nsMsgLocalMailFolder::CopyMessages(nsIMsgFolder* srcFolder, nsISupportsArray*
|
|||
msgTxn->SetTransactionType(nsIMessenger::eCopyMsg);
|
||||
}
|
||||
}
|
||||
PRUint32 numMsgs = 0;
|
||||
mCopyState->m_messages->Count(&numMsgs);
|
||||
|
||||
if (numMsgs > 1 && ((protocolType.LowerCaseEqualsLiteral("imap") && !WeAreOffline()) || protocolType.LowerCaseEqualsLiteral("mailbox")))
|
||||
{
|
||||
mCopyState->m_copyingMultipleMessages = PR_TRUE;
|
||||
rv = CopyMessagesTo(mCopyState->m_messages, msgWindow, this, isMove);
|
||||
rv = CopyMessagesTo(mCopyState->m_messages, keyArray, msgWindow, this, isMove);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
NS_ERROR("copy message failed");
|
||||
|
@ -1704,8 +1727,7 @@ nsMsgLocalMailFolder::CopyMessages(nsIMsgFolder* srcFolder, nsISupportsArray*
|
|||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsISupports> msgSupport;
|
||||
msgSupport = getter_AddRefs(mCopyState->m_messages->ElementAt(0));
|
||||
nsCOMPtr<nsISupports> msgSupport = do_QueryElementAt(mCopyState->m_messages, 0);
|
||||
if (msgSupport)
|
||||
{
|
||||
rv = CopyMessageTo(msgSupport, this, msgWindow, isMove);
|
||||
|
@ -1752,8 +1774,7 @@ nsMsgLocalMailFolder::CopyFolderAcrossServer(nsIMsgFolder* srcFolder, nsIMsgWind
|
|||
nsCOMPtr<nsISimpleEnumerator> messages;
|
||||
rv = srcFolder->GetMessages(msgWindow, getter_AddRefs(messages));
|
||||
|
||||
nsCOMPtr<nsISupportsArray> msgSupportsArray;
|
||||
NS_NewISupportsArray(getter_AddRefs(msgSupportsArray));
|
||||
nsCOMPtr<nsIMutableArray> msgArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
|
||||
PRBool hasMoreElements;
|
||||
nsCOMPtr<nsISupports> aSupport;
|
||||
|
@ -1764,15 +1785,15 @@ nsMsgLocalMailFolder::CopyFolderAcrossServer(nsIMsgFolder* srcFolder, nsIMsgWind
|
|||
while (hasMoreElements && NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = messages->GetNext(getter_AddRefs(aSupport));
|
||||
rv = msgSupportsArray->AppendElement(aSupport);
|
||||
rv = msgArray->AppendElement(aSupport, PR_FALSE);
|
||||
messages->HasMoreElements(&hasMoreElements);
|
||||
}
|
||||
|
||||
PRUint32 numMsgs=0;
|
||||
msgSupportsArray->Count(&numMsgs);
|
||||
msgArray->GetLength(&numMsgs);
|
||||
|
||||
if (numMsgs > 0 ) //if only srcFolder has messages..
|
||||
newMsgFolder->CopyMessages(srcFolder, msgSupportsArray, PR_FALSE, msgWindow, listener, PR_TRUE /* is folder*/, PR_FALSE /* allowUndo */);
|
||||
newMsgFolder->CopyMessages(srcFolder, msgArray, PR_FALSE, msgWindow, listener, PR_TRUE /* is folder*/, PR_FALSE /* allowUndo */);
|
||||
else
|
||||
{
|
||||
nsCOMPtr <nsIMsgLocalMailFolder> localFolder = do_QueryInterface(newMsgFolder);
|
||||
|
@ -1992,11 +2013,11 @@ nsMsgLocalMailFolder::CopyFolderLocal(nsIMsgFolder *srcFolder,
|
|||
notifier->GetHasListeners(&hasListeners);
|
||||
if (hasListeners)
|
||||
{
|
||||
nsCOMPtr <nsISupportsArray> supportsArray = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
if (supportsArray)
|
||||
nsCOMPtr<nsIMutableArray> folderArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
if (folderArray)
|
||||
{
|
||||
supportsArray->AppendElement(srcFolder);
|
||||
notifier->NotifyItemMoveCopyCompleted(isMoveFolder, supportsArray, this);
|
||||
folderArray->AppendElement(srcFolder, PR_FALSE);
|
||||
notifier->NotifyItemMoveCopyCompleted(isMoveFolder, folderArray, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2068,15 +2089,10 @@ nsMsgLocalMailFolder::CopyFileMessage(nsIFile* aFile, nsIMsgDBHdr*
|
|||
PRUint32 fileSize = 0;
|
||||
nsCOMPtr<nsISupports> fileSupport(do_QueryInterface(aFile, &rv));
|
||||
|
||||
nsCOMPtr<nsISupportsArray> messages;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
nsCOMPtr<nsIMutableArray> messages(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
|
||||
if (msgToReplace)
|
||||
{
|
||||
nsCOMPtr<nsISupports> msgSupport(do_QueryInterface(msgToReplace, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
messages->AppendElement(msgSupport);
|
||||
}
|
||||
messages->AppendElement(msgToReplace, PR_FALSE);
|
||||
|
||||
rv = InitCopyState(fileSupport, messages, msgToReplace ? PR_TRUE:PR_FALSE,
|
||||
listener, msgWindow, PR_FALSE, PR_FALSE);
|
||||
|
@ -2539,9 +2555,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndCopy(PRBool copySucceeded)
|
|||
{
|
||||
// CopyMessages() goes here; CopyFileMessage() never gets in here because
|
||||
// curCopyIndex will always be less than the mCopyState->m_totalMsgCount
|
||||
nsCOMPtr<nsISupports> aSupport =
|
||||
getter_AddRefs(mCopyState->m_messages->ElementAt
|
||||
(mCopyState->m_curCopyIndex));
|
||||
nsCOMPtr<nsISupports> aSupport = do_QueryElementAt(mCopyState->m_messages, mCopyState->m_curCopyIndex);
|
||||
rv = CopyMessageTo(aSupport, this, mCopyState->m_msgWindow, mCopyState->m_isMove);
|
||||
}
|
||||
else
|
||||
|
@ -2769,7 +2783,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndMessage(nsMsgKey key)
|
|||
}
|
||||
|
||||
|
||||
nsresult nsMsgLocalMailFolder::CopyMessagesTo(nsISupportsArray *messages,
|
||||
nsresult nsMsgLocalMailFolder::CopyMessagesTo(nsIArray *messages, nsTArray<nsMsgKey> &keyArray,
|
||||
nsIMsgWindow *aMsgWindow, nsIMsgFolder *dstFolder,
|
||||
PRBool isMove)
|
||||
{
|
||||
|
@ -2800,23 +2814,6 @@ nsresult nsMsgLocalMailFolder::CopyMessagesTo(nsISupportsArray *messages,
|
|||
|
||||
if (NS_SUCCEEDED(rv) && mCopyState->m_messageService)
|
||||
{
|
||||
PRUint32 numMessages = 0;
|
||||
messages->Count(&numMessages);
|
||||
nsTArray<nsMsgKey> keyArray(numMessages);
|
||||
for (PRUint32 i = 0; i < numMessages; i++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> aMessage = do_QueryElementAt(messages, i, &rv);
|
||||
if(NS_SUCCEEDED(rv) && aMessage)
|
||||
{
|
||||
nsMsgKey key;
|
||||
aMessage->GetMessageKey(&key);
|
||||
keyArray.AppendElement(key);
|
||||
}
|
||||
}
|
||||
keyArray.Sort();
|
||||
rv = SortMessagesBasedOnKey(messages, keyArray, srcFolder);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIStreamListener> streamListener(do_QueryInterface(copyStreamListener, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_NO_INTERFACE);
|
||||
|
||||
|
@ -2884,7 +2881,7 @@ nsresult nsMsgLocalMailFolder::CopyMessageTo(nsISupports *message,
|
|||
// The next time we look at mail the message will be deleted from the server.
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::MarkMsgsOnPop3Server(nsISupportsArray *aMessages, PRInt32 aMark)
|
||||
nsMsgLocalMailFolder::MarkMsgsOnPop3Server(nsIArray *aMessages, PRInt32 aMark)
|
||||
{
|
||||
nsLocalFolderScanState folderScanState;
|
||||
nsCOMPtr<nsIPop3IncomingServer> curFolderPop3MailServer;
|
||||
|
@ -2905,7 +2902,7 @@ nsMsgLocalMailFolder::MarkMsgsOnPop3Server(nsISupportsArray *aMessages, PRInt32
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
PRUint32 srcCount;
|
||||
aMessages->Count(&srcCount);
|
||||
aMessages->GetLength(&srcCount);
|
||||
|
||||
// Filter delete requests are always honored, others are subject
|
||||
// to the deleteMailLeftOnServer preference.
|
||||
|
@ -3053,7 +3050,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::SelectDownloadMsg()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgLocalMailFolder::DownloadMessagesForOffline(nsISupportsArray *aMessages, nsIMsgWindow *aWindow)
|
||||
NS_IMETHODIMP nsMsgLocalMailFolder::DownloadMessagesForOffline(nsIArray *aMessages, nsIMsgWindow *aWindow)
|
||||
{
|
||||
if (mDownloadState != DOWNLOAD_STATE_NONE)
|
||||
return NS_ERROR_FAILURE; // already has a download in progress
|
||||
|
@ -3065,7 +3062,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::DownloadMessagesForOffline(nsISupportsArray
|
|||
|
||||
// Pull out all the PARTIAL messages into a new array
|
||||
PRUint32 srcCount;
|
||||
aMessages->Count(&srcCount);
|
||||
aMessages->GetLength(&srcCount);
|
||||
|
||||
nsresult rv;
|
||||
NS_NewISupportsArray(getter_AddRefs(mDownloadMessages));
|
||||
|
@ -3534,17 +3531,13 @@ nsMsgLocalMailFolder::OnMessageClassified(const char *aMsgURI,
|
|||
nsCOMPtr<nsIMsgFolder> folder;
|
||||
rv = GetExistingFolder(mSpamFolderURI, getter_AddRefs(folder));
|
||||
if (NS_SUCCEEDED(rv) && folder) {
|
||||
nsCOMPtr<nsISupportsArray> messages;
|
||||
NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
nsCOMPtr<nsIMutableArray> messages(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
for (PRUint32 keyIndex = 0; keyIndex < mSpamKeysToMove.Length(); keyIndex++)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDBHdr> mailHdr = nsnull;
|
||||
rv = GetMessageHeader(mSpamKeysToMove.ElementAt(keyIndex), getter_AddRefs(mailHdr));
|
||||
if (NS_SUCCEEDED(rv) && mailHdr)
|
||||
{
|
||||
nsCOMPtr<nsISupports> iSupports = do_QueryInterface(mailHdr);
|
||||
messages->AppendElement(iSupports);
|
||||
}
|
||||
messages->AppendElement(mailHdr, PR_FALSE);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMsgCopyService> copySvc = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID, &rv);
|
||||
|
@ -3762,11 +3755,11 @@ NS_IMETHODIMP nsMsgLocalMailFolder::FetchMsgPreviewText(nsMsgKey *aKeysToFetch,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgLocalMailFolder::AddKeywordsToMessages(nsISupportsArray *aMessages, const nsACString& aKeywords)
|
||||
NS_IMETHODIMP nsMsgLocalMailFolder::AddKeywordsToMessages(nsIArray *aMessages, const nsACString& aKeywords)
|
||||
{
|
||||
return ChangeKeywordForMessages(aMessages, aKeywords, PR_TRUE /* add */);
|
||||
}
|
||||
nsresult nsMsgLocalMailFolder::ChangeKeywordForMessages(nsISupportsArray *aMessages, const nsACString& aKeywords, PRBool add)
|
||||
nsresult nsMsgLocalMailFolder::ChangeKeywordForMessages(nsIArray *aMessages, const nsACString& aKeywords, PRBool add)
|
||||
{
|
||||
nsresult rv = (add) ? nsMsgDBFolder::AddKeywordsToMessages(aMessages, aKeywords)
|
||||
: nsMsgDBFolder::RemoveKeywordsFromMessages(aMessages, aKeywords);
|
||||
|
@ -3785,7 +3778,7 @@ nsresult nsMsgLocalMailFolder::ChangeKeywordForMessages(nsISupportsArray *aMessa
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRUint32 count, bytesWritten;
|
||||
NS_ENSURE_ARG(aMessages);
|
||||
nsresult rv = aMessages->Count(&count);
|
||||
nsresult rv = aMessages->GetLength(&count);
|
||||
|
||||
nsLineBuffer<char> *lineBuffer;
|
||||
rv = NS_InitLineBuffer(&lineBuffer);
|
||||
|
@ -3904,7 +3897,7 @@ nsresult nsMsgLocalMailFolder::ChangeKeywordForMessages(nsISupportsArray *aMessa
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgLocalMailFolder::RemoveKeywordsFromMessages(nsISupportsArray *aMessages, const nsACString& aKeywords)
|
||||
NS_IMETHODIMP nsMsgLocalMailFolder::RemoveKeywordsFromMessages(nsIArray *aMessages, const nsACString& aKeywords)
|
||||
{
|
||||
return ChangeKeywordForMessages(aMessages, aKeywords, PR_FALSE /* remove */);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "nsIMsgLocalMailFolder.h"
|
||||
#include "nsIMsgFilterPlugin.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
#define COPY_BUFFER_SIZE 16384
|
||||
|
||||
|
@ -64,7 +65,7 @@ struct nsLocalMailCopyState
|
|||
|
||||
nsCOMPtr <nsIOutputStream> m_fileStream;
|
||||
nsCOMPtr<nsISupports> m_srcSupport;
|
||||
nsCOMPtr<nsISupportsArray> m_messages;
|
||||
nsCOMPtr<nsIArray> m_messages;
|
||||
nsRefPtr<nsMsgTxn> m_undoMsgTxn;
|
||||
nsCOMPtr<nsIMsgDBHdr> m_message; // current copy message
|
||||
nsCOMPtr<nsIMsgParseMailMsgState> m_parseMsgState;
|
||||
|
@ -144,7 +145,7 @@ public:
|
|||
NS_IMETHOD CompactAll(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow, nsISupportsArray *aFolderArray, PRBool aCompactOfflineAlso, nsISupportsArray *aOfflineFolderArray);
|
||||
NS_IMETHOD EmptyTrash(nsIMsgWindow *msgWindow, nsIUrlListener *aListener);
|
||||
NS_IMETHOD Delete ();
|
||||
NS_IMETHOD DeleteSubFolders(nsISupportsArray *folders, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD DeleteSubFolders(nsIArray *folders, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD CreateStorageIfMissing(nsIUrlListener* urlListener);
|
||||
NS_IMETHOD Rename (const nsAString& aNewName, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD RenameSubFolders (nsIMsgWindow *msgWindow, nsIMsgFolder *oldFolder);
|
||||
|
@ -164,11 +165,11 @@ public:
|
|||
|
||||
NS_IMETHOD GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgDatabase **db);
|
||||
|
||||
NS_IMETHOD DeleteMessages(nsISupportsArray *messages,
|
||||
NS_IMETHOD DeleteMessages(nsIArray *messages,
|
||||
nsIMsgWindow *msgWindow, PRBool
|
||||
deleteStorage, PRBool isMove,
|
||||
nsIMsgCopyServiceListener* listener, PRBool allowUndo);
|
||||
NS_IMETHOD CopyMessages(nsIMsgFolder *srcFolder, nsISupportsArray* messages,
|
||||
NS_IMETHOD CopyMessages(nsIMsgFolder *srcFolder, nsIArray* messages,
|
||||
PRBool isMove, nsIMsgWindow *msgWindow,
|
||||
nsIMsgCopyServiceListener* listener, PRBool isFolder, PRBool allowUndo);
|
||||
NS_IMETHOD CopyFolder(nsIMsgFolder *srcFolder, PRBool isMoveFolder, nsIMsgWindow *msgWindow,
|
||||
|
@ -188,12 +189,12 @@ public:
|
|||
NS_IMETHOD GetName(nsAString& aName);
|
||||
|
||||
// Used when headers_only is TRUE
|
||||
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *aMessages, nsIMsgWindow *aWindow);
|
||||
NS_IMETHOD DownloadMessagesForOffline(nsIArray *aMessages, nsIMsgWindow *aWindow);
|
||||
NS_IMETHOD FetchMsgPreviewText(nsMsgKey *aKeysToFetch, PRUint32 aNumKeys,
|
||||
PRBool aLocalOnly, nsIUrlListener *aUrlListener,
|
||||
PRBool *aAsyncResults);
|
||||
NS_IMETHOD AddKeywordsToMessages(nsISupportsArray *aMessages, const nsACString& aKeywords);
|
||||
NS_IMETHOD RemoveKeywordsFromMessages(nsISupportsArray *aMessages, const nsACString& aKeywords);
|
||||
NS_IMETHOD AddKeywordsToMessages(nsIArray *aMessages, const nsACString& aKeywords);
|
||||
NS_IMETHOD RemoveKeywordsFromMessages(nsIArray *aMessages, const nsACString& aKeywords);
|
||||
|
||||
protected:
|
||||
nsresult CopyFolderAcrossServer(nsIMsgFolder *srcFolder, nsIMsgWindow *msgWindow,nsIMsgCopyServiceListener* listener);
|
||||
|
@ -211,23 +212,24 @@ protected:
|
|||
|
||||
// copy message helper
|
||||
nsresult DisplayMoveCopyStatusMsg();
|
||||
nsresult SortMessagesBasedOnKey(nsISupportsArray *messages, nsTArray<nsMsgKey> &aKeyArray, nsIMsgFolder *srcFolder);
|
||||
nsresult SortMessagesBasedOnKey(nsTArray<nsMsgKey> &aKeyArray, nsIMsgFolder *srcFolder, nsIMutableArray* messages);
|
||||
|
||||
nsresult CopyMessageTo(nsISupports *message, nsIMsgFolder *dstFolder,
|
||||
nsIMsgWindow *msgWindow, PRBool isMove);
|
||||
|
||||
// copy multiple messages at a time from this folder
|
||||
nsresult CopyMessagesTo(nsISupportsArray *messages, nsIMsgWindow *aMsgWindow,
|
||||
nsresult CopyMessagesTo(nsIArray *messages, nsTArray<nsMsgKey> &keyArray,
|
||||
nsIMsgWindow *aMsgWindow,
|
||||
nsIMsgFolder *dstFolder,
|
||||
PRBool isMove);
|
||||
virtual void GetIncomingServerType(nsCString& serverType);
|
||||
nsresult InitCopyState(nsISupports* aSupport, nsISupportsArray* messages,
|
||||
nsresult InitCopyState(nsISupports* aSupport, nsIArray* messages,
|
||||
PRBool isMove, nsIMsgCopyServiceListener* listener, nsIMsgWindow *msgWindow, PRBool isMoveFolder, PRBool allowUndo);
|
||||
void CopyPropertiesToMsgHdr(nsIMsgDBHdr *destHdr, nsIMsgDBHdr *srcHdr);
|
||||
virtual nsresult CreateBaseMessageURI(const nsACString& aURI);
|
||||
virtual nsresult SpamFilterClassifyMessage(const char *aURI, nsIMsgWindow *aMsgWindow, nsIJunkMailPlugin *aJunkMailPlugin);
|
||||
virtual nsresult SpamFilterClassifyMessages(const char **aURIArray, PRUint32 aURICount, nsIMsgWindow *aMsgWindow, nsIJunkMailPlugin *aJunkMailPlugin);
|
||||
nsresult ChangeKeywordForMessages(nsISupportsArray *aMessages, const nsACString& aKeyword, PRBool add);
|
||||
nsresult ChangeKeywordForMessages(nsIArray *aMessages, const nsACString& aKeyword, PRBool add);
|
||||
PRBool GetDeleteFromServerOnMove();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "nsIMsgMailSession.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIMsgDatabase.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
nsLocalMoveCopyMsgTxn::nsLocalMoveCopyMsgTxn() : m_srcIsImap4(PR_FALSE)
|
||||
{
|
||||
|
@ -289,9 +290,7 @@ nsLocalMoveCopyMsgTxn::UndoTransactionInternal()
|
|||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> srcMessages;
|
||||
NS_NewISupportsArray(getter_AddRefs(srcMessages));
|
||||
nsCOMPtr <nsISupports> msgSupports;
|
||||
nsCOMPtr<nsIMutableArray> srcMessages = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
for (i=0; i<count; i++)
|
||||
{
|
||||
rv = dstDB->GetMsgHdrForKey(m_dstKeyArray[i],
|
||||
|
@ -308,8 +307,7 @@ nsLocalMoveCopyMsgTxn::UndoTransactionInternal()
|
|||
{
|
||||
newHdr->SetStatusOffset(m_srcStatusOffsetArray[i]);
|
||||
srcDB->UndoDelete(newHdr);
|
||||
msgSupports = do_QueryInterface(newHdr);
|
||||
srcMessages->AppendElement(msgSupports);
|
||||
srcMessages->AppendElement(newHdr, PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -349,8 +347,7 @@ nsLocalMoveCopyMsgTxn::RedoTransaction()
|
|||
nsCOMPtr<nsIMsgDBHdr> oldHdr;
|
||||
nsCOMPtr<nsIMsgDBHdr> newHdr;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> srcMessages;
|
||||
NS_NewISupportsArray(getter_AddRefs(srcMessages));
|
||||
nsCOMPtr<nsIMutableArray> srcMessages = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
nsCOMPtr <nsISupports> msgSupports;
|
||||
|
||||
for (i=0; i<count; i++)
|
||||
|
@ -362,7 +359,7 @@ nsLocalMoveCopyMsgTxn::RedoTransaction()
|
|||
if (NS_SUCCEEDED(rv) && oldHdr)
|
||||
{
|
||||
msgSupports =do_QueryInterface(oldHdr);
|
||||
srcMessages->AppendElement(msgSupports);
|
||||
srcMessages->AppendElement(msgSupports, PR_FALSE);
|
||||
|
||||
rv = dstDB->CopyHdrFromExistingHdr(m_dstKeyArray[i],
|
||||
oldHdr, PR_TRUE,
|
||||
|
|
|
@ -91,6 +91,8 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include "nsLocalStrings.h"
|
||||
#include "nsIMsgFilterPlugin.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
@ -1948,9 +1950,8 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWi
|
|||
|
||||
if (!actionTargetFolderUri.IsEmpty() && !actionTargetFolderUri.Equals(uri))
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
messageArray->AppendElement(msgHdr);
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
messageArray->AppendElement(msgHdr, PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> dstFolder;
|
||||
rv = GetExistingFolder(actionTargetFolderUri,
|
||||
|
@ -1997,9 +1998,8 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWi
|
|||
{
|
||||
nsCString keyword;
|
||||
filterAction->GetStrValue(keyword);
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
messageArray->AppendElement(msgHdr);
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
messageArray->AppendElement(msgHdr, PR_FALSE);
|
||||
m_downloadFolder->AddKeywordsToMessages(messageArray, keyword);
|
||||
break;
|
||||
}
|
||||
|
@ -2049,11 +2049,9 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWi
|
|||
msgHdr->GetFlags(&flags);
|
||||
if (localFolder)
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> messages;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
nsCOMPtr<nsIMutableArray> messages = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsISupports> iSupports = do_QueryInterface(msgHdr);
|
||||
messages->AppendElement(iSupports);
|
||||
messages->AppendElement(msgHdr, PR_FALSE);
|
||||
// This action ignores the deleteMailLeftOnServer preference
|
||||
localFolder->MarkMsgsOnPop3Server(messages, POP3_FORCE_DEL);
|
||||
|
||||
|
@ -2076,11 +2074,9 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWi
|
|||
msgHdr->GetFlags(&flags);
|
||||
if (localFolder && (flags & MSG_FLAG_PARTIAL))
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> messages;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
nsCOMPtr<nsIMutableArray> messages = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsISupports> iSupports = do_QueryInterface(msgHdr);
|
||||
messages->AppendElement(iSupports);
|
||||
messages->AppendElement(msgHdr, PR_FALSE);
|
||||
localFolder->MarkMsgsOnPop3Server(messages, POP3_FETCH_BODY);
|
||||
// Don't add this header to the DB, we're going to replace it
|
||||
// with the full message.
|
||||
|
|
|
@ -90,6 +90,7 @@
|
|||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIMutableArray.h"
|
||||
|
||||
// update status on header download once per second
|
||||
#define MIN_STATUS_UPDATE_INTERVAL PR_USEC_PER_SEC
|
||||
|
@ -824,9 +825,8 @@ NS_IMETHODIMP nsNNTPNewsgroupList::ApplyFilterHit(nsIMsgFilter *aFilter, nsIMsgW
|
|||
{
|
||||
nsCString keyword;
|
||||
filterAction->GetStrValue(keyword);
|
||||
nsCOMPtr<nsISupportsArray> messageArray;
|
||||
NS_NewISupportsArray(getter_AddRefs(messageArray));
|
||||
messageArray->AppendElement(m_newMsgHdr);
|
||||
nsCOMPtr<nsIMutableArray> messageArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
|
||||
messageArray->AppendElement(m_newMsgHdr, PR_FALSE);
|
||||
nsCOMPtr <nsIMsgFolder> folder = do_QueryInterface(m_newsFolder, &rv);
|
||||
if (folder)
|
||||
folder->AddKeywordsToMessages(messageArray, keyword);
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "nsMsgFolderFlags.h"
|
||||
#include "prprf.h"
|
||||
#include "prsystem.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIArray.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsINntpService.h"
|
||||
|
@ -93,6 +93,7 @@
|
|||
#include "nsMsgI18N.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsArrayUtils.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
|
@ -776,7 +777,7 @@ NS_IMETHODIMP nsMsgNewsFolder::GetSizeOnDisk(PRUint32 *size)
|
|||
|
||||
/* this is news, so remember that DeleteMessage is really CANCEL. */
|
||||
NS_IMETHODIMP
|
||||
nsMsgNewsFolder::DeleteMessages(nsISupportsArray *messages, nsIMsgWindow *aMsgWindow,
|
||||
nsMsgNewsFolder::DeleteMessages(nsIArray *messages, nsIMsgWindow *aMsgWindow,
|
||||
PRBool deleteStorage, PRBool isMove,
|
||||
nsIMsgCopyServiceListener* listener, PRBool allowUndo)
|
||||
{
|
||||
|
@ -786,8 +787,8 @@ nsMsgNewsFolder::DeleteMessages(nsISupportsArray *messages, nsIMsgWindow *aMsgWi
|
|||
NS_ENSURE_ARG_POINTER(aMsgWindow);
|
||||
|
||||
PRUint32 count = 0;
|
||||
rv = messages->Count(&count);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = messages->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (count != 1)
|
||||
{
|
||||
|
@ -1552,13 +1553,13 @@ NS_IMETHODIMP nsMsgNewsFolder::DownloadAllForOffline(nsIUrlListener *listener, n
|
|||
return downloadState->DownloadArticles(msgWindow, this, &srcKeyArray);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgNewsFolder::DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *window)
|
||||
NS_IMETHODIMP nsMsgNewsFolder::DownloadMessagesForOffline(nsIArray *messages, nsIMsgWindow *window)
|
||||
{
|
||||
nsTArray<nsMsgKey> srcKeyArray;
|
||||
SetSaveArticleOffline(PR_TRUE); // ### TODO need to clear this when we've finished
|
||||
PRUint32 count = 0;
|
||||
PRUint32 i;
|
||||
nsresult rv = messages->Count(&count);
|
||||
nsresult rv = messages->GetLength(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// build up message keys.
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "nsIMsgNewsFolder.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIMsgFilterService.h"
|
||||
#include "nsIArray.h"
|
||||
|
||||
class nsMsgNewsFolder : public nsMsgDBFolder, public nsIMsgNewsFolder
|
||||
{
|
||||
|
@ -88,7 +89,7 @@ public:
|
|||
|
||||
NS_IMETHOD GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgDatabase **db);
|
||||
|
||||
NS_IMETHOD DeleteMessages(nsISupportsArray *messages,
|
||||
NS_IMETHOD DeleteMessages(nsIArray *messages,
|
||||
nsIMsgWindow *msgWindow, PRBool deleteStorage, PRBool isMove,
|
||||
nsIMsgCopyServiceListener* listener, PRBool allowUndo);
|
||||
NS_IMETHOD GetNewMessages(nsIMsgWindow *aWindow, nsIUrlListener *aListener);
|
||||
|
@ -101,7 +102,7 @@ public:
|
|||
NS_IMETHOD GetCanCompact(PRBool *aResult);
|
||||
NS_IMETHOD OnReadChanged(nsIDBChangeListener * aInstigator);
|
||||
|
||||
NS_IMETHOD DownloadMessagesForOffline(nsISupportsArray *messages, nsIMsgWindow *window);
|
||||
NS_IMETHOD DownloadMessagesForOffline(nsIArray *messages, nsIMsgWindow *window);
|
||||
NS_IMETHOD Compact(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow);
|
||||
NS_IMETHOD DownloadAllForOffline(nsIUrlListener *listener, nsIMsgWindow *msgWindow);
|
||||
NS_IMETHOD GetSortOrder(PRInt32 *order);
|
||||
|
|
Загрузка…
Ссылка в новой задаче