rem: var folderTree = GetFolderTree(); var identity = null; var selectedFolderList = folderTree.selectedItems; if(selectedFolderList.length > 0) { var selectedFolder = selectedFolderList[0]; var folderUri = selectedFolder.getAttribute('id');    var server = FindIncomingServer(folderUri);   var identities = accountManager.GetIdentitiesForServer(server);   if (identities.Count() > 0 ) { identity = identities.GetElementAt(0).QueryInterface(Components.interfaces.nsIMsgIdentity); } } messenger.saveAs(uri, false, identity); 
add: var identity = getIdentityForSelectedServer(); messenger.saveAs(uri, false, identity); 
context: function MsgSaveAsTemplate() {  dump("\MsgSaveAsTemplate from XUL\n");  var tree = GetThreadTree();  //get the selected elements  var messageList = tree.selectedItems;  if (messageList && messageList.length == 1)  {      var uri = messageList[0].getAttribute('id');      // dump (uri);      if (uri)      {		var folderTree = GetFolderTree();        var identity = null;		var selectedFolderList = folderTree.selectedItems;		if(selectedFolderList.length > 0)		{			var selectedFolder = selectedFolderList[0]; 			var folderUri = selectedFolder.getAttribute('id');			// dump("selectedFolder uri = " + uri + "\n");			// get the incoming server associated with this folder uri			var server = FindIncomingServer(folderUri);			// 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);  			}		}        messenger.saveAs(uri, false, identity);      }  }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/5e9de002d8888aa71d660dac897dda8acf83906f/widgetglue.js/clean/mailnews/base/resources/content/widgetglue.js