-- CHATZILLA CHANGES ONLY --

* Makefile.in, makefile.win
Install new files: munger.js, test3-readprefs.js, and face-*.gif (9 files)

* irc.js
Update regexps to 1.5 syntax.

* test3-commands.js
Wire whois command.

* test3-handlers.js
readPrefs() on startup.
Show checkmark on debug message menu.
Clear inputbox after a /command.
Send eval output to currentobject, instead of *client*
Fix for /join #channelname joining ##channelname.
Whois command implementation.
Factor _addToUserList out of onJoin so it can be used from onNick as well.
Whois reply display code.

* test3-output-*.css
New styles for munger tags.
Assorted style changes.

* test3-static.js
Change linuxnet->moznet.
Munger hookup.
newInlineText creates spans instead of anchors.
notifyActivity blinks indicator if it is already lit.
s/parity/mark

* test3.css
Assorted ui style changes: tbuttons in groove, color changes, etc.

* test3.xul
Include new js file.
Put statusbar in a toolbox.
This commit is contained in:
rginda%netscape.com 1999-11-29 03:57:45 +00:00
parent 99f5ad93db
commit 3f34d95584
23 changed files with 790 additions and 79 deletions

View File

@ -50,6 +50,7 @@ JSLIBFILES = \
XULLIBFILES = \
$(srcdir)/xul/lib/EntryHistory.js \
$(srcdir)/xul/lib/listbox.js \
$(srcdir)/xul/lib/munger.js \
$(NULL)
TESTFILES = \
@ -71,15 +72,26 @@ TESTFILES = \
$(srcdir)/xul/tests/test3-static.js \
$(srcdir)/xul/tests/test3-handlers.js \
$(srcdir)/xul/tests/test3-commands.js \
$(srcdir)/xul/tests/test3-readprefs.js \
$(srcdir)/xul/tests/g_green.gif \
$(srcdir)/xul/tests/g_green_on.gif \
$(srcdir)/xul/tests/g_grey.gif \
$(srcdir)/xul/tests/g_grey_on.gif \
$(srcdir)/xul/tests/green-on.gif \
$(srcdir)/xul/tests/green-off.gif \
$(srcdir)/xul/tests/green-blink-1.gif \
$(srcdir)/xul/tests/yellow-on.gif \
$(srcdir)/xul/tests/xtal.jpg \
$(srcdir)/xul/tests/blue_rock.gif \
$(srcdir)/xul/tests/face-angry.gif \
$(srcdir)/xul/tests/face-cry.gif \
$(srcdir)/xul/tests/face-frown.gif \
$(srcdir)/xul/tests/face-smile.gif \
$(srcdir)/xul/tests/face-surprise.gif \
$(srcdir)/xul/tests/face-tongue.gif \
$(srcdir)/xul/tests/face-wink.gif \
$(srcdir)/xul/tests/face-screw.gif \
$(srcdir)/xul/tests/face-dunno.gif \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -178,6 +178,7 @@ function ep_routeevent (e)
catch (ex)
{
dd ("Error routing event: " + ex + " in " + e.destMethod);
}
if (count++ > this.MAX_EVENT_DEPTH)
throw "Too many events in chain";

View File

