rem: gPrefInt = Components.classes["@mozilla.org/preferences;1"]; gPrefInt = gPrefInt.getService(Components.interfaces.nsIPref); 
add: gPrefInt = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefBranch); 
context: function onOK(){  var pref_string_content = "";  var pref_string_title = "";  if (!gPrefInt) {    try {      gPrefInt = Components.classes["@mozilla.org/preferences;1"];      gPrefInt = gPrefInt.getService(Components.interfaces.nsIPref);    }    catch (ex) {      dump("failed to get prefs service!\n");      gPrefInt = null;    }  }  try {    var ldapUrl = Components.classes["@mozilla.org/network/ldap-url;1"];    ldapUrl = ldapUrl.createInstance().              QueryInterface(Components.interfaces.nsILDAPURL);  }  catch (ex) {    dump("failed to get ldap url service!\n");    ldapUrl = null;  }  var description = document.getElementById("description").value;  var hostname = document.getElementById("hostname").value;  var port = document.getElementById("port").value;  var results = document.getElementById("results").value;  var errorValue = null;  gPref_string_desc = description;  if ((!gPref_string_desc) || hasOnlyWhitespaces(gPref_string_desc))    errorValue = "invalidName";  else if ((!hostname) || hasOnlyWhitespaces(hostname))    errorValue = "invalidHostname";  else if (port && hasCharacters(port))    errorValue = "invalidPortNumber";  else if (results && hasCharacters(results))    errorValue = "invalidResults";  if (!errorValue) {  pref_string_content = gPref_string_desc;  if (gCurrentDirectory && gCurrentDirectoryString)  {    gPref_string_desc = gCurrentDirectoryString;  }  else  {    createUniqueServername();    gPref_string_desc = gPrefstring + gPref_string_desc;  }  pref_string_title = gPref_string_desc +"." + "description";  gPrefInt.SetUnicharPref(pref_string_title, pref_string_content);    ldapUrl.host = hostname;  if(!gLdapService) {    try {      gLdapService = Components.classes[          "@mozilla.org/network/ldap-service;1"].          getService(Components.interfaces.nsILDAPService);    }    catch (ex)    {       dump("failed to get LdapService \n");      gLdapService = null;    }  }  if (gLdapService) {    pref_string_content = gLdapService.                          UCS2toUTF8(document.getElementById("basedn").value);    ldapUrl.dn = pref_string_content;    pref_string_content = gLdapService.                          UCS2toUTF8(document.getElementById("search").value);    ldapUrl.filter = pref_string_content;  }  if (!port)    ldapUrl.port = gPortNumber;  else    ldapUrl.port = port;  if (document.getElementById("one").checked)  {    ldapUrl.scope = 1;  }  else {      ldapUrl.scope = 2;  }  pref_string_title = gPref_string_desc + ".uri";  gPrefInt.SetCharPref(pref_string_title, ldapUrl.spec);  pref_string_content = results;  pref_string_title = gPref_string_desc + ".maxHits";  if (pref_string_content != gMaxHits) {    gPrefInt.SetIntPref(pref_string_title, pref_string_content);  }  else  {    try {      gPrefInt.ClearUserPref(pref_string_title);    }    catch(ex) {}  }  pref_string_title = gPref_string_desc + ".auth.enabled";  try{    pref_string_content = gPrefInt.GetBoolPref(pref_string_title);   }  catch(ex) {    pref_string_content = false;  }  window.opener.gNewServer = description;  window.opener.gNewServerString = gPref_string_desc;  // set window.opener.gUpdate to true so that LDAP Directory Servers  // dialog gets updated  window.opener.gUpdate = true;   window.close();  }  else  {    var addressBookBundle = document.getElementById("bundle_addressBook");    var errorMsg = addressBookBundle.getString(errorValue);    alert(errorMsg);  }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/faf03ce445712b372523f881cc3144cfadc7a611/pref-directory-add.js/clean/mailnews/addrbook/prefs/resources/content/pref-directory-add.js