From 4d92f7b4c47c3a443d7b60b68db4bf3ab585ca08 Mon Sep 17 00:00:00 2001 From: "rginda%netscape.com" Date: Tue, 3 Sep 2002 23:33:27 +0000 Subject: [PATCH] - chatzilla only - bug 165901, "Clicking on network/channel name has no effect" bug 165875, "Support CTCP CLIENTINFO in Chatzilla" bug 165868, "Support CTCP TIME in Chatzilla" bug 137892, "Pref for new tab threshold is ignored" fix strict warning in static.js git-svn-id: svn://10.0.0.236/trunk@128768 18797224-902f-48f8-a5cc-f745e15eee43 --- .../irc/js/lib/chatzilla-service.js | 6 ---- mozilla/extensions/irc/js/lib/irc.js | 33 +++++++++++++++++++ .../extensions/irc/xul/content/handlers.js | 4 +-- .../extensions/irc/xul/content/readprefs.js | 22 ++++++------- mozilla/extensions/irc/xul/content/static.js | 4 +-- 5 files changed, 48 insertions(+), 21 deletions(-) diff --git a/mozilla/extensions/irc/js/lib/chatzilla-service.js b/mozilla/extensions/irc/js/lib/chatzilla-service.js index 6796d18209d..b0bc8a28a86 100644 --- a/mozilla/extensions/irc/js/lib/chatzilla-service.js +++ b/mozilla/extensions/irc/js/lib/chatzilla-service.js @@ -177,12 +177,6 @@ function (aPort, aScheme) IRCProtocolHandler.prototype.newURI = function (aSpec, aCharset, aBaseURI) { - if (aBaseURI) - { - debug ("-*- ircHandler: aBaseURI passed to newURI, bailing.\n"); - return null; - } - var url = Components.classes[STANDARDURL_CONTRACTID]. createInstance(nsIStandardURL); url.init(nsIStandardURL.URLTYPE_STANDARD, 6667, aSpec, aCharset, aBaseURI); diff --git a/mozilla/extensions/irc/js/lib/irc.js b/mozilla/extensions/irc/js/lib/irc.js index b72e7315734..107f5189991 100644 --- a/mozilla/extensions/irc/js/lib/irc.js +++ b/mozilla/extensions/irc/js/lib/irc.js @@ -1503,6 +1503,12 @@ function serv_ctcp (e) e.CTCPData = ary[2] ? ary[2] : ""; e.CTCPCode = ary[1].toLowerCase(); + if (e.CTCPCode.search (/^reply/i) == 0) + { + dd ("dropping spoofed reply."); + return false; + } + e.type = "ctcp-" + e.CTCPCode; e.destMethod = "onCTCP" + ary[1][0].toUpperCase() + ary[1].substr (1, ary[1].length).toLowerCase(); @@ -1525,6 +1531,24 @@ function serv_ctcp (e) } +CIRCServer.prototype.onCTCPClientinfo = +function serv_ccinfo (e) +{ + var clientinfo = new Array(); + + for (var fname in this) + { + var ary = fname.match(/^onCTCP(.*)/); + if (ary && ary[1].search(/^Reply/) == -1) + clientinfo.push (ary[1].toUpperCase()); + } + + e.server.ctcpTo (e.user.nick, "CLIENTINFO", clientinfo.join(" "), + "NOTICE"); + + return true; +} + CIRCServer.prototype.onCTCPAction = function serv_cact (e) { @@ -1533,6 +1557,15 @@ function serv_cact (e) } +CIRCServer.prototype.onCTCPTime = +function serv_cping (e) +{ + + e.server.ctcpTo (e.user.nick, "TIME", new Date(), "NOTICE"); + + return true; + +} CIRCServer.prototype.onCTCPVersion = function serv_cver (e) diff --git a/mozilla/extensions/irc/xul/content/handlers.js b/mozilla/extensions/irc/xul/content/handlers.js index 9d607d19c3f..1e0036f1f17 100644 --- a/mozilla/extensions/irc/xul/content/handlers.js +++ b/mozilla/extensions/irc/xul/content/handlers.js @@ -3265,8 +3265,8 @@ function my_cprivmsg (e) else { playSounds(client.MSG_BEEP); - if (client.NEW_TAB_THRESHOLD == 0 || - client.viewsArray.length < client.NEW_TAB_THRESHOLD) + if (client.NEW_TAB_LIMIT == 0 || + client.viewsArray.length < client.NEW_TAB_LIMIT) { var tab = openQueryTab (e.server, e.user.nick); if (client.FOCUS_NEW_TAB) diff --git a/mozilla/extensions/irc/xul/content/readprefs.js b/mozilla/extensions/irc/xul/content/readprefs.js index f6ecbcc3e94..35b3bfa6df5 100644 --- a/mozilla/extensions/irc/xul/content/readprefs.js +++ b/mozilla/extensions/irc/xul/content/readprefs.js @@ -32,11 +32,11 @@ * | seperated * +- initialScripts (String) urls for scripts to run at startup, * | semicolon seperated - * +- newTabThreshold (Number) max number of tabs to have open before disabling - * | automatic tab creation for private messages. - * | use 0 for unlimited new tabs, or 1 to disable - * | automatic tab creation. - * +- focusNewTab (Boolean) bring new tabs created in response to a private + * +- newTabLimit (Number) max number of tabs to have open before disabling + * | automatic tab creation for private messages. + * | use 0 for unlimited new tabs, or 1 to disable + * | automatic tab creation. + * +- raiseNewTab (Boolean) bring new tabs created in response to a private * | message to the front. * +- munger (Boolean) send output through text->html munger * | +- colorCodes (Boolean) enable color code handling @@ -112,10 +112,10 @@ function readIRCPrefs (rootNode) client.INITIAL_URLS = "irc://"; client.INITIAL_SCRIPTS = getCharPref (pref, rootNode + "initialScripts", ""); - client.NEW_TAB_THRESHOLD = - getIntPref (pref, rootNode + "newTabThreshold", 15); - client.FOCUS_NEW_TAB = - getIntPref (pref, rootNode + "focusNewTab", false); + client.NEW_TAB_LIMIT = + getIntPref (pref, rootNode + "newTabLimit", 15); + client.RAISE_NEW_TAB = + getBoolPref (pref, rootNode + "raiseNewTab", false); client.ADDRESSED_NICK_SEP = getCharPref (pref, rootNode + "nickCompleteStr", client.ADDRESSED_NICK_SEP).replace(/\s*$/, ""); @@ -212,8 +212,8 @@ function writeIRCPrefs (rootNode) pref.setCharPref (rootNode + "nickCompleteStr", client.ADDRESSED_NICK_SEP); pref.setCharPref (rootNode + "initialURLs", client.INITIAL_URLS); pref.setCharPref (rootNode + "initialScripts", client.INITIAL_SCRIPTS); - pref.setCharPref (rootNode + "newTabThreshold", client.NEW_TAB_THRESHOLD); - pref.setCharPref (rootNode + "focusNewTab", client.FOCUS_NEW_TAB); + pref.setIntPref (rootNode + "newTabLimit", client.NEW_TAB_LIMIT); + pref.setBoolPref (rootNode + "raiseNewTab", client.RAISE_NEW_TAB); pref.setCharPref (rootNode + "style.default", client.DEFAULT_STYLE); pref.setCharPref (rootNode + "stalkWords", client.stalkingVictims.join ("; ")); diff --git a/mozilla/extensions/irc/xul/content/static.js b/mozilla/extensions/irc/xul/content/static.js index 5e0c2549c74..fcab54792a9 100644 --- a/mozilla/extensions/irc/xul/content/static.js +++ b/mozilla/extensions/irc/xul/content/static.js @@ -36,7 +36,7 @@ const MSG_UNKNOWN = getMsg ("unknown"); client.defaultNick = getMsg( "defaultNick" ); -client.version = "0.8.9"; +client.version = "0.8.10"; client.TYPE = "IRCClient"; client.COMMAND_CHAR = "/"; @@ -314,7 +314,7 @@ function processStartupURLs() if (!wentSomewhere) { /* if we had nowhere else to go, connect to any default urls */ - ary = client.INITIAL_URLS.split(/\s*;\s*/).reverse(); + var ary = client.INITIAL_URLS.split(/\s*;\s*/).reverse(); for (var i in ary) { if (ary[i] && ary[i] != "irc://")