nsresult rv = GetMessageServiceFromURI(uri, &messageService);
rv = GetMessageServiceFromURI(uri, &messageService);
nsMsgAppCore::CopyMessages(nsIDOMXULElement *srcFolderElement, nsIDOMXULElement *dstFolderElement,						   nsIDOMNodeList *nodeList, PRBool isMove){	nsresult rv;	nsIRDFResource *srcResource, *dstResource;	nsICopyMessageListener *dstFolder;	nsIMsgFolder *srcFolder;	nsISupportsArray *resourceArray;	if(NS_FAILED(rv = dstFolderElement->GetResource(&dstResource)))		return rv;	if(NS_FAILED(rv = dstResource->QueryInterface(nsICopyMessageListener::GetIID(), (void**)&dstFolder)))		return rv;	if(NS_FAILED(rv = srcFolderElement->GetResource(&srcResource)))		return rv;	if(NS_FAILED(rv = srcResource->QueryInterface(nsIMsgFolder::GetIID(), (void**)&srcFolder)))		return rv;	if(NS_FAILED(rv =ConvertDOMListToResourceArray(nodeList, &resourceArray)))		return rv;	//Call the mailbox service to copy first message.  In the future we should call CopyMessages.	//And even more in the future we need to distinguish between the different types of URI's, i.e.	//local, imap, and news, and call the appropriate copy function.	PRUint32 cnt;    rv = resourceArray->Count(&cnt);    if (NS_SUCCEEDED(rv) && cnt > 0)	{		nsIRDFResource * firstMessage = (nsIRDFResource*)resourceArray->ElementAt(0);		char *uri;		firstMessage->GetValue(&uri);		nsCopyMessageStreamListener* copyStreamListener = new nsCopyMessageStreamListener(srcFolder, dstFolder, nsnull);		nsIMsgMessageService * messageService = nsnull;		nsresult rv = GetMessageServiceFromURI(uri, &messageService);		if (NS_SUCCEEDED(rv) && messageService)		{			nsIURL * url = nsnull;			messageService->CopyMessage(uri, copyStreamListener, isMove, nsnull, &url);			ReleaseMessageServiceFromURI(uri, messageService);		}	}	NS_RELEASE(srcResource);	NS_RELEASE(srcFolder);	NS_RELEASE(dstResource);	NS_RELEASE(dstFolder);	NS_RELEASE(resourceArray);	return rv;}