rem: var dragSession = dragService.getCurrentSession(); if ( !dragSession )	return(false); 
add: var dragSession = dragService.getCurrentSession(); if ( !dragSession )	return(false); 
context: function DropOnFolderTree(event){	debugDump("DropOnTree\n");	var RDF = GetRDFService();	if (!RDF) return(false);	var treeRoot = GetFolderTree();	if (!treeRoot)	return(false);	var treeDatabase = treeRoot.database;	if (!treeDatabase)	return(false);	// target is the <treecell>, and "id" is on the <treeitem> two levels above	var treeItem = event.target.parentNode.parentNode;	if (!treeItem)	return(false);	if (event.ctrlKey)		ctrlKeydown = true;	else		ctrlKeydown = false;	// drop action is always "on" not "before" or "after"	// get drop hint attributes	var dropBefore = treeItem.getAttribute("dd-droplocation");	var dropOn = treeItem.getAttribute("dd-dropon");	var dropAction;	if (dropOn == "true") 		dropAction = "on";	else		return(false);	var targetID = treeItem.getAttribute("id");	if (!targetID)	return(false);	debugDump("***targetID = " + targetID + "\n");	//make sure target is a folder	var dragService = GetDragService();	if ( !dragService )	return(false);		var dragSession = dragService.getCurrentSession();	if ( !dragSession )	return(false);	var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);	if ( !trans ) return(false);	var list = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);       var dropMessage = false;  	if (dragSession.isDataFlavorSupported("text/nsmessage"))	{	   dropMessage = true;	   debugDump( "dropMessage == true \n");	}	 		var dropFolder = false;	if (dragSession.isDataFlavorSupported("text/nsfolder"))	{	   dropFolder = true;	   debugDump( "dropFolder == true \n");	}    	if ( dropMessage )	    trans.addDataFlavor("text/nsmessage");       else if ( dropFolder )	    trans.addDataFlavor("text/nsfolder");	       var listCount =0;	for ( var i = 0; i < dragSession.numDropItems; ++i )	{		dragSession.getData ( trans, i );		var dataObj = new Object();		var bestFlavor = new Object();		var len = new Object();		trans.getAnyTransferData ( bestFlavor, dataObj, len );		if ( dataObj )	dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsWString);		if ( !dataObj )	continue;		// pull the URL out of the data object		var sourceID = dataObj.data.substring(0, len.value);		if (!sourceID)	continue;		debugDump("    Node #" + i + ": drop '" + sourceID + "' " + dropAction + " '" + targetID + "'");		debugDump("\n");		var sourceNode = RDF.GetResource(sourceID, true);		if (!sourceNode)			continue;		// Prevent dropping of a node before, after, or on itself		if (sourceNode == targetNode)			    continue;	    else		    listCount ++;		list.AppendElement(sourceNode);	}       if (listCount < 1)	      return false;       var isSourceNews = false;       isSourceNews = isNewsURI(sourceID);    	var targetNode = RDF.GetResource(targetID, true);	if (!targetNode)	return(false);  	var targetfolder = targetNode.QueryInterface(Components.interfaces.nsIMsgFolder);	var targetServer = targetfolder.server;       if (dropMessage)	{	    var message = sourceNode.QueryInterface(Components.interfaces.nsIMessage);	    var folder = message.msgFolder;	    var sourceResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);  	    var sourcefolder = sourceResource.QueryInterface(Components.interfaces.nsIMsgFolder);	    var sourceServer = sourcefolder.server;	    var nextMessage;           var messageTree;          if (isSourceNews) //news to pop or imap is always a copy          {             try             {                messenger.CopyMessages(treeDatabase,                                       sourceResource,                                       targetNode, list, false);             }             catch(e)             {                dump ( "Exception : CopyMessages \n");             }          }          else          {			//temperary for single mail window, not working when supporting multiple mail windows		if (!ctrlKeydown)		{			messageTree = GetThreadTree();			nextMessage = GetNextMessageAfterDelete(messageTree.selectedItems);			if(nextMessage)                       gNextMessageAfterDelete = nextMessage.getAttribute('id');			else				gNextMessageAfterDelete = null;		}              try {	         	messenger.CopyMessages(treeDatabase,		              		   sourceResource,						   targetNode, list, !ctrlKeydown);                  }              catch(e)                  {                      gNextMessageAfterDelete = null;                      dump ( "Exception : CopyMessages \n");                  }          }	}	else if (dropFolder)	{	    sourceNode = RDF.GetResource(sourceID, true);           folder = sourceNode.QueryInterface(Components.interfaces.nsIFolder);	    sourceResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);  	    sourcefolder = sourceResource.QueryInterface(Components.interfaces.nsIMsgFolder);	    sourceServer = sourcefolder.server;		var moveFolder = false;     	    if (sourceServer == targetServer)		   moveFolder = true;				try 		{		   messenger.CopyFolders(treeDatabase,targetNode,list,moveFolder);		}		catch(e)		{                  dump ("Exception : CopyFolder \n");              }        }	return(false);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/63fbb90dec83527d9ee9c4224fd79cb87c5c8c07/messengerdnd.js/clean/mailnews/base/resources/content/messengerdnd.js