@ -684,7 +684,7 @@ function serv_329 (e)
return true;
}
/* channel mode reply */
CIRCServer.prototype.on324 =
function serv_324 (e)
@ -1098,7 +1098,7 @@ function serv_privmsg (e)
e.replyTo = e.user; /* send replys to the user who sent the message */
}
if (e.meat.search (/\01.*\01/i) == 0)
if (e.meat.search (/\x01.*\x01/i) != -1)
{
e.type = "ctcp";
e.destMethod = "onCTCP";
@ -1115,7 +1115,7 @@ function serv_privmsg (e)
CIRCServer.prototype.onCTCP =
function serv_ctcp (e)
{
var ary = e.meat.match (/^\01(\S+)? ?(.*)\01$/i);
var ary = e.meat.match (/^\x01(\S+)? ?(.*)\x01$/i);
if (ary == null)
return false;

View File

@ -47,6 +47,7 @@ JSLIBFILES = \
XULLIBFILES = \
.\xul\lib\EntryHistory.js \
.\xul\lib\listbox.js \
.\xul\lib\munger.js \
$(NULL)
TESTFILES = \
@ -68,15 +69,26 @@ TESTFILES = \
.\xul\tests\test3-static.js \
.\xul\tests\test3-handlers.js \
.\xul\tests\test3-commands.js \
.\xul\tests\test3-readprefs.js \
.\xul\tests\g_green.gif \
.\xul\tests\g_green_on.gif \
.\xul\tests\g_grey.gif \
.\xul\tests\g_grey_on.gif \
.\xul\tests\green-on.gif \
.\xul\tests\green-off.gif \
.\xul\tests\green-blink-1.gif \
.\xul\tests\yellow-on.gif \
.\xul\tests\xtal.jpg \
.\xul\tests\blue_rock.gif \
.\xul\tests\face-angry.gif \
.\xul\tests\face-cry.gif \
.\xul\tests\face-frown.gif \
.\xul\tests\face-smile.gif \
.\xul\tests\face-surprise.gif \
.\xul\tests\face-tongue.gif \
.\xul\tests\face-wink.gif \
.\xul\tests\face-screw.gif \
.\xul\tests\face-dunno.gif \
$(NULL)

View File

@ -0,0 +1,105 @@
function CMungerEntry (name, regex, className, tagName)
{
this.name = name;
this.tagName = (tagName) ? tagName : "html:span";
if (regex instanceof RegExp)
this.regex = regex;
else
this.lambdaMatch = regex;
if (typeof className == "function")
this.lambdaReplace = className;
else
this.className = className;
}
function CMunger ()
{
this.entries = new Object();
}
CMunger.prototype.addRule =
function mng_addrule (name, regex, className)
{
this.entries[name] = new CMungerEntry (name, regex, className);
}
CMunger.prototype.delRule =
function mng_delrule (name)
{
delete this.entries[name];
}
CMunger.prototype.munge =
function mng_munge (text, containerTag, eventDetails)
{
var entry;
var ary;
if (!containerTag)
containerTag = document.createElement (tagName);
for (entry in this.entries)
{
if (typeof this.entries[entry].lambdaMatch == "function")
{
var rval;
rval = this.entries[entry].lambdaMatch(text, containerTag,
eventDetails,
this.entries[entry]);
if (rval)
ary = [(void 0), rval];
else
ary = null;
}
else
ary = text.match(this.entries[entry].regex);
if (ary != null)
{
var startPos = text.indexOf(ary[1]);
if (typeof this.entries[entry].lambdaReplace == "function")
{
this.munge (text.substr(0,startPos), containerTag,
eventDetails);
this.entries[entry].lambdaReplace (ary[1], containerTag,
eventDetails,
this.entries[entry]);
this.munge (text.substr (startPos + ary[1].length, text.length),
containerTag, eventDetails);
return containerTag;
}
else
{
this.munge (text.substr(0,startPos), containerTag, eventDetails);
var subTag = document.createElement
(this.entries[entry].tagName);
subTag.setAttribute ("class", this.entries[entry].className);
subTag.appendChild
(document.createTextNode (ary[1]));
containerTag.appendChild (subTag);
this.munge (text.substr (startPos + ary[1].length, text.length),
containerTag, eventDetails);
return containerTag;
}
}
}
containerTag.appendChild (document.createTextNode (text));
return containerTag;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

View File

@ -100,6 +100,12 @@ function addCommands(commandObject)
"Shows only messages <nick> has sent to the channel, filtering out " +
"all others, (including yours.)");
add ("whois", "onInputWhoIs",
"<nick>",
"Displays information about the user <nick>, including 'real name', " +
"server connected to, idle time, and signon time. Note that some " +
"servers will lie about the idle time.");
add ("topic", "onInputTopic",
"[<new-topic>]",
"If <new-topic> is specified and you are a chanop, or the channel " +

View File

@ -26,10 +26,11 @@
function onLoad()
{
initHost(client);
setOutputStyle ("default");
initStatic();
readIRCPrefs();
mainStep();
}
@ -37,7 +38,7 @@ function onLoad()
function onUnload()
{
client.quit ("re-load");
client.quit ("ChatZilla!");
}
@ -54,11 +55,10 @@ function onTBIClick (id)
function onToggleTraceHook()
{
var h = client.eventPump.getHook ("event-tracer");
var caption;
h.enabled = !h.enabled;
caption = h.enabled ? "Debug Messages (ON)" : "Debug Messages (OFF)";
document.getElementById("menu-dmessages").setAttribute ("value", caption);
document.getElementById("menu-dmessages").setAttribute ("checked",
h.enabled);
}
@ -145,6 +145,7 @@ function onInputCompleteLine(e)
ev.target = client.currentObject;
getObjectDetails (ev.target, ev);
client.eventPump.addEvent (ev);
e.target.value = "";
}
}
else /* plain text */
@ -170,6 +171,7 @@ function onInputCompleteLine(e)
e.target.style.height = client.COLLAPSE_HEIGHT;
e.target.value = "";
client.sayToCurrentTarget (lines[i]);
e.target.value = "";
}
}
@ -453,13 +455,15 @@ function cli_ieval (e)
{
rv = String(eval (e.inputData));
if (rv.indexOf ("\n") == -1)
client.display ("{" + e.inputData + "} " + rv, "EVAL");
client.currentObject.display ("{" + e.inputData + "} " + rv,
"EVAL");
else
client.display ("{" + e.inputData + "}\n" + rv, "EVAL");
client.currentObject.display ("{" + e.inputData + "}\n" + rv,
"EVAL");
}
catch (ex)
{
client.display (String(ex), "ERROR");
client.currentObject.display (String(ex), "ERROR");
}
return true;
@ -483,10 +487,12 @@ function cli_ijoin (e)
if (!name)
return false;
name = String(name);
if ((name[0] != "#") && (name[0] != "&"))
name = "#" + name;
e.channel = e.server.addChannel (String(name));
e.channel = e.server.addChannel (name);
e.channel.join();
e.channel.display ("Joining...", "INFO");
setCurrentObject(e.channel);
@ -542,6 +548,31 @@ function cli_izoom (e)
}
client.onInputWhoIs =
function cli_whois (e)
{
if (!e.inputData)
return false;
if (!e.network || !e.network.isConnected())
{
if (!e.network)
client.currentObject.display ("No network selected.", "ERROR");
else
client.currentObject.display ("Network '" + e.network.name +
" is not connected.", "ERROR");
return false;
}
var nick = e.inputData.match(/\S+/);
e.server.sendData ("whois " + nick + "\n");
return true;
}
client.onInputTopic =
function cli_itopic (e)
{
@ -574,7 +605,37 @@ function cli_itopic (e)
return true;
}
/* 'private' function, should only be used from inside */
CIRCChannel.prototype._addToUserList =
function my_addtolist (user)
{
var ary = new Array();
var u;
var i;
for (u in this.users)
ary.push (this.users[u].nick);
ary.sort();
for (i = 0; i < ary.length; i++)
if (user.nick == ary[i])
break;
if (!this.list)
this.list = new CListBox();
if (i < ary.length - 1)
{
this.list.prepend (user.getDecoratedNick(),
this.users[ary[i + 1]].getDecoratedNick());
}
else
this.list.add (user.getDecoratedNick());
}
CIRCNetwork.prototype.onNotice =
CIRCNetwork.prototype.on001 = /* Welcome! */
CIRCNetwork.prototype.on002 = /* your host is */
@ -620,6 +681,47 @@ function my_showtonet (e)
}
CIRCNetwork.prototype.on311 = /* whois name */
CIRCNetwork.prototype.on319 = /* whois channels */
CIRCNetwork.prototype.on312 = /* whois server */
CIRCNetwork.prototype.on317 = /* whois idle time */
CIRCNetwork.prototype.on318 = /* whois end of whois*/
function my_whoisreply (e)
{
var text = "egads!";
switch (Number(e.code))
{
case 311:
text = e.params[2] + " (" + e.params[3] + "@" + e.params[4] +
") is " + e.meat;
break;
case 319:
text = e.params[2] + " is a member of " + e.meat;
break;
case 312:
text = e.params[2] + " is attached to " + e.params[3]
break;
case 317:
text = e.params[2] + " has been idle for " + e.params[3] +
" seconds (on since " + new Date(Number(e.params[4]) * 100) +
")";
break;
case 318:
text = "End of whois information for " + e.params[2];
break;
}
e.server.parent.display(text, e.code);
}
CIRCNetwork.prototype.onPing =
function my_netping (e)
{
@ -740,28 +842,8 @@ function my_cjoin (e)
e.user.host + ") has joined " + e.channel.name,
"JOIN", e.user.nick);
var ary = new Array();
for (var u in this.users)
ary.push (this.users[u].nick);
this._addToUserList (e.user);
ary.sort();
for (u in ary)
if (ary[u] == e.user.nick)
break;
if (!this.list)
this.list = new CListBox();
if (u < ary.length - 1)
{
this.list.prepend (e.user.getDecoratedNick(),
e.channel.users[ary[u + 1]].getDecoratedNick());
}
else
this.list.add (e.user.getDecoratedNick());
updateChannel (e.channel);
}
@ -845,7 +927,9 @@ function my_cnick (e)
this.display (e.oldNick + " is now known as " + e.user.properNick,
"NICK");
this.list.remove (e.user.getDecoratedNick());
e.user.updateDecoratedNick();
this._addToUserList(e.user);
}

