Bug 131604 - Use local environment to set default nickname.

ChatZilla only.
r=rginda
This commit is contained in:
silver%warwickcompsoc.co.uk 2005-08-22 18:36:42 +00:00
Родитель a8ad73d870
Коммит ab6ba04d26
1 изменённых файлов: 26 добавлений и 3 удалений

Просмотреть файл

@ -80,14 +80,37 @@ function initPrefs()
var logDefault = client.prefManager.logPath.clone();
logDefault.append(escapeFileName("client.log"));
var gotos = ["goto-url", "goto-url-newwin",
var gotos = ["goto-url", "goto-url-newwin",
"goto-url-newtab", "goto-url-newtab"];
if (client.host == "XULrunner")
{
gotos = ["goto-url-external", "goto-url-external",
gotos = ["goto-url-external", "goto-url-external",
"goto-url-external", "goto-url-external"];
}
// Set up default nickname, if possible.
var defaultNick = DEFAULT_NICK;
var en = getService("@mozilla.org/process/environment;1", "nsIEnvironment");
if (en)
{
/* Get the enviroment variables used by various OSes:
* USER - Linux, Mac OSX and other *nix-types.
* USERNAME - Windows.
* LOGNAME - *nix again.
*/
const vars = ["USER", "USERNAME", "LOGNAME"];
for (var i = 0; i < vars.length; i++)
{
var nick = en.get(vars[i]);
if (nick)
{
defaultNick = nick;
break;
}
}
}
var prefs =
[
["activityFlashDelay", 200, "global"],
@ -162,7 +185,7 @@ function initPrefs()
["newTabLimit", 15, "global"],
["notify.aggressive", true, "global"],
["nickCompleteStr", ":", "global"],
["nickname", DEFAULT_NICK, ".ident"],
["nickname", defaultNick, ".ident"],
["nicknameList", [], "lists.nicknameList"],
["outgoing.colorCodes", false, "global"],
["outputWindowURL", "chrome://chatzilla/content/output-window.html",