sr = scc, r = syd
fix for bug 57633, which also fixes 27805,40636,41343,51352,54145,56708,57104,57138, and some other random unfiled bugs.
This commit is contained in:
rginda%netscape.com 2000-11-01 09:33:16 +00:00
Родитель 31416b4fbb
Коммит 10add773ff
10 изменённых файлов: 381 добавлений и 218 удалений

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

@ -24,6 +24,7 @@ chatzilla.jar:
skin/modern/chatzilla/output-marble.css (xul/skin/output-marble.css)
skin/modern/chatzilla/images/xtal.jpg (xul/skin/images/xtal.jpg)
skin/modern/chatzilla/images/blue_rock.gif (xul/skin/images/blue_rock.gif)
skin/modern/chatzilla/images/face-ear.gif (xul/skin/images/face-ear.gif)
skin/modern/chatzilla/images/face-frown.gif (xul/skin/images/face-frown.gif)
skin/modern/chatzilla/images/face-tongue.gif (xul/skin/images/face-tongue.gif)
skin/modern/chatzilla/images/face-angry.gif (xul/skin/images/face-angry.gif)

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

@ -80,7 +80,7 @@ CLineService.prototype.defaultArgs ="";
CLineService.prototype.openWindowWithArgs=false;
/* factory for command line handler service (CLineService) */
CLineFactory = new Object();
var CLineFactory = new Object();
CLineFactory.createInstance =
function (outer, iid) {
@ -128,7 +128,7 @@ function (aContentType, aCommand, aWindowTarget, aSourceContext, aChannel)
else
{
var ass = Components.classes[ASS_CONTRACTID].getService(nsIAppShellService);
var w = ass.getHiddenDOMWindow();
w = ass.getHiddenDOMWindow();
w.open("chrome://chatzilla/content/chatzilla.xul?" + aChannel.URI.spec,
"_blank", "chrome,menubar,toolbar,resizable");
}
@ -136,7 +136,7 @@ function (aContentType, aCommand, aWindowTarget, aSourceContext, aChannel)
}
/* content handler factory object (IRCContentHandler) */
IRCContentHandlerFactory = new Object();
var IRCContentHandlerFactory = new Object();
IRCContentHandlerFactory.createInstance =
function (outer, iid) {
@ -179,7 +179,7 @@ function (aURI)
}
/* protocol handler factory object (IRCProtocolHandler) */
IRCProtocolHandlerFactory = new Object();
var IRCProtocolHandlerFactory = new Object();
IRCProtocolHandlerFactory.createInstance =
function (outer, iid) {

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

@ -90,6 +90,7 @@ function ep_hook(e, hooks)
}
}
return false;
}
CEventPump.prototype.addHook =

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

@ -76,6 +76,8 @@ function userIsMe (user)
return false;
}
return false;
}
/*
@ -135,6 +137,7 @@ function net_doconnect(e)
var attempt = (typeof e.attempt == "undefined") ? 1 : e.attempt + 1;
var host = (typeof e.lastHost == "undefined") ? 0 : e.lastHost + 1;
var ev;
if (attempt > this.MAX_CONNECT_ATTEMPTS)
return false;
@ -147,7 +150,7 @@ function net_doconnect(e)
{
dd ("cant make socket.");
var ev = new CEvent ("network", "error", this, "onError");
ev = new CEvent ("network", "error", this, "onError");
ev.meat = "Unable to create socket: " + ex;
this.eventPump.addEvent (ev);
return false;
@ -159,13 +162,13 @@ function net_doconnect(e)
if (c.connect (this.serverList[host].name, this.serverList[host].port,
(void 0), true))
{
var ev = new CEvent ("network", "connect", this, "onConnect");
ev = new CEvent ("network", "connect", this, "onConnect");
ev.server = this.primServ = new CIRCServer (this, c);
this.eventPump.addEvent (ev);
}
else
{ /* connect failed, try again */
var ev = new CEvent ("network", "do-connect", this, "onDoConnect");
ev = new CEvent ("network", "do-connect", this, "onDoConnect");
ev.lastHost = host;
ev.attempt = attempt;
this.eventPump.addEvent (ev);
@ -475,7 +478,7 @@ function serv_onsenddata (e)
if (this.sendQueue.length > 0)
this.parent.eventPump.addEvent (new CEvent ("server", "senddata",
this, "onSendData"));
return true;
}
CIRCServer.prototype.onPoll =
@ -483,6 +486,7 @@ function serv_poll(e)
{
var lines;
var ex;
var ev;
try
{
@ -499,12 +503,11 @@ function serv_poll(e)
}
else if (typeof ex != "undefined")
{
var ev = new CEvent ("server", "disconnect", this,
"onDisconnect");
ev.reason = "error";
ev.exception = ex;
this.parent.eventPump.addEvent (ev);
return false;
ev = new CEvent ("server", "disconnect", this, "onDisconnect");
ev.reason = "error";
ev.exception = ex;
this.parent.eventPump.addEvent (ev);
return false;
}
else
line = ""
@ -515,11 +518,12 @@ function serv_poll(e)
if (line)
{
var ev = new CEvent ("server", "data-available", this,
"onDataAvailable");
ev = new CEvent ("server", "data-available", this, "onDataAvailable");
ev.line = line;
this.parent.eventPump.addEvent (ev);
}
return true;
}
@ -549,6 +553,8 @@ function serv_ppline(e)
ev.data = lines[i].replace(/\r/g, "");
this.parent.eventPump.addEvent (ev);
}
return true;
}
/*
@ -862,6 +868,9 @@ function serv_chanmode (e)
e.modeStr = mode_str;
e.usersAffected = new Array();
var nick;
var user;
for (var i = 0; i < mode_str.length ; i++)
{
switch (mode_str[i])
@ -875,16 +884,16 @@ function serv_chanmode (e)
case "o": /* operator */
if (modifier == "+")
{
var nick = e.params[BASE_PARAM + params_eaten];
var user = new CIRCChanUser (e.channel, nick, true);
nick = e.params[BASE_PARAM + params_eaten];
user = new CIRCChanUser (e.channel, nick, true);
params_eaten++;
e.usersAffected.push (user);
}
else
if (modifier == "-")
{
var nick = e.params[BASE_PARAM + params_eaten];
var user = new CIRCChanUser (e.channel, nick, false);
nick = e.params[BASE_PARAM + params_eaten];
user = new CIRCChanUser (e.channel, nick, false);
params_eaten++;
e.usersAffected.push (user);
}
@ -893,18 +902,17 @@ function serv_chanmode (e)
case "v": /* voice */
if (modifier == "+")
{
var nick = e.params[BASE_PARAM + params_eaten];
var user = new CIRCChanUser (e.channel, nick, (void 0),
true);
nick = e.params[BASE_PARAM + params_eaten];
user = new CIRCChanUser (e.channel, nick, (void 0), true);
params_eaten++;
e.usersAffected.push (user);
}
else
if (modifier == "-")
{
var nick = e.params[BASE_PARAM + params_eaten];
var user = new CIRCChanUser (e.channel, nick, (void 0),
false);
nick = e.params[BASE_PARAM + params_eaten];
user = new CIRCChanUser (e.channel, nick, (void 0),
false);
params_eaten++;
e.usersAffected.push (user);
}
@ -1365,6 +1373,8 @@ function CIRCChannel (parent, name)
parent.channels[name] = this;
return this;
}
CIRCChannel.prototype.TYPE = "IRCChannel";
@ -1474,6 +1484,7 @@ function chan_part ()
{
this.parent.sendData ("PART " + this.name + "\n");
this.users = new Object();
return true;
}
@ -1697,6 +1708,8 @@ function CIRCUser (parent, nick, name, host)
parent.users[nick] = this;
return this;
}
CIRCUser.prototype.TYPE = "IRCUser";
@ -1804,6 +1817,7 @@ function CIRCChanUser (parent, nick, isOp, isVoice)
parent.users[nick] = this;
return this;
}
function cusr_setop (f)

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