View File

@ -33,6 +33,56 @@ body {
}
a {
color: cyan;
}
.bold {
font-weight: bold;
}
.italic {
font-style: italic;
}
.underline {
text-decoration: underline;
}
.strikethrough {
text-decoration: line-through;
}
.teletype {
font-family: monospace;
}
.smallcap {
font-variant: small-caps;
}
.rheet {
font-size: 14pt;
font-weight: bold;
color: magenta;
}
/* output from a chat session (contains msgs) */
.chat-view {
@ -58,7 +108,35 @@ body {
/* message data in output window */
.msg-data {
color: lightgrey;
padding: 2px;
color: white;
}
.msg-data[msgtype="311"] {
border: none;
border-top: 1 cyan solid;
border-right: 1 cyan solid;
}
.msg-data[msgtype="319"],
.msg-data[msgtype="312"],
.msg-data[msgtype="317"] {
margin-top: 0px;
border: none;
border-right: 1 cyan solid;
}
.msg-data[msgtype="318"] {
border: none;
border-right: 1 cyan solid;
border-bottom: 1 cyan solid;
margin-top: 0px;
}
@ -67,6 +145,18 @@ body {
.msg-data[user="!ME"]{
}
.msg-data[directedToMe="true"] {
color: orange;
}
.msg-data[mark="odd"]{
color: lightgrey;
}
.msg-data[msgtype="EVAL"] {
@ -113,11 +203,18 @@ body {
.msg-data[msgtype="ACTION"] {
color: lightmagenta;
color: #6ac9ee;
}
.msg-data[msgtype="NOTICE"] {
.msg-data[msgtype="NICK"] {
color: #96fa94;
}
.msg-data[msgtype="NOTICE"],
.msg-data[msgtype="MODE"] {
color: yellow;
@ -146,11 +243,6 @@ body {
font-weight: bold;
border: 1 white solid;
}
.msg-user[parity="odd"]{
}
.msg-user[user="!ME"] {
@ -165,6 +257,17 @@ body {
}
.msg-user[msgtype="PRIVMSG"],
.msg-user[msgtype="ACTION"] {
border: none;
padding-right: 2px;
text-align: right;
vertical-align: middle;
font-weight: bold;
}
/* Message type indicator in output window */
.msg-type {
@ -176,8 +279,37 @@ body {
}
.msg-type[msgtype="311"] {
border: none;
border-top: 1 cyan solid;
border-left: 1 cyan solid;
}
.msg-type[msgtype="319"],
.msg-type[msgtype="312"],
.msg-type[msgtype="317"] {
margin-top: 0px;
border: none;
border-left: 1 cyan solid;
}
.msg-type[msgtype="318"] {
border: none;
border-left: 1 cyan solid;
border-bottom: 1 cyan solid;
margin-top: 0px;
}
.msg-type[user="!ME"] {
background: slategrey;
}
}

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
@ -19,7 +19,7 @@
* Contributor(s):
* Robert Ginda, rginda@ndcico.com, original author
*
/* Styles for output window, See test3.css for UI styles
* Styles for output window, See test3.css for UI styles
*
*/
@ -30,6 +30,50 @@ body {
}
.bold {
font-weight: bold;
}
.italic {
font-style: italic;
}
.underline {
text-decoration: underline;
}
.strikethrough {
text-decoration: line-through;
}
.teletype {
font-family: monospace;
}
.smallcap {
font-variant: small-caps;
}
.rheet {
font-size: 14pt;
font-weight: bold;
color: magenta;
}
/* output from a chat session (contains msgs) */
.chat-view {

View File

@ -33,6 +33,50 @@ body {
}
.bold {
font-weight: bold;
}
.italic {
font-style: italic;
}
.underline {
text-decoration: underline;
}
.strikethrough {
text-decoration: line-through;
}
.teletype {
font-family: monospace;
}
.smallcap {
font-variant: small-caps;
}
.rheet {
font-size: 14pt;
font-weight: bold;
color: magenta;
}
/* output from a chat session (contains msgs) */
.chat-view {

View File

@ -0,0 +1,90 @@
function readIRCPrefs (rootNode)
{
var pref =
Components.classes["component://netscape/preferences"].createInstance();
if(!pref)
throw ("Can't find pref component.");
if (!rootNode)
rootNode = "extensions.irc.";
if (!rootNode.match(/\.$/))
rootNode += ".";
pref = pref.QueryInterface(Components.interfaces.nsIPref);
CIRCNetwork.prototype.INITIAL_NICK =
getCharPref (pref, rootNode + "nickname",
CIRCNetwork.prototype.INITIAL_NICK);
CIRCNetwork.prototype.INITIAL_NAME =
getCharPref (pref, rootNode + "username",
CIRCNetwork.prototype.INITIAL_NAME);
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.MAX_MESSAGES =
getIntPref (pref, rootNode + "views.client.maxlines",
client.MAX_MESSAGES);
CIRCChannel.prototype.MAX_MESSAGES =
getIntPref (pref, rootNode + "views.channel.maxlines",
CIRCChannel.prototype.MAX_MESSAGES);
CIRCChanUser.prototype.MAX_MESSAGES =
getIntPref (pref, rootNode + "views.chanuser.maxlines",
CIRCChanUser.prototype.MAX_MESSAGES);
var h = client.eventPump.getHook ("event-tracer");
h.enabled =
getBoolPref (pref, rootNode + "debug.tracer", h.enabled);
}
function getCharPref (prefObj, prefName, defaultValue)
{
var e;
try
{
return prefObj.CopyCharPref (prefName);
}
catch (e)
{
dd ("Reading pref '" + prefName + "' threw '" + e + "'");
return defaultValue;
}
}
function getIntPref (prefObj, prefName, defaultValue)
{
var e;
try
{
return prefObj.GetIntPref (prefName);
}
catch (e)
{
return defaultValue;
}
}
function getBoolPref (prefObj, prefName, defaultValue)
{
var e;
try
{
return prefObj.GetBoolPref (prefName);
}
catch (e)
{
return defaultValue;
}
}

View File

@ -31,12 +31,14 @@ client.STEP_TIMEOUT = 500;
client.UPDATE_DELAY = 500;
client.EXPAND_HEIGHT = "200px";
client.COLLAPSE_HEIGHT = "25px";
client.MAX_MESSAGES = 200;
client.TYPE = "IRCClient";
client.OP1_IMG = "g_green_on.gif"; /* user is op image */
client.OP1_IMG = "g_green_on.gif"; /* user is op image */
client.OP0_IMG = "g_green.gif"; /* user isnt op image */
client.V1_IMG = "g_grey_on.gif"; /* user is voice image */
client.V0_IMG = "g_grey.gif"; /* user isnt voide image */
client.ACT_IMG = "green-on.gif"; /* view has activity image */
client.V1_IMG = "g_grey_on.gif"; /* user is voice image */
client.V0_IMG = "g_grey.gif"; /* user isnt voice image */
client.ACT_IMG = "green-on.gif"; /* view has activity image */
client.HEY_YOU_IMG = "green-blink-1.gif"; /* view has activity image */
client.NACT_IMG = "green-off.gif"; /* view has no activity image */
client.CUR_IMG = "yellow-on.gif"; /* view is currently displayed */
client.PRINT_DIRECTION = 1; /*1 => new messages at bottom, -1 => at top */
@ -50,7 +52,7 @@ CIRCNetwork.prototype.INITIAL_NICK = "IRCMonkey";
CIRCNetwork.prototype.INITIAL_NAME = "chatzilla";
CIRCNetwork.prototype.INITIAL_DESC = "New Now Know How";
CIRCNetwork.prototype.INITIAL_CHANNEL = "";
CIRCNetwork.prototype.MAX_MESSAGES = 50;
CIRCNetwork.prototype.MAX_MESSAGES = 100;
CIRCNetwork.prototype.IGNORE_MOTD = false;
CIRCServer.prototype.READ_TIMEOUT = 0;
@ -107,8 +109,8 @@ function initHost(obj)
{name: "irc.primenet.com", port: 6667},
{name: "irc.cs.cmu.edu", port: 6667}],
obj.eventPump);
obj.networks["linuxnet"] =
new CIRCNetwork ("linuxnet", [{name: "irc.mozilla.org", port: 6667}],
obj.networks["moznet"] =
new CIRCNetwork ("moznet", [{name: "irc.mozilla.org", port: 6667}],
obj.eventPump);
obj.networks["hybridnet"] =
new CIRCNetwork ("hybridnet", [{name: "irc.ssc.net", port: 6667}],
@ -123,6 +125,89 @@ function initHost(obj)
{type: "event-end"}], event_tracer,
"event-tracer", true /* negate */,
false /* disable */);
obj.munger = new CMunger();
obj.munger.addRule ("you-talking-to-me?", matchMyNick, "");
obj.munger.addRule
("link", /((http|mailto|ftp)\:\/\/[^\)\s]*|www\.\S+\.\S[^\)\s]*)/,
insertLink);
obj.munger.addRule
("face", /([\<\>]?[\;\=\:\8]\~?[\-\^\v]?[\)\|\(pP\<\>oO0\[\]\/\\])/,
insertSmiley);
obj.munger.addRule ("rheet", /(rhe+t\!*)/i, "rheet");
obj.munger.addRule ("bold", /(\*.*\*)/, "bold");
obj.munger.addRule ("italic", /[^sS](\/.*\/)/, "italic");
obj.munger.addRule ("teletype", /(\|.*\|)/, "teletype");
obj.munger.addRule ("underline", /(\_.*\_)/, "underline");
//obj.munger.addRule ("strikethrough", /(\-.*\-)/, "strikethrough");
obj.munger.addRule ("smallcap", /(\#.*\#)/, "smallcap");
}
function matchMyNick (text, containerTag, eventDetails)
{
if (eventDetails && eventDetails.server)
{
if ((stringTrim(text.toLowerCase()).indexOf
(eventDetails.server.me.nick) == 0) &&
text[eventDetails.server.me.nick.length + 1].match(/[\W\s]/))
{
containerTag.setAttribute ("directedToMe", "true");
}
}
return false;
}
function insertLink (matchText, containerTag)
{
var href;
if (matchText.indexOf ("://") == -1)
href = "http://" + matchText;
else
href = matchText;
var anchor = document.createElement ("html:a");
anchor.setAttribute ("href", href);
anchor.setAttribute ("target", "other_window");
anchor.appendChild (document.createTextNode (matchText));
containerTag.appendChild (anchor);
}
function insertSmiley (emoticon, containerTag)
{
var src = "";
if (emoticon.search (/\;[\-\^\v]?[\)\>\]]/) != -1)
src = "face-wink.gif";
else if (emoticon.search (/[\=\:\8][\-\^\v]?[\)\>\]]/) != -1)
src = "face-smile.gif";
else if (emoticon.search (/[\=\:\8][\-\^\v]?[\/\\]/) != -1)
src = "face-screw.gif";
else if (emoticon.search (/[\=\:\8]\~[\-\^\v]?\(/) != -1)
src = "face-cry.gif";
else if (emoticon.search (/[\=\:\8][\-\^\v]?[\(\<\[]/) != -1)
src = "face-frown.gif";
else if (emoticon.search (/\<?[\=\:\8][\-\^\v]?[0oO]/) != -1)
src = "face-surprise.gif";
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 (src)
{
var img = document.createElement ("html:img");
img.setAttribute ("src", src);
containerTag.appendChild (img);
}
}
@ -137,6 +222,9 @@ function mainStep()
function getObjectDetails (obj, rv)
{
if (!rv)
rv = new Object();
switch (obj.TYPE)
{
case "IRCChannel":
@ -177,6 +265,9 @@ function getObjectDetails (obj, rv)
/* no setup for unknown object */
break;
}
return rv;
}
function setOutputStyle (style)
@ -268,7 +359,7 @@ function updateChannel (obj)
function newInlineText (data, className, tagName)
{
if (typeof tagName == "undefined")
tagName = "html:a";
tagName = "html:span";
var a = document.createElement (tagName);
a.setAttribute ("class", className);
@ -341,6 +432,8 @@ function addHistory (source, obj)
{
source.messages = document.createElement ("html:table");
source.messages.setAttribute ("class", "chat-view");
source.messages.setAttribute ("cellpadding", "0");
source.messages.setAttribute ("cellspacing", "0");
source.messages.setAttribute ("type", source.TYPE);
source.messages.setAttribute ("width", "100%");
@ -389,10 +482,21 @@ function addHistory (source, obj)
function notifyActivity (source)
{
if (typeof source != "object")
source = client.viewsArray[source].source;
var tb = getTBForObject (source, true);
if (client.currentObject != source)
tb.setAttribute ("src", client.ACT_IMG);
if (tb.getAttribute ("src") == client.NACT_IMG)
tb.setAttribute ("src", client.ACT_IMG);
else /* if act light is already lit, blink it real quick */
{
tb.setAttribute ("src", client.NACT_IMG);
setTimeout ("notifyActivity(" +
Number(tb.getAttribute("viewKey")) + ");", 200);
}
}
@ -436,10 +540,10 @@ function getTBForObject (source, create)
{
var views = document.getElementById ("views-tbar");
var tbi = document.createElement ("toolbaritem");
tbi.setAttribute ("class", "activity-button");
tbi.setAttribute ("onclick", "onTBIClick('" + id + "')");
tb = document.createElement ("titledbutton");
tb.setAttribute ("class", "activity-button");
tb.setAttribute ("id", id);
client.viewsArray.push ({source: source, tb: tb});
tb.setAttribute ("viewKey", client.viewsArray.length - 1);
@ -650,7 +754,7 @@ function user_display(message, msgtype, sourceNick)
break;
case "PRIVMSG":
nickText = newInlineText ("<" + realNick + "> ",
nickText = newInlineText (/*"<" +*/ realNick /*+ ">"*/,
"msg-user", "html:td");
break;
@ -658,19 +762,19 @@ function user_display(message, msgtype, sourceNick)
if (nickText)
{
this.parity = (typeof this.parity != "undefined") ? this.parity :
this.mark = (typeof this.mark != "undefined") ? this.mark :
false;
if ((this.lastNickDisplayed) &&
(realNick != this.lastNickDisplayed))
{
this.parity = !this.parity;
this.mark = !this.mark ;
this.lastNickDisplayed = realNick;
}
else
this.lastNickDisplayed = realNick;
nickText.setAttribute ("parity", (this.parity) ? "even" : "odd");
nickText.setAttribute ("mark", (this.mark) ? "even" : "odd");
nickText.setAttribute ("network", this.parent.parent.name);
nickText.setAttribute ("user", this.nick);
nickText.setAttribute ("msgtype", msgtype);
@ -690,11 +794,18 @@ function user_display(message, msgtype, sourceNick)
{network: this.parent.parent.name, msgtype: msgtype},
"msg-data", "html:td");
msgData.setAttribute ("width", "100%");
msgData.setAttribute ("mark", (this.mark) ? "even" : "odd");
msgData.setAttribute ("network", this.parent.parent.name);
msgData.setAttribute ("channel", this.name);
msgData.setAttribute ("user", nick);
msgData.setAttribute ("msgtype", msgtype);
for (var l in ary)
{
msgData.appendChild(newInlineText (ary[l]));
if (msgtype.search (/PRIVMSG|ACTION/) != -1)
client.munger.munge(ary[l], msgData, getObjectDetails (this));
else
msgData.appendChild(newInlineText (ary[l]));
msgData.appendChild (document.createElement ("html:br"));
}
@ -747,7 +858,7 @@ function chan_display (message, msgtype, nick)
break;
case "PRIVMSG":
nickText = newInlineText ("<" + realNick + "> ",
nickText = newInlineText (/*"<" + */ realNick /*+ "> "*/,
"msg-user", "html:td");
break;
@ -756,18 +867,19 @@ function chan_display (message, msgtype, nick)
if (nickText)
{
this.parity = (typeof this.parity != "undefined") ? this.parity : false;
if (typeof this.mark == "undefined")
this.mark = "even";
if ((this.lastNickDisplayed) &&
(nick != this.lastNickDisplayed))
{
this.parity = !this.parity;
this.mark = (this.mark == "odd") ? "even" : "odd";
this.lastNickDisplayed = nick;
}
else
this.lastNickDisplayed = nick;
nickText.setAttribute ("parity", (this.parity) ? "even" : "odd");
nickText.setAttribute ("mark", this.mark);
nickText.setAttribute ("network", this.parent.parent.name);
nickText.setAttribute ("channel", this.name);
nickText.setAttribute ("user", nick);
@ -789,11 +901,18 @@ function chan_display (message, msgtype, nick)
user: nick, msgtype: msgtype},
"msg-data", "html:td");
msgData.setAttribute ("parity", (this.parity) ? "even" : "odd");
msgData.setAttribute ("mark", this.mark);
msgData.setAttribute ("network", this.parent.parent.name);
msgData.setAttribute ("channel", this.name);
msgData.setAttribute ("user", nick);
msgData.setAttribute ("msgtype", msgtype);
for (var l in ary)
{
msgData.appendChild (newInlineText (ary[l]));
if (msgtype.search (/PRIVMSG|ACTION/) != -1)
client.munger.munge(ary[l], msgData, getObjectDetails (this));
else
msgData.appendChild(newInlineText (ary[l]));
msgData.appendChild (document.createElement ("html:br"));
}

View File

@ -26,6 +26,19 @@
*
*/
window {
font-size: 12px;
background: url(xtal.jpg);
}
menubar, menu, menuitem, menupopup {
background: silver;
}
#outer-box {
margin: 5px;
@ -37,6 +50,7 @@
border: thin silver outset;
margin-left: 2px;
margin-right: 2px;
background: silver;
}
@ -49,8 +63,49 @@
#status-bar {
margin-top: 5px;
border: thin silver inset;
border: thin silver double;
background: #dddddd;
}
toolbar {
background: #dddddd;
border: silver double;
}
.activity-button {
background: #dddddd;
padding-top: 1px;
padding-left: 2px;
padding-right: 2px;
padding-bottom: 0px;
margin: 1px;
border: groove 2px;
}
.activity-button:hover {
background: #eeeeee;
padding-top: 0px;
padding-left: 1px;
padding-right: 3px;
padding-bottom: 1px;
border: 2px grey outset;
}
.activity-button:active {
background: #cccccc;
padding-top: 1px;
padding-left: 2px;
padding-right: 2px;
padding-bottom: 0px;
border: 2px grey inset;
}
@ -63,7 +118,7 @@
.status-data {
text-align: left;
color: brown;
color: darkslategrey;
}
@ -93,7 +148,7 @@
border: thin silver inset;
overflow: auto;
background: white;
background: #dddddd;
}

View File

@ -44,16 +44,18 @@ resource:///irc/tests/test3.xul
<html:script src="resource:///irc/js/lib/irc.js"/>
<html:script src="resource:///irc/js/lib/irc-debug.js"/>
<html:script src="resource:///irc/xul/lib/listbox.js"/>
<html:script src="resource:///irc/xul/lib/munger.js"/>
<html:script src="resource:///irc/tests/test3-commands.js"/>
<html:script src="resource:///irc/tests/test3-readprefs.js"/>
<html:script src="resource:///irc/tests/test3-static.js"/>
<html:script src="resource:///irc/tests/test3-handlers.js"/>
<html:script src="resource:///irc/tests/test3-commands.js"/>
<toolbox>
<menubar>
<menu value="Options">
<menupopup>
<menuitem id="menu-dmessages" value="Debug Messages (OFF)"
<menuitem id="menu-dmessages" value="Debug Messages"
oncommand="onToggleTraceHook()"/>
<menuseparator/>
<menu value="Style">
@ -83,14 +85,20 @@ resource:///irc/tests/test3.xul
<box id="inner-box" align="horizontal" flex="1">
<html:div id="quickList" class="quick-list" flex="0" width="150px">
</html:div>
<splitter id="main-splitter" align="vertical"/>
<splitter id="main-splitter" align="vertical" collapse="before"/>
<box align="vertical" flex="1">
<html:iframe id="it-doesnt-matter-anyway" class="output-container"
src="about:blank" flex="1"/>
<!--
<html:textarea id="input" class="input-window"/>
-->
<html:input type="text" id="input" class="input-window"/>
</box>
</box>
<html:div id="status-bar">
</box>
<toolbox>
<toolbar id="status-bar">
<html:table class="status-table">
<html:tr>
<html:td class="status-label">Network</html:td>
@ -147,7 +155,6 @@ resource:///irc/tests/test3.xul
</html:td>
</html:tr>
</html:table>
</html:div>
</box>
</toolbar>
</toolbox>
</window>