rem: dump("\nComposeMessage from XUL\n"); 
add: dump("\nComposeMessage from XUL: " + identity + "\n"); 
context: function ComposeMessage(type, format) //type is a nsIMsgCompType and format is a nsIMsgCompFormat{		var msgComposeType = Components.interfaces.nsIMsgCompType;        var identity = null;	var newsgroup = null;	try 	{		var folderTree = GetFolderTree();		var selectedFolderList = folderTree.selectedItems;		if(selectedFolderList.length > 0)		{			var selectedFolder = selectedFolderList[0]; 			var uri = selectedFolder.getAttribute('id');			// dump("selectedFolder uri = " + uri + "\n");			// get the incoming server associated with this uri			var server = FindIncomingServer(uri);			// if they hit new and they are reading a newsgroup			// turn this into a new post, not a new mail message			if (type == msgComposeType.New) {				if (server.type == "nntp") {					type = msgComposeType.NewsPost;					// from the uri, get the newsgroup name					var resource = RDF.GetResource(uri);					var msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder); 					if (msgfolder.isServer) 						newsgroup = "";					else       					newsgroup = msgfolder.name; 				}			}			// dump("server = " + server + "\n");			// get the identity associated with this server			var identities = accountManager.GetIdentitiesForServer(server);			// dump("identities = " + identities + "\n");			// just get the first one			if (identities.Count() > 0 ) {				identity = identities.GetElementAt(0).QueryInterface(Components.interfaces.nsIMsgIdentity);  			}		}		// dump("identity = " + identity + "\n");	}	catch (ex) 	{		// dump("failed to get an identity to pre-select\n");	}	dump("\nComposeMessage from XUL\n");	var uri = null;	if (! msgComposeService)	{		dump("### msgComposeService is invalid\n");		return;	}		if (type == msgComposeType.New) //new message	{		//dump("OpenComposeWindow with " + identity + "\n");		msgComposeService.OpenComposeWindow(null, null, type, format, identity);		return;	}        else if (type == msgComposeType.NewsPost) 	{		dump("OpenComposeWindow with " + identity + " and " + newsgroup + "\n");		msgComposeService.OpenComposeWindow(null, newsgroup, type, format, identity);		return;	}			var tree = GetThreadTree();	if (tree)	{		var nodeList = tree.selectedItems;		var appCore = FindMessenger();		if (appCore)			appCore.SetWindow(window, msgWindow);					var object = null;			if (nodeList && nodeList.length > 0)		{			uri = "";			for (var i = 0; i < nodeList.length && i < 8; i ++)			{					dump('i = '+ i);				dump('\n');								if (type == msgComposeType.Reply || type == msgComposeType.ReplyAll || type == msgComposeType.ForwardInline ||					type == msgComposeType.Template || type == msgComposeType.Draft)				{					msgComposeService.OpenComposeWindow(null, nodeList[i].getAttribute('id'), type, format, identity);				}				else				{					if (i) 						uri += ","					uri += nodeList[i].getAttribute('id');				}			}			if (type == msgComposeType.ForwardAsAttachment)			{				msgComposeService.OpenComposeWindow(null, uri, type, format, identity);  			}		}		else			dump("### nodeList is invalid\n");	}	else		dump("### tree is invalid\n");}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/98b0123fb33346e4025dc5af8eab338511241727/commandglue.js/buggy/mailnews/base/resources/content/commandglue.js