rem: var msgFlavor = false; var folderFlavor = false; 
add:  var sourceID = dataObj.data.substring(0, len.value); if (!sourceID)	continue; 
context: function DragOverTree(event){       if (event.target.localName != "treecell" &&          event.target.localName != "treeitem") {                  event.preventBubble();          return false;       }	var msgFlavor = false;	var folderFlavor = false;	var dragSession = null;	var dragService = GetDragService();	if ( !dragService )	return(false);	dragSession = dragService.getCurrentSession();	if ( !dragSession )	return(false);	if ( dragSession.isDataFlavorSupported("text/nsmessage") )	msgFlavor = true;	if ( dragSession.isDataFlavorSupported("text/nsfolder") )	folderFlavor = true;	var treeItem = event.target.parentNode.parentNode;	if (!treeItem)	return(false);  	var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);	if ( !trans ) return(false);	if (msgFlavor)	{	    var isServer = treeItem.getAttribute("IsServer");	    if (isServer == "true")	    {		    debugDump("***isServer == true\n");		    return(false);	    }	    var canFileMessages = treeItem.getAttribute("CanFileMessages");	    if (canFileMessages != "true")	    {		    debugDump("***canFileMessages == false\n");		    return(false);	    }	    var noSelect = treeItem.getAttribute("NoSelect");	    if (noSelect == "true")	    {	        debugDump("***NoSelect == true\n");	        return(false);                 }	         }       if (folderFlavor)       {         debugDump("***isFolderFlavor == true \n");          	  if (event.ctrlKey)              //ctrlkey does not apply to folder drag             return(false);         var canCreateSubfolders = treeItem.getAttribute('CanCreateSubfolders');         if ( canCreateSubfolders == "false")  // if cannot create subfolders then a folder cannot be dropped here              {            debugDump("***canCreateSubfolders == false \n");            return(false);	  }         var serverType = treeItem.getAttribute('ServerType');         if ( serverType != "none" && gSrcCanRename == "false")         {                               //folders that cannot be renamed can be dropped only on local folders.	     return(false);	  }         var targetID = treeItem.getAttribute("id");         var targetNode = RDF.GetResource(targetID, true);         if (!targetNode)	return(false);  	     var targetfolder = targetNode.QueryInterface(Components.interfaces.nsIMsgFolder);	     var targetServer = targetfolder.server;         trans.addDataFlavor("text/nsfolder");            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;	     var sourceNode = RDF.GetResource(sourceID, true);	     var folder = sourceNode.QueryInterface(Components.interfaces.nsIFolder);	     var sourceResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);  	     var sourcefolder = sourceResource.QueryInterface(Components.interfaces.nsIMsgFolder);	     var sourceServer = sourcefolder.server;	     if (sourceNode == targetNode)			    return (false);	     if (sourceServer != targetServer && targetServer.type == "imap") //don't allow drop on different imap servers.	           return (false);			    	     if (targetfolder.URI == sourcefolder.parent.URI)   //don't allow immediate child to be dropped to it's parent	       {		    debugDump(targetfolder.URI + "\n");		    debugDump(sourcefolder.parent.URI + "\n");     		    return (false);		}					var isAncestor = sourcefolder.isAncestorOf(targetfolder);		if (isAncestor)  // don't allow parent to be dropped on its ancestors		     return (false);		    }         }	//XXX other flavors here...	// touch the attribute on the treeItem to trigger the repaint with the drop feedback	// (recall that it is two levels above the target, which is a treeCell).	if ( msgFlavor || folderFlavor )	{	    //XXX this is really slow and likes to refresh N times per second.	    event.target.parentNode.parentNode.setAttribute ( "dd-triggerrepaint", 0 );	    dragSession.canDrop = true;	    event.preventBubble();  // do not propagate message           return true;	}    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