@ -31,6 +31,9 @@
var DEBUG = true;
var dumpln;
var dd;
if (typeof document == "undefined") /* in xpcshell */
dumpln = print;
else
@ -119,7 +122,7 @@ function dumpObjectTree (o, recurse, compress, level)
case "function":
var sfunc = String(o[i]).split("\n");
if (sfunc[2] == " [native code]")
var sfunc = "[native code]";
sfunc = "[native code]";
else
sfunc = sfunc.length + " lines";
s += pfx + tee + i + " (function) " + sfunc + "\n";

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

@ -28,7 +28,7 @@
<!DOCTYPE window SYSTEM "chrome://chatzilla/locale/chatzilla.dtd">
<?xml-stylesheet href="chrome://chatzilla/skin" type="text/css"?>
<?xml-stylesheet href="chrome://chatzilla/skin/chatzilla.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
@ -57,35 +57,60 @@
<broadcasterset id="broadcasterset"/>
<popupset>
<popup id="userlistPopup" onclick="onUserListPopupClick(event)">
<menuitem value="&op.value;" accesskey="&op.accesskey;" code="/op" />
<menuitem value="&deop.value;" accesskey="&deop.accesskey;" code="/deop" />
<menuitem value="&voice.value;" accesskey="&voice.accesskey;" code="/voice" />
<menuitem value="&devoice.value;" accesskey="&devoice.accesskey;" code="/devoice" />
<menuitem value="&kick.value;" accesskey="&kick.accesskey;" code="/kick" />
<!-- <menuitem value="&kick2.value;" accesskey="&kick2.accesskey;" code="/kick" /> -->
<popup id="userlistPopup" onclick="onUserListPopupClick(event)">
<menuitem value="&op.value;" accesskey="&op.accesskey;" code="/op" />
<menuitem value="&deop.value;" accesskey="&deop.accesskey;"
code="/deop" />
<menuitem value="&voice.value;" accesskey="&voice.accesskey;"
code="/voice" />
<menuitem value="&devoice.value;" accesskey="&devoice.accesskey;"
code="/devoice" />
<menuitem value="&kick.value;" accesskey="&kick.accesskey;"
code="/kick" />
<!--
<menuitem value="&kick2.value;" accesskey="&kick2.accesskey;"
code="/kick" />
-->
<menuitem value="&whois.value;" accesskey="&whois.accesskey;" code="/whois" />
</popup>
</popup>
</popupset>
<toolbox>
<menubar id="main-menubar">
<menubar id="main-menubar" persist="collapsed">
<menu value="Options">
<menupopup>
<menu value="Toggles">
<menupopup>
<menuitem id="menu-dmessages" value="Debug Messages"
oncommand="onToggleTraceHook()" type="checkbox"/>
<menuitem id="menu-munger" value="Munger"
oncommand="onToggleMunger()" type="checkbox"/>
</menupopup>
</menu>
<menuitem id="menu-view-toolbar" value="Show Toolbar"
type="checkbox" oncommand="onToggleVisibility('toolbar');"/>
<menuitem id="menu-view-info" value="Show Userlist"
type="checkbox" oncommand="onToggleVisibility('info');"/>
<menuitem id="menu-view-status" value="Show Statusbar"
type="checkbox" oncommand="onToggleVisibility('status');"/>
<menuseparator/>
<menuitem id="menu-viewicons" value="LEDs in View Buttons"
type="checkbox" oncommand="onToggleToolbarIcons();"/>
<menuitem id="menu-munger" value="Enable Smileys"
oncommand="onToggleMunger()" type="checkbox"/>
<menuseparator/>
<menuitem id="menu-dmessages" value="Debug Messages"
oncommand="onToggleTraceHook()" type="checkbox"/>
<menuseparator/>
<menuitem id="menu-settings-save-now" value="Save Settings Now"
oncommand="writeIRCPrefs()"/>
<menuitem id="menu-settings-autosave" value="Save Settings On Exit"
oncommand="onToggleSaveOnExit()" type="checkbox"/>
<!--
<menuitem value="Logging..." enabled="false"
oncommand="onNotImplemented();"/>
<menuseparator/>
<!--
<menu value="Style">
<menupopup>
<menuitem value="Default"
@ -99,50 +124,34 @@
oncommand="onDoStyleChange('other')"/>
</menupopup>
</menu>
-->
-->
</menupopup>
</menu>
<menu value="View">
<menupopup>
<menuitem id="menu-view-toolbar" value="Toolbar"
type="checkbox" oncommand="onToggleVisibility('toolbar');"/>
<menuitem id="menu-view-info" value="Info Tree"
type="checkbox" oncommand="onToggleVisibility('info');"/>
<menuitem id="menu-view-status" value="Statusbar"
type="checkbox" oncommand="onToggleVisibility('status');"/>
<menuseparator/>
<menuitem id="menu-viewicons" value="Icons in View Buttons"
type="checkbox" oncommand="onToggleToolbarIcons();"/>
<menuseparator/>
<menu value="Current View">
<menupopup>
<menuitem value="Hide" oncommand="onHideCurrentView();"/>
<menuitem value="Clear" oncommand="onClearCurrentView();"/>
<menuitem value="Delete" oncommand="onDeleteCurrentView();"/>
</menupopup>
</menu>
<!-- hide vs delete nuances are too vague
<menuitem value="Hide" oncommand="onHideCurrentView();"/>
-->
<menuitem value="Clear this view" oncommand="onClearCurrentView();"/>
<menuitem value="Delete this view" oncommand="onDeleteCurrentView();"/>
</menupopup>
</menu>
<menu id="tasksMenu"/>
</menubar>
</toolbox>
<toolbox id="views-tbox" persist-notyet="collapsed">
<toolbar id="views-tbar" class="toolbar-primary chromeclass-toolbar">
<toolbar id="views-tbar" class="toolbar-primary chromeclass-toolbar"
persist="collapsed">
<box id="views-tbar-inner"/>
</toolbar>
</toolbox>
<box id="outer-box" align="vertical" flex="1">
<box id="inner-box" align="horizontal" flex="1">
<box id="user-list-box" flex="30%">
<tree id="user-list" container="true" datasources="rdf:null" style="width:0px" flex="1"
<box id="user-list-box" flex="30%" persist="collapsed">
<tree id="user-list" container="true" datasources="rdf:null"
style="width:0px" flex="1"
containment="http://home.netscape.com/NC-irc#chanuser"
multiple="true"
context="userlistPopup">
@ -196,7 +205,8 @@
</treehead>
</tree>
</box>
<splitter id="main-splitter" align="vertical" collapse="before"/>
<splitter id="main-splitter" align="vertical" collapse="before"
persist="collapsed"/>
<box align="vertical" flex="60%">
<iframe id="it-doesnt-matter-anyway" class="output-container"
type="content" src="about:blank" flex="1"/>
@ -205,62 +215,62 @@
</box>
</box>
<toolbox id="status-bar-tbox" persist-notyet="collapsed">
<toolbar id="status-bar" class="chromeclass-status">
<toolbox id="status-bar-tbox">
<toolbar id="status-bar-tbar" class="chromeclass-status" persist="collapsed">
<box class="status-box" align="horizontal" flex="20%">
<box class="status-label" align="vertical">
<label>&network.label;</label>
<label>&channel.label;</label>
<label>&topicBy.label;</label>
<text value="&network.label;"/>
<text value="&channel.label;"/>
<text value="&topicBy.label;"/>
</box>
<box class="status-data" align="vertical">
<label id="net-name">(none)</label>
<label id="channel-name">(none)</label>
<label id="channel-topicby">(nobody)</label>
<text id="net-name" value="(one)"/>
<text id="channel-name" value="(none)"/>
<text id="channel-topicby" value="(nobody)"/>
</box>
<spring flex="20%"/>
<box class="status-label" align="vertical">
<label>&server.label;</label>
<label>&mode.label;</label>
<label>&topic.label;</label>
<text value="&server.label;"/>
<text value="&mode.label;"/>
<text value="&topic.label;"/>
</box>
<box align="vertical" flex="80%">
<box align="horizontal" flex="1">
<box class="status-data" align="vertical">
<label id="server-name">(none)</label>
<label id="channel-mode">(none)</label>
<text id="server-name" value="(none)"/>
<text id="channel-mode" value="(none)"/>
</box>
<spring flex="100%"/>
<box class="status-label" align="vertical">
<label>&nickname.label;</label>
<label>&users.label;</label>
<text value="&nickname.label;"/>
<text value="&users.label;"/>
</box>
<box class="status-data" align="vertical">
<label id="server-nick">(unknown)</label>
<label id="channel-users">(none)</label>
<text id="server-nick" value="(unknown)"/>
<text id="channel-users" value="(none)"/>
</box>
<spring flex="100%"/>
<box class="status-label" align="vertical">
<label>&lag.label;</label>
<label>&limit.label;</label>
<text value="&lag.label;"/>
<text value="&limit.label;"/>
</box>
<box class="status-data" align="vertical">
<label id="server-lag">-1</label>
<label id="channel-limit">(none)</label>
<text id="server-lag" value="-1"/>
<text id="channel-limit" value="(none)"/>
</box>
<spring flex="100%"/>
<box class="status-label" align="vertical">
<label>&lastPing.label;</label>
<label>&key.label;</label>
<text value="&lastPing.label;"/>
<text value="&key.label;"/>
</box>
<box class="status-data" align="vertical">
<label id="last-ping">(never)</label>
<label id="channel-key">(none)</label>
<text id="last-ping" value="(never)"/>
<text id="channel-key" value="(none)"/>
</box>
</box>
<box align="horizontal" flex="1">
<box class="status-data" align="vertical" flex="1">
<label id="channel-topic">(none)</label>
<text id="channel-topic" value="(none)"/>
</box>
</box>
</box>

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

