зеркало из https://github.com/mozilla/gecko-dev.git
* index.html
Added start page for the various test clients. * Makefile.in, makefile.win Changes to install index.html. * irc.js Fix to stop e.meat from getting filled with the <params> when there is no <trailing> token in the message (raw data events) Forward server ping and pong events to the parent network. * utils.js Verify XPCOM is present for functions that require it. Modified arrayInsertAt and arrayRemoveAt to use Array.prototype.splice() * test3-handlers.js Add various verifications to commands, report on precondition problems Added /msg command. * test3.css Show message types by default, suppress only specific types.
This commit is contained in:
Родитель
880466e384
Коммит
edd763aa10
|
@ -53,6 +53,7 @@ XULLIBFILES = \
|
|||
$(NULL)
|
||||
|
||||
TESTFILES = \
|
||||
$(srcdir)/xul/tests/index.html \
|
||||
$(srcdir)/xul/tests/test1.html \
|
||||
$(srcdir)/xul/tests/test1-static.js \
|
||||
$(srcdir)/xul/tests/test1-handlers.js \
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* list of potential hostnames for an IRC network. (among other things.)
|
||||
*
|
||||
* CIRCServer
|
||||
* Server object. Requires an initialized nsIConnection object for
|
||||
* Server object. Requires an initialized bsIConnection object for
|
||||
* communicating with the irc server.
|
||||
* Server.sayTo queues outgoing PRIVMSGs for sending to the server. Using
|
||||
* sayTo takes care not to send lines faster than one every 1.5 seconds.
|
||||
|
@ -522,6 +522,12 @@ function serv_onRawData(e)
|
|||
e.server = this;
|
||||
|
||||
var sep = l.indexOf(":");
|
||||
|
||||
if (sep != -1) /* <trailing> param, if there is one */
|
||||
e.meat = l.substr (sep + 1, l.length);
|
||||
else
|
||||
e.meat = "";
|
||||
|
||||
if (sep != -1)
|
||||
e.params = l.substr(0, sep).split(" ");
|
||||
else
|
||||
|
@ -529,7 +535,6 @@ function serv_onRawData(e)
|
|||
e.code = e.params[0].toUpperCase();
|
||||
if (e.params[e.params.length - 1] == "")
|
||||
e.params.length--;
|
||||
e.meat = l.substr (sep + 1, l.length);
|
||||
|
||||
e.type = "parseddata";
|
||||
e.destObject = this;
|
||||
|
@ -1021,6 +1026,9 @@ function serv_ping (e)
|
|||
this.connection.sendData ("PING :" + e.meat + "\n");
|
||||
this.lastPing = this.lastPingSent = new Date();
|
||||
|
||||
e.destObject = this.parent;
|
||||
e.set = "network";
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -1034,6 +1042,9 @@ function serv_pong (e)
|
|||
|
||||
delete this.lastPingSent;
|
||||
|
||||
e.destObject = this.parent;
|
||||
e.set = "network";
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,10 @@ var DEBUG = true;
|
|||
if (typeof document == "undefined") /* in xpcshell */
|
||||
dumpln = print;
|
||||
else
|
||||
dumpln = function (str) {dump (str + "\n");}
|
||||
if (typeof dump == "function")
|
||||
dumpln = function (str) {dump (str + "\n");}
|
||||
else
|
||||
dumpln = function () {} /* no suitable function */
|
||||
|
||||
if (DEBUG)
|
||||
dd = dumpln;
|
||||
|
@ -40,8 +43,8 @@ else
|
|||
|
||||
var jsenv = new Object();
|
||||
|
||||
jsenv.HAS_XPCOM = ((typeof Components == "function") &&
|
||||
(typeof Components.classes == "function"));
|
||||
jsenv.HAS_XPCOM = ((typeof Components == "function") &&
|
||||
(typeof Components.classes == "function"));
|
||||
jsenv.HAS_JAVA = (typeof java == "object");
|
||||
jsenv.HAS_RHINO = (typeof defineClass == "function");
|
||||
jsenv.HAS_DOCUMENT = (typeof document == "object");
|
||||
|
@ -214,6 +217,9 @@ function renameProperty (obj, oldname, newname)
|
|||
|
||||
function newObject(progID, iface)
|
||||
{
|
||||
if (!jsenv.HAS_XPCOM)
|
||||
return;
|
||||
|
||||
var obj = Components.classes[progID].createInstance();
|
||||
var rv;
|
||||
|
||||
|
@ -260,6 +266,9 @@ function stringTrim (s)
|
|||
function arrayInsertAt (ary, i, o)
|
||||
{
|
||||
|
||||
ary.splice (i, 0, o);
|
||||
|
||||
/* doh, forgot about that 'splice' thing
|
||||
if (ary.length < i)
|
||||
{
|
||||
this[i] = o;
|
||||
|
@ -270,12 +279,15 @@ function arrayInsertAt (ary, i, o)
|
|||
ary[j] = ary[j - 1];
|
||||
|
||||
ary[i] = o;
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
function arrayRemoveAt (ary, i)
|
||||
{
|
||||
|
||||
ary.splice (i, 1);
|
||||
|
||||
/* doh, forgot about that 'splice' thing
|
||||
if (ary.length < i)
|
||||
return false;
|
||||
|
||||
|
@ -283,6 +295,7 @@ function arrayRemoveAt (ary, i)
|
|||
ary[j] = ary[j + 1];
|
||||
|
||||
ary.length--;
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -320,6 +333,9 @@ function randomRange (min, max)
|
|||
|
||||
function getInterfaces (cls)
|
||||
{
|
||||
if (!jsenv.HAS_XPCOM)
|
||||
return;
|
||||
|
||||
var rv = new Object();
|
||||
var e;
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ XULLIBFILES = \
|
|||
$(NULL)
|
||||
|
||||
TESTFILES = \
|
||||
.\xul\tests\index.html \
|
||||
.\xul\tests\test1.html \
|
||||
.\xul\tests\test1-handlers.js \
|
||||
.\xul\tests\test1-static.js \
|
||||
|
|
|
@ -314,14 +314,42 @@ function cli_iattach (e)
|
|||
client.onInputMe =
|
||||
function cli_ime (e)
|
||||
{
|
||||
if (e.channel)
|
||||
if (!e.channel)
|
||||
{
|
||||
e.inputData = filterOutput (e.inputData, "ACTION", "!ME");
|
||||
e.channel.act (e.inputData);
|
||||
client.currentObject.display ("Me can only be used from channels.",
|
||||
"ERROR");
|
||||
return false;
|
||||
}
|
||||
|
||||
e.inputData = filterOutput (e.inputData, "ACTION", "!ME");
|
||||
e.channel.act (e.inputData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
client.onInputMsg =
|
||||
function cli_imsg (e)
|
||||
{
|
||||
|
||||
if (!e.network || !e.network.isConnected())
|
||||
{
|
||||
client.currentObject.display ("You must be connected to a network " +
|
||||
"to use msg", "ERROR");
|
||||
return false;
|
||||
}
|
||||
|
||||
var ary = e.inputData.match (/(\S+)\s+(.*)/);
|
||||
if (ary == null)
|
||||
return false;
|
||||
|
||||
var usr = e.network.primServ.addUser(ary[1].toLowerCase());
|
||||
|
||||
usr.say (ary[2]);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
client.onInputNick =
|
||||
function cli_inick (e)
|
||||
{
|
||||
|
@ -368,8 +396,14 @@ function cli_idesc (e)
|
|||
client.onInputQuote =
|
||||
function cli_iquote (e)
|
||||
{
|
||||
if (!e.network || !e.network.isConnected())
|
||||
{
|
||||
client.currentObject.display ("You must be connected to a network " +
|
||||
"to use quote.", "ERROR");
|
||||
return false;
|
||||
}
|
||||
|
||||
client.primNet.primServ.sendData (e.inputData + "\n");
|
||||
client.network.primServ.sendData (e.inputData + "\n");
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -435,7 +469,7 @@ function cli_ipart (e)
|
|||
{
|
||||
if (!e.channel)
|
||||
{
|
||||
client.currentObject.display ("Part can only be used from channels.",
|
||||
client.currentObject.display ("Leave can only be used from channels.",
|
||||
"ERROR");
|
||||
return false;
|
||||
}
|
||||
|
@ -449,6 +483,9 @@ function cli_ipart (e)
|
|||
client.onInputZoom =
|
||||
function cli_izoom (e)
|
||||
{
|
||||
client.currentObject.display ("**WARNING** Zoom is busted at this time :(",
|
||||
"WARNING");
|
||||
|
||||
if (!e.inputData)
|
||||
return false;
|
||||
|
||||
|
@ -521,9 +558,14 @@ CIRCNetwork.prototype.on376 = /* end of MOTD */
|
|||
function my_showtonet (e)
|
||||
{
|
||||
var p = (e.params[2]) ? e.params[2] + " " : "";
|
||||
var str = "";
|
||||
|
||||
switch (e.code)
|
||||
{
|
||||
case 004:
|
||||
str = e.params.slice(1).join (" ");
|
||||
break;
|
||||
|
||||
case 372:
|
||||
case 375:
|
||||
case 376:
|
||||
|
@ -532,9 +574,11 @@ function my_showtonet (e)
|
|||
/* no break */
|
||||
|
||||
default:
|
||||
this.display (p + e.meat, e.code.toUpperCase());
|
||||
str = e.meat;
|
||||
break;
|
||||
}
|
||||
|
||||
this.display (p + str, e.code.toUpperCase());
|
||||
|
||||
}
|
||||
|
||||
|
@ -697,7 +741,7 @@ CIRCChannel.prototype.onChanMode =
|
|||
function my_cmode (e)
|
||||
{
|
||||
|
||||
this.display (e.meat + " by " +
|
||||
this.display ("Mode " + e.params.slice(1).join(" ") + " by " +
|
||||
e.user.nick, "MODE");
|
||||
|
||||
for (var u in e.usersAffected)
|
||||
|
|
|
@ -138,24 +138,24 @@
|
|||
/* Message type indicator in output window */
|
||||
.msg-type {
|
||||
|
||||
display: none;
|
||||
color: grey;
|
||||
font-weight: bold;
|
||||
margin-right: 10px;
|
||||
|
||||
}
|
||||
|
||||
.msg-type[msgtype="NOTICE"] {
|
||||
.msg-type[msgtype="PRIVMSG"], /* dont show message types indicator */
|
||||
.msg-type[msgtype="ACTION"], /* for these kinds of messages */
|
||||
.msg-type[msgtype="JOIN"],
|
||||
.msg-type[msgtype="PART"],
|
||||
.msg-type[msgtype="QUIT"],
|
||||
.msg-type[msgtype="KICK"],
|
||||
.msg-type[msgtype="MODE"] {
|
||||
|
||||
display: inline;
|
||||
display: none;
|
||||
|
||||
}
|
||||
|
||||
.msg-type[network="{LOCAL}"] {
|
||||
|
||||
display: inline;
|
||||
|
||||
}
|
||||
|
||||
/* Listbox on left of UI (aka QuickList) */
|
||||
.quick-list {
|
||||
|
|
Загрузка…
Ссылка в новой задаче