nsCOMPtr<nsIRDFResource> srcResource, dstResource; nsCOMPtr<nsIMsgFolder> srcFolder; nsCOMPtr<nsISupportsArray> argumentArray; nsCOMPtr<nsISupportsArray> folderArray;  rv = dstFolderElement->GetResource(getter_AddRefs(dstResource)); if(NS_FAILED(rv)) return rv;  rv = srcFolderElement->GetResource(getter_AddRefs(srcResource)); if(NS_FAILED(rv)) return rv;  srcFolder = do_QueryInterface(srcResource); if(!srcFolder) return NS_ERROR_NO_INTERFACE;  rv =ConvertDOMListToResourceArray(messages, getter_AddRefs(argumentArray)); if(NS_FAILED(rv)) return rv;  nsCOMPtr<nsISupports> srcFolderSupports(do_QueryInterface(srcFolder)); if(srcFolderSupports) argumentArray->InsertElementAt(srcFolderSupports, 0);  rv = NS_NewISupportsArray(getter_AddRefs(folderArray)); if(NS_FAILED(rv)) { return NS_ERROR_OUT_OF_MEMORY; }  folderArray->AppendElement(dstResource);  rv = DoCommand(database, isMove ? (char *)NC_RDF_MOVE : (char *)NC_RDF_COPY, folderArray, argumentArray); return rv;
rv = NS_NewISupportsArray(getter_AddRefs(folderArray)); NS_ENSURE_SUCCESS(rv, rv);  folderArray->AppendElement(dstResource); if (isMove) rv = DoCommand(database, NS_LITERAL_CSTRING(NC_RDF_MOVE), folderArray, argumentArray); else rv = DoCommand(database, NS_LITERAL_CSTRING(NC_RDF_COPY), folderArray, argumentArray); return rv;
nsMessenger::CopyMessages(nsIRDFCompositeDataSource *database, nsIDOMXULElement *srcFolderElement,						  nsIDOMXULElement *dstFolderElement, nsIDOMNodeList *messages, PRBool isMove){	nsresult rv;	if(!srcFolderElement || !dstFolderElement || !messages)		return NS_ERROR_NULL_POINTER;	nsCOMPtr<nsIRDFResource> srcResource, dstResource;	nsCOMPtr<nsIMsgFolder> srcFolder;	nsCOMPtr<nsISupportsArray> argumentArray;	nsCOMPtr<nsISupportsArray> folderArray;	rv = dstFolderElement->GetResource(getter_AddRefs(dstResource));	if(NS_FAILED(rv))		return rv;	rv = srcFolderElement->GetResource(getter_AddRefs(srcResource));	if(NS_FAILED(rv))		return rv;	srcFolder = do_QueryInterface(srcResource);	if(!srcFolder)		return NS_ERROR_NO_INTERFACE;	rv =ConvertDOMListToResourceArray(messages, getter_AddRefs(argumentArray));	if(NS_FAILED(rv))		return rv;	nsCOMPtr<nsISupports> srcFolderSupports(do_QueryInterface(srcFolder));	if(srcFolderSupports)		argumentArray->InsertElementAt(srcFolderSupports, 0);	rv = NS_NewISupportsArray(getter_AddRefs(folderArray));	if(NS_FAILED(rv))	{		return NS_ERROR_OUT_OF_MEMORY;	}	folderArray->AppendElement(dstResource);		rv = DoCommand(database, isMove ? (char *)NC_RDF_MOVE : (char *)NC_RDF_COPY, folderArray, argumentArray);	return rv;}