@ -26,7 +26,7 @@
function onLoad()
{
initHost(client);
readIRCPrefs();
setOutputStyle (client.DEFAULT_STYLE);
@ -34,12 +34,15 @@ function onLoad()
Called in a callback once the document loads due to a current bug
*/
mainStep();
}
function onUnload()
{
if (client.SAVE_SETTINGS)
writeIRCPrefs();
client.quit ("ChatZilla! [" + navigator.userAgent + "]");
}
@ -94,7 +97,20 @@ function onToggleTraceHook()
document.getElementById("menu-dmessages").setAttribute ("checked",
h.enabled);
}
}
function onToggleSaveOnExit()
{
client.SAVE_SETTINGS = !client.SAVE_SETTINGS;
var m = document.getElementById ("menu-settings-autosave");
m.setAttribute ("checked", String(client.SAVE_SETTINGS));
var pref =
Components.classes["@mozilla.org/preferences;1"].createInstance(Components.interfaces.nsIPref);
pref.SetBoolPref ("extensions.irc.settings.autoSave",
client.SAVE_SETTINGS);
}
function onToggleToolbarIcons()
{
@ -116,7 +132,7 @@ function onToggleVisibility(thing)
switch (thing)
{
case "toolbar":
ids = ["views-tbox"];
ids = ["views-tbar"];
break;
case "info":
@ -124,7 +140,7 @@ function onToggleVisibility(thing)
break;
case "status":
ids = ["status-bar-tbox"];
ids = ["status-bar-tbar"];
break;
default:
@ -359,6 +375,9 @@ function onTabCompleteRequest (e)
var firstSpace = v.indexOf(" ");
if (firstSpace == -1)
firstSpace = v.length;
var pfx;
var d;
if ((v[0] == client.COMMAND_CHAR) && (selStart <= firstSpace))
{
@ -369,7 +388,7 @@ function onTabCompleteRequest (e)
if (cmds.length == 1)
{
/* partial matched exactly one command */
var pfx = client.COMMAND_CHAR + cmds[0];
pfx = client.COMMAND_CHAR + cmds[0];
if (firstSpace == v.length)
v = pfx + " ";
else
@ -382,7 +401,7 @@ function onTabCompleteRequest (e)
else if (cmds.length > 1)
{
/* partial matched more than one command */
var d = new Date();
d = new Date();
if ((d - client.lastTabUp) <= client.DOUBLETAB_TIME)
client.currentObject.display
("Commands matching ``" + partialCommand +
@ -390,7 +409,7 @@ function onTabCompleteRequest (e)
else
client.lastTabUp = d;
var pfx = client.COMMAND_CHAR + getCommonPfx(cmds);
pfx = client.COMMAND_CHAR + getCommonPfx(cmds);
if (firstSpace == v.length)
v = pfx;
else
@ -438,7 +457,7 @@ function onTabCompleteRequest (e)
}
else
{ /* partial matched more than one command */
var d = new Date();
d = new Date();
if ((d - client.lastTabUp) <= client.DOUBLETAB_TIME)
client.currentObject.display
("Users matching ``" + partialNick +
@ -461,7 +480,10 @@ function onTabCompleteRequest (e)
function onWindowKeyPress (e)
{
var code = Number (e.keyCode)
var code = Number (e.keyCode);
var w;
var newOfs;
switch (code)
{
case 112: /* F1 */
@ -477,13 +499,11 @@ function onWindowKeyPress (e)
var idx = code - 112;
if ((client.viewsArray[idx]) && (client.viewsArray[idx].source))
setCurrentObject(client.viewsArray[idx].source);
return false;
break;
case 33: /* pgup */
var w = window.frames[0];
var newOfs = w.pageYOffset - (w.innerHeight / 2);
w = window.frames[0];
newOfs = w.pageYOffset - (w.innerHeight / 2);
if (newOfs > 0)
w.scrollTo (w.pageXOffset, newOfs);
else
@ -491,8 +511,8 @@ function onWindowKeyPress (e)
break;
case 34: /* pgdn */
var w = window.frames[0];
var newOfs = w.pageYOffset + (w.innerHeight / 2);
w = window.frames[0];
newOfs = w.pageYOffset + (w.innerHeight / 2);
if (newOfs < (w.innerHeight + w.pageYOffset))
w.scrollTo (w.pageXOffset, newOfs);
else
@ -1853,6 +1873,9 @@ function my_cpart (e)
if (client.currentObject == this)
/* redisplay the tree */
client.rdf.setTreeRoot("user-list", this.getGraphResource());
if (client.DELETE_ON_PART)
client.onInputDelete(e);
}
else
this.display (e.user.properNick + " has left " + e.channel.name,

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

@ -92,9 +92,7 @@ function rdf_assert (n1, a, n2, f)
if (typeof f == "undefined")
f = true;
return this.dAssert (n1, a, n2, f);
//return this.dAssert (n1, a, n2, f);
return this.ds.Assert (n1, a, n2, f);
}
@ -142,7 +140,7 @@ function rdf_duassert (n1, a, n2)
{
dd ("** Unable to change " + n1.Value + " -[" + a.Value + "]->, " +
"because old value was not found.");
return;
return null;
}
return this.ds.Change (n1, a, oldN2, n2);

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

@ -30,14 +30,26 @@
* +- nickname (String) initial nickname
* +- username (String) initial username (ie: username@host.tld)
* +- desc (String) initial description (used in whois info)
* +- network (String) network to connect to on startup
* +- channel (String) channel to join after connecting
* +- defaultNet (String) default network to use for irc:// urls
* +- initialURLs (String) irc:// urls to connect to on startup, semicolon
* | seperated
* +- munger (Boolean) send output through text->html munger
* | +- smileyText (Boolean) true => display text (and graphic) when
* | matching smileys
* | false => show only the smiley graphic
* +- nickCompleteStr (String) String to use when tab-completing nicknames
* | at the beginning of sentences
* +- stalkWords (String) List of words to add to the stalk victims list
* | semicolon seperated (see the /stalk command)
* +- deleteOnPart (Boolean) Delete channel window automatically after a /part
* |
* +- toolbar
* | +- icons (Boolean) display icons in toolbar buttons
* +- notify
* +- aggressive (Boolean) flash trayicon/ bring window to top when
* your nickname is mentioned.
* | +- aggressive (Boolean) flash trayicon/ bring window to top when
* | your nickname is mentioned.
* +- settings
* | +- autoSave (Boolean) Save settings on exit
* +- style
* | +- default (String) default style (relative to chrome://chatzilla/skin)
* | +- user
@ -78,30 +90,41 @@ function readIRCPrefs (rootNode)
CIRCNetwork.prototype.INITIAL_DESC =
getCharPref (pref, rootNode + "desc",
CIRCNetwork.prototype.INITIAL_DESC);
CIRCNetwork.prototype.INITIAL_CHANNEL =
getCharPref (pref, rootNode + "channel",
CIRCNetwork.prototype.INITIAL_CHANNEL);
client.STARTUP_NETWORK =
getCharPref (pref, rootNode + "network", "");
client.DEFAULT_NETWORK =
getCharPref (pref, rootNode + "defaultNet", "moznet");
client.INITIAL_URLS =
getCharPref (pref, rootNode + "initialURLs", "");
client.ADDRESSED_NICK_SEP =
getCharPref (pref, rootNode + "nickCompleteStr",
client.ADDRESSED_NICK_SEP);
client.INITIAL_VICTIMS =
getCharPref (pref, rootNode + "stalkWords", "");
client.DELETE_ON_PART =
getCharPref (pref, rootNode + "deleteOnPart", true);
client.munger.enabled =
getBoolPref (pref, rootNode + "munger", client.munger.enabled);
client.smileyText =
getBoolPref (pref, rootNode + "munger.smileyText", false);
client.ICONS_IN_TOOLBAR =
getBoolPref (pref, rootNode + "toolbar.icons", true);
getBoolPref (pref, rootNode + "toolbar.icons", false);
client.FLASH_WINDOW =
getBoolPref (pref, rootNode + "notify.aggressive", true);
client.SAVE_SETTINGS =
getBoolPref (pref, rootNode + "settings.autoSave", true);
client.DEFAULT_STYLE =
getCharPref (pref, rootNode + "style.default", "output-default.css");
client.USER_CSS_PRE =
getCharPref (pref, rootNode + "style.user.pre", "");
client.USER_CSS_POST =
getCharPref (pref, rootNode + "style.user.post", "");
client.MAX_MESSAGES =
@ -122,6 +145,39 @@ function readIRCPrefs (rootNode)
}
function writeIRCPrefs (rootNode)
{
var pref =
Components.classes["@mozilla.org/preferences;1"].createInstance();
if(!pref)
throw ("Can't find pref component.");
if (!rootNode)
rootNode = "extensions.irc.";
if (!rootNode.match(/\.$/))
rootNode += ".";
pref = pref.QueryInterface(Components.interfaces.nsIPref);
pref.SetCharPref (rootNode + "nickname",
CIRCNetwork.prototype.INITIAL_NICK);
pref.SetCharPref (rootNode + "username",
CIRCNetwork.prototype.INITIAL_NAME);
pref.SetCharPref (rootNode + "desc", CIRCNetwork.prototype.INITIAL_DESC);
pref.SetCharPref (rootNode + "nickCompleteStr", client.ADDRESSED_NICK_SEP);
pref.SetCharPref (rootNode + "stalkWords",
client.stalkingVictims.join ("; "));
pref.SetBoolPref (rootNode + "munger", client.munger.enabled);
pref.SetBoolPref (rootNode + "munger.smileyText", client.smileyText);
pref.SetBoolPref (rootNode + "toolbar.icons", client.ICONS_IN_TOOLBAR);
pref.SetBoolPref (rootNode + "notify.aggressive", client.FLASH_WINDOW);
var h = client.eventPump.getHook ("event-tracer");
pref.SetBoolPref (rootNode + "debug.tracer", h.enabled);
}
function getCharPref (prefObj, prefName, defaultValue)
{
var e, rv;

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

@ -47,7 +47,7 @@ client.MAX_NICK_DISPLAY = 14;
client.MAX_WORD_DISPLAY = 35;
client.TYPE = "IRCClient";
client.PRINT_DIRECTION = 1; /*1 => new messages at bottom, -1 => at top */
client.ADDRESSED_NICK_SEP = ", ";
client.ADDRESSED_NICK_SEP = ": ";
client.name = "*client*";
client.viewsArray = new Array();
@ -88,52 +88,84 @@ function initStatic()
obj = document.getElementById("input");
obj.addEventListener("keyup", onInputKeyUp, false);
//obj = document.getElementById("tb[*client*]");
/*
client.quickList = new CListBox(document.getElementById("quickList"));
client.quickList.selectedItemCallback = quicklistCallback;
*/
var saveDir = client.PRINT_DIRECTION;
client.PRINT_DIRECTION = 1;
client.display ("Welcome to ChatZilla...\n" +
"Use /attach <network-name> connect to a network.\n" +
"Where <network-name> is one of [" +
keys (client.networks) + "]\n" +
"More help is available with /help [<command-name>]",
"HELLO");
setCurrentObject (client);
client.onInputCommands();
client.PRINT_DIRECTION = saveDir;
if (!jsenv.HAS_XPCOM)
client.display ("ChatZilla was not given access to the XPConnect " +
"service. You will not be able to connect to an " +
"irc server. A workaround may be to set the " +
"'security.checkxpconnect' pref to false in " +
"all.js, or your user prefs.",
"ERROR");
window.onkeypress = onWindowKeyPress;
setMenuCheck ("menu-dmessages",
client.eventPump.getHook ("event-tracer").enabled);
setMenuCheck ("menu-munger", client.munger.enabled);
setMenuCheck ("menu-viewicons", client.ICONS_IN_TOOLBAR);
client.uiState["toolbar"] =
setMenuCheck ("menu-view-toolbar", isVisible("views-tbox"));
setMenuCheck ("menu-view-toolbar", isVisible("views-tbar"));
client.uiState["info"] =
setMenuCheck ("menu-view-info", isVisible("user-list"));
setMenuCheck ("menu-view-info", isVisible("user-list-box"));
client.uiState["status"] =
setMenuCheck ("menu-view-status", isVisible("status-bar-tbox"));
setMenuCheck ("menu-view-status", isVisible("status-bar-tbar"));
client.statusBar = new Object();
client.statusBar["net-name"] =
document.getElementById ("net-name");
client.statusBar["server-name"] =
document.getElementById ("server-name");
client.statusBar["server-nick"] =
document.getElementById ("server-nick");
client.statusBar["server-lag"] =
document.getElementById ("server-lag");
client.statusBar["last-ping"] =
document.getElementById ("last-ping");
client.statusBar["channel-name"] =
document.getElementById ("channel-name");
client.statusBar["channel-limit"] =
document.getElementById ("channel-limit");
client.statusBar["channel-key"] =
document.getElementById ("channel-key");
client.statusBar["channel-mode"] =
document.getElementById ("channel-mode");
client.statusBar["channel-users"] =
document.getElementById ("channel-users");
client.statusBar["channel-topic"] =
document.getElementById ("channel-topic");
client.statusBar["channel-topicby"] =
document.getElementById ("channel-topicby");
onSortCol ("usercol-nick");
client.display ("Welcome to ChatZilla...\n" +
"Use /attach <network-name> connect to a network.\n" +
"Where <network-name> is one of [" +
keys (client.networks) + "]\n" +
"More help is available with /help [<command-name>]",
"HELLO");
setCurrentObject (client);
client.onInputCommands();
var ary = client.INITIAL_URLS.split(";");
for (var i in ary)
{
ary[i] = stringTrim(ary[i]);
if (ary[i])
{
if (ary[i].indexOf("irc://") != 0)
ary[i] = "irc://" + ary[i];
gotoIRCURL (ary[i]);
}
}
ary = client.INITIAL_VICTIMS.split(";");
for (i in ary)
{
ary[i] = stringTrim(ary[i]);
if (ary[i])
client.stalkingVictims.push (ary[i]);
}
var m = document.getElementById ("menu-settings-autosave");
m.setAttribute ("checked", String(client.SAVE_SETTINGS));
if (document.location.search)
gotoIRCURL (document.location.search.substr(1));
gotoIRCURL (document.location.search.substr(1));
}
function setMenuCheck (id, state)
@ -200,17 +232,16 @@ function initHost(obj)
obj.munger = new CMunger();
obj.munger.enabled = true;
obj.munger.addRule ("you-talking-to-me?", matchMyNick, "");
// obj.munger.addRule ("im-stalking-you", matchMyNick, "" );
obj.munger.addRule
("link", /((\w+)\:\/\/[^\<\>\(\)\'\"\s]*|www\.[^\<\>\(\)\'\"\s]+\.[^\<\>\(\)\'\"\s]*)/,
("link", /((\w+):\/\/[^<>()\'\"\s]+|www(\.[^.<>()\'\"\s]+){2,})/,
insertLink);
obj.munger.addRule
("face",
obj.munger.addRule ("face",
/((^|\s)[\<\>]?[\;\=\:\8]\~?[\-\^\v]?[\)\|\(pP\<\>oO0\[\]\/\\](\s|$))/,
insertSmiley);
obj.munger.addRule ("rheet", /(rhee+t\!*)/i, "rheet");
obj.munger.addRule ("ear", /(\(\*)/, insertEar);
obj.munger.addRule ("rheet", /(rhee+t\!*)/i, insertRheet);
obj.munger.addRule ("bold", /(\*[^\*]*\*)/, "bold");
obj.munger.addRule ("italic", /[^sS](\/[^\/]*\/)/, "italic");
obj.munger.addRule ("italic", /[^sS\<](\/[^\/][^\>]*\/)/, "italic");
obj.munger.addRule ("teletype", /(\|[^|]*\|)/, "teletype");
obj.munger.addRule ("underline1", /^(\_[^\_]*\_)/, "underline");
obj.munger.addRule ("underline2", /\W(\_[^\_]*\_)/, "underline");
@ -236,8 +267,8 @@ function matchMyNick (text, containerTag, eventDetails)
sv += "|(" + client.stalkingVictims.join( ")|(" ) + ")";
}
var re = new RegExp("(^|[\\W\\s])" + sv +
"([\\W\\s]|$)", "i");
var str = "(^|[\\W\\s])" + sv + "([\\W\\s]|$)";
var re = new RegExp(str, "i");
if (text.search(re) != -1 ||
eventDetails.orig.lastNickDisplayed.search(re) != -1)
{
@ -271,28 +302,56 @@ function insertLink (matchText, containerTag)
}
function insertRheet (matchText, containerTag)
{
var anchor = document.createElementNS ("http://www.w3.org/1999/xhtml",
"html:a");
anchor.setAttribute ("href",
"ftp://ftp.mozilla.org/pub/mozilla/libraries/bonus-tracks/rheet.wav");
anchor.setAttribute ("class", "rheet");
anchor.setAttribute ("target", "_content");
if (matchText.length >= client.MAX_WORD_DISPLAY)
matchText = hyphenateWord (matchText, client.MAX_WORD_DISPLAY);
anchor.appendChild (document.createTextNode (matchText));
containerTag.appendChild (anchor);
}
function insertEar (matchText, containerTag)
{
if (client.smileyText)
containerTag.appendChild (document.createTextNode (matchText));
var img = document.createElementNS ("http://www.w3.org/1999/xhtml",
"html:img");
img.setAttribute ("src", client.IMAGEDIR + "face-ear.gif");
containerTag.appendChild (img);
}
function insertSmiley (emoticon, containerTag)
{
var src = "";
if (emoticon.search (/\;[\-\^\v]?[\)\>\]]/) != -1)
if (emoticon.search (/\;[-^v]?[)>\]]/) != -1)
src = "face-wink.gif";
else if (emoticon.search (/[\=\:\8][\-\^\v]?[\)\>\]]/) != -1)
else if (emoticon.search (/[=:8][-^v]?[)>\]]/) != -1)
src = "face-smile.gif";
else if (emoticon.search (/[\=\:\8][\-\^\v]?[\/\\]/) != -1)
else if (emoticon.search (/[=:8][-^v]?[\/\\]/) != -1)
src = "face-screw.gif";
else if (emoticon.search (/[\=\:\8]\~[\-\^\v]?\(/) != -1)
else if (emoticon.search (/[=:8]\~[-^v]?\(/) != -1)
src = "face-cry.gif";
else if (emoticon.search (/[\=\:\8][\-\^\v]?[\(\<\[]/) != -1)
else if (emoticon.search (/[=:8][-^v]?[(<\[]/) != -1)
src = "face-frown.gif";
else if (emoticon.search (/\<?[\=\:\8][\-\^\v]?[0oO]/) != -1)
else if (emoticon.search (/\<?[=:8][-^v]?[0oO]/) != -1)
src = "face-surprise.gif";
else if (emoticon.search (/[\=\:\8][\-\^\v]?[pP]/) != -1)
else if (emoticon.search (/[=;:8][-^v]?[pP]/) != -1)
src = "face-tongue.gif";
else if (emoticon.search (/\>?[\=\:\8][\-\^\v]?[\(\|]/) != -1)
src = "face-angry.gif";
containerTag.appendChild (document.createTextNode (emoticon));
if (client.smileyText)
containerTag.appendChild (document.createTextNode (emoticon));
if (src)
{
@ -432,15 +491,13 @@ function setClientOutput(doc)
dd ("Got output element.");
/* continue processing now: */
initStatic();
if (client.STARTUP_NETWORK)
client.onInputAttach ({inputData: client.STARTUP_NETWORK});
}
else
dd ("ARG! Couldn't get output element, try again later.");
}
testURLs =
var testURLs =
["irc:", "irc://", "irc:///", "irc:///help", "irc:///help,needkey",
"irc://irc.foo.org", "irc://foo:6666",
"irc://foo", "irc://irc.foo.org/", "irc://foo:6666/", "irc://foo/",
@ -456,10 +513,10 @@ function doURLTest()
{
for (var u in testURLs)
{
dd ("-*- testing url \"" + testURLs[u] + "\"");
dd ("testing url \"" + testURLs[u] + "\"");
var o = parseIRCURL(testURLs[u]);
if (!o)
dd ("-!- PARSE FAILED!");
dd ("PARSE FAILED!");
else
dd (dumpObjectTree(o));
dd ("---");
@ -472,7 +529,7 @@ function parseIRCURL (url)
var rv = new Object();
rv.spec = url;
rv.host = client.STARTUP_NETWORK;
rv.host = client.DEFAULT_NETWORK;
rv.target = "";
rv.port = 6667;
rv.msg = "";
@ -488,7 +545,7 @@ function parseIRCURL (url)
var ary = url.match (/^irc:\/\/([^\/\s]+)?(\/.*)?\s*$/i);
if (!ary)
{
dd ("chatzilla: parseIRCURL: initial split failed");
dd ("parseIRCURL: initial split failed");
return null;
}
var host = ary[1];
@ -498,7 +555,7 @@ function parseIRCURL (url)
ary = host.match (/^([^\s\:]+)?(\:\d+)?$/);
if (!ary)
{
dd ("chatzilla: parseIRCURL: host/port split failed");
dd ("parseIRCURL: host/port split failed");
return null;
}
@ -506,7 +563,7 @@ function parseIRCURL (url)
{
if (!ary[1])
{
dd ("chatzilla: parseIRCURL: port with no host");
dd ("parseIRCURL: port with no host");
return null;
}
specifiedHost = rv.host = ary[1].toLowerCase();
@ -529,7 +586,7 @@ function parseIRCURL (url)
ary = rest.match (/^\/([^\,\?\s]*)?(,[^\?]*)?(\?.*)?$/);
if (!ary)
{
dd ("chatzilla: parseIRCURL: rest split failed '" + rest + "'");
dd ("parseIRCURL: rest split failed '" + rest + "'");
return null;
}
@ -544,7 +601,7 @@ function parseIRCURL (url)
(params.search (/,\s*isnick\s*,|,\s*isnick\s*$/) != -1);
if (rv.isnick && !rv.target)
{
dd ("chatzilla: parseIRCURL: isnick w/o target");
dd ("parseIRCURL: isnick w/o target");
/* isnick w/o a target is bogus */
return null;
}
@ -553,7 +610,7 @@ function parseIRCURL (url)
(params.search (/,\s*isserver\s*,|,\s*isserver\s*$/) != -1);
if (rv.isserver && !specifiedHost)
{
dd ("chatzilla: parseIRCURL: isserver w/o host");
dd ("parseIRCURL: isserver w/o host");
/* isserver w/o a host is bogus */
return null;
}
@ -620,7 +677,7 @@ function gotoIRCURL (url)
if (!alreadyThere)
{
dd ("-*- chatzilla: gotoIRCURL: not already connected to " +
dd ("gotoIRCURL: not already connected to " +
"server " + url.host + " trying to connect...");
client.onInputServer ({inputData: url.host + " " + url.port +
" " + pass});
@ -637,7 +694,7 @@ function gotoIRCURL (url)
net = client.networks[url.host];
if (!net.isConnected())
{
dd ("-*- chatzilla: gotoIRCURL: not already connected to " +
dd ("gotoIRCURL: not already connected to " +
"network " + url.host + " trying to connect...");
client.onInputAttach ({inputData: url.host + " " + pass});
if (!net.pendingURLs)
@ -648,7 +705,7 @@ function gotoIRCURL (url)
}
/* already connected, do whatever comes next in the url */
dd ("-*- chatzilla: gotoIRCURL: connected, time to finish parsing '" +
dd ("gotoIRCURL: connected, time to finish parsing '" +
url + "'");
if (url.target)
{
@ -707,11 +764,11 @@ function updateNetwork(obj)
ping = "(never)";
}
document.getElementById ("net-name").firstChild.data = net;
document.getElementById ("server-name").firstChild.data = serv;
document.getElementById ("server-nick").firstChild.data = nick;
document.getElementById ("server-lag").firstChild.data = lag;
document.getElementById ("last-ping").firstChild.data = ping;
client.statusBar["net-name"].setAttribute("value", net);
client.statusBar["server-name"].setAttribute("value", serv);
client.statusBar["server-nick"].setAttribute("value", nick);
client.statusBar["server-lag"].setAttribute("value", lag);
client.statusBar["last-ping"].setAttribute("value", ping);
}
@ -739,13 +796,13 @@ function updateChannel (obj)
topicBy = o.channel.topicBy ? o.channel.topicBy : "(nobody)";
}
document.getElementById ("channel-name").firstChild.data = chan;
document.getElementById ("channel-limit").firstChild.data = l;
document.getElementById ("channel-key").firstChild.data = k;
document.getElementById ("channel-mode").firstChild.data = mode;
document.getElementById ("channel-users").firstChild.data = users;
document.getElementById ("channel-topic").firstChild.data = topic;
document.getElementById ("channel-topicby").firstChild.data = topicBy;
client.statusBar["channel-name"].setAttribute("value", chan);
client.statusBar["channel-limit"].setAttribute("value", l);
client.statusBar["channel-key"].setAttribute("value", k);
client.statusBar["channel-mode"].setAttribute("value", mode);
client.statusBar["channel-users"].setAttribute("value", users);
client.statusBar["channel-topic"].setAttribute("value", topic);
client.statusBar["channel-topicby"].setAttribute("value", topicBy);
}
@ -868,11 +925,11 @@ function setCurrentObject (obj)
if (!obj.messages)
{
dd ("** INVALID OBJECT passed to setCurrentObject **");
return false;
return;
}
if (client.currentObject == obj)
return true;
return;
var tb, userList;
@ -886,7 +943,7 @@ function setCurrentObject (obj)
client.output.removeChild (client.output.firstChild);
client.output.appendChild (obj.messages);
/* Unselect currenrly selected users. */
/* Unselect currently selected users. */
userList = document.getElementById("user-list");
if (userList)
/* Remove curently selection items before this tree gets rerooted, because it seems to
@ -1041,7 +1098,7 @@ function getTBForObject (source, create)
{
dd ("** UNDEFINED passed to getTBForObject **");
dd (getStackTrace());
return;
return null;
}
create = (typeof create != "undefined") ? Boolean(create) : false;
@ -1061,7 +1118,7 @@ function getTBForObject (source, create)
default:
dd ("** INVALID OBJECT passed to getTBForObject **");
return;
return null;
}
var tb, id = "tb[" + name + "]";