2000-05-13 02:30:21 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2000-01-18 06:32:43 +03:00
|
|
|
*
|
2004-04-19 02:14:17 +04:00
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* 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 the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
2003-08-19 01:35:33 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
2004-04-19 02:14:17 +04:00
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is ChatZilla.
|
2000-01-18 06:32:43 +03:00
|
|
|
*
|
2003-08-19 01:35:33 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2004-04-19 02:14:17 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2000-01-18 06:32:43 +03:00
|
|
|
*
|
|
|
|
* Contributor(s):
|
2004-04-19 02:14:17 +04:00
|
|
|
* Robert Ginda, <rginda@netscape.com>, original author
|
|
|
|
* Chiaki Koufugata chiaki@mozilla.gr.jp UI i18n
|
|
|
|
* Samuel Sieb, samuel@sieb.net, MIRC color codes, munger menu, and various
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2006-07-30 04:28:31 +04:00
|
|
|
const __cz_version = "0.9.75";
|
2003-10-22 03:47:35 +04:00
|
|
|
const __cz_condition = "green";
|
2004-09-15 22:39:16 +04:00
|
|
|
const __cz_suffix = "";
|
2004-10-18 17:22:20 +04:00
|
|
|
const __cz_guid = "59c81df5-4b7a-477b-912d-4e0fdf64e5f2";
|
2006-08-12 17:47:18 +04:00
|
|
|
const __cz_locale = "0.9.75.2";
|
2003-08-19 01:35:33 +04:00
|
|
|
|
|
|
|
var warn;
|
|
|
|
var ASSERT;
|
|
|
|
var TEST;
|
|
|
|
|
2000-06-23 02:57:09 +04:00
|
|
|
if (DEBUG)
|
2003-06-22 04:17:55 +04:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
_dd_pfx = "cz: ";
|
|
|
|
warn = function (msg) { dumpln ("** WARNING " + msg + " **"); }
|
2004-09-15 22:39:16 +04:00
|
|
|
TEST = ASSERT = function _assert(expr, msg) {
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!expr) {
|
2004-09-15 22:39:16 +04:00
|
|
|
dd("** ASSERTION FAILED: " + msg + " **\n" +
|
|
|
|
getStackTrace() + "\n");
|
2003-08-19 01:35:33 +04:00
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2003-06-22 04:17:55 +04:00
|
|
|
}
|
2000-06-23 02:57:09 +04:00
|
|
|
else
|
2003-08-19 01:35:33 +04:00
|
|
|
dd = warn = TEST = ASSERT = function (){};
|
2000-06-23 02:57:09 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
var client = new Object();
|
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
client.TYPE = "IRCClient";
|
2000-01-18 06:32:43 +03:00
|
|
|
client.COMMAND_CHAR = "/";
|
2005-10-25 00:48:34 +04:00
|
|
|
client.STEP_TIMEOUT = 500;
|
2000-01-18 06:32:43 +03:00
|
|
|
client.MAX_MESSAGES = 200;
|
|
|
|
client.MAX_HISTORY = 50;
|
2001-03-14 05:35:29 +03:00
|
|
|
/* longest nick to show in display before forcing the message to a block level
|
|
|
|
* element */
|
2000-05-15 09:58:30 +04:00
|
|
|
client.MAX_NICK_DISPLAY = 14;
|
2001-03-14 05:35:29 +03:00
|
|
|
/* longest word to show in display before abbreviating */
|
2001-08-24 01:41:24 +04:00
|
|
|
client.MAX_WORD_DISPLAY = 20;
|
2000-01-18 06:32:43 +03:00
|
|
|
client.PRINT_DIRECTION = 1; /*1 => new messages at bottom, -1 => at top */
|
2000-05-13 02:30:21 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
client.MAX_MSG_PER_ROW = 3; /* default number of messages to collapse into a
|
|
|
|
* single row, max. */
|
2004-09-15 22:39:16 +04:00
|
|
|
client.INITIAL_COLSPAN = 5; /* MAX_MSG_PER_ROW cannot grow to greater than
|
2001-12-04 03:20:48 +03:00
|
|
|
* one half INITIAL_COLSPAN + 1. */
|
|
|
|
client.NOTIFY_TIMEOUT = 5 * 60 * 1000; /* update notify list every 5 minutes */
|
2006-03-05 04:24:26 +03:00
|
|
|
|
|
|
|
// Check every minute which networks have away statuses that need an update.
|
|
|
|
client.AWAY_TIMEOUT = 60 * 1000;
|
2001-03-14 05:35:29 +03:00
|
|
|
|
|
|
|
client.SLOPPY_NETWORKS = true; /* true if msgs from a network can be displayed
|
|
|
|
* on the current object if it is related to
|
|
|
|
* the network (ie, /whois results will appear
|
|
|
|
* on the channel you're viewing, if that channel
|
|
|
|
* is on the network that the results came from)
|
|
|
|
*/
|
|
|
|
client.DOUBLETAB_TIME = 500;
|
|
|
|
client.IMAGEDIR = "chrome://chatzilla/skin/images/";
|
2004-09-15 22:39:16 +04:00
|
|
|
client.HIDE_CODES = true; /* true if you'd prefer to show numeric response
|
2001-03-14 05:35:29 +03:00
|
|
|
* codes as some default value (ie, "===") */
|
2003-03-26 01:23:50 +03:00
|
|
|
/* true if the browser widget shouldn't be allowed to take focus. windows, and
|
|
|
|
* probably the mac, need to be able to give focus to the browser widget for
|
|
|
|
* copy to work properly. */
|
|
|
|
client.NO_BROWSER_FOCUS = (navigator.platform.search(/mac|win/i) == -1);
|
2001-03-14 05:35:29 +03:00
|
|
|
client.DEFAULT_RESPONSE_CODE = "===";
|
2005-10-21 02:30:40 +04:00
|
|
|
/* Minimum number of users above or below the conference limit the user count
|
|
|
|
* must go, before it is changed. This allows the user count to fluctuate
|
|
|
|
* around the limit without continously going on and off.
|
|
|
|
*/
|
|
|
|
client.CONFERENCE_LOW_PASS = 10;
|
2001-03-14 05:35:29 +03:00
|
|
|
|
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
client.viewsArray = new Array();
|
2000-05-13 02:30:21 +04:00
|
|
|
client.activityList = new Object();
|
2005-11-26 23:56:30 +03:00
|
|
|
client.hostCompat = new Object();
|
2000-01-18 06:32:43 +03:00
|
|
|
client.inputHistory = new Array();
|
|
|
|
client.lastHistoryReferenced = -1;
|
|
|
|
client.incompleteLine = "";
|
2000-05-11 02:23:35 +04:00
|
|
|
client.lastTabUp = new Date();
|
2005-12-04 04:08:02 +03:00
|
|
|
client.awayMsgs = new Array();
|
|
|
|
client.awayMsgCount = 5;
|
2000-06-01 09:31:04 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
CIRCNetwork.prototype.INITIAL_CHANNEL = "";
|
|
|
|
CIRCNetwork.prototype.MAX_MESSAGES = 100;
|
2001-03-14 05:35:29 +03:00
|
|
|
CIRCNetwork.prototype.IGNORE_MOTD = false;
|
2004-12-20 01:52:37 +03:00
|
|
|
CIRCNetwork.prototype.RECLAIM_WAIT = 15000;
|
|
|
|
CIRCNetwork.prototype.RECLAIM_TIMEOUT = 400000;
|
2005-10-25 01:36:35 +04:00
|
|
|
CIRCNetwork.prototype.MIN_RECONNECT_MS = 15 * 1000; // 15s
|
|
|
|
CIRCNetwork.prototype.MAX_RECONNECT_MS = 2 * 60 * 60 * 1000; // 2h
|
2000-01-18 06:32:43 +03:00
|
|
|
|
|
|
|
CIRCServer.prototype.READ_TIMEOUT = 0;
|
2004-09-15 22:39:16 +04:00
|
|
|
CIRCServer.prototype.PRUNE_OLD_USERS = 0; // prune on user quit.
|
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
CIRCUser.prototype.MAX_MESSAGES = 200;
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
CIRCChannel.prototype.MAX_MESSAGES = 300;
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
CIRCChanUser.prototype.MAX_MESSAGES = 200;
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function init()
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
2004-03-10 07:39:50 +03:00
|
|
|
if (("initialized" in client) && client.initialized)
|
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
client.initialized = false;
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
client.networks = new Object();
|
2005-04-22 00:34:54 +04:00
|
|
|
client.entities = new Object();
|
2003-08-19 01:35:33 +04:00
|
|
|
client.eventPump = new CEventPump (200);
|
|
|
|
|
|
|
|
if (DEBUG)
|
|
|
|
{
|
|
|
|
/* hook all events EXCEPT server.poll and *.event-end types
|
|
|
|
* (the 4th param inverts the match) */
|
2004-09-15 22:39:16 +04:00
|
|
|
client.debugHook =
|
2003-08-19 01:35:33 +04:00
|
|
|
client.eventPump.addHook([{type: "poll", set:/^(server|dcc-chat)$/},
|
|
|
|
{type: "event-end"}], event_tracer,
|
|
|
|
"event-tracer", true /* negate */,
|
|
|
|
false /* disable */);
|
2004-09-15 22:39:16 +04:00
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
|
2004-12-20 01:52:37 +03:00
|
|
|
initApplicationCompatibility();
|
2005-04-22 00:34:54 +04:00
|
|
|
initMessages();
|
|
|
|
if (client.host == "")
|
2006-02-20 19:42:08 +03:00
|
|
|
showErrorDlg(getMsg(MSG_ERR_UNKNOWN_HOST, client.unknownUID));
|
2005-04-22 00:34:54 +04:00
|
|
|
|
|
|
|
initRDF();
|
2003-08-19 01:35:33 +04:00
|
|
|
initCommands();
|
|
|
|
initPrefs();
|
|
|
|
initMunger();
|
|
|
|
initNetworks();
|
|
|
|
initMenus();
|
|
|
|
initStatic();
|
|
|
|
initHandlers();
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Create DCC handler.
|
|
|
|
client.dcc = new CIRCDCC(client);
|
2003-08-19 01:35:33 +04:00
|
|
|
|
2006-02-11 22:26:14 +03:00
|
|
|
client.ident = new IdentServer(client);
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
// start logging. nothing should call display() before this point.
|
|
|
|
if (client.prefs["log"])
|
2004-09-15 22:39:16 +04:00
|
|
|
client.openLogFile(client);
|
2006-03-06 02:32:28 +03:00
|
|
|
// kick-start a log-check interval to make sure we change logfiles in time:
|
|
|
|
// It will fire 2 seconds past the next full hour.
|
2006-07-14 16:02:17 +04:00
|
|
|
setTimeout("checkLogFiles()", 3602000 - (Number(new Date()) % 3600000));
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-12-26 01:30:05 +03:00
|
|
|
// Make sure the userlist is on the correct side.
|
|
|
|
updateUserlistSide(client.prefs["userlistLeft"]);
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
client.display(MSG_WELCOME, "HELLO");
|
2004-09-15 22:39:16 +04:00
|
|
|
client.dispatch("set-current-view", { view: client });
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
importFromFrame("updateHeader");
|
|
|
|
importFromFrame("setHeaderState");
|
|
|
|
importFromFrame("changeCSS");
|
2005-09-06 01:12:03 +04:00
|
|
|
importFromFrame("updateMotifSettings");
|
2004-09-15 22:39:16 +04:00
|
|
|
importFromFrame("addUsers");
|
|
|
|
importFromFrame("updateUsers");
|
|
|
|
importFromFrame("removeUsers");
|
2003-08-19 01:35:33 +04:00
|
|
|
|
|
|
|
processStartupScripts();
|
|
|
|
|
|
|
|
client.commandManager.installKeys(document);
|
|
|
|
createMenus();
|
2003-09-24 04:49:09 +04:00
|
|
|
|
2004-12-20 01:52:37 +03:00
|
|
|
initIcons();
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
client.busy = false;
|
|
|
|
updateProgress();
|
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
client.initialized = true;
|
|
|
|
|
2006-01-19 02:20:58 +03:00
|
|
|
dispatch("help", { hello: true });
|
2003-09-24 04:49:09 +04:00
|
|
|
dispatch("networks");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2006-01-20 20:37:56 +03:00
|
|
|
initInstrumentation();
|
2005-10-31 06:31:17 +03:00
|
|
|
setTimeout(processStartupURLs, 0);
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function initStatic()
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
client.mainWindow = window;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
try
|
|
|
|
{
|
|
|
|
var io = Components.classes['@mozilla.org/network/io-service;1'];
|
|
|
|
client.iosvc = io.getService(Components.interfaces.nsIIOService);
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
2006-02-23 12:36:43 +03:00
|
|
|
dd("IO service failed to initialize: " + ex);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
try
|
|
|
|
{
|
|
|
|
const nsISound = Components.interfaces.nsISound;
|
|
|
|
client.sound =
|
|
|
|
Components.classes["@mozilla.org/sound;1"].createInstance(nsISound);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
client.soundList = new Object();
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
2006-02-23 12:36:43 +03:00
|
|
|
dd("Sound failed to initialize: " + ex);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
try
|
|
|
|
{
|
|
|
|
const nsIGlobalHistory = Components.interfaces.nsIGlobalHistory;
|
|
|
|
const GHIST_CONTRACTID = "@mozilla.org/browser/global-history;1";
|
|
|
|
client.globalHistory =
|
|
|
|
Components.classes[GHIST_CONTRACTID].getService(nsIGlobalHistory);
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
2006-02-23 12:36:43 +03:00
|
|
|
dd("Global History failed to initialize: " + ex);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
try
|
|
|
|
{
|
|
|
|
const nsISDateFormat = Components.interfaces.nsIScriptableDateFormat;
|
|
|
|
const DTFMT_CID = "@mozilla.org/intl/scriptabledateformat;1";
|
2004-09-15 22:39:16 +04:00
|
|
|
client.dtFormatter =
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
Components.classes[DTFMT_CID].createInstance(nsISDateFormat);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Mmmm, fun. This ONLY affects the ChatZilla window, don't worry!
|
|
|
|
Date.prototype.toStringInt = Date.prototype.toString;
|
|
|
|
Date.prototype.toString = function() {
|
|
|
|
var dtf = client.dtFormatter;
|
2004-09-15 22:39:16 +04:00
|
|
|
return dtf.FormatDateTime("", dtf.dateFormatLong,
|
|
|
|
dtf.timeFormatSeconds,
|
|
|
|
this.getFullYear(), this.getMonth() + 1,
|
|
|
|
this.getDate(), this.getHours(),
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
this.getMinutes(), this.getSeconds()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
2006-02-23 12:36:43 +03:00
|
|
|
dd("Locale-correct date formatting failed to initialize: " + ex);
|
2004-03-10 07:37:06 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
multilineInputMode(client.prefs["multiline"]);
|
2003-09-24 04:49:09 +04:00
|
|
|
if (client.prefs["showModeSymbols"])
|
|
|
|
setListMode("symbol");
|
|
|
|
else
|
|
|
|
setListMode("graphic");
|
2005-12-29 00:48:33 +03:00
|
|
|
|
|
|
|
var tree = document.getElementById('user-list');
|
|
|
|
tree.setAttribute("ondraggesture",
|
|
|
|
"nsDragAndDrop.startDrag(event, userlistDNDObserver);");
|
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
setDebugMode(client.prefs["debugMode"]);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
var ver = __cz_version + (__cz_suffix ? "-" + __cz_suffix : "");
|
|
|
|
|
2005-04-22 00:34:54 +04:00
|
|
|
var ua = navigator.userAgent;
|
2005-07-14 22:43:57 +04:00
|
|
|
var app = getService("@mozilla.org/xre/app-info;1", "nsIXULAppInfo");
|
|
|
|
if (app)
|
2002-08-02 01:08:59 +04:00
|
|
|
{
|
2005-07-14 22:43:57 +04:00
|
|
|
// Use the XUL host app info, and Gecko build ID.
|
2005-07-27 20:10:02 +04:00
|
|
|
if (app.ID == "{" + __cz_guid + "}")
|
|
|
|
{
|
|
|
|
// We ARE the app, in other words, we're running in XULrunner.
|
|
|
|
// Because of this, we must disregard app.(name|vendor|version).
|
|
|
|
// "XULRunner 1.7+/2005071506"
|
|
|
|
ua = "XULRunner " + app.platformVersion + "/" + app.platformBuildID;
|
|
|
|
|
|
|
|
// "XULRunner 1.7+/2005071506, Windows"
|
|
|
|
CIRCServer.prototype.HOST_RPLY = ua + ", " + client.platform;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// "Firefox 1.0+/2005071506"
|
|
|
|
ua = app.name + " " + app.version + "/";
|
|
|
|
if ("platformBuildID" in app) // 1.1 and up
|
|
|
|
ua += app.platformBuildID;
|
|
|
|
else if ("geckoBuildID" in app) // 1.0 - 1.1 trunk only
|
|
|
|
ua += app.geckoBuildID;
|
|
|
|
else // Uh oh!
|
|
|
|
ua += "??????????";
|
|
|
|
|
|
|
|
// "Mozilla Firefox 1.0+, Windows"
|
|
|
|
CIRCServer.prototype.HOST_RPLY = app.vendor + " " + app.name + " " +
|
|
|
|
app.version + ", " + client.platform;
|
|
|
|
}
|
2005-07-14 22:43:57 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Extract the revision number, and Gecko build ID.
|
|
|
|
var ary = navigator.userAgent.match(/(rv:[^;)\s]+).*?Gecko\/(\d+)/);
|
|
|
|
if (ary)
|
|
|
|
{
|
|
|
|
if (navigator.vendor)
|
|
|
|
ua = navigator.vendor + " " + navigator.vendorSub; // FF 1.0
|
|
|
|
else
|
|
|
|
ua = client.entities.brandShortName + " " + ary[1]; // Suite
|
|
|
|
ua = ua + "/" + ary[2];
|
|
|
|
}
|
|
|
|
CIRCServer.prototype.HOST_RPLY = client.entities.brandShortName + ", " +
|
|
|
|
client.platform;
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
|
|
|
|
2005-07-14 22:43:57 +04:00
|
|
|
client.userAgent = getMsg(MSG_VERSION_REPLY, [ver, ua]);
|
2004-09-15 22:39:16 +04:00
|
|
|
CIRCServer.prototype.VERSION_RPLY = client.userAgent;
|
2005-04-21 23:53:04 +04:00
|
|
|
CIRCServer.prototype.SOURCE_RPLY = MSG_SOURCE_REPLY;
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
client.statusBar = new Object();
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2006-01-19 01:28:31 +03:00
|
|
|
client.statusBar["server-nick"] = document.getElementById("server-nick");
|
2003-05-23 01:28:13 +04:00
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
client.statusElement = document.getElementById("status-text");
|
2003-08-19 01:35:33 +04:00
|
|
|
client.defaultStatus = MSG_DEFAULT_STATUS;
|
2001-12-04 03:20:48 +03:00
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
client.progressPanel = document.getElementById("status-progress-panel");
|
|
|
|
client.progressBar = document.getElementById("status-progress-bar");
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
client.logFile = null;
|
|
|
|
setInterval("onNotifyTimeout()", client.NOTIFY_TIMEOUT);
|
2006-03-05 04:24:26 +03:00
|
|
|
// Call every minute, will check only the networks necessary.
|
2004-09-15 22:39:16 +04:00
|
|
|
setInterval("onWhoTimeout()", client.AWAY_TIMEOUT);
|
|
|
|
|
2005-12-04 04:08:02 +03:00
|
|
|
client.awayMsgs = [{ message: MSG_AWAY_DEFAULT }];
|
|
|
|
var awayFile = new nsLocalFile(client.prefs["profilePath"]);
|
|
|
|
awayFile.append("awayMsgs.txt");
|
|
|
|
if (awayFile.exists())
|
|
|
|
{
|
|
|
|
var awayLoader = new TextSerializer(awayFile);
|
|
|
|
if (awayLoader.open("<"))
|
|
|
|
{
|
|
|
|
// Load the first item from the file.
|
|
|
|
var item = awayLoader.deserialize();
|
2006-09-08 03:05:20 +04:00
|
|
|
if (isinstance(item, Array))
|
2005-12-04 04:08:02 +03:00
|
|
|
{
|
|
|
|
// If the first item is an array, it is the entire thing.
|
|
|
|
client.awayMsgs = item;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Not an array, so we have the old format of a single object
|
|
|
|
* per entry.
|
|
|
|
*/
|
|
|
|
client.awayMsgs = [item];
|
|
|
|
while ((item = awayLoader.deserialize()))
|
|
|
|
client.awayMsgs.push(item);
|
|
|
|
}
|
|
|
|
awayLoader.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
client.defaultCompletion = client.COMMAND_CHAR + "help ";
|
2003-05-23 01:28:13 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
client.deck = document.getElementById('output-deck');
|
|
|
|
}
|
2003-05-23 01:28:13 +04:00
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
function initApplicationCompatibility()
|
|
|
|
{
|
|
|
|
// This routine does nothing more than tweak the UI based on the host
|
|
|
|
// application.
|
|
|
|
|
2006-01-19 01:28:31 +03:00
|
|
|
/* client.hostCompat.typeChromeBrowser indicates whether we should use
|
2005-11-26 23:56:30 +03:00
|
|
|
* type="chrome" <browser> elements for the output window documents.
|
|
|
|
* Using these is necessary to work properly with xpcnativewrappers, but
|
|
|
|
* broke selection in older builds.
|
|
|
|
*/
|
|
|
|
client.hostCompat.typeChromeBrowser = false;
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
// Set up simple host and platform information.
|
2004-12-20 01:52:37 +03:00
|
|
|
client.host = "Unknown";
|
2005-11-26 23:56:30 +03:00
|
|
|
var app = getService("@mozilla.org/xre/app-info;1", "nsIXULAppInfo");
|
|
|
|
if (app)
|
|
|
|
{
|
|
|
|
// Use the XULAppInfo.ID to find out what host we run on.
|
|
|
|
switch (app.ID)
|
|
|
|
{
|
|
|
|
case "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}":
|
|
|
|
client.host = "Firefox";
|
|
|
|
if (compareVersions(app.version, "1.4") <= 0)
|
|
|
|
client.hostCompat.typeChromeBrowser = true;
|
|
|
|
break;
|
|
|
|
case "{" + __cz_guid + "}":
|
|
|
|
// We ARE the app, in other words, we're running in XULrunner.
|
|
|
|
client.host = "XULrunner";
|
|
|
|
client.hostCompat.typeChromeBrowser = true;
|
|
|
|
break;
|
|
|
|
case "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}": // SeaMonkey
|
|
|
|
client.host = "Mozilla";
|
|
|
|
client.hostCompat.typeChromeBrowser = true;
|
|
|
|
break;
|
2006-02-20 19:42:08 +03:00
|
|
|
case "{a463f10c-3994-11da-9945-000d60ca027b}": // Flock
|
|
|
|
client.host = "Flock";
|
|
|
|
client.hostCompat.typeChromeBrowser = true;
|
|
|
|
break;
|
2005-11-26 23:56:30 +03:00
|
|
|
default:
|
2006-02-20 19:42:08 +03:00
|
|
|
client.unknownUID = app.ID;
|
2005-11-26 23:56:30 +03:00
|
|
|
client.host = ""; // Unknown host, show an error later.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ("getBrowserURL" in window)
|
2004-12-20 01:52:37 +03:00
|
|
|
{
|
|
|
|
var url = getBrowserURL();
|
|
|
|
if (url == "chrome://navigator/content/navigator.xul")
|
2006-02-21 21:31:17 +03:00
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
client.host = "Mozilla";
|
2006-02-21 21:31:17 +03:00
|
|
|
}
|
2004-12-20 01:52:37 +03:00
|
|
|
else if (url == "chrome://browser/content/browser.xul")
|
2006-02-21 21:31:17 +03:00
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
client.host = "Firefox";
|
2006-02-21 21:31:17 +03:00
|
|
|
}
|
2004-12-20 01:52:37 +03:00
|
|
|
else
|
2006-02-21 21:31:17 +03:00
|
|
|
{
|
2005-04-22 00:34:54 +04:00
|
|
|
client.host = ""; // We don't know this host. Show an error later.
|
2006-02-21 21:31:17 +03:00
|
|
|
client.unknownUID = url;
|
|
|
|
}
|
2004-12-20 01:52:37 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
client.platform = "Unknown";
|
|
|
|
if (navigator.platform.search(/mac/i) > -1)
|
|
|
|
client.platform = "Mac";
|
|
|
|
if (navigator.platform.search(/win/i) > -1)
|
|
|
|
client.platform = "Windows";
|
|
|
|
if (navigator.platform.search(/linux/i) > -1)
|
|
|
|
client.platform = "Linux";
|
2004-12-20 01:52:37 +03:00
|
|
|
if (navigator.platform.search(/os\/2/i) > -1)
|
|
|
|
client.platform = "OS/2";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
client.hostPlatform = client.host + client.platform;
|
|
|
|
|
|
|
|
CIRCServer.prototype.OS_RPLY = navigator.oscpu + " (" +
|
|
|
|
navigator.platform + ")";
|
|
|
|
|
|
|
|
// Windows likes \r\n line endings, as wussy-notepad can't cope with just
|
|
|
|
// \n logs.
|
|
|
|
if (client.platform == "Windows")
|
|
|
|
client.lineEnd = "\r\n";
|
2004-12-20 01:52:37 +03:00
|
|
|
else
|
|
|
|
client.lineEnd = "\n";
|
2004-09-15 22:39:16 +04:00
|
|
|
}
|
|
|
|
|
2004-12-20 01:52:37 +03:00
|
|
|
function initIcons()
|
|
|
|
{
|
|
|
|
// Make sure we got the ChatZilla icon(s) in place first.
|
|
|
|
const iconName = "chatzilla-window";
|
|
|
|
const suffixes = [".ico", ".xpm", "16.xpm"];
|
|
|
|
|
|
|
|
/* when installing on Mozilla, the XPI has the power to put the icons where
|
|
|
|
* they are needed - in Firefox, it doesn't. So we move them here, instead.
|
2005-09-27 00:34:03 +04:00
|
|
|
* In XULRunner, things are more fun, as we're not an extension.
|
2004-12-20 01:52:37 +03:00
|
|
|
*/
|
2005-09-27 00:34:03 +04:00
|
|
|
var sourceDir;
|
2006-02-20 19:42:08 +03:00
|
|
|
if ((client.host == "Firefox") || (client.host == "Flock"))
|
2005-09-27 00:34:03 +04:00
|
|
|
{
|
|
|
|
sourceDir = getSpecialDirectory("ProfD");
|
|
|
|
sourceDir.append("extensions");
|
|
|
|
sourceDir.append("{" + __cz_guid + "}");
|
|
|
|
sourceDir.append("defaults");
|
|
|
|
}
|
|
|
|
else if (client.host == "XULrunner")
|
|
|
|
{
|
|
|
|
sourceDir = getSpecialDirectory("resource:app");
|
|
|
|
sourceDir.append("chrome");
|
|
|
|
sourceDir.append("icons");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
return;
|
2005-09-27 00:34:03 +04:00
|
|
|
}
|
2004-12-20 01:52:37 +03:00
|
|
|
|
|
|
|
var destDir = getSpecialDirectory("AChrom");
|
|
|
|
destDir.append("icons");
|
|
|
|
destDir.append("default");
|
|
|
|
if (!destDir.exists())
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
mkdir(destDir);
|
|
|
|
}
|
|
|
|
catch(ex)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < suffixes.length; i++)
|
|
|
|
{
|
|
|
|
var iconDest = destDir.clone();
|
|
|
|
iconDest.append(iconName + suffixes[i]);
|
|
|
|
var iconSrc = sourceDir.clone();
|
|
|
|
iconSrc.append(iconName + suffixes[i]);
|
|
|
|
|
|
|
|
if (iconSrc.exists() && !iconDest.exists())
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
iconSrc.copyTo(iconDest.parent, iconDest.leafName);
|
|
|
|
}
|
|
|
|
catch(ex){}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-20 20:37:56 +03:00
|
|
|
function initInstrumentation()
|
|
|
|
{
|
|
|
|
// Make sure we assign the user a random key - this is not used for
|
|
|
|
// anything except percentage chance of participation.
|
|
|
|
if (client.prefs["instrumentation.key"] == 0)
|
|
|
|
{
|
|
|
|
var rand = 1 + Math.round(Math.random() * 10000);
|
|
|
|
client.prefs["instrumentation.key"] = rand;
|
|
|
|
}
|
|
|
|
|
|
|
|
runInstrumentation("inst1");
|
|
|
|
}
|
|
|
|
|
|
|
|
function runInstrumentation(name, firstRun)
|
|
|
|
{
|
|
|
|
if (!/^inst\d+$/.test(name))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Values:
|
|
|
|
// 0 = not answered question
|
|
|
|
// 1 = allowed inst
|
|
|
|
// 2 = denied inst
|
|
|
|
|
|
|
|
if (client.prefs["instrumentation." + name] == 0)
|
|
|
|
{
|
|
|
|
// We only want 1% of people to be asked here.
|
|
|
|
if (client.prefs["instrumentation.key"] > 100)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// User has not seen the info about this system. Show them the info.
|
|
|
|
var cmdYes = "allow-" + name;
|
|
|
|
var cmdNo = "deny-" + name;
|
|
|
|
var btnYes = getMsg(MSG_INST1_COMMAND_YES, cmdYes);
|
|
|
|
var btnNo = getMsg(MSG_INST1_COMMAND_NO, cmdNo);
|
|
|
|
client.munger.entries[".inline-buttons"].enabled = true;
|
|
|
|
client.display(getMsg("msg." + name + ".msg1", [btnYes, btnNo]));
|
|
|
|
client.display(getMsg("msg." + name + ".msg2", [cmdYes, cmdNo]));
|
|
|
|
client.munger.entries[".inline-buttons"].enabled = false;
|
|
|
|
|
|
|
|
// Don't hide *client* if we're asking the user about the startup ping.
|
|
|
|
client.lockView = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (client.prefs["instrumentation." + name] != 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (name == "inst1")
|
|
|
|
runInstrumentation1(firstRun);
|
|
|
|
}
|
|
|
|
|
|
|
|
function runInstrumentation1(firstRun)
|
|
|
|
{
|
|
|
|
function inst1onLoad()
|
|
|
|
{
|
|
|
|
if (/OK/.test(req.responseText))
|
|
|
|
client.display(MSG_INST1_MSGRPLY2);
|
|
|
|
else
|
|
|
|
client.display(getMsg(MSG_INST1_MSGRPLY1, MSG_UNKNOWN));
|
|
|
|
};
|
|
|
|
|
|
|
|
function inst1onError()
|
|
|
|
{
|
|
|
|
client.display(getMsg(MSG_INST1_MSGRPLY1, req.statusText));
|
|
|
|
};
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
const baseURI = "http://silver.warwickcompsoc.co.uk/" +
|
|
|
|
"mozilla/chatzilla/instrumentation/startup?";
|
|
|
|
|
|
|
|
if (firstRun)
|
|
|
|
{
|
|
|
|
// Do a first-run ping here.
|
|
|
|
var frReq = new XMLHttpRequest();
|
|
|
|
frReq.open("GET", baseURI + "first-run");
|
|
|
|
frReq.send(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
var data = new Array();
|
|
|
|
data.push("ver=" + encodeURIComponent(CIRCServer.prototype.VERSION_RPLY));
|
|
|
|
data.push("host=" + encodeURIComponent(client.hostPlatform));
|
|
|
|
data.push("chost=" + encodeURIComponent(CIRCServer.prototype.HOST_RPLY));
|
|
|
|
data.push("cos=" + encodeURIComponent(CIRCServer.prototype.OS_RPLY));
|
|
|
|
|
|
|
|
var url = baseURI + data.join("&");
|
|
|
|
|
|
|
|
var req = new XMLHttpRequest();
|
|
|
|
req.onload = inst1onLoad;
|
|
|
|
req.onerror = inst1onError;
|
|
|
|
req.open("GET", url);
|
|
|
|
req.send(null);
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
|
|
|
client.display(getMsg(MSG_INST1_MSGRPLY1, formatException(ex)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-03 22:41:26 +03:00
|
|
|
function getFindData(e)
|
|
|
|
{
|
|
|
|
var findData = new nsFindInstData();
|
|
|
|
findData.browser = e.sourceObject.frame;
|
|
|
|
findData.rootSearchWindow = e.sourceObject.frame.contentWindow;
|
|
|
|
findData.currentSearchWindow = e.sourceObject.frame.contentWindow;
|
2005-11-14 07:08:26 +03:00
|
|
|
|
|
|
|
/* Yay, evil hacks! findData.init doesn't care about the findService, it
|
|
|
|
* gets option settings from webBrowserFind. As we want the wrap option *on*
|
2006-01-20 20:37:56 +03:00
|
|
|
* when we use /find foo, we set it on the findService there. However,
|
|
|
|
* restoring the original value afterwards doesn't help, because init() here
|
2005-11-14 07:08:26 +03:00
|
|
|
* overrides that value. Unless we make .init do something else, of course:
|
|
|
|
*/
|
|
|
|
findData._init = findData.init;
|
2006-01-20 20:37:56 +03:00
|
|
|
findData.init =
|
2005-11-14 07:08:26 +03:00
|
|
|
function init()
|
2006-01-20 20:37:56 +03:00
|
|
|
{
|
2005-11-14 07:08:26 +03:00
|
|
|
this._init();
|
|
|
|
const FINDSVC_ID = "@mozilla.org/find/find_service;1";
|
|
|
|
var findService = getService(FINDSVC_ID, "nsIFindService");
|
|
|
|
this.webBrowserFind.wrapFind = findService.wrapFind;
|
|
|
|
};
|
|
|
|
|
2005-01-03 22:41:26 +03:00
|
|
|
return findData;
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function importFromFrame(method)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
client.__defineGetter__(method, import_wrapper);
|
|
|
|
CIRCNetwork.prototype.__defineGetter__(method, import_wrapper);
|
|
|
|
CIRCChannel.prototype.__defineGetter__(method, import_wrapper);
|
|
|
|
CIRCUser.prototype.__defineGetter__(method, import_wrapper);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
CIRCDCCChat.prototype.__defineGetter__(method, import_wrapper);
|
2004-09-15 22:39:16 +04:00
|
|
|
CIRCDCCFileTransfer.prototype.__defineGetter__(method, import_wrapper);
|
2003-08-19 01:35:33 +04:00
|
|
|
|
|
|
|
function import_wrapper()
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
var dummy = function(){};
|
|
|
|
|
|
|
|
if (!("frame" in this))
|
|
|
|
return dummy;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
try
|
2001-12-12 07:40:02 +03:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
var window = getContentWindow(this.frame)
|
|
|
|
if (window && "initialized" in window && window.initialized &&
|
|
|
|
method in window)
|
|
|
|
{
|
|
|
|
return window[method];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
|
|
|
ASSERT(0, "Caught exception calling: " + method + "\n" + ex);
|
2001-12-12 07:40:02 +03:00
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return dummy;
|
|
|
|
};
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function processStartupScripts()
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
client.plugins = new Array();
|
|
|
|
var scripts = client.prefs["initialScripts"];
|
|
|
|
for (var i = 0; i < scripts.length; ++i)
|
|
|
|
{
|
|
|
|
if (scripts[i].search(/^file:|chrome:/i) != 0)
|
|
|
|
{
|
|
|
|
display(getMsg(MSG_ERR_INVALID_SCHEME, scripts[i]), MT_ERROR);
|
|
|
|
continue;
|
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
var path = getFileFromURLSpec(scripts[i]);
|
2003-03-26 01:23:50 +03:00
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
if (!path.exists())
|
|
|
|
{
|
|
|
|
display(getMsg(MSG_ERR_ITEM_NOT_FOUND, scripts[i]), MT_WARN);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (path.isDirectory())
|
|
|
|
loadPluginDirectory(path);
|
|
|
|
else
|
|
|
|
loadLocalFile(path);
|
|
|
|
}
|
|
|
|
}
|
2001-06-07 04:52:57 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function loadPluginDirectory(localPath, recurse)
|
|
|
|
{
|
|
|
|
if (typeof recurse == "undefined")
|
|
|
|
recurse = 1;
|
-- CHATZILLA CHANGES ONLY --
checking in patch from Josh Gough, <exv@randomc.com>
muchas gracias!
irc.js
add whois, invite
utils.js
added map and mapObjFunc
chatzilla.xul
add cntxt menu for userlist
commands.js
hook up /away, op, deop, voice, devoice, echo, invite, and kick commands
hadlers.js
onload hack
whois, away, deop, op, voice, devoice, echo, invite, kick command implementations
static.js
more of the onload hack
addEventListener on toolbuttons
listbox.js
selection code
chatzilla.css
selicted list item style
2000-04-24 04:40:56 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
var initPath = localPath.clone();
|
|
|
|
initPath.append("init.js");
|
|
|
|
if (initPath.exists())
|
|
|
|
loadLocalFile(initPath);
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (recurse < 1)
|
|
|
|
return;
|
2001-09-20 09:04:17 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
var enumer = localPath.directoryEntries;
|
|
|
|
while (enumer.hasMoreElements())
|
|
|
|
{
|
|
|
|
var entry = enumer.getNext();
|
|
|
|
entry = entry.QueryInterface(Components.interfaces.nsILocalFile);
|
|
|
|
if (entry.isDirectory())
|
|
|
|
loadPluginDirectory(entry, recurse - 1);
|
|
|
|
}
|
|
|
|
}
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function loadLocalFile(localFile)
|
|
|
|
{
|
|
|
|
var url = getURLSpecFromFile(localFile);
|
|
|
|
var glob = new Object();
|
|
|
|
dispatch("load", {url: url, scope: glob});
|
|
|
|
}
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function getPluginById(id)
|
|
|
|
{
|
|
|
|
for (var i = 0; i < client.plugins.length; ++i)
|
|
|
|
{
|
|
|
|
if (client.plugins[i].id == id)
|
|
|
|
return client.plugins[i];
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return null;
|
|
|
|
}
|
2003-06-22 04:17:55 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function getPluginIndexById(id)
|
|
|
|
{
|
|
|
|
for (var i = 0; i < client.plugins.length; ++i)
|
|
|
|
{
|
|
|
|
if (client.plugins[i].id == id)
|
|
|
|
return i;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2000-05-13 02:30:21 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return -1;
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
function getPluginByURL(url)
|
|
|
|
{
|
|
|
|
for (var i = 0; i < client.plugins.length; ++i)
|
|
|
|
{
|
|
|
|
if (client.plugins[i].url == url)
|
|
|
|
return client.plugins[i];
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getPluginIndexByURL(url)
|
|
|
|
{
|
|
|
|
for (var i = 0; i < client.plugins.length; ++i)
|
|
|
|
{
|
|
|
|
if (client.plugins[i].url == url)
|
|
|
|
return i;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
function processStartupURLs()
|
|
|
|
{
|
2001-08-24 01:41:24 +04:00
|
|
|
var wentSomewhere = false;
|
2001-12-04 03:20:48 +03:00
|
|
|
|
|
|
|
if ("arguments" in window &&
|
|
|
|
0 in window.arguments && typeof window.arguments[0] == "object" &&
|
|
|
|
"url" in window.arguments[0])
|
2001-08-24 01:41:24 +04:00
|
|
|
{
|
2002-08-02 01:08:59 +04:00
|
|
|
var url = window.arguments[0].url;
|
2004-09-15 22:39:16 +04:00
|
|
|
if (url.search(/^ircs?:\/?\/?\/?$/i) == -1)
|
2001-08-24 01:41:24 +04:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
/* if the url is not irc: irc:/, irc://, or ircs equiv then go to it. */
|
2003-09-24 04:49:09 +04:00
|
|
|
gotoIRCURL(url);
|
2001-08-24 01:41:24 +04:00
|
|
|
wentSomewhere = true;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
}
|
2005-09-12 22:54:27 +04:00
|
|
|
/* check to see whether the URL has been passed via the command line
|
|
|
|
instead. */
|
|
|
|
else if ("arguments" in window &&
|
|
|
|
0 in window.arguments && typeof window.arguments[0] == "string")
|
|
|
|
{
|
|
|
|
var url = window.arguments[0]
|
|
|
|
var urlMatches = url.match(/^ircs?:\/\/\/?(.*)$/)
|
|
|
|
if (urlMatches)
|
|
|
|
{
|
|
|
|
if (urlMatches[1])
|
|
|
|
{
|
|
|
|
/* if the url is not "irc://", "irc:///" or an ircs equiv then
|
|
|
|
go to it. */
|
|
|
|
gotoIRCURL(url);
|
|
|
|
wentSomewhere = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (url)
|
|
|
|
{
|
|
|
|
/* URL parameter is not blank, but does not not conform to the
|
|
|
|
irc[s] scheme. */
|
|
|
|
display(getMsg(MSG_ERR_INVALID_SCHEME, url), MT_ERROR);
|
|
|
|
}
|
|
|
|
}
|
2001-08-24 01:41:24 +04:00
|
|
|
|
|
|
|
if (!wentSomewhere)
|
|
|
|
{
|
|
|
|
/* if we had nowhere else to go, connect to any default urls */
|
2003-08-19 01:35:33 +04:00
|
|
|
var ary = client.prefs["initialURLs"];
|
|
|
|
for (var i = 0; i < ary.length; ++i)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2003-12-19 06:54:03 +03:00
|
|
|
if (ary[i] && ary[i] == "irc:///")
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
// Clean out "default network" entries, which we don't
|
2003-12-19 06:54:03 +03:00
|
|
|
// support any more; replace with the harmless irc:// URL.
|
|
|
|
ary[i] = "irc://";
|
|
|
|
client.prefs["initialURLs"].update();
|
|
|
|
}
|
2001-12-14 04:43:26 +03:00
|
|
|
if (ary[i] && ary[i] != "irc://")
|
2003-08-19 01:35:33 +04:00
|
|
|
gotoIRCURL(ary[i]);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2001-08-24 01:41:24 +04:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
if (client.viewsArray.length > 1 && !isStartupURL("irc://"))
|
|
|
|
{
|
2005-04-22 00:08:25 +04:00
|
|
|
dispatch("delete-view", {view: client});
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2000-05-09 05:00:42 +04:00
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function destroy()
|
|
|
|
{
|
|
|
|
destroyPrefs();
|
|
|
|
}
|
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
function setStatus (str)
|
|
|
|
{
|
|
|
|
client.statusElement.setAttribute ("label", str);
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
client.__defineSetter__ ("status", setStatus);
|
|
|
|
|
|
|
|
function getStatus ()
|
|
|
|
{
|
|
|
|
return client.statusElement.getAttribute ("label");
|
|
|
|
}
|
|
|
|
|
|
|
|
client.__defineGetter__ ("status", getStatus);
|
|
|
|
|
2000-05-13 02:30:21 +04:00
|
|
|
function isVisible (id)
|
|
|
|
{
|
|
|
|
var e = document.getElementById(id);
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!ASSERT(e,"Bogus id ``" + id + "'' passed to isVisible() **"))
|
2000-05-13 02:30:21 +04:00
|
|
|
return false;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-05-13 02:30:21 +04:00
|
|
|
return (e.getAttribute ("collapsed") != "true");
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2005-02-27 01:19:46 +03:00
|
|
|
client.getConnectedNetworks =
|
2005-05-09 16:26:19 +04:00
|
|
|
function getConnectedNetworks()
|
2005-02-27 01:19:46 +03:00
|
|
|
{
|
|
|
|
var rv = [];
|
|
|
|
for (var n in client.networks)
|
|
|
|
{
|
|
|
|
if (client.networks[n].isConnected())
|
|
|
|
rv.push(client.networks[n]);
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2005-10-25 02:22:22 +04:00
|
|
|
function insertLink (matchText, containerTag, data)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
|
|
|
var href;
|
landing chatzilla 0.8.23, bug 194241, r=samuel@sieb.net, a=asa@mozilla.org
fixes...
bug 190568, ssieb upgraded networking code that was making incorrect assumptions.
bug 191910, added a munger rule to turn `` and '' into unicode left/right double
quotes.
bug 124638, Neil's fix to keep chatzilla from stealing focus when joining channels.
bug 191500, Items in chatzilla's pref tree were hardcoded into the .xul file.
bug 194334, Adds accelerator keys to some pref panels, in places where they were missing.
Allows formatting to be nested, to a certain extent. * http://foo * will
linkify http://foo AND bold it.
Lets tab characters pass through the control-code munger.
Added auto-reconnect, and a pref to control it.
Fixed URL munging so that it only creates links for valid schemes, and doesn't
include trailing punctuation in the link.
No longer strips leading and trailing whitespace from submitted lines.
2003-02-26 03:57:45 +03:00
|
|
|
var linkText;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
landing chatzilla 0.8.23, bug 194241, r=samuel@sieb.net, a=asa@mozilla.org
fixes...
bug 190568, ssieb upgraded networking code that was making incorrect assumptions.
bug 191910, added a munger rule to turn `` and '' into unicode left/right double
quotes.
bug 124638, Neil's fix to keep chatzilla from stealing focus when joining channels.
bug 191500, Items in chatzilla's pref tree were hardcoded into the .xul file.
bug 194334, Adds accelerator keys to some pref panels, in places where they were missing.
Allows formatting to be nested, to a certain extent. * http://foo * will
linkify http://foo AND bold it.
Lets tab characters pass through the control-code munger.
Added auto-reconnect, and a pref to control it.
Fixed URL munging so that it only creates links for valid schemes, and doesn't
include trailing punctuation in the link.
No longer strips leading and trailing whitespace from submitted lines.
2003-02-26 03:57:45 +03:00
|
|
|
var trailing;
|
2003-03-26 01:23:50 +03:00
|
|
|
ary = matchText.match(/([.,?]+)$/);
|
landing chatzilla 0.8.23, bug 194241, r=samuel@sieb.net, a=asa@mozilla.org
fixes...
bug 190568, ssieb upgraded networking code that was making incorrect assumptions.
bug 191910, added a munger rule to turn `` and '' into unicode left/right double
quotes.
bug 124638, Neil's fix to keep chatzilla from stealing focus when joining channels.
bug 191500, Items in chatzilla's pref tree were hardcoded into the .xul file.
bug 194334, Adds accelerator keys to some pref panels, in places where they were missing.
Allows formatting to be nested, to a certain extent. * http://foo * will
linkify http://foo AND bold it.
Lets tab characters pass through the control-code munger.
Added auto-reconnect, and a pref to control it.
Fixed URL munging so that it only creates links for valid schemes, and doesn't
include trailing punctuation in the link.
No longer strips leading and trailing whitespace from submitted lines.
2003-02-26 03:57:45 +03:00
|
|
|
if (ary)
|
|
|
|
{
|
|
|
|
linkText = RegExp.leftContext;
|
|
|
|
trailing = ary[1];
|
|
|
|
}
|
2002-02-19 01:50:59 +03:00
|
|
|
else
|
landing chatzilla 0.8.23, bug 194241, r=samuel@sieb.net, a=asa@mozilla.org
fixes...
bug 190568, ssieb upgraded networking code that was making incorrect assumptions.
bug 191910, added a munger rule to turn `` and '' into unicode left/right double
quotes.
bug 124638, Neil's fix to keep chatzilla from stealing focus when joining channels.
bug 191500, Items in chatzilla's pref tree were hardcoded into the .xul file.
bug 194334, Adds accelerator keys to some pref panels, in places where they were missing.
Allows formatting to be nested, to a certain extent. * http://foo * will
linkify http://foo AND bold it.
Lets tab characters pass through the control-code munger.
Added auto-reconnect, and a pref to control it.
Fixed URL munging so that it only creates links for valid schemes, and doesn't
include trailing punctuation in the link.
No longer strips leading and trailing whitespace from submitted lines.
2003-02-26 03:57:45 +03:00
|
|
|
{
|
|
|
|
linkText = matchText;
|
|
|
|
}
|
|
|
|
|
|
|
|
var ary = linkText.match (/^(\w[\w-]+):/);
|
|
|
|
if (ary)
|
|
|
|
{
|
|
|
|
if (!("schemes" in client))
|
|
|
|
{
|
|
|
|
var pfx = "@mozilla.org/network/protocol;1?name=";
|
2003-04-22 04:34:03 +04:00
|
|
|
var len = pfx.length;
|
landing chatzilla 0.8.23, bug 194241, r=samuel@sieb.net, a=asa@mozilla.org
fixes...
bug 190568, ssieb upgraded networking code that was making incorrect assumptions.
bug 191910, added a munger rule to turn `` and '' into unicode left/right double
quotes.
bug 124638, Neil's fix to keep chatzilla from stealing focus when joining channels.
bug 191500, Items in chatzilla's pref tree were hardcoded into the .xul file.
bug 194334, Adds accelerator keys to some pref panels, in places where they were missing.
Allows formatting to be nested, to a certain extent. * http://foo * will
linkify http://foo AND bold it.
Lets tab characters pass through the control-code munger.
Added auto-reconnect, and a pref to control it.
Fixed URL munging so that it only creates links for valid schemes, and doesn't
include trailing punctuation in the link.
No longer strips leading and trailing whitespace from submitted lines.
2003-02-26 03:57:45 +03:00
|
|
|
|
|
|
|
client.schemes = new Object();
|
|
|
|
for (var c in Components.classes)
|
|
|
|
{
|
|
|
|
if (c.indexOf(pfx) == 0)
|
|
|
|
client.schemes[c.substr(len)] = true;
|
|
|
|
}
|
|
|
|
}
|
2003-04-22 04:34:03 +04:00
|
|
|
|
landing chatzilla 0.8.23, bug 194241, r=samuel@sieb.net, a=asa@mozilla.org
fixes...
bug 190568, ssieb upgraded networking code that was making incorrect assumptions.
bug 191910, added a munger rule to turn `` and '' into unicode left/right double
quotes.
bug 124638, Neil's fix to keep chatzilla from stealing focus when joining channels.
bug 191500, Items in chatzilla's pref tree were hardcoded into the .xul file.
bug 194334, Adds accelerator keys to some pref panels, in places where they were missing.
Allows formatting to be nested, to a certain extent. * http://foo * will
linkify http://foo AND bold it.
Lets tab characters pass through the control-code munger.
Added auto-reconnect, and a pref to control it.
Fixed URL munging so that it only creates links for valid schemes, and doesn't
include trailing punctuation in the link.
No longer strips leading and trailing whitespace from submitted lines.
2003-02-26 03:57:45 +03:00
|
|
|
if (!(ary[1] in client.schemes))
|
|
|
|
{
|
|
|
|
insertHyphenatedWord(matchText, containerTag);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
href = linkText;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
href = "http://" + linkText;
|
|
|
|
}
|
|
|
|
|
2005-10-25 02:22:22 +04:00
|
|
|
/* This gives callers to the munger control over URLs being logged; the
|
|
|
|
* channel topic munger uses this, as well as the "is important" checker.
|
|
|
|
* If either of |dontLogURLs| or |noStateChange| is present and true, we
|
|
|
|
* don't log.
|
|
|
|
*/
|
|
|
|
if ((!("dontLogURLs" in data) || !data.dontLogURLs) &&
|
|
|
|
(!("noStateChange" in data) || !data.noStateChange))
|
|
|
|
{
|
|
|
|
var max = client.prefs["urls.store.max"];
|
|
|
|
if (client.prefs["urls.list"].unshift(href) > max)
|
|
|
|
client.prefs["urls.list"].pop();
|
|
|
|
client.prefs["urls.list"].update();
|
|
|
|
}
|
2004-12-11 17:19:44 +03:00
|
|
|
|
2000-06-15 13:54:41 +04:00
|
|
|
var anchor = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
2000-05-18 23:32:02 +04:00
|
|
|
"html:a");
|
2000-01-18 06:32:43 +03:00
|
|
|
anchor.setAttribute ("href", href);
|
2001-03-14 05:35:29 +03:00
|
|
|
anchor.setAttribute ("class", "chatzilla-link");
|
2000-06-01 09:31:04 +04:00
|
|
|
anchor.setAttribute ("target", "_content");
|
landing chatzilla 0.8.23, bug 194241, r=samuel@sieb.net, a=asa@mozilla.org
fixes...
bug 190568, ssieb upgraded networking code that was making incorrect assumptions.
bug 191910, added a munger rule to turn `` and '' into unicode left/right double
quotes.
bug 124638, Neil's fix to keep chatzilla from stealing focus when joining channels.
bug 191500, Items in chatzilla's pref tree were hardcoded into the .xul file.
bug 194334, Adds accelerator keys to some pref panels, in places where they were missing.
Allows formatting to be nested, to a certain extent. * http://foo * will
linkify http://foo AND bold it.
Lets tab characters pass through the control-code munger.
Added auto-reconnect, and a pref to control it.
Fixed URL munging so that it only creates links for valid schemes, and doesn't
include trailing punctuation in the link.
No longer strips leading and trailing whitespace from submitted lines.
2003-02-26 03:57:45 +03:00
|
|
|
insertHyphenatedWord (linkText, anchor);
|
2000-01-18 06:32:43 +03:00
|
|
|
containerTag.appendChild (anchor);
|
landing chatzilla 0.8.23, bug 194241, r=samuel@sieb.net, a=asa@mozilla.org
fixes...
bug 190568, ssieb upgraded networking code that was making incorrect assumptions.
bug 191910, added a munger rule to turn `` and '' into unicode left/right double
quotes.
bug 124638, Neil's fix to keep chatzilla from stealing focus when joining channels.
bug 191500, Items in chatzilla's pref tree were hardcoded into the .xul file.
bug 194334, Adds accelerator keys to some pref panels, in places where they were missing.
Allows formatting to be nested, to a certain extent. * http://foo * will
linkify http://foo AND bold it.
Lets tab characters pass through the control-code munger.
Added auto-reconnect, and a pref to control it.
Fixed URL munging so that it only creates links for valid schemes, and doesn't
include trailing punctuation in the link.
No longer strips leading and trailing whitespace from submitted lines.
2003-02-26 03:57:45 +03:00
|
|
|
if (trailing)
|
|
|
|
insertHyphenatedWord (trailing, containerTag);
|
2003-04-22 04:34:03 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
function insertMailToLink (matchText, containerTag)
|
|
|
|
{
|
|
|
|
|
|
|
|
var href;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
if (matchText.indexOf ("mailto:") != 0)
|
|
|
|
href = "mailto:" + matchText;
|
|
|
|
else
|
|
|
|
href = matchText;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
var anchor = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:a");
|
|
|
|
anchor.setAttribute ("href", href);
|
|
|
|
anchor.setAttribute ("class", "chatzilla-link");
|
|
|
|
//anchor.setAttribute ("target", "_content");
|
|
|
|
insertHyphenatedWord (matchText, anchor);
|
|
|
|
containerTag.appendChild (anchor);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function insertChannelLink (matchText, containerTag, eventData)
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
var bogusChannels =
|
|
|
|
/^#(include|error|define|if|ifdef|else|elsif|endif|\d+)$/i;
|
2001-08-24 01:41:24 +04:00
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
if (!("network" in eventData) || !eventData.network ||
|
|
|
|
matchText.search(bogusChannels) != -1)
|
2001-08-24 01:41:24 +04:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
containerTag.appendChild(document.createTextNode(matchText));
|
2001-08-24 01:41:24 +04:00
|
|
|
return;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
var encodedMatchText = fromUnicode(matchText, eventData.sourceObject);
|
2003-10-11 04:21:05 +04:00
|
|
|
var anchor = document.createElementNS("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:a");
|
2003-01-24 10:44:55 +03:00
|
|
|
anchor.setAttribute ("href", eventData.network.getURL() +
|
2003-10-11 04:21:05 +04:00
|
|
|
ecmaEscape(encodedMatchText));
|
2001-08-24 01:41:24 +04:00
|
|
|
anchor.setAttribute ("class", "chatzilla-link");
|
|
|
|
insertHyphenatedWord (matchText, anchor);
|
|
|
|
containerTag.appendChild (anchor);
|
|
|
|
}
|
|
|
|
|
2006-02-03 21:51:24 +03:00
|
|
|
function insertTalkbackLink(matchText, containerTag, eventData)
|
|
|
|
{
|
|
|
|
var anchor = document.createElementNS("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:a");
|
|
|
|
|
|
|
|
anchor.setAttribute("href", "http://talkback-public.mozilla.org/" +
|
2006-03-17 03:11:28 +03:00
|
|
|
"search/start.jsp?search=2&type=iid&id=" + matchText);
|
2006-02-03 21:51:24 +03:00
|
|
|
anchor.setAttribute("class", "chatzilla-link");
|
|
|
|
insertHyphenatedWord(matchText, anchor);
|
|
|
|
containerTag.appendChild(anchor);
|
|
|
|
}
|
|
|
|
|
2005-02-26 23:02:42 +03:00
|
|
|
function insertBugzillaLink (matchText, containerTag, eventData)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2005-11-22 20:42:57 +03:00
|
|
|
var idOrAlias = matchText.match(/bug\s+#?(\d{3,6}|[^\s,]{1,20})/i)[1];
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
var anchor = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:a");
|
2005-02-26 23:02:42 +03:00
|
|
|
|
|
|
|
var bugURL;
|
|
|
|
if (eventData.channel)
|
|
|
|
bugURL = eventData.channel.prefs["bugURL"];
|
|
|
|
else if (eventData.network)
|
|
|
|
bugURL = eventData.network.prefs["bugURL"];
|
|
|
|
else
|
|
|
|
bugURL = client.prefs["bugURL"];
|
|
|
|
|
2005-11-20 01:39:21 +03:00
|
|
|
anchor.setAttribute ("href", bugURL.replace("%s", idOrAlias));
|
2001-12-04 03:20:48 +03:00
|
|
|
anchor.setAttribute ("class", "chatzilla-link");
|
|
|
|
anchor.setAttribute ("target", "_content");
|
|
|
|
insertHyphenatedWord (matchText, anchor);
|
|
|
|
containerTag.appendChild (anchor);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
function insertRheet (matchText, containerTag)
|
|
|
|
{
|
|
|
|
|
|
|
|
var anchor = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:a");
|
|
|
|
anchor.setAttribute ("href",
|
2004-04-05 22:23:22 +04:00
|
|
|
"http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/bonus-tracks/rheet.wav");
|
2001-03-14 05:35:29 +03:00
|
|
|
anchor.setAttribute ("class", "chatzilla-rheet chatzilla-link");
|
2001-08-24 01:41:24 +04:00
|
|
|
//anchor.setAttribute ("target", "_content");
|
2001-03-14 05:35:29 +03:00
|
|
|
insertHyphenatedWord (matchText, anchor);
|
2004-09-15 22:39:16 +04:00
|
|
|
containerTag.appendChild (anchor);
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
}
|
|
|
|
|
landing chatzilla 0.8.23, bug 194241, r=samuel@sieb.net, a=asa@mozilla.org
fixes...
bug 190568, ssieb upgraded networking code that was making incorrect assumptions.
bug 191910, added a munger rule to turn `` and '' into unicode left/right double
quotes.
bug 124638, Neil's fix to keep chatzilla from stealing focus when joining channels.
bug 191500, Items in chatzilla's pref tree were hardcoded into the .xul file.
bug 194334, Adds accelerator keys to some pref panels, in places where they were missing.
Allows formatting to be nested, to a certain extent. * http://foo * will
linkify http://foo AND bold it.
Lets tab characters pass through the control-code munger.
Added auto-reconnect, and a pref to control it.
Fixed URL munging so that it only creates links for valid schemes, and doesn't
include trailing punctuation in the link.
No longer strips leading and trailing whitespace from submitted lines.
2003-02-26 03:57:45 +03:00
|
|
|
function insertQuote (matchText, containerTag)
|
|
|
|
{
|
|
|
|
if (matchText == "``")
|
|
|
|
containerTag.appendChild(document.createTextNode("\u201c"));
|
|
|
|
else
|
|
|
|
containerTag.appendChild(document.createTextNode("\u201d"));
|
|
|
|
}
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
function insertSmiley(emoticon, containerTag)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
2001-08-24 01:41:24 +04:00
|
|
|
var type = "error";
|
2000-06-23 02:57:09 +04:00
|
|
|
|
2004-12-20 01:52:37 +03:00
|
|
|
if (emoticon.search(/\>[-^v]?\)/) != -1)
|
|
|
|
type = "face-alien";
|
|
|
|
else if (emoticon.search(/\>[=:;][-^v]?[(|]/) != -1)
|
2004-09-15 22:39:16 +04:00
|
|
|
type = "face-angry";
|
|
|
|
else if (emoticon.search(/[=:;][-^v]?[Ss\\\/]/) != -1)
|
|
|
|
type = "face-confused";
|
|
|
|
else if (emoticon.search(/[B8][-^v]?[)\]]/) != -1)
|
|
|
|
type = "face-cool";
|
2004-12-20 01:52:37 +03:00
|
|
|
else if (emoticon.search(/[=:;][~'][-^v]?\(/) != -1)
|
2001-08-24 01:41:24 +04:00
|
|
|
type = "face-cry";
|
2004-12-20 01:52:37 +03:00
|
|
|
else if (emoticon.search(/o[._]O/) != -1)
|
2004-09-15 22:39:16 +04:00
|
|
|
type = "face-dizzy";
|
2004-12-20 01:52:37 +03:00
|
|
|
else if (emoticon.search(/O[._]o/) != -1)
|
|
|
|
type = "face-dizzy-back";
|
2004-09-15 22:39:16 +04:00
|
|
|
else if (emoticon.search(/o[._]o|O[._]O/) != -1)
|
|
|
|
type = "face-eek";
|
|
|
|
else if (emoticon.search(/\>[=:;][-^v]?D/) != -1)
|
|
|
|
type = "face-evil";
|
2004-12-20 01:52:37 +03:00
|
|
|
else if (emoticon.search(/[=:;][-^v]?DD/) != -1)
|
|
|
|
type = "face-lol";
|
2004-09-15 22:39:16 +04:00
|
|
|
else if (emoticon.search(/[=:;][-^v]?D/) != -1)
|
|
|
|
type = "face-laugh";
|
|
|
|
else if (emoticon.search(/\([-^v]?D|[xX][-^v]?D/) != -1)
|
2004-12-20 01:52:37 +03:00
|
|
|
type = "face-rofl";
|
2004-09-15 22:39:16 +04:00
|
|
|
else if (emoticon.search(/[=:;][-^v]?\|/) != -1)
|
|
|
|
type = "face-normal";
|
|
|
|
else if (emoticon.search(/[=:;][-^v]?\?/) != -1)
|
|
|
|
type = "face-question";
|
|
|
|
else if (emoticon.search(/[=:;]"[)\]]/) != -1)
|
|
|
|
type = "face-red";
|
|
|
|
else if (emoticon.search(/9[._]9/) != -1)
|
|
|
|
type = "face-rolleyes";
|
|
|
|
else if (emoticon.search(/[=:;][-^v]?[(\[]/) != -1)
|
|
|
|
type = "face-sad";
|
|
|
|
else if (emoticon.search(/[=:][-^v]?[)\]]/) != -1)
|
|
|
|
type = "face-smile";
|
|
|
|
else if (emoticon.search(/[=:;][-^v]?[0oO]/) != -1)
|
|
|
|
type = "face-surprised";
|
|
|
|
else if (emoticon.search(/[=:;][-^v]?[pP]/) != -1)
|
2001-08-24 01:41:24 +04:00
|
|
|
type = "face-tongue";
|
2004-09-15 22:39:16 +04:00
|
|
|
else if (emoticon.search(/;[-^v]?[)\]]/) != -1)
|
|
|
|
type = "face-wink";
|
|
|
|
|
|
|
|
if (type == "error")
|
|
|
|
{
|
|
|
|
// We didn't actually match anything, so it'll be a too-generic match
|
|
|
|
// from the munger RegExp.
|
|
|
|
containerTag.appendChild(document.createTextNode(emoticon));
|
|
|
|
return;
|
|
|
|
}
|
2001-03-14 05:35:29 +03:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
var span = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:span");
|
|
|
|
|
|
|
|
/* create a span to hold the emoticon text */
|
|
|
|
span.setAttribute ("class", "chatzilla-emote-txt");
|
|
|
|
span.setAttribute ("type", type);
|
|
|
|
span.appendChild (document.createTextNode (emoticon));
|
|
|
|
containerTag.appendChild (span);
|
|
|
|
|
|
|
|
/* create an empty span after the text. this span will have an image added
|
|
|
|
* after it with a chatzilla-emote:after css rule. using
|
|
|
|
* chatzilla-emote-txt:after is not good enough because it does not allow us
|
|
|
|
* to turn off the emoticon text, but keep the image. ie.
|
2003-08-19 01:35:33 +04:00
|
|
|
* chatzilla-emote-txt { display: none; } turns off
|
|
|
|
* chatzilla-emote-txt:after as well.*/
|
2001-08-24 01:41:24 +04:00
|
|
|
span = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:span");
|
|
|
|
span.setAttribute ("class", "chatzilla-emote");
|
|
|
|
span.setAttribute ("type", type);
|
2001-09-20 09:04:17 +04:00
|
|
|
span.setAttribute ("title", emoticon);
|
2001-08-24 01:41:24 +04:00
|
|
|
containerTag.appendChild (span);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
function mircChangeColor (colorInfo, containerTag, data)
|
|
|
|
{
|
2005-10-25 02:22:22 +04:00
|
|
|
/* If colors are disabled, the caller doesn't want colors specifically, or
|
|
|
|
* the caller doesn't want any state-changing effects, we drop out.
|
|
|
|
*/
|
|
|
|
if (!client.enableColors ||
|
|
|
|
(("noMircColors" in data) && data.noMircColors) ||
|
|
|
|
(("noStateChange" in data) && data.noStateChange))
|
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
return;
|
2005-10-25 02:22:22 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
|
|
|
|
var ary = colorInfo.match (/.(\d{1,2}|)(,(\d{1,2})|)/);
|
|
|
|
|
2005-11-27 00:06:19 +03:00
|
|
|
// Do we have a BG color specified...?
|
|
|
|
if (!arrayHasElementAt(ary, 1) || !ary[1])
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2005-11-27 00:06:19 +03:00
|
|
|
// Oops, no colors.
|
|
|
|
delete data.currFgColor;
|
|
|
|
delete data.currBgColor;
|
|
|
|
return;
|
|
|
|
}
|
2003-12-04 18:35:22 +03:00
|
|
|
|
2005-11-27 00:06:19 +03:00
|
|
|
var fgColor = String(Number(ary[1]) % 16);
|
2003-12-04 18:35:22 +03:00
|
|
|
|
2005-11-27 00:06:19 +03:00
|
|
|
if (fgColor.length == 1)
|
|
|
|
data.currFgColor = "0" + fgColor;
|
|
|
|
else
|
|
|
|
data.currFgColor = fgColor;
|
2003-12-04 18:35:22 +03:00
|
|
|
|
2005-11-27 00:06:19 +03:00
|
|
|
// Do we have a BG color specified...?
|
|
|
|
if (arrayHasElementAt(ary, 3) && ary[3])
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2005-11-27 00:06:19 +03:00
|
|
|
var bgColor = String(Number(ary[3]) % 16);
|
2003-12-04 18:35:22 +03:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
if (bgColor.length == 1)
|
|
|
|
data.currBgColor = "0" + bgColor;
|
|
|
|
else
|
|
|
|
data.currBgColor = bgColor;
|
|
|
|
}
|
2003-12-04 18:35:22 +03:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
data.hasColorInfo = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function mircToggleBold (colorInfo, containerTag, data)
|
|
|
|
{
|
2005-10-25 02:22:22 +04:00
|
|
|
if (!client.enableColors ||
|
|
|
|
(("noMircColors" in data) && data.noMircColors) ||
|
|
|
|
(("noStateChange" in data) && data.noStateChange))
|
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
return;
|
2005-10-25 02:22:22 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
|
|
|
|
if ("isBold" in data)
|
|
|
|
delete data.isBold;
|
|
|
|
else
|
|
|
|
data.isBold = true;
|
|
|
|
data.hasColorInfo = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function mircToggleUnder (colorInfo, containerTag, data)
|
|
|
|
{
|
2005-10-25 02:22:22 +04:00
|
|
|
if (!client.enableColors ||
|
|
|
|
(("noMircColors" in data) && data.noMircColors) ||
|
|
|
|
(("noStateChange" in data) && data.noStateChange))
|
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
return;
|
2005-10-25 02:22:22 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
|
|
|
|
if ("isUnderline" in data)
|
|
|
|
delete data.isUnderline;
|
|
|
|
else
|
2004-09-15 22:39:16 +04:00
|
|
|
data.isUnderline = true;
|
2001-12-04 03:20:48 +03:00
|
|
|
data.hasColorInfo = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function mircResetColor (text, containerTag, data)
|
|
|
|
{
|
2005-10-25 02:22:22 +04:00
|
|
|
if (!client.enableColors ||
|
|
|
|
(("noMircColors" in data) && data.noMircColors) ||
|
|
|
|
(("noStateChange" in data) && data.noStateChange) ||
|
|
|
|
!("hasColorInfo" in data))
|
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
return;
|
2005-10-25 02:22:22 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
|
|
|
|
delete data.currFgColor;
|
|
|
|
delete data.currBgColor;
|
|
|
|
delete data.isBold;
|
|
|
|
delete data.isUnder;
|
|
|
|
delete data.hasColorInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
function mircReverseColor (text, containerTag, data)
|
|
|
|
{
|
2005-10-25 02:22:22 +04:00
|
|
|
if (!client.enableColors ||
|
|
|
|
(("noMircColors" in data) && data.noMircColors) ||
|
|
|
|
(("noStateChange" in data) && data.noStateChange))
|
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
return;
|
2005-10-25 02:22:22 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
|
2005-11-27 00:06:19 +03:00
|
|
|
var tempColor = ("currFgColor" in data ? data.currFgColor : "");
|
2001-12-04 03:20:48 +03:00
|
|
|
|
|
|
|
if ("currBgColor" in data)
|
|
|
|
data.currFgColor = data.currBgColor;
|
|
|
|
else
|
2005-11-27 00:06:19 +03:00
|
|
|
delete data.currFgColor;
|
|
|
|
if (tempColor)
|
|
|
|
data.currBgColor = tempColor;
|
|
|
|
else
|
|
|
|
delete data.currBgColor;
|
2001-12-04 03:20:48 +03:00
|
|
|
data.hasColorInfo = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function showCtrlChar(c, containerTag)
|
|
|
|
{
|
|
|
|
var span = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:span");
|
|
|
|
span.setAttribute ("class", "chatzilla-control-char");
|
landing chatzilla 0.8.23, bug 194241, r=samuel@sieb.net, a=asa@mozilla.org
fixes...
bug 190568, ssieb upgraded networking code that was making incorrect assumptions.
bug 191910, added a munger rule to turn `` and '' into unicode left/right double
quotes.
bug 124638, Neil's fix to keep chatzilla from stealing focus when joining channels.
bug 191500, Items in chatzilla's pref tree were hardcoded into the .xul file.
bug 194334, Adds accelerator keys to some pref panels, in places where they were missing.
Allows formatting to be nested, to a certain extent. * http://foo * will
linkify http://foo AND bold it.
Lets tab characters pass through the control-code munger.
Added auto-reconnect, and a pref to control it.
Fixed URL munging so that it only creates links for valid schemes, and doesn't
include trailing punctuation in the link.
No longer strips leading and trailing whitespace from submitted lines.
2003-02-26 03:57:45 +03:00
|
|
|
if (c == "\t")
|
|
|
|
{
|
|
|
|
containerTag.appendChild(document.createTextNode(c));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
var ctrlStr = c.charCodeAt(0).toString(16);
|
|
|
|
if (ctrlStr.length < 2)
|
|
|
|
ctrlStr = "0" + ctrlStr;
|
|
|
|
span.appendChild (document.createTextNode ("0x" + ctrlStr));
|
|
|
|
containerTag.appendChild (span);
|
|
|
|
}
|
|
|
|
|
2000-06-01 09:31:04 +04:00
|
|
|
function insertHyphenatedWord (longWord, containerTag)
|
|
|
|
{
|
2001-03-14 05:35:29 +03:00
|
|
|
var wordParts = splitLongWord (longWord, client.MAX_WORD_DISPLAY);
|
|
|
|
for (var i = 0; i < wordParts.length; ++i)
|
|
|
|
{
|
|
|
|
containerTag.appendChild (document.createTextNode (wordParts[i]));
|
|
|
|
if (i != wordParts.length)
|
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
var wbr = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:wbr");
|
|
|
|
containerTag.appendChild (wbr);
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
function insertInlineButton(text, containerTag, data)
|
|
|
|
{
|
|
|
|
var ary = text.match(/\[\[([^\]]+)\]\[([^\]]+)\]\[([^\]]+)\]\]/);
|
|
|
|
|
|
|
|
if (!ary)
|
|
|
|
{
|
|
|
|
containerTag.appendChild(document.createTextNode(text));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var label = ary[1];
|
|
|
|
var title = ary[2];
|
|
|
|
var command = ary[3];
|
|
|
|
|
|
|
|
var link = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
|
|
|
|
link.setAttribute("href", "x-cz-command:" + encodeURI(command));
|
|
|
|
link.setAttribute("title", title);
|
2006-01-20 03:12:39 +03:00
|
|
|
link.setAttribute("class", "chatzilla-link");
|
2004-09-15 22:39:16 +04:00
|
|
|
link.appendChild(document.createTextNode(label));
|
|
|
|
|
|
|
|
containerTag.appendChild(document.createTextNode("["));
|
|
|
|
containerTag.appendChild(link);
|
|
|
|
containerTag.appendChild(document.createTextNode("]"));
|
|
|
|
}
|
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
function combineNicks(nickList, max)
|
|
|
|
{
|
|
|
|
if (!max)
|
|
|
|
max = 4;
|
|
|
|
|
|
|
|
var combinedList = [];
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
for (var i = 0; i < nickList.length; i += max)
|
|
|
|
{
|
|
|
|
count = Math.min(max, nickList.length - i);
|
|
|
|
var nicks = nickList.slice(i, i + count);
|
|
|
|
var str = new String(nicks.join(" "));
|
|
|
|
str.count = count;
|
|
|
|
combinedList.push(str);
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
return combinedList;
|
|
|
|
}
|
|
|
|
|
2003-06-22 04:31:54 +04:00
|
|
|
function updateAllStalkExpressions()
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
var list = client.prefs["stalkWords"];
|
|
|
|
|
2003-06-22 04:31:54 +04:00
|
|
|
for (var name in client.networks)
|
|
|
|
{
|
|
|
|
if ("stalkExpression" in client.networks[name])
|
2003-08-19 01:35:33 +04:00
|
|
|
updateStalkExpression(client.networks[name], list);
|
2003-06-22 04:31:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-22 04:17:55 +04:00
|
|
|
function updateStalkExpression(network)
|
|
|
|
{
|
|
|
|
function escapeChar(ch)
|
|
|
|
{
|
|
|
|
return "\\" + ch;
|
|
|
|
};
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
var list = client.prefs["stalkWords"];
|
|
|
|
|
|
|
|
var ary = new Array();
|
2003-06-22 04:17:55 +04:00
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
ary.push(network.primServ.me.unicodeName.replace(/[^\w\d]/g, escapeChar));
|
|
|
|
|
2003-06-22 04:17:55 +04:00
|
|
|
for (var i = 0; i < list.length; ++i)
|
|
|
|
ary.push(list[i].replace(/[^\w\d]/g, escapeChar));
|
|
|
|
|
|
|
|
var re;
|
2003-08-19 01:35:33 +04:00
|
|
|
if (client.prefs["stalkWholeWords"])
|
2003-06-22 04:17:55 +04:00
|
|
|
re = "(^|[\\W\\s])((" + ary.join(")|(") + "))([\\W\\s]|$)";
|
|
|
|
else
|
|
|
|
re = "(" + ary.join(")|(") + ")";
|
|
|
|
|
|
|
|
network.stalkExpression = new RegExp(re, "i");
|
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
function getDefaultFontSize()
|
|
|
|
{
|
|
|
|
const PREF_CTRID = "@mozilla.org/preferences-service;1";
|
|
|
|
const nsIPrefService = Components.interfaces.nsIPrefService;
|
|
|
|
const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
const XHTML_NS = "http://www.w3.org/1999/xhtml";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var prefSvc = Components.classes[PREF_CTRID].getService(nsIPrefService);
|
|
|
|
var prefBranch = prefSvc.getBranch(null);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
// PX size pref: font.size.variable.x-western
|
|
|
|
var pxSize = 16;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
pxSize = prefBranch.getIntPref("font.size.variable.x-western");
|
|
|
|
}
|
|
|
|
catch(ex) { }
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var dpi = 96;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// Get the DPI the fun way (make Mozilla do the work).
|
|
|
|
var b = document.createElement("box");
|
|
|
|
b.style.width = "1in";
|
|
|
|
dpi = window.getComputedStyle(b, null).width.match(/^\d+/);
|
|
|
|
}
|
|
|
|
catch(ex)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// Get the DPI the fun way (make Mozilla do the work).
|
|
|
|
b = document.createElementNS("box", XHTML_NS);
|
|
|
|
b.style.width = "1in";
|
|
|
|
dpi = window.getComputedStyle(b, null).width.match(/^\d+/);
|
|
|
|
}
|
|
|
|
catch(ex) { }
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
return Math.round((pxSize / dpi) * 72);
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function getDefaultContext(cx)
|
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
if (!cx)
|
|
|
|
cx = new Object();
|
|
|
|
/* Use __proto__ here and in all other get*Context so that the command can
|
|
|
|
* tell the difference between getObjectDetails and actual parameters. See
|
|
|
|
* cmdJoin for more details.
|
|
|
|
*/
|
|
|
|
cx.__proto__ = getObjectDetails(client.currentObject);
|
|
|
|
return cx;
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function getMessagesContext(cx, element)
|
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
if (!cx)
|
|
|
|
cx = new Object();
|
|
|
|
cx.__proto__ = getObjectDetails(client.currentObject);
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!element)
|
|
|
|
element = document.popupNode;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
while (element)
|
|
|
|
{
|
|
|
|
switch (element.localName)
|
|
|
|
{
|
|
|
|
case "a":
|
|
|
|
var href = element.getAttribute("href");
|
|
|
|
cx.url = href;
|
|
|
|
break;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
case "tr":
|
2003-08-19 01:35:33 +04:00
|
|
|
var nickname = element.getAttribute("msg-user");
|
|
|
|
if (!nickname)
|
|
|
|
break;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
// strip out a potential ME! suffix
|
|
|
|
var ary = nickname.match(/(\S+)/);
|
|
|
|
nickname = ary[1];
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
if (!cx.network)
|
2003-08-19 01:35:33 +04:00
|
|
|
break;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
// NOTE: nickname is the unicodeName here!
|
2003-08-19 01:35:33 +04:00
|
|
|
if (cx.channel)
|
2003-09-24 04:49:09 +04:00
|
|
|
cx.user = cx.channel.getUser(nickname);
|
2003-08-19 01:35:33 +04:00
|
|
|
else
|
2003-09-24 04:49:09 +04:00
|
|
|
cx.user = cx.network.getUser(nickname);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (cx.user)
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
cx.nickname = cx.user.unicodeName;
|
|
|
|
cx.canonNick = cx.user.canonicalName;
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2004-12-20 01:52:37 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
cx.nickname = nickname;
|
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
element = element.parentNode;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return cx;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getTabContext(cx, element)
|
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
if (!cx)
|
|
|
|
cx = new Object();
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!element)
|
|
|
|
element = document.popupNode;
|
|
|
|
|
|
|
|
while (element)
|
|
|
|
{
|
|
|
|
if (element.localName == "tab")
|
2005-11-20 05:08:37 +03:00
|
|
|
{
|
|
|
|
cx.__proto__ = getObjectDetails(element.view);
|
|
|
|
return cx;
|
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
element = element.parentNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
return cx;
|
|
|
|
}
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
function getUserlistContext(cx)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
if (!cx)
|
|
|
|
cx = new Object();
|
|
|
|
cx.__proto__ = getObjectDetails(client.currentObject);
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!cx.channel)
|
|
|
|
return cx;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-11-20 01:11:07 +03:00
|
|
|
var user, tree = document.getElementById("user-list");
|
2003-08-19 01:35:33 +04:00
|
|
|
cx.userList = new Array();
|
2004-09-15 22:39:16 +04:00
|
|
|
cx.canonNickList = new Array();
|
2005-11-20 01:11:07 +03:00
|
|
|
cx.nicknameList = getSelectedNicknames(tree);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-11-20 01:11:07 +03:00
|
|
|
for (var i = 0; i < cx.nicknameList.length; ++i)
|
|
|
|
{
|
|
|
|
user = cx.channel.getUser(cx.nicknameList[i])
|
|
|
|
cx.userList.push(user);
|
|
|
|
cx.canonNickList.push(user.canonicalName);
|
|
|
|
if (i == 0)
|
|
|
|
{
|
|
|
|
cx.user = user;
|
|
|
|
cx.nickname = user.unicodeName;
|
|
|
|
cx.canonNick = user.canonicalName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return cx;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getSelectedNicknames(tree)
|
|
|
|
{
|
|
|
|
var rv = [];
|
|
|
|
if (!tree || !tree.view || !tree.view.selection)
|
|
|
|
return rv;
|
2003-08-19 01:35:33 +04:00
|
|
|
var rangeCount = tree.view.selection.getRangeCount();
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-11-20 01:11:07 +03:00
|
|
|
// Loop through the selection ranges.
|
2003-08-19 01:35:33 +04:00
|
|
|
for (var i = 0; i < rangeCount; ++i)
|
|
|
|
{
|
|
|
|
var start = {}, end = {};
|
|
|
|
tree.view.selection.getRangeAt(i, start, end);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// If they == -1, we've got no selection, so bail.
|
|
|
|
if ((start.value == -1) && (end.value == -1))
|
2005-11-20 01:11:07 +03:00
|
|
|
continue;
|
2005-12-07 17:51:26 +03:00
|
|
|
/* Workaround: Because we use select(-1) instead of clearSelection()
|
|
|
|
* (see bug 197667) the tree will then give us selection ranges
|
|
|
|
* starting from -1 instead of 0! (See bug 319066.)
|
|
|
|
*/
|
|
|
|
if (start.value == -1)
|
|
|
|
start.value = 0;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-11-20 01:11:07 +03:00
|
|
|
// Loop through the contents of the current selection range.
|
2003-08-19 01:35:33 +04:00
|
|
|
for (var k = start.value; k <= end.value; ++k)
|
|
|
|
{
|
2005-11-20 01:11:07 +03:00
|
|
|
var item = tree.contentView.getItemAtIndex(k).firstChild.firstChild;
|
|
|
|
var userName = item.getAttribute("unicodeName");
|
|
|
|
rv.push(userName);
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
|
|
|
}
|
2005-11-20 01:11:07 +03:00
|
|
|
return rv;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-11-20 01:11:07 +03:00
|
|
|
function setSelectedNicknames(tree, nicknameAry)
|
|
|
|
{
|
2005-12-05 01:37:47 +03:00
|
|
|
if (!tree || !tree.view || !tree.view.selection || !nicknameAry)
|
2005-11-20 01:11:07 +03:00
|
|
|
return;
|
|
|
|
var item, unicodeName, resultAry = [];
|
|
|
|
// Clear selection:
|
|
|
|
tree.view.selection.select(-1);
|
|
|
|
// Loop through the tree to (re-)select nicknames
|
|
|
|
for (var i = 0; i < tree.view.rowCount; i++)
|
|
|
|
{
|
|
|
|
item = tree.contentView.getItemAtIndex(i).firstChild.firstChild;
|
|
|
|
unicodeName = item.getAttribute("unicodeName");
|
|
|
|
if ((unicodeName != "") && arrayContains(nicknameAry, unicodeName))
|
|
|
|
{
|
|
|
|
tree.view.selection.toggleSelect(i);
|
|
|
|
resultAry.push(unicodeName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Make sure we pass back a correct array:
|
|
|
|
nicknameAry.length = 0;
|
|
|
|
for (var j = 0; j < resultAry.length; j++)
|
|
|
|
nicknameAry.push(resultAry[j]);
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
function getFontContext(cx)
|
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
if (!cx)
|
|
|
|
cx = new Object();
|
|
|
|
cx.__proto__ = getObjectDetails(client.currentObject);
|
2004-01-29 14:27:35 +03:00
|
|
|
cx.fontSizeDefault = getDefaultFontSize();
|
|
|
|
var view = client;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
if ("prefs" in cx.sourceObject)
|
|
|
|
{
|
|
|
|
cx.fontFamily = view.prefs["font.family"];
|
|
|
|
if (cx.fontFamily.match(/^(default|(sans-)?serif|monospace)$/))
|
|
|
|
delete cx.fontFamily;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
cx.fontSize = view.prefs["font.size"];
|
|
|
|
if (cx.fontSize == 0)
|
|
|
|
delete cx.fontSize;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
return cx;
|
|
|
|
}
|
|
|
|
|
2003-06-22 04:17:55 +04:00
|
|
|
function msgIsImportant (msg, sourceNick, network)
|
|
|
|
{
|
2004-03-02 23:24:11 +03:00
|
|
|
/* This is a huge hack, but it works. What we want is to match against the
|
|
|
|
* plain text of a message, ignoring color codes, bold, etc. so we put it
|
|
|
|
* through the munger. This produces a tree of HTML elements, which we use
|
|
|
|
* |.innerHTML| to convert to a textual representation.
|
2004-09-15 22:39:16 +04:00
|
|
|
*
|
2004-03-02 23:24:11 +03:00
|
|
|
* Then we remove all the HTML tags, using a RegExp.
|
2004-09-15 22:39:16 +04:00
|
|
|
*
|
2004-03-02 23:24:11 +03:00
|
|
|
* It certainly isn't ideal, and there has to be a better way, but it:
|
|
|
|
* a) works, and
|
|
|
|
* b) is fast enough to not cause problems,
|
|
|
|
* so it will do for now.
|
2005-10-25 02:22:22 +04:00
|
|
|
*
|
|
|
|
* Note also that we don't want to log URLs munged here, or generally do
|
|
|
|
* any state-changing stuff.
|
2004-03-02 23:24:11 +03:00
|
|
|
*/
|
2005-10-25 02:22:22 +04:00
|
|
|
var plainMsg = client.munger.munge(msg, null, { noStateChange: true });
|
2004-03-02 23:24:11 +03:00
|
|
|
plainMsg = plainMsg.innerHTML.replace(/<[^>]+>/g, "");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
var re = network.stalkExpression;
|
2004-03-02 23:24:11 +03:00
|
|
|
if (plainMsg.search(re) != -1 || sourceNick && sourceNick.search(re) == 0)
|
2001-03-14 05:35:29 +03:00
|
|
|
return true;
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
return false;
|
2000-06-01 09:31:04 +04:00
|
|
|
}
|
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
function isStartupURL(url)
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
return arrayContains(client.prefs["initialURLs"], url);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
function cycleView (amount)
|
|
|
|
{
|
|
|
|
var len = client.viewsArray.length;
|
|
|
|
if (len <= 1)
|
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
var tb = getTabForObject (client.currentObject);
|
|
|
|
if (!tb)
|
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
var vk = Number(tb.getAttribute("viewKey"));
|
2003-01-10 09:42:59 +03:00
|
|
|
var destKey = (vk + amount) % len; /* wrap around */
|
2003-04-09 02:07:28 +04:00
|
|
|
if (destKey < 0)
|
|
|
|
destKey += len;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
dispatch("set-current-view", { view: client.viewsArray[destKey].source });
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Plays the sound for a particular event on a type of object.
|
|
|
|
function playEventSounds(type, event)
|
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
if (!client.sound || !client.prefs["sound.enabled"])
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Converts .TYPE values into the event object names.
|
|
|
|
// IRCChannel => channel, IRCUser => user, etc.
|
|
|
|
if (type.match(/^IRC/))
|
|
|
|
type = type.substr(3, type.length).toLowerCase();
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var ev = type + "." + event;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if (ev in client.soundList)
|
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if (!(("sound." + ev) in client.prefs))
|
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var s = client.prefs["sound." + ev];
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if (!s)
|
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if (client.prefs["sound.overlapDelay"] > 0)
|
|
|
|
{
|
|
|
|
client.soundList[ev] = true;
|
2004-09-15 22:39:16 +04:00
|
|
|
setTimeout("delete client.soundList['" + ev + "']",
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
client.prefs["sound.overlapDelay"]);
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if (event == "start")
|
|
|
|
{
|
|
|
|
blockEventSounds(type, "event");
|
|
|
|
blockEventSounds(type, "chat");
|
|
|
|
blockEventSounds(type, "stalk");
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
playSounds(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Blocks a particular type of event sound occuring.
|
|
|
|
function blockEventSounds(type, event)
|
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
if (!client.sound || !client.prefs["sound.enabled"])
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Converts .TYPE values into the event object names.
|
|
|
|
// IRCChannel => channel, IRCUser => user, etc.
|
|
|
|
if (type.match(/^IRC/))
|
|
|
|
type = type.substr(3, type.length).toLowerCase();
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var ev = type + "." + event;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if (client.prefs["sound.overlapDelay"] > 0)
|
|
|
|
{
|
|
|
|
client.soundList[ev] = true;
|
2004-09-15 22:39:16 +04:00
|
|
|
setTimeout("delete client.soundList['" + ev + "']",
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
client.prefs["sound.overlapDelay"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function playSounds(list)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2001-12-12 07:40:02 +03:00
|
|
|
var ary = list.split (" ");
|
2001-12-04 03:20:48 +03:00
|
|
|
if (ary.length == 0)
|
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
playSound(ary[0]);
|
2001-12-04 03:20:48 +03:00
|
|
|
for (var i = 1; i < ary.length; ++i)
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
setTimeout(playSound, 250 * i, ary[i]);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
|
2004-01-22 16:57:26 +03:00
|
|
|
function playSound(file)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2004-12-20 01:52:37 +03:00
|
|
|
if (!client.sound || !client.prefs["sound.enabled"] || !file)
|
2001-12-04 03:20:48 +03:00
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
if (file == "beep")
|
|
|
|
{
|
|
|
|
client.sound.beep();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-06-22 04:17:55 +04:00
|
|
|
try
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var uri = client.iosvc.newURI(file, null, null);
|
2004-01-22 16:57:26 +03:00
|
|
|
client.sound.play(uri);
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
2003-06-22 04:17:55 +04:00
|
|
|
// ignore exceptions from this pile of code.
|
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
/* timer-based mainloop */
|
|
|
|
function mainStep()
|
|
|
|
{
|
2005-09-21 05:09:28 +04:00
|
|
|
try
|
|
|
|
{
|
|
|
|
var count = client.eventPump.stepEvents();
|
|
|
|
if (count > 0)
|
|
|
|
setTimeout("mainStep()", client.STEP_TIMEOUT);
|
|
|
|
else
|
|
|
|
setTimeout("mainStep()", client.STEP_TIMEOUT / 5);
|
|
|
|
}
|
|
|
|
catch(ex)
|
|
|
|
{
|
|
|
|
dd("Exception in mainStep!");
|
|
|
|
dd(formatException(ex));
|
|
|
|
setTimeout("mainStep()", client.STEP_TIMEOUT);
|
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
function openQueryTab(server, nick)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
|
|
|
var user = server.addUser(nick);
|
2005-01-17 01:30:45 +03:00
|
|
|
if (client.globalHistory)
|
|
|
|
client.globalHistory.addPage(user.getURL());
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!("messages" in user))
|
2004-01-04 01:21:35 +03:00
|
|
|
{
|
|
|
|
var value = "";
|
|
|
|
var same = true;
|
|
|
|
for (var c in server.channels)
|
|
|
|
{
|
|
|
|
var chan = server.channels[c];
|
2004-09-15 22:39:16 +04:00
|
|
|
if (!(user.canonicalName in chan.users))
|
2004-01-04 01:21:35 +03:00
|
|
|
continue;
|
2004-09-15 22:39:16 +04:00
|
|
|
/* This takes a boolean value for each channel (true - channel has
|
2004-01-04 01:21:35 +03:00
|
|
|
* same value as first), and &&-s them all together. Thus, |same|
|
|
|
|
* will tell us, at the end, if all the channels found have the
|
|
|
|
* same value for charset.
|
|
|
|
*/
|
|
|
|
if (value)
|
|
|
|
same = same && (value == chan.prefs["charset"]);
|
|
|
|
else
|
|
|
|
value = chan.prefs["charset"];
|
|
|
|
}
|
|
|
|
/* If we've got a value, and it's the same accross all channels,
|
|
|
|
* we use it as the *default* for the charset pref. If not, it'll
|
|
|
|
* just keep the "defer" default which pulls it off the network.
|
|
|
|
*/
|
|
|
|
if (value && same)
|
|
|
|
{
|
|
|
|
user.prefManager.prefRecords["charset"].defaultValue = value;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
user.displayHere (getMsg(MSG_QUERY_OPENED, user.unicodeName));
|
2004-01-04 01:21:35 +03:00
|
|
|
}
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
user.whois();
|
2003-08-19 01:35:33 +04:00
|
|
|
return user;
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
|
2001-07-02 08:36:29 +04:00
|
|
|
function arraySpeak (ary, single, plural)
|
|
|
|
{
|
|
|
|
var rv = "";
|
2003-08-19 01:35:33 +04:00
|
|
|
var and = MSG_AND;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-07-02 08:36:29 +04:00
|
|
|
switch (ary.length)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
break;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-07-02 08:36:29 +04:00
|
|
|
case 1:
|
|
|
|
rv = ary[0];
|
|
|
|
if (single)
|
2004-09-15 22:39:16 +04:00
|
|
|
rv += " " + single;
|
2001-07-02 08:36:29 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
rv = ary[0] + " " + and + " " + ary[1];
|
|
|
|
if (plural)
|
|
|
|
rv += " " + plural;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
for (var i = 0; i < ary.length - 1; ++i)
|
|
|
|
rv += ary[i] + ", ";
|
|
|
|
rv += and + " " + ary[ary.length - 1];
|
|
|
|
if (plural)
|
|
|
|
rv += " " + plural;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-07-02 08:36:29 +04:00
|
|
|
}
|
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
function getObjectDetails (obj, rv)
|
|
|
|
{
|
|
|
|
if (!rv)
|
|
|
|
rv = new Object();
|
2000-05-13 02:30:21 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!ASSERT(obj && typeof obj == "object",
|
|
|
|
"INVALID OBJECT passed to getObjectDetails (" + obj + "). **"))
|
2000-05-13 02:30:21 +04:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
return rv;
|
2000-05-13 02:30:21 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
rv.sourceObject = obj;
|
|
|
|
rv.TYPE = obj.TYPE;
|
2001-12-04 03:20:48 +03:00
|
|
|
rv.parent = ("parent" in obj) ? obj.parent : null;
|
2003-08-19 01:35:33 +04:00
|
|
|
rv.user = null;
|
|
|
|
rv.channel = null;
|
|
|
|
rv.server = null;
|
|
|
|
rv.network = null;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
switch (obj.TYPE)
|
|
|
|
{
|
|
|
|
case "IRCChannel":
|
2003-08-19 01:35:33 +04:00
|
|
|
rv.viewType = MSG_CHANNEL;
|
2000-01-18 06:32:43 +03:00
|
|
|
rv.channel = obj;
|
2003-08-19 01:35:33 +04:00
|
|
|
rv.channelName = obj.unicodeName;
|
2000-01-18 06:32:43 +03:00
|
|
|
rv.server = rv.channel.parent;
|
|
|
|
rv.network = rv.server.parent;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "IRCUser":
|
2003-08-19 01:35:33 +04:00
|
|
|
rv.viewType = MSG_USER;
|
2000-01-18 06:32:43 +03:00
|
|
|
rv.user = obj;
|
2004-09-15 22:39:16 +04:00
|
|
|
rv.userName = obj.unicodeName;
|
2000-01-18 06:32:43 +03:00
|
|
|
rv.server = rv.user.parent;
|
|
|
|
rv.network = rv.server.parent;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "IRCChanUser":
|
2003-08-19 01:35:33 +04:00
|
|
|
rv.viewType = MSG_USER;
|
2000-01-18 06:32:43 +03:00
|
|
|
rv.user = obj;
|
2004-09-15 22:39:16 +04:00
|
|
|
rv.userName = obj.unicodeName;
|
2000-01-18 06:32:43 +03:00
|
|
|
rv.channel = rv.user.parent;
|
|
|
|
rv.server = rv.channel.parent;
|
|
|
|
rv.network = rv.server.parent;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "IRCNetwork":
|
|
|
|
rv.network = obj;
|
2003-08-19 01:35:33 +04:00
|
|
|
rv.viewType = MSG_NETWORK;
|
2001-12-04 03:20:48 +03:00
|
|
|
if ("primServ" in rv.network)
|
2000-01-18 06:32:43 +03:00
|
|
|
rv.server = rv.network.primServ;
|
2003-08-19 01:35:33 +04:00
|
|
|
else
|
|
|
|
rv.server = null;
|
2000-01-18 06:32:43 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case "IRCClient":
|
2003-08-19 01:35:33 +04:00
|
|
|
rv.viewType = MSG_TAB;
|
2000-01-18 06:32:43 +03:00
|
|
|
break;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-11-04 01:35:00 +03:00
|
|
|
case "IRCDCCUser":
|
|
|
|
//rv.viewType = MSG_USER;
|
|
|
|
rv.user = obj;
|
|
|
|
rv.userName = obj.unicodeName;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "IRCDCCChat":
|
|
|
|
//rv.viewType = MSG_USER;
|
|
|
|
rv.chat = obj;
|
|
|
|
rv.user = obj.user;
|
|
|
|
rv.userName = obj.unicodeName;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "IRCDCCFileTransfer":
|
|
|
|
//rv.viewType = MSG_USER;
|
|
|
|
rv.file = obj;
|
|
|
|
rv.user = obj.user;
|
2006-03-05 04:18:58 +03:00
|
|
|
rv.userName = obj.unicodeName;
|
|
|
|
rv.fileName = obj.filename;
|
2005-11-04 01:35:00 +03:00
|
|
|
break;
|
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
default:
|
|
|
|
/* no setup for unknown object */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (rv.network)
|
2004-09-15 22:39:16 +04:00
|
|
|
rv.networkName = rv.network.unicodeName;
|
2003-08-19 01:35:33 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
return rv;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
function findDynamicRule (selector)
|
|
|
|
{
|
|
|
|
var rules = frames[0].document.styleSheets[1].cssRules;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2006-09-08 03:05:20 +04:00
|
|
|
if (isinstance(selector, RegExp))
|
2001-08-24 01:41:24 +04:00
|
|
|
fun = "search";
|
|
|
|
else
|
|
|
|
fun = "indexOf";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
for (var i = 0; i < rules.length; ++i)
|
|
|
|
{
|
|
|
|
var rule = rules.item(i);
|
|
|
|
if (rule.selectorText && rule.selectorText[fun](selector) == 0)
|
|
|
|
return {sheet: frames[0].document.styleSheets[1], rule: rule,
|
|
|
|
index: i};
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
function addDynamicRule (rule)
|
|
|
|
{
|
|
|
|
var rules = frames[0].document.styleSheets[1];
|
|
|
|
|
|
|
|
var pos = rules.cssRules.length;
|
|
|
|
rules.insertRule (rule, pos);
|
|
|
|
}
|
|
|
|
|
2004-01-04 01:21:35 +03:00
|
|
|
function getCommandEnabled(command)
|
|
|
|
{
|
|
|
|
try {
|
2006-03-25 19:52:44 +03:00
|
|
|
var dispatcher = document.commandDispatcher;
|
2004-01-04 01:21:35 +03:00
|
|
|
var controller = dispatcher.getControllerForCommand(command);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-04 01:21:35 +03:00
|
|
|
return controller.isCommandEnabled(command);
|
|
|
|
}
|
|
|
|
catch (e)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function doCommand(command)
|
|
|
|
{
|
|
|
|
try {
|
2006-03-25 19:52:44 +03:00
|
|
|
var dispatcher = document.commandDispatcher;
|
2004-01-04 01:21:35 +03:00
|
|
|
var controller = dispatcher.getControllerForCommand(command);
|
|
|
|
if (controller && controller.isCommandEnabled(command))
|
|
|
|
controller.doCommand(command);
|
|
|
|
}
|
|
|
|
catch (e)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-25 19:52:44 +03:00
|
|
|
function doCommandWithParams(command, params)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
var dispatcher = document.commandDispatcher;
|
|
|
|
var controller = dispatcher.getControllerForCommand(command);
|
|
|
|
controller.QueryInterface(Components.interfaces.nsICommandController);
|
|
|
|
|
|
|
|
if (!controller || !controller.isCommandEnabled(command))
|
|
|
|
return;
|
|
|
|
|
|
|
|
var cmdparams = newObject("@mozilla.org/embedcomp/command-params;1",
|
|
|
|
"nsICommandParams");
|
|
|
|
for (var i in params)
|
|
|
|
cmdparams.setISupportsValue(i, params[i]);
|
|
|
|
|
|
|
|
controller.doCommandWithParams(command, cmdparams);
|
|
|
|
}
|
|
|
|
catch (e)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
var testURLs =
|
2000-06-01 09:31:04 +04:00
|
|
|
["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/",
|
|
|
|
"irc://irc.foo.org/,needpass", "irc://foo/,isserver",
|
|
|
|
"irc://moznet/,isserver", "irc://moznet/",
|
2001-08-24 01:41:24 +04:00
|
|
|
"irc://foo/chatzilla", "irc://foo/chatzilla/",
|
|
|
|
"irc://irc.foo.org/?msg=hello%20there",
|
2000-06-01 09:31:04 +04:00
|
|
|
"irc://irc.foo.org/?msg=hello%20there&ignorethis",
|
|
|
|
"irc://irc.foo.org/%23mozilla,needkey?msg=hello%20there&ignorethis",
|
|
|
|
"invalids",
|
|
|
|
"irc://irc.foo.org/,isnick"];
|
|
|
|
|
|
|
|
function doURLTest()
|
|
|
|
{
|
|
|
|
for (var u in testURLs)
|
|
|
|
{
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
dd ("testing url \"" + testURLs[u] + "\"");
|
2000-06-01 09:31:04 +04:00
|
|
|
var o = parseIRCURL(testURLs[u]);
|
|
|
|
if (!o)
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
dd ("PARSE FAILED!");
|
2000-06-01 09:31:04 +04:00
|
|
|
else
|
|
|
|
dd (dumpObjectTree(o));
|
|
|
|
dd ("---");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function parseIRCURL (url)
|
|
|
|
{
|
|
|
|
var specifiedHost = "";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-06-01 09:31:04 +04:00
|
|
|
var rv = new Object();
|
|
|
|
rv.spec = url;
|
2004-09-15 22:39:16 +04:00
|
|
|
rv.scheme = url.split(":")[0];
|
2001-08-24 01:41:24 +04:00
|
|
|
rv.host = null;
|
2000-06-01 09:31:04 +04:00
|
|
|
rv.target = "";
|
2004-09-15 22:39:16 +04:00
|
|
|
rv.port = (rv.scheme == "ircs" ? 9999 : 6667);
|
2000-06-01 09:31:04 +04:00
|
|
|
rv.msg = "";
|
2003-08-19 01:35:33 +04:00
|
|
|
rv.pass = null;
|
|
|
|
rv.key = null;
|
|
|
|
rv.charset = null;
|
2000-06-01 09:31:04 +04:00
|
|
|
rv.needpass = false;
|
|
|
|
rv.needkey = false;
|
|
|
|
rv.isnick = false;
|
|
|
|
rv.isserver = false;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
if (url.search(/^(ircs?:\/?\/?)$/i) != -1)
|
2000-06-01 09:31:04 +04:00
|
|
|
return rv;
|
|
|
|
|
|
|
|
/* split url into <host>/<everything-else> pieces */
|
2005-09-12 23:15:37 +04:00
|
|
|
var ary = url.match (/^ircs?:\/\/([^\/\s]+)?(\/[^\s]*)?$/i);
|
2003-12-17 00:03:56 +03:00
|
|
|
if (!ary || !ary[1])
|
2000-06-01 09:31:04 +04:00
|
|
|
{
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
dd ("parseIRCURL: initial split failed");
|
2000-06-01 09:31:04 +04:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
var host = ary[1];
|
2003-10-24 22:29:35 +04:00
|
|
|
var rest = arrayHasElementAt(ary, 2) ? ary[2] : "";
|
2000-06-01 09:31:04 +04:00
|
|
|
|
|
|
|
/* split <host> into server (or network) / port */
|
2005-09-12 23:15:37 +04:00
|
|
|
ary = host.match (/^([^\:]+)?(\:\d+)?$/);
|
2000-06-01 09:31:04 +04:00
|
|
|
if (!ary)
|
|
|
|
{
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
dd ("parseIRCURL: host/port split failed");
|
2000-06-01 09:31:04 +04:00
|
|
|
return null;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-10-24 22:29:35 +04:00
|
|
|
if (arrayHasElementAt(ary, 2))
|
2000-06-01 09:31:04 +04:00
|
|
|
{
|
2003-10-24 22:29:35 +04:00
|
|
|
if (!arrayHasElementAt(ary, 2))
|
2000-06-01 09:31:04 +04:00
|
|
|
{
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
dd ("parseIRCURL: port with no host");
|
2000-06-01 09:31:04 +04:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
specifiedHost = rv.host = ary[1].toLowerCase();
|
|
|
|
rv.isserver = true;
|
|
|
|
rv.port = parseInt(ary[2].substr(1));
|
|
|
|
}
|
2003-10-24 22:29:35 +04:00
|
|
|
else if (arrayHasElementAt(ary, 1))
|
2000-06-01 09:31:04 +04:00
|
|
|
{
|
2001-08-24 01:41:24 +04:00
|
|
|
specifiedHost = rv.host = ary[1].toLowerCase();
|
|
|
|
if (specifiedHost.indexOf(".") != -1)
|
2000-06-01 09:31:04 +04:00
|
|
|
rv.isserver = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rest)
|
|
|
|
{
|
2005-09-12 23:15:37 +04:00
|
|
|
ary = rest.match (/^\/([^\?\s\/,]*)?\/?(,[^\?]*)?(\?.*)?$/);
|
2000-06-01 09:31:04 +04:00
|
|
|
if (!ary)
|
|
|
|
{
|
2001-03-14 05:35:29 +03:00
|
|
|
dd ("parseIRCURL: rest split failed ``" + rest + "''");
|
2000-06-01 09:31:04 +04:00
|
|
|
return null;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-09-12 23:15:37 +04:00
|
|
|
rv.target = arrayHasElementAt(ary, 1) ? ecmaUnescape(ary[1]) : "";
|
|
|
|
|
|
|
|
if (rv.target.search(/[\x07,:\s]/) != -1)
|
|
|
|
{
|
|
|
|
dd ("parseIRCURL: invalid characters in channel name");
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2003-10-24 22:29:35 +04:00
|
|
|
var params = arrayHasElementAt(ary, 2) ? ary[2].toLowerCase() : "";
|
|
|
|
var query = arrayHasElementAt(ary, 3) ? ary[3] : "";
|
2000-06-01 09:31:04 +04:00
|
|
|
|
|
|
|
if (params)
|
|
|
|
{
|
|
|
|
rv.isnick =
|
2005-09-12 23:15:37 +04:00
|
|
|
(params.search (/,isnick(?:,|$)/) != -1);
|
2000-06-01 09:31:04 +04:00
|
|
|
if (rv.isnick && !rv.target)
|
|
|
|
{
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
dd ("parseIRCURL: isnick w/o target");
|
2003-01-22 08:49:52 +03:00
|
|
|
/* isnick w/o a target is bogus */
|
2000-06-01 09:31:04 +04:00
|
|
|
return null;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-01-22 08:49:52 +03:00
|
|
|
if (!rv.isserver)
|
|
|
|
{
|
|
|
|
rv.isserver =
|
2005-09-12 23:15:37 +04:00
|
|
|
(params.search (/,isserver(?:,|$)/) != -1);
|
2003-01-22 08:49:52 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-06-01 09:31:04 +04:00
|
|
|
if (rv.isserver && !specifiedHost)
|
|
|
|
{
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
dd ("parseIRCURL: isserver w/o host");
|
2000-06-01 09:31:04 +04:00
|
|
|
/* isserver w/o a host is bogus */
|
|
|
|
return null;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-06-01 09:31:04 +04:00
|
|
|
rv.needpass =
|
2005-09-12 23:15:37 +04:00
|
|
|
(params.search (/,needpass(?:,|$)/) != -1);
|
2000-06-01 09:31:04 +04:00
|
|
|
|
|
|
|
rv.needkey =
|
2005-09-12 23:15:37 +04:00
|
|
|
(params.search (/,needkey(?:,|$)/) != -1);
|
2000-06-01 09:31:04 +04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (query)
|
|
|
|
{
|
2003-01-22 08:49:52 +03:00
|
|
|
ary = query.substr(1).split("&");
|
|
|
|
while (ary.length)
|
|
|
|
{
|
|
|
|
var arg = ary.pop().split("=");
|
|
|
|
/*
|
|
|
|
* we don't want to accept *any* query, or folks could
|
|
|
|
* say things like "target=foo", and overwrite what we've
|
|
|
|
* already parsed, so we only use query args we know about.
|
|
|
|
*/
|
|
|
|
switch (arg[0].toLowerCase())
|
|
|
|
{
|
|
|
|
case "msg":
|
|
|
|
rv.msg = unescape(arg[1]).replace ("\n", "\\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "pass":
|
|
|
|
rv.needpass = true;
|
|
|
|
rv.pass = unescape(arg[1]).replace ("\n", "\\n");
|
2000-06-01 09:31:04 +04:00
|
|
|
break;
|
2003-01-22 08:49:52 +03:00
|
|
|
|
|
|
|
case "key":
|
|
|
|
rv.needkey = true;
|
|
|
|
rv.key = unescape(arg[1]).replace ("\n", "\\n");
|
|
|
|
break;
|
2003-05-23 01:28:13 +04:00
|
|
|
|
|
|
|
case "charset":
|
|
|
|
rv.charset = unescape(arg[1]).replace ("\n", "\\n");
|
|
|
|
break;
|
2003-01-22 08:49:52 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
}
|
2000-06-01 09:31:04 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-06-01 09:31:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function gotoIRCURL (url)
|
|
|
|
{
|
2003-12-19 06:54:03 +03:00
|
|
|
var urlspec = url;
|
2000-06-01 09:31:04 +04:00
|
|
|
if (typeof url == "string")
|
|
|
|
url = parseIRCURL(url);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-06-01 09:31:04 +04:00
|
|
|
if (!url)
|
|
|
|
{
|
2003-12-19 06:54:03 +03:00
|
|
|
window.alert (getMsg(MSG_ERR_BAD_IRCURL, urlspec));
|
2000-06-01 09:31:04 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
if (!url.host)
|
|
|
|
{
|
|
|
|
/* focus the *client* view for irc:, irc:/, and irc:// (the only irc
|
|
|
|
* urls that don't have a host. (irc:/// implies a connect to the
|
|
|
|
* default network.)
|
|
|
|
*/
|
2003-08-19 01:35:33 +04:00
|
|
|
dispatch("client");
|
2001-08-24 01:41:24 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
var network;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-06-01 09:31:04 +04:00
|
|
|
if (url.isserver)
|
|
|
|
{
|
|
|
|
var alreadyThere = false;
|
|
|
|
for (var n in client.networks)
|
|
|
|
{
|
|
|
|
if ((client.networks[n].isConnected()) &&
|
2003-08-19 01:35:33 +04:00
|
|
|
(client.networks[n].primServ.hostname == url.host) &&
|
|
|
|
(client.networks[n].primServ.port == url.port))
|
2000-06-01 09:31:04 +04:00
|
|
|
{
|
|
|
|
/* already connected to this server/port */
|
2003-08-19 01:35:33 +04:00
|
|
|
network = client.networks[n];
|
2000-06-01 09:31:04 +04:00
|
|
|
alreadyThere = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!alreadyThere)
|
|
|
|
{
|
2001-08-24 01:41:24 +04:00
|
|
|
/*
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
dd ("gotoIRCURL: not already connected to " +
|
2000-06-03 04:11:57 +04:00
|
|
|
"server " + url.host + " trying to connect...");
|
2001-08-24 01:41:24 +04:00
|
|
|
*/
|
2006-07-20 00:14:37 +04:00
|
|
|
var pass = "";
|
|
|
|
if (url.needpass)
|
|
|
|
{
|
|
|
|
if (url.pass)
|
|
|
|
pass = url.pass;
|
|
|
|
else
|
|
|
|
pass = promptPassword(getMsg(MSG_HOST_PASSWORD, url.host));
|
|
|
|
}
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
network = dispatch((url.scheme == "ircs" ? "sslserver" : "server"),
|
2006-07-20 00:14:37 +04:00
|
|
|
{hostname: url.host, port: url.port,
|
|
|
|
password: pass});
|
|
|
|
|
|
|
|
if (!url.target)
|
|
|
|
return;
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!("pendingURLs" in network))
|
|
|
|
network.pendingURLs = new Array();
|
|
|
|
network.pendingURLs.unshift(url);
|
2000-06-01 09:31:04 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
/* parsed as a network name */
|
2003-09-24 04:49:09 +04:00
|
|
|
if (!(url.host in client.networks))
|
|
|
|
{
|
|
|
|
display(getMsg(MSG_ERR_UNKNOWN_NETWORK, url.host));
|
|
|
|
return;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
network = client.networks[url.host];
|
|
|
|
if (!network.isConnected())
|
2000-06-01 09:31:04 +04:00
|
|
|
{
|
2001-08-24 01:41:24 +04:00
|
|
|
/*
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
dd ("gotoIRCURL: not already connected to " +
|
2000-06-01 09:31:04 +04:00
|
|
|
"network " + url.host + " trying to connect...");
|
2001-08-24 01:41:24 +04:00
|
|
|
*/
|
2004-09-15 22:39:16 +04:00
|
|
|
client.connectToNetwork(network, (url.scheme == "ircs" ? true : false));
|
2006-07-20 00:14:37 +04:00
|
|
|
|
|
|
|
if (!url.target)
|
|
|
|
return;
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!("pendingURLs" in network))
|
|
|
|
network.pendingURLs = new Array();
|
|
|
|
network.pendingURLs.unshift(url);
|
2000-06-01 09:31:04 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-06-01 09:31:04 +04:00
|
|
|
/* already connected, do whatever comes next in the url */
|
2001-08-24 01:41:24 +04:00
|
|
|
//dd ("gotoIRCURL: connected, time to finish parsing ``" + url + "''");
|
2000-06-01 09:31:04 +04:00
|
|
|
if (url.target)
|
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
var targetObject;
|
|
|
|
var ev;
|
2000-06-01 09:31:04 +04:00
|
|
|
if (url.isnick)
|
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
/* url points to a person. */
|
|
|
|
var nick = url.target;
|
|
|
|
var ary = url.target.split("!");
|
|
|
|
if (ary)
|
|
|
|
nick = ary[0];
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
targetObject = network.dispatch("query", {nickname: nick});
|
2000-06-01 09:31:04 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
/* url points to a channel */
|
2003-08-19 01:35:33 +04:00
|
|
|
var key;
|
2001-12-04 03:20:48 +03:00
|
|
|
if (url.needkey)
|
2003-01-22 08:49:52 +03:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
if (url.key)
|
2003-01-22 08:49:52 +03:00
|
|
|
key = url.key;
|
|
|
|
else
|
2003-11-19 01:39:26 +03:00
|
|
|
key = window.promptPassword(getMsg(MSG_URL_KEY, url.spec));
|
2003-01-22 08:49:52 +03:00
|
|
|
}
|
2003-05-23 01:28:13 +04:00
|
|
|
|
2003-10-11 04:21:05 +04:00
|
|
|
if (url.charset)
|
2004-09-15 22:39:16 +04:00
|
|
|
{
|
|
|
|
var d = { channelName: url.target, key: key,
|
|
|
|
charset: url.charset };
|
|
|
|
targetObject = network.dispatch("join", d);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Must do this the hard way... we have the server's format
|
|
|
|
// for the channel name here, and all our commands only work
|
|
|
|
// with the Unicode forms.
|
|
|
|
var serv = network.primServ;
|
|
|
|
var target = url.target;
|
2004-09-21 18:58:26 +04:00
|
|
|
|
|
|
|
/* If we don't have a valid prefix, stick a "#" on it.
|
|
|
|
* NOTE: This is always a "#" so that URLs may be compared
|
|
|
|
* properly without involving the server (e.g. off-line).
|
|
|
|
*/
|
2005-12-09 17:03:03 +03:00
|
|
|
if ((arrayIndexOf(["#", "&", "+", "!"], target[0]) == -1) &&
|
|
|
|
(arrayIndexOf(serv.channelTypes, target[0]) == -1))
|
|
|
|
{
|
2004-09-21 18:58:26 +04:00
|
|
|
target = "#" + target;
|
2005-12-09 17:03:03 +03:00
|
|
|
}
|
2004-09-21 18:58:26 +04:00
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
var chan = new CIRCChannel(serv, null, target);
|
|
|
|
|
|
|
|
d = { channelName: chan.unicodeName, key: key,
|
|
|
|
charset: url.charset };
|
|
|
|
targetObject = network.dispatch("join", d);
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!targetObject)
|
|
|
|
return;
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (url.msg)
|
|
|
|
{
|
|
|
|
var msg;
|
|
|
|
if (url.msg.indexOf("\01ACTION") == 0)
|
2000-06-01 09:31:04 +04:00
|
|
|
{
|
2005-10-25 02:27:16 +04:00
|
|
|
msg = filterOutput(url.msg, "ACTION", targetObject);
|
2003-08-19 01:35:33 +04:00
|
|
|
targetObject.display(msg, "ACTION", "ME!",
|
|
|
|
client.currentObject);
|
2000-06-01 09:31:04 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
else
|
|
|
|
{
|
2005-10-25 02:27:16 +04:00
|
|
|
msg = filterOutput(url.msg, "PRIVMSG", targetObject);
|
2003-08-19 01:35:33 +04:00
|
|
|
targetObject.display(msg, "PRIVMSG", "ME!",
|
|
|
|
client.currentObject);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2003-10-11 04:21:05 +04:00
|
|
|
targetObject.say(msg);
|
2004-09-15 22:39:16 +04:00
|
|
|
dispatch("set-current-view", { view: targetObject });
|
2000-06-01 09:31:04 +04:00
|
|
|
}
|
|
|
|
}
|
2001-03-14 05:35:29 +03:00
|
|
|
else
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!network.messages)
|
2004-09-15 22:39:16 +04:00
|
|
|
network.displayHere (getMsg(MSG_NETWORK_OPENED, network.unicodeName));
|
|
|
|
dispatch("set-current-view", { view: network });
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
-- CHATZILLA CHANGES ONLY --
checking in patch from Josh Gough, <exv@randomc.com>
muchas gracias!
irc.js
add whois, invite
utils.js
added map and mapObjFunc
chatzilla.xul
add cntxt menu for userlist
commands.js
hook up /away, op, deop, voice, devoice, echo, invite, and kick commands
hadlers.js
onload hack
whois, away, deop, op, voice, devoice, echo, invite, kick command implementations
static.js
more of the onload hack
addEventListener on toolbuttons
listbox.js
selection code
chatzilla.css
selicted list item style
2000-04-24 04:40:56 +04:00
|
|
|
}
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
function updateProgress()
|
|
|
|
{
|
|
|
|
var busy;
|
|
|
|
var progress = -1;
|
|
|
|
|
|
|
|
if ("busy" in client.currentObject)
|
|
|
|
busy = client.currentObject.busy;
|
|
|
|
|
|
|
|
if ("progress" in client.currentObject)
|
|
|
|
progress = client.currentObject.progress;
|
|
|
|
|
2005-12-26 01:37:33 +03:00
|
|
|
if (!busy)
|
|
|
|
progress = 0;
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
client.progressPanel.collapsed = !busy;
|
2005-12-26 01:37:33 +03:00
|
|
|
client.progressBar.mode = (progress < 0 ? "undetermined" : "determined");
|
|
|
|
if (progress >= 0)
|
2004-09-15 22:39:16 +04:00
|
|
|
client.progressBar.value = progress;
|
|
|
|
}
|
|
|
|
|
2005-06-12 18:17:27 +04:00
|
|
|
function updateSecurityIcon()
|
|
|
|
{
|
|
|
|
var o = getObjectDetails(client.currentObject);
|
|
|
|
var securityButton = window.document.getElementById("security-button");
|
|
|
|
securityButton.firstChild.value = "";
|
|
|
|
securityButton.removeAttribute("level");
|
|
|
|
securityButton.removeAttribute("tooltiptext");
|
|
|
|
if (!o.server || !o.server.isConnected) // No server or connection?
|
|
|
|
{
|
|
|
|
securityButton.setAttribute("tooltiptext", MSG_SECURITY_INFO);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var securityState = o.server.connection.getSecurityState()
|
2006-01-19 01:28:31 +03:00
|
|
|
switch (securityState[0])
|
2005-06-12 18:17:27 +04:00
|
|
|
{
|
|
|
|
case STATE_IS_SECURE:
|
|
|
|
securityButton.firstChild.value = o.server.hostname;
|
|
|
|
if (securityState[1] == STATE_SECURE_HIGH)
|
|
|
|
securityButton.setAttribute("level", "high");
|
|
|
|
else // Because low security is the worst we have when being secure
|
|
|
|
securityButton.setAttribute("level", "low");
|
|
|
|
|
|
|
|
// Add the tooltip:
|
|
|
|
var issuer = o.server.connection.getCertificate().issuerOrganization;
|
|
|
|
var tooltiptext = getMsg(MSG_SECURE_CONNECTION, issuer);
|
|
|
|
securityButton.setAttribute("tooltiptext", tooltiptext);
|
|
|
|
securityButton.firstChild.setAttribute("tooltiptext", tooltiptext);
|
|
|
|
securityButton.lastChild.setAttribute("tooltiptext", tooltiptext);
|
|
|
|
break;
|
|
|
|
case STATE_IS_BROKEN:
|
|
|
|
securityButton.setAttribute("level", "broken");
|
|
|
|
// No break to make sure we get the correct tooltip
|
|
|
|
case STATE_IS_INSECURE:
|
|
|
|
default:
|
|
|
|
securityButton.setAttribute("tooltiptext", MSG_SECURITY_INFO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function updateNetwork()
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
var o = getObjectDetails (client.currentObject);
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
var lag = MSG_UNKNOWN;
|
2003-08-19 01:35:33 +04:00
|
|
|
var nick = "";
|
|
|
|
if (o.server)
|
|
|
|
{
|
|
|
|
if (o.server.me)
|
2004-09-15 22:39:16 +04:00
|
|
|
nick = o.server.me.unicodeName;
|
2003-08-19 01:35:33 +04:00
|
|
|
lag = (o.server.lag != -1) ? o.server.lag : MSG_UNKNOWN;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
client.statusBar["header-url"].setAttribute("value",
|
2003-08-19 01:35:33 +04:00
|
|
|
client.currentObject.getURL());
|
2004-09-15 22:39:16 +04:00
|
|
|
client.statusBar["header-url"].setAttribute("href",
|
2003-08-19 01:35:33 +04:00
|
|
|
client.currentObject.getURL());
|
2004-09-15 22:39:16 +04:00
|
|
|
client.statusBar["header-url"].setAttribute("name",
|
|
|
|
client.currentObject.unicodeName);
|
2000-01-27 12:45:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateTitle (obj)
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
if (!(("currentObject" in client) && client.currentObject) ||
|
2004-01-04 01:21:35 +03:00
|
|
|
(obj && obj != client.currentObject))
|
2000-01-27 12:45:11 +03:00
|
|
|
return;
|
|
|
|
|
2006-03-05 04:18:58 +03:00
|
|
|
var tstring = MSG_TITLE_UNKNOWN;
|
2003-08-19 01:35:33 +04:00
|
|
|
var o = getObjectDetails(client.currentObject);
|
2004-09-15 22:39:16 +04:00
|
|
|
var net = o.network ? o.network.unicodeName : "";
|
2001-12-04 03:20:48 +03:00
|
|
|
var nick = "";
|
2006-03-05 04:18:58 +03:00
|
|
|
client.statusBar["server-nick"].disabled = false;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-05-15 09:58:30 +04:00
|
|
|
switch (client.currentObject.TYPE)
|
2000-01-27 12:45:11 +03:00
|
|
|
{
|
2000-05-15 09:58:30 +04:00
|
|
|
case "IRCNetwork":
|
2001-12-04 03:20:48 +03:00
|
|
|
var serv = "", port = "";
|
2003-08-19 01:35:33 +04:00
|
|
|
if (client.currentObject.isConnected())
|
2000-05-17 04:50:16 +04:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
serv = o.server.hostname;
|
|
|
|
port = o.server.port;
|
2000-05-17 04:50:16 +04:00
|
|
|
if (o.server.me)
|
2004-09-15 22:39:16 +04:00
|
|
|
nick = o.server.me.unicodeName;
|
2003-08-19 01:35:33 +04:00
|
|
|
tstring = getMsg(MSG_TITLE_NET_ON, [nick, net, serv, port]);
|
2000-05-17 04:50:16 +04:00
|
|
|
}
|
2000-05-15 09:58:30 +04:00
|
|
|
else
|
2001-07-02 08:36:29 +04:00
|
|
|
{
|
|
|
|
nick = client.currentObject.INITIAL_NICK;
|
2003-08-19 01:35:33 +04:00
|
|
|
tstring = getMsg(MSG_TITLE_NET_OFF, [nick, net]);
|
2001-07-02 08:36:29 +04:00
|
|
|
}
|
2000-05-15 09:58:30 +04:00
|
|
|
break;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-05-15 09:58:30 +04:00
|
|
|
case "IRCChannel":
|
2001-07-02 08:36:29 +04:00
|
|
|
var chan = "", mode = "", topic = "";
|
2003-08-19 01:35:33 +04:00
|
|
|
if ("me" in o.parent)
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
nick = o.parent.me.unicodeName;
|
|
|
|
if (o.parent.me.canonicalName in client.currentObject.users)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
var cuser = client.currentObject.users[o.parent.me.canonicalName];
|
2006-03-05 04:13:34 +03:00
|
|
|
if (cuser.isFounder)
|
|
|
|
nick = "~" + nick;
|
|
|
|
else if (cuser.isAdmin)
|
|
|
|
nick = "&" + nick;
|
|
|
|
else if (cuser.isOp)
|
2003-08-19 01:35:33 +04:00
|
|
|
nick = "@" + nick;
|
2004-09-15 22:39:16 +04:00
|
|
|
else if (cuser.isHalfOp)
|
|
|
|
nick = "%" + nick;
|
2003-08-19 01:35:33 +04:00
|
|
|
else if (cuser.isVoice)
|
|
|
|
nick = "+" + nick;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nick = MSG_TITLE_NONICK;
|
|
|
|
}
|
2002-08-02 01:08:59 +04:00
|
|
|
chan = o.channel.unicodeName;
|
2000-05-15 09:58:30 +04:00
|
|
|
mode = o.channel.mode.getModeStr();
|
|
|
|
if (!mode)
|
2003-08-19 01:35:33 +04:00
|
|
|
mode = MSG_TITLE_NO_MODE;
|
|
|
|
topic = o.channel.topic ? o.channel.topic : MSG_TITLE_NO_TOPIC;
|
2004-01-04 01:21:35 +03:00
|
|
|
var re = /\x1f|\x02|\x0f|\x16|\x03([0-9]{1,2}(,[0-9]{1,2})?)?/g;
|
|
|
|
topic = topic.replace(re, "");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
tstring = getMsg(MSG_TITLE_CHANNEL, [nick, chan, mode, topic]);
|
2000-05-15 09:58:30 +04:00
|
|
|
break;
|
2000-05-13 02:30:21 +04:00
|
|
|
|
2000-05-15 09:58:30 +04:00
|
|
|
case "IRCUser":
|
2004-09-15 22:39:16 +04:00
|
|
|
nick = client.currentObject.unicodeName;
|
2001-12-04 03:20:48 +03:00
|
|
|
var source = "";
|
|
|
|
if (client.currentObject.name)
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
source = "<" + client.currentObject.name + "@" +
|
|
|
|
client.currentObject.host +">";
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
tstring = getMsg(MSG_TITLE_USER, [nick, source]);
|
2004-09-15 22:39:16 +04:00
|
|
|
nick = "me" in o.parent ? o.parent.me.unicodeName : MSG_TITLE_NONICK;
|
2000-05-15 09:58:30 +04:00
|
|
|
break;
|
|
|
|
|
2005-05-09 16:26:19 +04:00
|
|
|
case "IRCClient":
|
|
|
|
nick = client.prefs["nickname"];
|
2006-03-05 04:18:58 +03:00
|
|
|
break;
|
2005-05-09 16:26:19 +04:00
|
|
|
|
2006-03-05 04:18:58 +03:00
|
|
|
case "IRCDCCChat":
|
|
|
|
client.statusBar["server-nick"].disabled = true;
|
|
|
|
nick = o.chat.me.unicodeName;
|
|
|
|
tstring = getMsg(MSG_TITLE_DCCCHAT, o.userName);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "IRCDCCFileTransfer":
|
|
|
|
client.statusBar["server-nick"].disabled = true;
|
|
|
|
nick = o.file.me.unicodeName;
|
|
|
|
var data = [o.file.progress, o.file.filename, o.userName];
|
|
|
|
if (o.file.state.dir == 1)
|
|
|
|
tstring = getMsg(MSG_TITLE_DCCFILE_SEND, data);
|
|
|
|
else
|
|
|
|
tstring = getMsg(MSG_TITLE_DCCFILE_GET, data);
|
2000-05-15 09:58:30 +04:00
|
|
|
break;
|
2000-01-27 12:45:11 +03:00
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (0 && !client.uiState["tabstrip"])
|
2000-05-13 02:30:21 +04:00
|
|
|
{
|
|
|
|
var actl = new Array();
|
|
|
|
for (var i in client.activityList)
|
2001-03-14 05:35:29 +03:00
|
|
|
actl.push ((client.activityList[i] == "!") ?
|
|
|
|
(Number(i) + 1) + "!" : (Number(i) + 1));
|
2000-05-13 02:30:21 +04:00
|
|
|
if (actl.length > 0)
|
2003-08-19 01:35:33 +04:00
|
|
|
tstring = getMsg(MSG_TITLE_ACTIVITY,
|
|
|
|
[tstring, actl.join (MSG_COMMASP)]);
|
2000-05-13 02:30:21 +04:00
|
|
|
}
|
|
|
|
|
2000-01-27 12:45:11 +03:00
|
|
|
document.title = tstring;
|
2005-06-02 02:43:41 +04:00
|
|
|
client.statusBar["server-nick"].setAttribute("label", nick);
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2005-12-26 01:30:05 +03:00
|
|
|
// Where 'right' is orientation, not wrong/right:
|
|
|
|
function updateUserlistSide(shouldBeLeft)
|
|
|
|
{
|
|
|
|
var listParent = document.getElementById("tabpanels-contents-box");
|
|
|
|
var isLeft = (listParent.childNodes[0].id == "user-list-box");
|
|
|
|
if (isLeft == shouldBeLeft)
|
|
|
|
return;
|
|
|
|
if (shouldBeLeft) // Move from right to left.
|
|
|
|
{
|
|
|
|
listParent.insertBefore(listParent.childNodes[1], listParent.childNodes[0]);
|
|
|
|
listParent.insertBefore(listParent.childNodes[2], listParent.childNodes[0]);
|
|
|
|
listParent.childNodes[1].setAttribute("collapse", "before");
|
|
|
|
}
|
|
|
|
else // Move from left to right.
|
|
|
|
{
|
|
|
|
listParent.appendChild(listParent.childNodes[1]);
|
|
|
|
listParent.appendChild(listParent.childNodes[0]);
|
|
|
|
listParent.childNodes[1].setAttribute("collapse", "after");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
function multilineInputMode (state)
|
|
|
|
{
|
|
|
|
var multiInput = document.getElementById("multiline-input");
|
2003-01-22 08:49:52 +03:00
|
|
|
var multiInputBox = document.getElementById("multiline-box");
|
2001-03-14 05:35:29 +03:00
|
|
|
var singleInput = document.getElementById("input");
|
2003-01-22 08:49:52 +03:00
|
|
|
var singleInputBox = document.getElementById("singleline-box");
|
2001-03-14 05:35:29 +03:00
|
|
|
var splitter = document.getElementById("input-splitter");
|
|
|
|
var iw = document.getElementById("input-widgets");
|
|
|
|
var h;
|
2001-08-24 01:41:24 +04:00
|
|
|
|
|
|
|
client._mlMode = state;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
if (state) /* turn on multiline input mode */
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
h = iw.getAttribute ("lastHeight");
|
|
|
|
if (h)
|
|
|
|
iw.setAttribute ("height", h); /* restore the slider position */
|
|
|
|
|
2003-01-22 08:49:52 +03:00
|
|
|
singleInputBox.setAttribute ("collapsed", "true");
|
2001-03-14 05:35:29 +03:00
|
|
|
splitter.setAttribute ("collapsed", "false");
|
2003-01-22 08:49:52 +03:00
|
|
|
multiInputBox.setAttribute ("collapsed", "false");
|
2004-09-15 22:39:16 +04:00
|
|
|
// multiInput should have the same direction as singleInput
|
|
|
|
multiInput.setAttribute("dir", singleInput.getAttribute("dir"));
|
2005-11-20 01:29:47 +03:00
|
|
|
multiInput.value = (client.input ? client.input.value : "");
|
2001-08-24 01:41:24 +04:00
|
|
|
client.input = multiInput;
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
|
|
|
else /* turn off multiline input mode */
|
|
|
|
{
|
|
|
|
h = iw.getAttribute ("height");
|
|
|
|
iw.setAttribute ("lastHeight", h); /* save the slider position */
|
|
|
|
iw.removeAttribute ("height"); /* let the slider drop */
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
splitter.setAttribute ("collapsed", "true");
|
2003-01-22 08:49:52 +03:00
|
|
|
multiInputBox.setAttribute ("collapsed", "true");
|
|
|
|
singleInputBox.setAttribute ("collapsed", "false");
|
2004-07-18 01:14:34 +04:00
|
|
|
// singleInput should have the same direction as multiInput
|
2004-09-15 22:39:16 +04:00
|
|
|
singleInput.setAttribute("dir", multiInput.getAttribute("dir"));
|
2005-11-20 01:29:47 +03:00
|
|
|
singleInput.value = (client.input ? client.input.value : "");
|
2001-08-24 01:41:24 +04:00
|
|
|
client.input = singleInput;
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2001-08-24 01:41:24 +04:00
|
|
|
|
|
|
|
client.input.focus();
|
|
|
|
}
|
|
|
|
|
2005-06-12 18:17:27 +04:00
|
|
|
function displayCertificateInfo()
|
|
|
|
{
|
|
|
|
var o = getObjectDetails(client.currentObject);
|
|
|
|
if (!o.server)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!o.server.isSecure)
|
|
|
|
{
|
|
|
|
alert(getMsg(MSG_INSECURE_SERVER, o.server.hostname));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
viewCert(o.server.connection.getCertificate());
|
|
|
|
}
|
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
function newInlineText (data, className, tagName)
|
|
|
|
{
|
|
|
|
if (typeof tagName == "undefined")
|
|
|
|
tagName = "html:span";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-06-15 13:54:41 +04:00
|
|
|
var a = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
2000-05-18 23:32:02 +04:00
|
|
|
tagName);
|
2001-12-04 03:20:48 +03:00
|
|
|
if (className)
|
|
|
|
a.setAttribute ("class", className);
|
2000-01-18 06:32:43 +03:00
|
|
|
|
|
|
|
switch (typeof data)
|
|
|
|
{
|
|
|
|
case "string":
|
|
|
|
a.appendChild (document.createTextNode (data));
|
|
|
|
break;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
case "object":
|
|
|
|
for (var p in data)
|
|
|
|
if (p != "data")
|
|
|
|
a.setAttribute (p, data[p]);
|
|
|
|
else
|
|
|
|
a.appendChild (document.createTextNode (data[p]));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "undefined":
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2003-08-19 01:35:33 +04:00
|
|
|
ASSERT(0, "INVALID TYPE ('" + typeof data + "') passed to " +
|
|
|
|
"newInlineText.");
|
2000-01-18 06:32:43 +03:00
|
|
|
break;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return a;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
function stringToMsg (message, obj)
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
|
|
|
var ary = message.split ("\n");
|
|
|
|
var span = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
2001-08-24 01:41:24 +04:00
|
|
|
"html:span");
|
|
|
|
var data = getObjectDetails(obj);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
if (ary.length == 1)
|
|
|
|
client.munger.munge(ary[0], span, data);
|
|
|
|
else
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
2001-08-24 01:41:24 +04:00
|
|
|
for (var l = 0; l < ary.length - 1; ++l)
|
|
|
|
{
|
|
|
|
client.munger.munge(ary[l], span, data);
|
2004-09-15 22:39:16 +04:00
|
|
|
span.appendChild
|
2001-08-24 01:41:24 +04:00
|
|
|
(document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:br"));
|
|
|
|
}
|
|
|
|
client.munger.munge(ary[l], span, data);
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return span;
|
|
|
|
}
|
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
function getFrame()
|
|
|
|
{
|
|
|
|
if (client.deck.childNodes.length == 0)
|
|
|
|
return undefined;
|
|
|
|
var panel = client.deck.selectedPanel;
|
2003-08-19 01:35:33 +04:00
|
|
|
return getContentWindow(panel);
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
client.__defineGetter__ ("currentFrame", getFrame);
|
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
function setCurrentObject (obj)
|
|
|
|
{
|
2003-09-24 04:49:09 +04:00
|
|
|
function clearList()
|
|
|
|
{
|
|
|
|
client.rdf.Unassert (client.rdf.resNullChan, client.rdf.resChanUser,
|
|
|
|
client.rdf.resNullUser, true);
|
|
|
|
};
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!ASSERT(obj.messages, "INVALID OBJECT passed to setCurrentObject **"))
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
return;
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
if ("currentObject" in client && client.currentObject == obj)
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-06-01 09:31:04 +04:00
|
|
|
var tb, userList;
|
2005-11-20 01:11:07 +03:00
|
|
|
userList = document.getElementById("user-list");
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
if ("currentObject" in client && client.currentObject)
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
2005-11-20 01:11:07 +03:00
|
|
|
var co = client.currentObject;
|
|
|
|
// Save any nicknames selected
|
|
|
|
if (client.currentObject.TYPE == "IRCChannel")
|
|
|
|
co.userlistSelection = getSelectedNicknames(userList);
|
|
|
|
tb = getTabForObject(co);
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2000-01-18 06:32:43 +03:00
|
|
|
if (tb)
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
2002-02-20 00:07:34 +03:00
|
|
|
tb.selected = false;
|
2000-05-09 05:00:42 +04:00
|
|
|
tb.setAttribute ("state", "normal");
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-11-20 01:11:07 +03:00
|
|
|
/* Unselect currently selected users.
|
|
|
|
* If the splitter's collapsed, the userlist *isn't* visible, but we'll not
|
2004-09-15 22:39:16 +04:00
|
|
|
* get told when it becomes visible, so update it even if it's only the
|
2004-01-22 16:53:38 +03:00
|
|
|
* splitter visible. */
|
|
|
|
if (isVisible("user-list-box") || isVisible("main-splitter"))
|
2002-05-16 14:49:25 +04:00
|
|
|
{
|
|
|
|
/* Remove currently selected items before this tree gets rerooted,
|
|
|
|
* because it seems to remember the selections for eternity if not. */
|
2004-04-18 22:52:24 +04:00
|
|
|
if (userList.view && userList.view.selection)
|
2004-04-17 09:53:38 +04:00
|
|
|
userList.view.selection.select(-1);
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2002-05-16 14:49:25 +04:00
|
|
|
if (obj.TYPE == "IRCChannel")
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
|
|
|
client.rdf.setTreeRoot("user-list", obj.getGraphResource());
|
2005-11-20 01:11:07 +03:00
|
|
|
reSortUserlist(userList);
|
|
|
|
// Restore any selections previously made
|
|
|
|
if (("userlistSelection" in obj) && obj.userlistSelection)
|
|
|
|
setSelectedNicknames(userList, obj.userlistSelection);
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2002-05-16 14:49:25 +04:00
|
|
|
else
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2003-09-24 04:49:09 +04:00
|
|
|
var rdf = client.rdf;
|
|
|
|
rdf.setTreeRoot("user-list", rdf.resNullChan);
|
|
|
|
rdf.Assert (rdf.resNullChan, rdf.resChanUser, rdf.resNullUser,
|
|
|
|
true);
|
|
|
|
setTimeout(clearList, 100);
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2002-05-16 14:49:25 +04:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
client.currentObject = obj;
|
2004-09-15 22:39:16 +04:00
|
|
|
tb = dispatch("create-tab-for-view", { view: obj });
|
2000-01-18 06:32:43 +03:00
|
|
|
if (tb)
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
2002-02-20 00:07:34 +03:00
|
|
|
tb.selected = true;
|
2000-05-09 05:00:42 +04:00
|
|
|
tb.setAttribute ("state", "current");
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-05-13 02:30:21 +04:00
|
|
|
var vk = Number(tb.getAttribute("viewKey"));
|
|
|
|
delete client.activityList[vk];
|
2002-08-02 01:08:59 +04:00
|
|
|
client.deck.selectedIndex = vk;
|
2000-05-13 02:30:21 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
updateTitle();
|
2004-09-15 22:39:16 +04:00
|
|
|
updateProgress();
|
2005-06-12 18:17:27 +04:00
|
|
|
updateSecurityIcon();
|
2000-01-18 06:32:43 +03:00
|
|
|
|
|
|
|
if (client.PRINT_DIRECTION == 1)
|
2004-09-15 22:39:16 +04:00
|
|
|
scrollDown(obj.frame, false);
|
2003-11-09 02:47:04 +03:00
|
|
|
|
2004-07-18 01:14:34 +04:00
|
|
|
// Input area should have the same direction as the output area
|
2004-12-20 01:52:37 +03:00
|
|
|
if (("frame" in client.currentObject) &&
|
|
|
|
client.currentObject.frame &&
|
|
|
|
("contentDocument" in client.currentObject.frame) &&
|
|
|
|
client.currentObject.frame.contentDocument &&
|
|
|
|
("body" in client.currentObject.frame.contentDocument) &&
|
|
|
|
client.currentObject.frame.contentDocument.body)
|
|
|
|
{
|
|
|
|
var contentArea = client.currentObject.frame.contentDocument.body;
|
|
|
|
client.input.setAttribute("dir", contentArea.getAttribute("dir"));
|
|
|
|
}
|
2003-11-09 02:47:04 +03:00
|
|
|
client.input.focus();
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2000-05-13 02:30:21 +04:00
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
function checkScroll(frame)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
var window = getContentWindow(frame);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if (!window || !("document" in window))
|
2002-08-02 01:08:59 +04:00
|
|
|
return false;
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return (window.document.height - window.innerHeight -
|
|
|
|
window.pageYOffset) < 160;
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function scrollDown(frame, force)
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
var window = getContentWindow(frame);
|
|
|
|
if (window && (force || checkScroll(frame)))
|
|
|
|
window.scrollTo(0, window.document.height);
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2002-02-03 07:35:26 +03:00
|
|
|
/* valid values for |what| are "superfluous", "activity", and "attention".
|
|
|
|
* final value for state is dependant on priority of the current state, and the
|
|
|
|
* new state. the priority is: normal < superfluous < activity < attention.
|
|
|
|
*/
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
function setTabState(source, what, callback)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
|
|
|
if (typeof source != "object")
|
2004-01-04 01:21:35 +03:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
if (!ASSERT(source in client.viewsArray,
|
2004-01-04 01:21:35 +03:00
|
|
|
"INVALID SOURCE passed to setTabState"))
|
|
|
|
return;
|
2000-01-18 06:32:43 +03:00
|
|
|
source = client.viewsArray[source].source;
|
2004-01-04 01:21:35 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
callback = callback || false;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
var tb = source.dispatch("create-tab-for-view", { view: source });
|
2000-05-13 02:30:21 +04:00
|
|
|
var vk = Number(tb.getAttribute("viewKey"));
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var current = ("currentObject" in client && client.currentObject == source);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
/* We want to play sounds if they're from a non-current view, or we don't
|
|
|
|
* have focus at all. Also make sure stalk matches always play sounds.
|
|
|
|
* Also make sure we don't play on the 2nd half of the flash (Callback).
|
|
|
|
*/
|
|
|
|
if (!callback && (!window.isFocused || !current || (what == "attention")))
|
2000-05-09 05:00:42 +04:00
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if (what == "attention")
|
|
|
|
playEventSounds(source.TYPE, "stalk");
|
|
|
|
else if (what == "activity")
|
|
|
|
playEventSounds(source.TYPE, "chat");
|
|
|
|
else if (what == "superfluous")
|
|
|
|
playEventSounds(source.TYPE, "event");
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Only change the tab's colour if it's not the active view.
|
|
|
|
if (!current)
|
|
|
|
{
|
|
|
|
var state = tb.getAttribute("state");
|
2002-02-03 07:35:26 +03:00
|
|
|
if (state == what)
|
|
|
|
{
|
|
|
|
/* if the tab state has an equal priority to what we are setting
|
|
|
|
* then blink it */
|
2004-01-04 01:21:35 +03:00
|
|
|
if (client.prefs["activityFlashDelay"] > 0)
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
tb.setAttribute("state", "normal");
|
2004-09-15 22:39:16 +04:00
|
|
|
setTimeout(setTabState, client.prefs["activityFlashDelay"],
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
vk, what, true);
|
2004-01-04 01:21:35 +03:00
|
|
|
}
|
2002-02-03 07:35:26 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (state == "normal" || state == "superfluous" ||
|
|
|
|
(state == "activity" && what == "attention"))
|
2000-05-13 02:30:21 +04:00
|
|
|
{
|
2002-02-03 07:35:26 +03:00
|
|
|
/* if the tab state has a lower priority than what we are
|
|
|
|
* setting, change it to the new state */
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
tb.setAttribute("state", what);
|
2002-02-03 07:35:26 +03:00
|
|
|
/* we only change the activity list if priority has increased */
|
|
|
|
if (what == "attention")
|
|
|
|
client.activityList[vk] = "!";
|
|
|
|
else if (what == "activity")
|
|
|
|
client.activityList[vk] = "+";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* this is functionally equivalent to "+" for now */
|
|
|
|
client.activityList[vk] = "-";
|
|
|
|
}
|
2000-05-13 02:30:21 +04:00
|
|
|
updateTitle();
|
|
|
|
}
|
2002-02-03 07:35:26 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* the current state of the tab has a higher priority than the
|
|
|
|
* new state.
|
|
|
|
* blink the new lower state quickly, then back to the old */
|
2004-01-04 01:21:35 +03:00
|
|
|
if (client.prefs["activityFlashDelay"] > 0)
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
tb.setAttribute("state", what);
|
2004-09-15 22:39:16 +04:00
|
|
|
setTimeout(setTabState,
|
|
|
|
client.prefs["activityFlashDelay"], vk,
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
state, true);
|
2004-01-04 01:21:35 +03:00
|
|
|
}
|
2002-02-03 07:35:26 +03:00
|
|
|
}
|
2000-05-09 05:00:42 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function notifyAttention (source)
|
|
|
|
{
|
|
|
|
if (typeof source != "object")
|
|
|
|
source = client.viewsArray[source].source;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-05-09 05:00:42 +04:00
|
|
|
if (client.currentObject != source)
|
2000-05-13 02:30:21 +04:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
var tb = dispatch("create-tab-for-view", { view: source });
|
2001-03-14 05:35:29 +03:00
|
|
|
var vk = Number(tb.getAttribute("viewKey"));
|
|
|
|
|
2000-05-09 05:00:42 +04:00
|
|
|
tb.setAttribute ("state", "attention");
|
2000-05-13 02:30:21 +04:00
|
|
|
client.activityList[vk] = "!";
|
|
|
|
updateTitle();
|
|
|
|
}
|
2000-05-09 05:00:42 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (client.prefs["notify.aggressive"])
|
2002-02-09 06:36:55 +03:00
|
|
|
window.getAttention();
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
function setDebugMode(mode)
|
|
|
|
{
|
|
|
|
if (mode.indexOf("t") != -1)
|
|
|
|
client.debugHook.enabled = true;
|
|
|
|
else
|
|
|
|
client.debugHook.enabled = false;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
if (mode.indexOf("c") != -1)
|
|
|
|
client.dbgContexts = true;
|
|
|
|
else
|
|
|
|
delete client.dbgContexts;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
if (mode.indexOf("d") != -1)
|
|
|
|
client.dbgDispatch = true;
|
|
|
|
else
|
|
|
|
delete client.dbgDispatch;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setListMode(mode)
|
|
|
|
{
|
|
|
|
var elem = document.getElementById("user-list");
|
|
|
|
if (mode)
|
|
|
|
elem.setAttribute("mode", mode);
|
|
|
|
else
|
|
|
|
elem.removeAttribute("mode");
|
|
|
|
updateUserList();
|
|
|
|
}
|
|
|
|
|
2003-06-22 04:17:55 +04:00
|
|
|
function updateUserList()
|
|
|
|
{
|
2005-11-20 01:11:07 +03:00
|
|
|
var node, chan;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
node = document.getElementById("user-list");
|
2005-04-15 19:38:56 +04:00
|
|
|
if (!node.view)
|
|
|
|
return;
|
2003-06-22 04:17:55 +04:00
|
|
|
|
2005-11-20 01:11:07 +03:00
|
|
|
// We'll lose the selection in a bit, if we don't save it if necessary:
|
|
|
|
if (("currentObject" in client) && client.currentObject &&
|
|
|
|
client.currentObject.TYPE == "IRCChannel")
|
|
|
|
{
|
|
|
|
chan = client.currentObject;
|
|
|
|
chan.userlistSelection = getSelectedNicknames(node, chan);
|
|
|
|
}
|
|
|
|
reSortUserlist(node);
|
|
|
|
|
|
|
|
// If this is a channel, restore the selection in the userlist.
|
|
|
|
if (chan)
|
|
|
|
setSelectedNicknames(node, client.currentObject.userlistSelection);
|
|
|
|
}
|
|
|
|
|
|
|
|
function reSortUserlist(node)
|
|
|
|
{
|
2003-06-22 04:17:55 +04:00
|
|
|
const nsIXULSortService = Components.interfaces.nsIXULSortService;
|
|
|
|
const isupports_uri = "@mozilla.org/xul/xul-sort-service;1";
|
|
|
|
|
|
|
|
var xulSortService =
|
|
|
|
Components.classes[isupports_uri].getService(nsIXULSortService);
|
|
|
|
if (!xulSortService)
|
2003-08-19 01:35:33 +04:00
|
|
|
return;
|
|
|
|
|
|
|
|
var sortResource;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (client.prefs["sortUsersByMode"])
|
|
|
|
sortResource = RES_PFX + "sortname";
|
|
|
|
else
|
2006-01-20 20:17:16 +03:00
|
|
|
sortResource = RES_PFX + "unicodeName";
|
2003-06-22 04:17:55 +04:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ("sort" in xulSortService)
|
2003-08-19 01:35:33 +04:00
|
|
|
xulSortService.sort(node, sortResource, "ascending");
|
2003-06-22 04:17:55 +04:00
|
|
|
else
|
2003-08-19 01:35:33 +04:00
|
|
|
xulSortService.Sort(node, sortResource, "ascending");
|
2003-06-22 04:17:55 +04:00
|
|
|
}
|
|
|
|
catch(ex)
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
dd("Exception calling xulSortService.sort()");
|
2003-06-22 04:17:55 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
function getFrameForDOMWindow(window)
|
|
|
|
{
|
|
|
|
var frame;
|
2003-01-22 08:49:52 +03:00
|
|
|
for (var i = 0; i < client.deck.childNodes.length; i++)
|
2002-08-02 01:08:59 +04:00
|
|
|
{
|
|
|
|
frame = client.deck.childNodes[i];
|
2003-08-19 01:35:33 +04:00
|
|
|
if (getContentWindow(frame) == window)
|
2002-08-02 01:08:59 +04:00
|
|
|
return frame;
|
|
|
|
}
|
|
|
|
return undefined;
|
2004-09-15 22:39:16 +04:00
|
|
|
}
|
2002-08-02 01:08:59 +04:00
|
|
|
|
2004-01-04 01:21:35 +03:00
|
|
|
function replaceColorCodes(msg)
|
|
|
|
{
|
|
|
|
// mIRC codes: underline, bold, Original (reset), colors, reverse colors.
|
|
|
|
msg = msg.replace(/(^|[^%])%U/g, "$1\x1f");
|
|
|
|
msg = msg.replace(/(^|[^%])%B/g, "$1\x02");
|
|
|
|
msg = msg.replace(/(^|[^%])%O/g, "$1\x0f");
|
|
|
|
msg = msg.replace(/(^|[^%])%C/g, "$1\x03");
|
|
|
|
msg = msg.replace(/(^|[^%])%R/g, "$1\x16");
|
|
|
|
// %%[UBOCR] --> %[UBOCR].
|
|
|
|
msg = msg.replace(/%(%[UBOCR])/g, "$1");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-04 01:21:35 +03:00
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
function decodeColorCodes(msg)
|
|
|
|
{
|
|
|
|
// %[UBOCR] --> %%[UBOCR].
|
|
|
|
msg = msg.replace(/(%[UBOCR])/g, "%$1");
|
|
|
|
// Put %-codes back in place of special character codes.
|
|
|
|
msg = msg.replace(/\x1f/g, "%U");
|
|
|
|
msg = msg.replace(/\x02/g, "%B");
|
|
|
|
msg = msg.replace(/\x0f/g, "%O");
|
|
|
|
msg = msg.replace(/\x03/g, "%C");
|
|
|
|
msg = msg.replace(/\x16/g, "%R");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-04 01:21:35 +03:00
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
client.progressListener = new Object();
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
client.progressListener.QueryInterface =
|
2002-08-02 01:08:59 +04:00
|
|
|
function qi(iid)
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
client.progressListener.onStateChange =
|
2002-08-02 01:08:59 +04:00
|
|
|
function client_statechange (webProgress, request, stateFlags, status)
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
|
|
|
const START = nsIWebProgressListener.STATE_START;
|
2002-08-02 01:08:59 +04:00
|
|
|
const STOP = nsIWebProgressListener.STATE_STOP;
|
2004-09-15 22:39:16 +04:00
|
|
|
const IS_NETWORK = nsIWebProgressListener.STATE_IS_NETWORK;
|
|
|
|
const IS_DOCUMENT = nsIWebProgressListener.STATE_IS_DOCUMENT;
|
2002-08-02 01:08:59 +04:00
|
|
|
|
|
|
|
var frame;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
// We only care about the initial start of loading, not the loading of
|
|
|
|
// and page sub-components (IS_DOCUMENT, etc.).
|
|
|
|
if ((stateFlags & START) && (stateFlags & IS_NETWORK) &&
|
|
|
|
(stateFlags & IS_DOCUMENT))
|
2002-08-02 01:08:59 +04:00
|
|
|
{
|
|
|
|
frame = getFrameForDOMWindow(webProgress.DOMWindow);
|
|
|
|
if (!frame)
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
dd("can't find frame for window (start)");
|
|
|
|
try
|
|
|
|
{
|
|
|
|
webProgress.removeProgressListener(this);
|
|
|
|
}
|
|
|
|
catch(ex)
|
|
|
|
{
|
|
|
|
dd("Exception removing progress listener (start): " + ex);
|
|
|
|
}
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
// We only want to know when the *network* stops, not the page's
|
|
|
|
// individual components (STATE_IS_REQUEST/STATE_IS_DOCUMENT/somesuch).
|
|
|
|
else if ((stateFlags & STOP) && (stateFlags & IS_NETWORK))
|
2002-08-02 01:08:59 +04:00
|
|
|
{
|
|
|
|
frame = getFrameForDOMWindow(webProgress.DOMWindow);
|
|
|
|
if (!frame)
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
dd("can't find frame for window (stop)");
|
|
|
|
try
|
|
|
|
{
|
|
|
|
webProgress.removeProgressListener(this);
|
|
|
|
}
|
|
|
|
catch(ex)
|
|
|
|
{
|
|
|
|
dd("Exception removing progress listener (stop): " + ex);
|
|
|
|
}
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
else
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
var cwin = getContentWindow(frame);
|
|
|
|
if (cwin && "initOutputWindow" in cwin)
|
|
|
|
{
|
|
|
|
cwin.getMsg = getMsg;
|
|
|
|
cwin.initOutputWindow(client, frame.source, onMessageViewClick);
|
|
|
|
cwin.changeCSS(frame.source.getTimestampCSS("data"),
|
|
|
|
"cz-timestamp-format");
|
|
|
|
cwin.changeCSS(frame.source.getFontCSS("data"),
|
|
|
|
"cz-fonts");
|
|
|
|
scrollDown(frame, true);
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
webProgress.removeProgressListener(this);
|
|
|
|
}
|
|
|
|
catch(ex)
|
|
|
|
{
|
|
|
|
dd("Exception removing progress listener (done): " + ex);
|
|
|
|
}
|
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
client.progressListener.onProgressChange =
|
|
|
|
function client_progresschange (webProgress, request, currentSelf, totalSelf,
|
|
|
|
currentMax, selfMax)
|
|
|
|
{
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
client.progressListener.onLocationChange =
|
|
|
|
function client_locationchange (webProgress, request, uri)
|
|
|
|
{
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
client.progressListener.onStatusChange =
|
|
|
|
function client_statuschange (webProgress, request, status, message)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
client.progressListener.onSecurityChange =
|
|
|
|
function client_securitychange (webProgress, request, state)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
function syncOutputFrame(obj, nesting)
|
2002-08-02 01:08:59 +04:00
|
|
|
{
|
|
|
|
const nsIWebProgress = Components.interfaces.nsIWebProgress;
|
|
|
|
const WINDOW = nsIWebProgress.NOTIFY_STATE_WINDOW;
|
2004-09-15 22:39:16 +04:00
|
|
|
const NETWORK = nsIWebProgress.NOTIFY_STATE_NETWORK;
|
|
|
|
const ALL = nsIWebProgress.NOTIFY_ALL;
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
var iframe = obj.frame;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
function tryAgain(nLevel)
|
2002-08-02 01:08:59 +04:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
syncOutputFrame(obj, nLevel);
|
2002-08-02 01:08:59 +04:00
|
|
|
};
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
if (typeof nesting != "number")
|
|
|
|
nesting = 0;
|
|
|
|
|
|
|
|
if (nesting > 10)
|
|
|
|
{
|
|
|
|
dd("Aborting syncOutputFrame, taken too many tries.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
try
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
if (("contentDocument" in iframe) && ("webProgress" in iframe))
|
2002-08-02 01:08:59 +04:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
var url = obj.prefs["outputWindowURL"];
|
2004-09-15 22:39:16 +04:00
|
|
|
iframe.addProgressListener(client.progressListener, ALL);
|
2003-08-19 01:35:33 +04:00
|
|
|
iframe.loadURI(url);
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
setTimeout(tryAgain, 500, nesting + 1);
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
dd("caught exception showing session view, will try again later.");
|
|
|
|
dd(dumpObjectTree(ex) + "\n");
|
2004-09-15 22:39:16 +04:00
|
|
|
setTimeout(tryAgain, 500, nesting + 1);
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function createMessages(source)
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
playEventSounds(source.TYPE, "start");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
source.messages =
|
|
|
|
document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:table");
|
|
|
|
|
|
|
|
source.messages.setAttribute ("class", "msg-table");
|
|
|
|
source.messages.setAttribute ("view-type", source.TYPE);
|
|
|
|
var tbody =
|
|
|
|
document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:tbody");
|
|
|
|
source.messages.appendChild (tbody);
|
|
|
|
source.messageCount = 0;
|
|
|
|
}
|
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
/* gets the toolbutton associated with an object
|
|
|
|
* if |create| is present, and true, create if not found */
|
2001-08-24 01:41:24 +04:00
|
|
|
function getTabForObject (source, create)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
|
|
|
var name;
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!ASSERT(source, "UNDEFINED passed to getTabForObject"))
|
-- CHATZILLA CHANGES ONLY --
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.
2000-11-01 12:33:16 +03:00
|
|
|
return null;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
if ("viewName" in source)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
name = source.viewName;
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ASSERT(0, "INVALID OBJECT passed to getTabForObject");
|
|
|
|
return null;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
var tb, id = "tb[" + name + "]";
|
|
|
|
var matches = 1;
|
|
|
|
|
|
|
|
for (var i in client.viewsArray)
|
|
|
|
{
|
|
|
|
if (client.viewsArray[i].source == source)
|
2000-05-15 09:58:30 +04:00
|
|
|
{
|
2000-01-18 06:32:43 +03:00
|
|
|
tb = client.viewsArray[i].tb;
|
2000-05-15 09:58:30 +04:00
|
|
|
break;
|
|
|
|
}
|
2000-01-18 06:32:43 +03:00
|
|
|
else
|
2000-05-15 09:58:30 +04:00
|
|
|
if (client.viewsArray[i].tb.getAttribute("id") == id)
|
2000-01-18 06:32:43 +03:00
|
|
|
id = "tb[" + name + "<" + (++matches) + ">]";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!tb && create) /* not found, create one */
|
|
|
|
{
|
2002-08-02 01:08:59 +04:00
|
|
|
if (!("messages" in source) || source.messages == null)
|
|
|
|
createMessages(source);
|
2000-05-08 10:04:24 +04:00
|
|
|
var views = document.getElementById ("views-tbar-inner");
|
2001-03-14 05:35:29 +03:00
|
|
|
tb = document.createElement ("tab");
|
2004-09-15 22:39:16 +04:00
|
|
|
tb.setAttribute("ondraggesture",
|
|
|
|
"nsDragAndDrop.startDrag(event, tabDNDObserver);");
|
|
|
|
tb.setAttribute("href", source.getURL());
|
|
|
|
tb.setAttribute("name", source.unicodeName);
|
|
|
|
tb.setAttribute("onclick", "onTabClick(event, " + id.quote() + ");");
|
2004-12-10 23:04:36 +03:00
|
|
|
// This wouldn't be here if there was a supported CSS property for it.
|
2004-09-15 22:39:16 +04:00
|
|
|
tb.setAttribute("crop", "center");
|
|
|
|
tb.setAttribute("context", "context:tab");
|
2004-12-10 23:04:36 +03:00
|
|
|
tb.setAttribute("tooltip", "xul-tooltip-node");
|
2004-09-15 22:39:16 +04:00
|
|
|
tb.setAttribute("class", "tab-bottom view-button");
|
|
|
|
tb.setAttribute("id", id);
|
|
|
|
tb.setAttribute("state", "normal");
|
2000-05-09 05:00:42 +04:00
|
|
|
|
2002-01-04 00:42:34 +03:00
|
|
|
client.viewsArray.push ({source: source, tb: tb});
|
2000-01-18 06:32:43 +03:00
|
|
|
tb.setAttribute ("viewKey", client.viewsArray.length - 1);
|
2003-08-19 01:35:33 +04:00
|
|
|
tb.view = source;
|
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
if (matches > 1)
|
2001-08-24 01:41:24 +04:00
|
|
|
tb.setAttribute("label", name + "<" + matches + ">");
|
2000-01-18 06:32:43 +03:00
|
|
|
else
|
2001-08-24 01:41:24 +04:00
|
|
|
tb.setAttribute("label", name);
|
2000-05-09 05:00:42 +04:00
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
views.appendChild(tb);
|
2002-08-02 01:08:59 +04:00
|
|
|
|
|
|
|
var browser = document.createElement ("browser");
|
2003-08-19 01:35:33 +04:00
|
|
|
browser.setAttribute("class", "output-container");
|
2005-11-26 23:56:30 +03:00
|
|
|
// Only use type="chrome" if the host app supports it properly:
|
|
|
|
if (client.hostCompat.typeChromeBrowser)
|
|
|
|
browser.setAttribute("type", "chrome");
|
|
|
|
else
|
|
|
|
browser.setAttribute("type", "content");
|
2003-08-19 01:35:33 +04:00
|
|
|
browser.setAttribute("flex", "1");
|
|
|
|
browser.setAttribute("tooltip", "html-tooltip-node");
|
|
|
|
browser.setAttribute("context", "context:messages");
|
2002-08-02 01:08:59 +04:00
|
|
|
//browser.setAttribute ("onload", "scrollDown(true);");
|
2003-08-19 01:35:33 +04:00
|
|
|
browser.setAttribute("onclick",
|
|
|
|
"return onMessageViewClick(event)");
|
|
|
|
browser.setAttribute("ondragover",
|
|
|
|
"nsDragAndDrop.dragOver(event, " +
|
|
|
|
"contentDropObserver);");
|
|
|
|
browser.setAttribute("ondragdrop",
|
|
|
|
"nsDragAndDrop.drop(event, contentDropObserver);");
|
|
|
|
browser.setAttribute("ondraggesture",
|
|
|
|
"nsDragAndDrop.startDrag(event, " +
|
|
|
|
"contentAreaDNDObserver);");
|
2006-09-08 02:38:11 +04:00
|
|
|
if (typeof startScrolling == "function")
|
|
|
|
browser.setAttribute("onmousedown", "startScrolling(event);");
|
2002-08-02 01:08:59 +04:00
|
|
|
browser.source = source;
|
|
|
|
source.frame = browser;
|
2003-08-19 01:35:33 +04:00
|
|
|
ASSERT(client.deck, "no deck?");
|
2002-08-02 01:08:59 +04:00
|
|
|
client.deck.appendChild (browser);
|
2003-08-19 01:35:33 +04:00
|
|
|
syncOutputFrame (source);
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return tb;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
var contentDropObserver = new Object();
|
|
|
|
|
|
|
|
contentDropObserver.onDragOver =
|
|
|
|
function tabdnd_dover (aEvent, aFlavour, aDragSession)
|
|
|
|
{
|
|
|
|
if (aEvent.getPreventDefault())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (aDragSession.sourceDocument == aEvent.view.document)
|
|
|
|
{
|
|
|
|
aDragSession.canDrop = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contentDropObserver.onDrop =
|
|
|
|
function tabdnd_drop (aEvent, aXferData, aDragSession)
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
var url = transferUtils.retrieveURLFromData(aXferData.data,
|
|
|
|
aXferData.flavour.contentType);
|
2002-07-10 05:23:56 +04:00
|
|
|
if (!url || url.search(client.linkRE) == -1)
|
2001-08-24 01:41:24 +04:00
|
|
|
return;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (url.search(/\.css$/i) != -1 && confirm (getMsg(MSG_TABDND_DROP, url)))
|
|
|
|
dispatch("motif", {"motif": url});
|
2004-09-15 22:39:16 +04:00
|
|
|
else if (url.search(/^ircs?:\/\//i) != -1)
|
2003-08-19 01:35:33 +04:00
|
|
|
dispatch("goto-url", {"url": url});
|
2001-08-24 01:41:24 +04:00
|
|
|
}
|
-- CHATZILLA CHANGES ONLY --
checking in patch from Josh Gough, <exv@randomc.com>
muchas gracias!
irc.js
add whois, invite
utils.js
added map and mapObjFunc
chatzilla.xul
add cntxt menu for userlist
commands.js
hook up /away, op, deop, voice, devoice, echo, invite, and kick commands
hadlers.js
onload hack
whois, away, deop, op, voice, devoice, echo, invite, kick command implementations
static.js
more of the onload hack
addEventListener on toolbuttons
listbox.js
selection code
chatzilla.css
selicted list item style
2000-04-24 04:40:56 +04:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
contentDropObserver.getSupportedFlavours =
|
|
|
|
function tabdnd_gsf ()
|
|
|
|
{
|
|
|
|
var flavourSet = new FlavourSet();
|
|
|
|
flavourSet.appendFlavour("text/x-moz-url");
|
|
|
|
flavourSet.appendFlavour("application/x-moz-file", "nsIFile");
|
|
|
|
flavourSet.appendFlavour("text/unicode");
|
|
|
|
return flavourSet;
|
|
|
|
}
|
-- CHATZILLA CHANGES ONLY --
checking in patch from Josh Gough, <exv@randomc.com>
muchas gracias!
irc.js
add whois, invite
utils.js
added map and mapObjFunc
chatzilla.xul
add cntxt menu for userlist
commands.js
hook up /away, op, deop, voice, devoice, echo, invite, and kick commands
hadlers.js
onload hack
whois, away, deop, op, voice, devoice, echo, invite, kick command implementations
static.js
more of the onload hack
addEventListener on toolbuttons
listbox.js
selection code
chatzilla.css
selicted list item style
2000-04-24 04:40:56 +04:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
var tabDNDObserver = new Object();
|
|
|
|
|
|
|
|
tabDNDObserver.onDragStart =
|
|
|
|
function tabdnd_dstart (aEvent, aXferData, aDragAction)
|
|
|
|
{
|
|
|
|
var tb = aEvent.currentTarget;
|
|
|
|
var href = tb.getAttribute("href");
|
|
|
|
var name = tb.getAttribute("name");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
aXferData.data = new TransferData();
|
|
|
|
/* x-moz-url has the format "<url>\n<name>", goodie */
|
|
|
|
aXferData.data.addDataForFlavour("text/x-moz-url", href + "\n" + name);
|
|
|
|
aXferData.data.addDataForFlavour("text/unicode", href);
|
|
|
|
aXferData.data.addDataForFlavour("text/html", "<a href='" + href + "'>" +
|
|
|
|
name + "</a>");
|
-- CHATZILLA CHANGES ONLY --
checking in patch from Josh Gough, <exv@randomc.com>
muchas gracias!
irc.js
add whois, invite
utils.js
added map and mapObjFunc
chatzilla.xul
add cntxt menu for userlist
commands.js
hook up /away, op, deop, voice, devoice, echo, invite, and kick commands
hadlers.js
onload hack
whois, away, deop, op, voice, devoice, echo, invite, kick command implementations
static.js
more of the onload hack
addEventListener on toolbuttons
listbox.js
selection code
chatzilla.css
selicted list item style
2000-04-24 04:40:56 +04:00
|
|
|
}
|
|
|
|
|
2005-12-29 00:48:33 +03:00
|
|
|
var userlistDNDObserver = new Object();
|
|
|
|
|
|
|
|
userlistDNDObserver.onDragStart =
|
2006-01-22 19:10:36 +03:00
|
|
|
function userlistdnd_dstart(event, transferData, dragAction)
|
2005-12-29 00:48:33 +03:00
|
|
|
{
|
2006-01-22 19:10:36 +03:00
|
|
|
var col = new Object(), row = new Object(), cell = new Object();
|
2005-12-29 00:48:33 +03:00
|
|
|
var tree = document.getElementById('user-list');
|
2006-01-22 19:10:36 +03:00
|
|
|
tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, cell);
|
|
|
|
// Check whether we're actually on a normal row and cell
|
2006-04-21 05:42:06 +04:00
|
|
|
if (!cell.value || (row.value == -1))
|
2006-01-22 19:10:36 +03:00
|
|
|
return;
|
|
|
|
var user = tree.contentView.getItemAtIndex(row.value).firstChild.firstChild;
|
2005-12-29 00:48:33 +03:00
|
|
|
var nickname = user.getAttribute("unicodeName");
|
|
|
|
|
2006-01-22 19:10:36 +03:00
|
|
|
transferData.data = new TransferData();
|
|
|
|
transferData.data.addDataForFlavour("text/unicode", nickname);
|
2005-12-29 00:48:33 +03:00
|
|
|
}
|
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
function deleteTab (tb)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
if (!ASSERT(tb.hasAttribute("viewKey"),
|
2003-08-19 01:35:33 +04:00
|
|
|
"INVALID OBJECT passed to deleteTab (" + tb + ")"))
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
var i;
|
|
|
|
var key = Number(tb.getAttribute("viewKey"));
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
/* re-index higher toolbuttons */
|
|
|
|
for (i = key + 1; i < client.viewsArray.length; i++)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
client.viewsArray[i].tb.setAttribute ("viewKey", i - 1);
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
arrayRemoveAt(client.viewsArray, key);
|
|
|
|
var tbinner = document.getElementById("views-tbar-inner");
|
|
|
|
tbinner.removeChild(tb);
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2000-05-15 09:58:30 +04:00
|
|
|
return key;
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2005-10-25 02:27:16 +04:00
|
|
|
function filterOutput(msg, msgtype, dest)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
if ("outputFilters" in client)
|
|
|
|
{
|
|
|
|
for (var f in client.outputFilters)
|
|
|
|
{
|
|
|
|
if (client.outputFilters[f].enabled)
|
2005-10-25 02:27:16 +04:00
|
|
|
msg = client.outputFilters[f].func(msg, msgtype, dest);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
}
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2001-12-12 07:40:02 +03:00
|
|
|
return msg;
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
client.addNetwork =
|
2005-04-22 00:16:03 +04:00
|
|
|
function cli_addnet(name, serverList, temporary)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
|
|
|
client.networks[name] =
|
2006-04-21 05:42:06 +04:00
|
|
|
new CIRCNetwork(name, serverList, client.eventPump, temporary);
|
|
|
|
}
|
|
|
|
|
|
|
|
client.removeNetwork =
|
|
|
|
function cli_removenet(name)
|
|
|
|
{
|
|
|
|
// Allow network a chance to clean up any mess.
|
|
|
|
if (typeof client.networks[name].destroy == "function")
|
|
|
|
client.networks[name].destroy();
|
|
|
|
|
|
|
|
delete client.networks[name];
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
client.connectToNetwork =
|
2004-09-15 22:39:16 +04:00
|
|
|
function cli_connect(networkOrName, requireSecurity)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2003-09-24 04:49:09 +04:00
|
|
|
var network;
|
|
|
|
var name;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
|
2006-09-08 03:05:20 +04:00
|
|
|
if (isinstance(networkOrName, CIRCNetwork))
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2003-09-24 04:49:09 +04:00
|
|
|
network = networkOrName;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
name = networkOrName;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
if (!(name in client.networks))
|
|
|
|
{
|
|
|
|
display(getMsg(MSG_ERR_UNKNOWN_NETWORK, name), MT_ERROR);
|
|
|
|
return null;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
network = client.networks[name];
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
name = network.unicodeName;
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!("messages" in network))
|
|
|
|
network.displayHere(getMsg(MSG_NETWORK_OPENED, name));
|
2003-06-22 04:17:55 +04:00
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
dispatch("set-current-view", { view: network });
|
2001-12-04 03:20:48 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (network.isConnected())
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
network.display(getMsg(MSG_ALREADY_CONNECTED, name));
|
2003-09-24 04:49:09 +04:00
|
|
|
return network;
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
|
2004-09-29 01:27:13 +04:00
|
|
|
if (network.state != NET_OFFLINE)
|
2003-09-24 04:49:09 +04:00
|
|
|
return network;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (network.prefs["nickname"] == DEFAULT_NICK)
|
|
|
|
network.prefs["nickname"] = prompt(MSG_ENTER_NICK, DEFAULT_NICK);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!("connecting" in network))
|
|
|
|
network.display(getMsg(MSG_NETWORK_CONNECTING, name));
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
network.connect(requireSecurity);
|
2003-08-19 01:35:33 +04:00
|
|
|
|
|
|
|
network.updateHeader();
|
|
|
|
client.updateHeader();
|
|
|
|
updateTitle();
|
|
|
|
|
2003-09-24 04:49:09 +04:00
|
|
|
return network;
|
-- CHATZILLA CHANGES ONLY --
checking in patch from Josh Gough, <exv@randomc.com>
muchas gracias!
irc.js
add whois, invite
utils.js
added map and mapObjFunc
chatzilla.xul
add cntxt menu for userlist
commands.js
hook up /away, op, deop, voice, devoice, echo, invite, and kick commands
hadlers.js
onload hack
whois, away, deop, op, voice, devoice, echo, invite, kick command implementations
static.js
more of the onload hack
addEventListener on toolbuttons
listbox.js
selection code
chatzilla.css
selicted list item style
2000-04-24 04:40:56 +04:00
|
|
|
}
|
2001-03-14 05:35:29 +03:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
client.getURL =
|
|
|
|
function cli_geturl ()
|
|
|
|
{
|
|
|
|
return "irc://";
|
|
|
|
}
|
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
client.load =
|
2003-08-19 01:35:33 +04:00
|
|
|
function cli_load(url, scope)
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!("_loader" in client))
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
|
|
|
const LOADER_CTRID = "@mozilla.org/moz/jssubscript-loader;1";
|
2004-09-15 22:39:16 +04:00
|
|
|
const mozIJSSubScriptLoader =
|
2001-03-14 05:35:29 +03:00
|
|
|
Components.interfaces.mozIJSSubScriptLoader;
|
|
|
|
|
|
|
|
var cls;
|
|
|
|
if ((cls = Components.classes[LOADER_CTRID]))
|
2004-08-20 03:00:27 +04:00
|
|
|
client._loader = cls.getService(mozIJSSubScriptLoader);
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return client._loader.loadSubScript(url, scope);
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
client.sayToCurrentTarget =
|
|
|
|
function cli_say(msg)
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if ("say" in client.currentObject)
|
|
|
|
{
|
2005-10-25 02:27:16 +04:00
|
|
|
msg = filterOutput(msg, "PRIVMSG", client.currentObject);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
display(msg, "PRIVMSG", "ME!", client.currentObject);
|
|
|
|
client.currentObject.say(msg);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
return;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-01-18 06:32:43 +03:00
|
|
|
switch (client.currentObject.TYPE)
|
|
|
|
{
|
|
|
|
case "IRCClient":
|
2003-08-19 01:35:33 +04:00
|
|
|
dispatch("eval", {expression: msg});
|
2000-01-18 06:32:43 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2001-06-07 04:52:57 +04:00
|
|
|
if (msg != "")
|
2005-12-29 00:36:30 +03:00
|
|
|
display(MSG_ERR_NO_DEFAULT, MT_ERROR);
|
2000-01-18 06:32:43 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
CIRCNetwork.prototype.__defineGetter__("prefs", net_getprefs);
|
|
|
|
function net_getprefs()
|
|
|
|
{
|
|
|
|
if (!("_prefs" in this))
|
|
|
|
{
|
|
|
|
this._prefManager = getNetworkPrefManager(this);
|
|
|
|
this._prefs = this._prefManager.prefs;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return this._prefs;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCNetwork.prototype.__defineGetter__("prefManager", net_getprefmgr);
|
|
|
|
function net_getprefmgr()
|
|
|
|
{
|
|
|
|
if (!("_prefManager" in this))
|
|
|
|
{
|
|
|
|
this._prefManager = getNetworkPrefManager(this);
|
|
|
|
this._prefs = this._prefManager.prefs;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return this._prefManager;
|
|
|
|
}
|
|
|
|
|
2003-10-11 04:21:05 +04:00
|
|
|
CIRCServer.prototype.__defineGetter__("prefs", srv_getprefs);
|
|
|
|
function srv_getprefs()
|
|
|
|
{
|
|
|
|
return this.parent.prefs;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCServer.prototype.__defineGetter__("prefManager", srv_getprefmgr);
|
|
|
|
function srv_getprefmgr()
|
|
|
|
{
|
|
|
|
return this.parent.prefManager;
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
CIRCChannel.prototype.__defineGetter__("prefs", chan_getprefs);
|
|
|
|
function chan_getprefs()
|
|
|
|
{
|
|
|
|
if (!("_prefs" in this))
|
|
|
|
{
|
|
|
|
this._prefManager = getChannelPrefManager(this);
|
|
|
|
this._prefs = this._prefManager.prefs;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return this._prefs;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCChannel.prototype.__defineGetter__("prefManager", chan_getprefmgr);
|
|
|
|
function chan_getprefmgr()
|
|
|
|
{
|
|
|
|
if (!("_prefManager" in this))
|
|
|
|
{
|
|
|
|
this._prefManager = getChannelPrefManager(this);
|
|
|
|
this._prefs = this._prefManager.prefs;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return this._prefManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCUser.prototype.__defineGetter__("prefs", usr_getprefs);
|
|
|
|
function usr_getprefs()
|
|
|
|
{
|
|
|
|
if (!("_prefs" in this))
|
|
|
|
{
|
|
|
|
this._prefManager = getUserPrefManager(this);
|
|
|
|
this._prefs = this._prefManager.prefs;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return this._prefs;
|
|
|
|
}
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
CIRCUser.prototype.__defineGetter__("prefManager", usr_getprefmgr);
|
|
|
|
function usr_getprefmgr()
|
|
|
|
{
|
|
|
|
if (!("_prefManager" in this))
|
|
|
|
{
|
|
|
|
this._prefManager = getUserPrefManager(this);
|
|
|
|
this._prefs = this._prefManager.prefs;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
return this._prefManager;
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2005-11-04 01:35:00 +03:00
|
|
|
CIRCDCCUser.prototype.__defineGetter__("prefs", dccusr_getprefs);
|
|
|
|
function dccusr_getprefs()
|
|
|
|
{
|
|
|
|
if (!("_prefs" in this))
|
|
|
|
{
|
|
|
|
this._prefManager = getDCCUserPrefManager(this);
|
|
|
|
this._prefs = this._prefManager.prefs;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this._prefs;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCDCCUser.prototype.__defineGetter__("prefManager", dccusr_getprefmgr);
|
|
|
|
function dccusr_getprefmgr()
|
|
|
|
{
|
|
|
|
if (!("_prefManager" in this))
|
|
|
|
{
|
|
|
|
this._prefManager = getDCCUserPrefManager(this);
|
|
|
|
this._prefs = this._prefManager.prefs;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this._prefManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCDCCChat.prototype.__defineGetter__("prefs", dccchat_getprefs);
|
|
|
|
function dccchat_getprefs()
|
|
|
|
{
|
|
|
|
return this.user.prefs;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCDCCChat.prototype.__defineGetter__("prefManager", dccchat_getprefmgr);
|
|
|
|
function dccchat_getprefmgr()
|
|
|
|
{
|
|
|
|
return this.user.prefManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCDCCFileTransfer.prototype.__defineGetter__("prefs", dccfile_getprefs);
|
|
|
|
function dccfile_getprefs()
|
|
|
|
{
|
|
|
|
return this.user.prefs;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCDCCFileTransfer.prototype.__defineGetter__("prefManager", dccfile_getprefmgr);
|
|
|
|
function dccfile_getprefmgr()
|
|
|
|
{
|
|
|
|
return this.user.prefManager;
|
|
|
|
}
|
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
CIRCNetwork.prototype.display =
|
2003-08-19 01:35:33 +04:00
|
|
|
function net_display (message, msgtype, sourceObj, destObj)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
2001-03-14 05:35:29 +03:00
|
|
|
var o = getObjectDetails(client.currentObject);
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2004-01-23 09:37:07 +03:00
|
|
|
if (client.SLOPPY_NETWORKS && client.currentObject != this &&
|
|
|
|
o.network == this && o.server && o.server.isConnected)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2001-03-14 05:35:29 +03:00
|
|
|
client.currentObject.display (message, msgtype, sourceObj, destObj);
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2001-03-14 05:35:29 +03:00
|
|
|
else
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2001-03-14 05:35:29 +03:00
|
|
|
this.displayHere (message, msgtype, sourceObj, destObj);
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
CIRCUser.prototype.display =
|
2003-08-19 01:35:33 +04:00
|
|
|
function usr_display(message, msgtype, sourceObj, destObj)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
if ("messages" in this)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2001-03-14 05:35:29 +03:00
|
|
|
this.displayHere (message, msgtype, sourceObj, destObj);
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2001-03-14 05:35:29 +03:00
|
|
|
else
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
2001-03-14 05:35:29 +03:00
|
|
|
var o = getObjectDetails(client.currentObject);
|
2004-01-23 09:37:07 +03:00
|
|
|
if (o.server && o.server.isConnected &&
|
2001-03-14 05:35:29 +03:00
|
|
|
o.network == this.parent.parent &&
|
|
|
|
client.currentObject.TYPE != "IRCUser")
|
|
|
|
client.currentObject.display (message, msgtype, sourceObj, destObj);
|
|
|
|
else
|
|
|
|
this.parent.parent.displayHere (message, msgtype, sourceObj,
|
|
|
|
destObj);
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
CIRCDCCChat.prototype.display =
|
|
|
|
CIRCDCCFileTransfer.prototype.display =
|
|
|
|
function dcc_display(message, msgtype, sourceObj, destObj)
|
|
|
|
{
|
|
|
|
var o = getObjectDetails(client.currentObject);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if ("messages" in this)
|
|
|
|
this.displayHere(message, msgtype, sourceObj, destObj);
|
|
|
|
else
|
|
|
|
client.currentObject.display(message, msgtype, sourceObj, destObj);
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function feedback(e, message, msgtype, sourceObj, destObj)
|
|
|
|
{
|
|
|
|
if ("isInteractive" in e && e.isInteractive)
|
|
|
|
display(message, msgtype, sourceObj, destObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCChannel.prototype.feedback =
|
|
|
|
CIRCNetwork.prototype.feedback =
|
|
|
|
CIRCUser.prototype.feedback =
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
CIRCDCCChat.prototype.feedback =
|
2004-09-15 22:39:16 +04:00
|
|
|
CIRCDCCFileTransfer.prototype.feedback =
|
2003-08-19 01:35:33 +04:00
|
|
|
client.feedback =
|
|
|
|
function this_feedback(e, message, msgtype, sourceObj, destObj)
|
|
|
|
{
|
|
|
|
if ("isInteractive" in e && e.isInteractive)
|
|
|
|
this.displayHere(message, msgtype, sourceObj, destObj);
|
|
|
|
}
|
|
|
|
|
2001-08-24 01:41:24 +04:00
|
|
|
function display (message, msgtype, sourceObj, destObj)
|
|
|
|
{
|
|
|
|
client.currentObject.display (message, msgtype, sourceObj, destObj);
|
|
|
|
}
|
|
|
|
|
2004-01-04 01:21:35 +03:00
|
|
|
client.getTimestampCSS =
|
|
|
|
CIRCNetwork.prototype.getTimestampCSS =
|
|
|
|
CIRCChannel.prototype.getTimestampCSS =
|
|
|
|
CIRCUser.prototype.getTimestampCSS =
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
CIRCDCCChat.prototype.getTimestampCSS =
|
2004-09-15 22:39:16 +04:00
|
|
|
CIRCDCCFileTransfer.prototype.getTimestampCSS =
|
2004-01-04 01:21:35 +03:00
|
|
|
function this_getTimestampCSS(format)
|
|
|
|
{
|
|
|
|
/* Wow, this is cool. We just put together a CSS-rule string based on the
|
|
|
|
* "timestampFormat" preferences. *This* is what CSS is all about. :)
|
|
|
|
* We also provide a "data: URL" format, to simplify other code.
|
|
|
|
*/
|
|
|
|
var css;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-04 01:21:35 +03:00
|
|
|
if (this.prefs["timestamps"])
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
/* Hack. To get around a Mozilla bug, we must force the display back
|
2004-01-04 01:21:35 +03:00
|
|
|
* to a displayed value.
|
|
|
|
*/
|
|
|
|
css = ".msg-timestamp { display: table-cell; } " +
|
2004-09-15 22:39:16 +04:00
|
|
|
".msg-timestamp:before { content: '" +
|
2004-01-04 01:21:35 +03:00
|
|
|
this.prefs["timestampFormat"] + "'; }";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-04 01:21:35 +03:00
|
|
|
var letters = new Array('y', 'm', 'd', 'h', 'n', 's');
|
|
|
|
for (var i = 0; i < letters.length; i++)
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
css = css.replace("%" + letters[i], "' attr(time-" +
|
2004-01-04 01:21:35 +03:00
|
|
|
letters[i] + ") '");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Completely remove the <td>s if they're off, neatens display. */
|
|
|
|
css = ".msg-timestamp { display: none; }";
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-04 01:21:35 +03:00
|
|
|
if (format == "data")
|
|
|
|
return "data:text/css," + encodeURIComponent(css);
|
|
|
|
return css;
|
|
|
|
}
|
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
client.getFontCSS =
|
|
|
|
CIRCNetwork.prototype.getFontCSS =
|
|
|
|
CIRCChannel.prototype.getFontCSS =
|
|
|
|
CIRCUser.prototype.getFontCSS =
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
CIRCDCCChat.prototype.getFontCSS =
|
2004-09-15 22:39:16 +04:00
|
|
|
CIRCDCCFileTransfer.prototype.getFontCSS =
|
2004-01-29 14:27:35 +03:00
|
|
|
function this_getFontCSS(format)
|
|
|
|
{
|
|
|
|
/* See this_getTimestampCSS. */
|
|
|
|
var css;
|
|
|
|
var fs;
|
|
|
|
var fn;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
if (this.prefs["font.family"] != "default")
|
|
|
|
fn = "font-family: " + this.prefs["font.family"] + ";";
|
|
|
|
else
|
|
|
|
fn = "font-family: inherit;";
|
|
|
|
if (this.prefs["font.size"] != 0)
|
|
|
|
fs = "font-size: " + this.prefs["font.size"] + "pt;";
|
|
|
|
else
|
|
|
|
fs = "font-size: medium;";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
css = "body.chatzilla-body { " + fs + fn + " }";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-29 14:27:35 +03:00
|
|
|
if (format == "data")
|
|
|
|
return "data:text/css," + encodeURIComponent(css);
|
|
|
|
return css;
|
|
|
|
}
|
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
client.display =
|
2001-12-04 03:20:48 +03:00
|
|
|
client.displayHere =
|
2001-03-14 05:35:29 +03:00
|
|
|
CIRCNetwork.prototype.displayHere =
|
|
|
|
CIRCChannel.prototype.display =
|
2001-12-04 03:20:48 +03:00
|
|
|
CIRCChannel.prototype.displayHere =
|
2001-03-14 05:35:29 +03:00
|
|
|
CIRCUser.prototype.displayHere =
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
CIRCDCCChat.prototype.displayHere =
|
|
|
|
CIRCDCCFileTransfer.prototype.displayHere =
|
2001-08-24 01:41:24 +04:00
|
|
|
function __display(message, msgtype, sourceObj, destObj)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// We like some control on the number of digits.
|
2004-01-04 01:21:35 +03:00
|
|
|
function formatTimeNumber (num, digits)
|
|
|
|
{
|
|
|
|
var rv = num.toString();
|
|
|
|
while (rv.length < digits)
|
|
|
|
rv = "0" + rv;
|
|
|
|
return rv;
|
|
|
|
};
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// We need a message type, assume "INFO".
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!msgtype)
|
|
|
|
msgtype = MT_INFO;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
var blockLevel = false; /* true if this row should be rendered at block
|
|
|
|
* level, (like, if it has a really long nickname
|
|
|
|
* that might disturb the rest of the layout) */
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var o = getObjectDetails(this); /* get the skinny on |this| */
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Get the 'me' object, so we can be sure to get the attributes right.
|
2001-12-04 03:20:48 +03:00
|
|
|
var me;
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if ("me" in this)
|
|
|
|
me = this.me;
|
|
|
|
else if (o.server && "me" in o.server)
|
|
|
|
me = o.server.me;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Let callers get away with "ME!" and we have to substitute here.
|
2003-08-19 01:35:33 +04:00
|
|
|
if (sourceObj == "ME!")
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
sourceObj = me;
|
2003-08-19 01:35:33 +04:00
|
|
|
if (destObj == "ME!")
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
destObj = me;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Get the TYPE of the source object.
|
2001-03-14 05:35:29 +03:00
|
|
|
var fromType = (sourceObj && sourceObj.TYPE) ? sourceObj.TYPE : "unk";
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Is the source a user?
|
2004-09-15 22:39:16 +04:00
|
|
|
var fromUser = (fromType.search(/IRC.*User/) != -1);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Get some sort of "name" for the source.
|
2004-09-15 22:39:16 +04:00
|
|
|
var fromAttr = "";
|
|
|
|
if (sourceObj)
|
|
|
|
{
|
|
|
|
if ("unicodeName" in sourceObj)
|
|
|
|
fromAttr = sourceObj.unicodeName;
|
|
|
|
else if ("name" in sourceObj)
|
|
|
|
fromAttr = sourceObj.name;
|
|
|
|
else
|
|
|
|
fromAttr = sourceObj.viewName;
|
|
|
|
}
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Attach "ME!" if appropriate, so motifs can style differently.
|
|
|
|
if (sourceObj == me)
|
|
|
|
fromAttr = fromAttr + " ME!";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Get the dest TYPE too...
|
|
|
|
var toType = (destObj) ? destObj.TYPE : "unk";
|
|
|
|
// Is the dest a user?
|
2004-09-15 22:39:16 +04:00
|
|
|
var toUser = (toType.search(/IRC.*User/) != -1);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Get a dest name too...
|
2004-09-15 22:39:16 +04:00
|
|
|
var toAttr = "";
|
|
|
|
if (destObj)
|
|
|
|
{
|
|
|
|
if ("unicodeName" in destObj)
|
|
|
|
toAttr = destObj.unicodeName;
|
|
|
|
else if ("name" in destObj)
|
|
|
|
toAttr = destObj.name;
|
|
|
|
else
|
|
|
|
toAttr = destObj.viewName;
|
|
|
|
}
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Also do "ME!" work for the dest.
|
2001-12-04 03:20:48 +03:00
|
|
|
if (destObj && destObj == me)
|
2004-09-15 22:39:16 +04:00
|
|
|
toAttr = me.unicodeName + " ME!";
|
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
/* isImportant means to style the messages as important, and flash the
|
|
|
|
* window, getAttention means just flash the window. */
|
2002-02-03 07:35:26 +03:00
|
|
|
var isImportant = false, getAttention = false, isSuperfluous = false;
|
2001-03-14 05:35:29 +03:00
|
|
|
var viewType = this.TYPE;
|
|
|
|
var code;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
var d = new Date();
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var dateInfo = { y: formatTimeNumber(d.getFullYear(), 4),
|
|
|
|
m: formatTimeNumber(d.getMonth() + 1, 2),
|
|
|
|
d: formatTimeNumber(d.getDate(), 2),
|
|
|
|
h: formatTimeNumber(d.getHours(), 2),
|
|
|
|
n: formatTimeNumber(d.getMinutes(), 2),
|
|
|
|
s: formatTimeNumber(d.getSeconds(), 2)
|
|
|
|
};
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Statusbar text, and the line that gets saved to the log.
|
2001-12-04 03:20:48 +03:00
|
|
|
var statusString;
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var logString;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-03-10 07:37:06 +03:00
|
|
|
var dtf = client.dtFormatter;
|
2004-09-15 22:39:16 +04:00
|
|
|
var timeStamp = dtf.FormatDateTime("", dtf.dateFormatShort,
|
|
|
|
dtf.timeFormatNoSeconds, d.getFullYear(),
|
|
|
|
d.getMonth() + 1, d.getDate(),
|
|
|
|
d.getHours(), d.getMinutes(),
|
2004-03-10 07:37:06 +03:00
|
|
|
d.getSeconds()
|
|
|
|
);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
logString = "[" + timeStamp + "] ";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
if (fromUser)
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
statusString = getMsg(MSG_FMT_STATUS,
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
[timeStamp,
|
2004-09-15 22:39:16 +04:00
|
|
|
sourceObj.unicodeName + "!" +
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
sourceObj.name + "@" + sourceObj.host]);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-08-02 01:08:59 +04:00
|
|
|
var name;
|
|
|
|
if (sourceObj)
|
2004-09-15 22:39:16 +04:00
|
|
|
name = sourceObj.viewName;
|
2002-08-02 01:08:59 +04:00
|
|
|
else
|
2004-09-15 22:39:16 +04:00
|
|
|
name = this.viewName;
|
|
|
|
|
|
|
|
statusString = getMsg(MSG_FMT_STATUS,
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
[timeStamp, name]);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// The table row, and it's attributes.
|
|
|
|
var msgRow = document.createElementNS("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:tr");
|
|
|
|
msgRow.setAttribute("class", "msg");
|
|
|
|
msgRow.setAttribute("msg-type", msgtype);
|
|
|
|
msgRow.setAttribute("msg-dest", toAttr);
|
|
|
|
msgRow.setAttribute("dest-type", toType);
|
2004-09-15 22:39:16 +04:00
|
|
|
msgRow.setAttribute("view-type", viewType);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRow.setAttribute("statusText", statusString);
|
|
|
|
if (fromAttr)
|
|
|
|
{
|
|
|
|
if (fromUser)
|
2004-09-15 22:39:16 +04:00
|
|
|
msgRow.setAttribute("msg-user", fromAttr);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
else
|
|
|
|
msgRow.setAttribute("msg-source", fromAttr);
|
|
|
|
}
|
2004-01-04 01:21:35 +03:00
|
|
|
if (isImportant)
|
|
|
|
msgTimestamp.setAttribute ("important", "true");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Timestamp cell.
|
|
|
|
var msgRowTimestamp = document.createElementNS("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:td");
|
|
|
|
msgRowTimestamp.setAttribute("class", "msg-timestamp");
|
|
|
|
for (var key in dateInfo)
|
|
|
|
msgRowTimestamp.setAttribute("time-" + key, dateInfo[key]);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var canMergeData;
|
|
|
|
var msgRowSource, msgRowType, msgRowData;
|
|
|
|
if (fromUser && msgtype.match(/^(PRIVMSG|ACTION|NOTICE)$/))
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
var nick = sourceObj.unicodeName;
|
2006-02-03 22:23:24 +03:00
|
|
|
var decorSt = "";
|
|
|
|
var decorEn = "";
|
|
|
|
|
|
|
|
// Set default decorations.
|
|
|
|
if (msgtype == "ACTION")
|
|
|
|
{
|
|
|
|
decorSt = "* ";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
decorSt = "<";
|
|
|
|
decorEn = ">";
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
var nickURL;
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if ((sourceObj != me) && ("getURL" in sourceObj))
|
|
|
|
nickURL = sourceObj.getURL();
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
if (sourceObj != me)
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Not from us...
|
|
|
|
if (destObj == me)
|
2000-01-18 06:32:43 +03:00
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// ...but to us. Messages from someone else to us.
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
getAttention = true;
|
2001-12-04 03:20:48 +03:00
|
|
|
this.defaultCompletion = "/msg " + nick + " ";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2006-02-03 22:23:24 +03:00
|
|
|
// If this is a private message, and it's not in a query view,
|
|
|
|
// use *nick* instead of <nick>.
|
|
|
|
if ((msgtype != "ACTION") && (this.TYPE != "IRCUser"))
|
2003-06-22 04:17:55 +04:00
|
|
|
{
|
2006-02-03 22:23:24 +03:00
|
|
|
decorSt = "*";
|
|
|
|
decorEn = "*";
|
2003-06-22 04:17:55 +04:00
|
|
|
}
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
else
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// ...or to us. Messages from someone else to channel or similar.
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2004-01-23 09:37:07 +03:00
|
|
|
if ((typeof message == "string") && me)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
isImportant = msgIsImportant(message, nick, o.network);
|
2001-12-04 03:20:48 +03:00
|
|
|
if (isImportant)
|
2003-01-22 08:49:52 +03:00
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
this.defaultCompletion = nick +
|
2003-08-19 01:35:33 +04:00
|
|
|
client.prefs["nickCompleteStr"] + " ";
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
}
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
else
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
2006-02-03 22:23:24 +03:00
|
|
|
// Messages from us, on a channel or network view, to a user
|
|
|
|
if (toUser && (this.TYPE != "IRCUser"))
|
2003-06-22 04:17:55 +04:00
|
|
|
{
|
2006-02-03 22:23:24 +03:00
|
|
|
nick = destObj.unicodeName;
|
|
|
|
decorSt = ">";
|
|
|
|
decorEn = "<";
|
2003-06-22 04:17:55 +04:00
|
|
|
}
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2006-02-03 22:23:24 +03:00
|
|
|
// Log the nickname in the same format as we'll let the user copy.
|
|
|
|
logString += decorSt + nick + decorEn + " ";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Mark makes alternate "talkers" show up in different shades.
|
|
|
|
//if (!("mark" in this))
|
|
|
|
// this.mark = "odd";
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if (!("lastNickDisplayed" in this) || this.lastNickDisplayed != nick)
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
|
|
|
this.lastNickDisplayed = nick;
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
this.mark = (("mark" in this) && this.mark == "even") ? "odd" : "even";
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRowSource = document.createElementNS("http://www.w3.org/1999/xhtml",
|
2004-01-04 01:21:35 +03:00
|
|
|
"html:td");
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRowSource.setAttribute("class", "msg-user");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Make excessive nicks get shunted.
|
|
|
|
if (nick && (nick.length > client.MAX_NICK_DISPLAY))
|
2001-03-14 05:35:29 +03:00
|
|
|
blockLevel = true;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2006-02-03 22:23:24 +03:00
|
|
|
if (decorSt)
|
|
|
|
msgRowSource.appendChild(newInlineText(decorSt, "chatzilla-decor"));
|
2001-12-04 03:20:48 +03:00
|
|
|
if (nickURL)
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
var nick_anchor =
|
2001-12-04 03:20:48 +03:00
|
|
|
document.createElementNS("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:a");
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
nick_anchor.setAttribute("class", "chatzilla-link");
|
|
|
|
nick_anchor.setAttribute("href", nickURL);
|
|
|
|
nick_anchor.appendChild(newInlineText(nick));
|
|
|
|
msgRowSource.appendChild(nick_anchor);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRowSource.appendChild(newInlineText(nick));
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2006-02-03 22:23:24 +03:00
|
|
|
if (decorEn)
|
|
|
|
msgRowSource.appendChild(newInlineText(decorEn, "chatzilla-decor"));
|
2003-08-19 01:35:33 +04:00
|
|
|
canMergeData = this.prefs["collapseMsgs"];
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
else
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
2002-02-03 07:35:26 +03:00
|
|
|
isSuperfluous = true;
|
2003-01-22 08:49:52 +03:00
|
|
|
if (!client.debugHook.enabled && msgtype in client.responseCodeMap)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
|
|
|
code = client.responseCodeMap[msgtype];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-01-22 08:49:52 +03:00
|
|
|
if (!client.debugHook.enabled && client.HIDE_CODES)
|
2001-12-04 03:20:48 +03:00
|
|
|
code = client.DEFAULT_RESPONSE_CODE;
|
|
|
|
else
|
|
|
|
code = "[" + msgtype + "]";
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
/* Display the message code */
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRowType = document.createElementNS("http://www.w3.org/1999/xhtml",
|
2004-01-04 01:21:35 +03:00
|
|
|
"html:td");
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRowType.setAttribute("class", "msg-type");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRowType.appendChild(newInlineText(code));
|
|
|
|
logString += code + " ";
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
if (message)
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRowData = document.createElementNS("http://www.w3.org/1999/xhtml",
|
2004-01-04 01:21:35 +03:00
|
|
|
"html:td");
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRowData.setAttribute("class", "msg-data");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
if (typeof message == "string")
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRowData.appendChild(stringToMsg(message, this));
|
|
|
|
logString += message;
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
2001-03-14 05:35:29 +03:00
|
|
|
else
|
2003-06-22 04:17:55 +04:00
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRowData.appendChild(message);
|
|
|
|
logString += message.innerHTML.replace(/<[^<]*>/g, "");
|
2003-06-22 04:17:55 +04:00
|
|
|
}
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if ("mark" in this)
|
|
|
|
msgRow.setAttribute("mark", this.mark);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
if (isImportant)
|
|
|
|
msgRow.setAttribute ("important", "true");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Timestamps first...
|
|
|
|
msgRow.appendChild(msgRowTimestamp);
|
|
|
|
// Now do the rest of the row, after block-level stuff.
|
|
|
|
if (msgRowSource)
|
|
|
|
msgRow.appendChild(msgRowSource);
|
2004-01-04 01:21:35 +03:00
|
|
|
else
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
msgRow.appendChild(msgRowType);
|
|
|
|
if (msgRowData)
|
|
|
|
msgRow.appendChild(msgRowData);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
if (blockLevel)
|
|
|
|
{
|
|
|
|
/* putting a div here crashes mozilla, so fake it with nested tables
|
|
|
|
* for now */
|
|
|
|
var tr = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:tr");
|
|
|
|
tr.setAttribute ("class", "msg-nested-tr");
|
|
|
|
var td = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
2004-09-15 22:39:16 +04:00
|
|
|
"html:td");
|
2001-03-14 05:35:29 +03:00
|
|
|
td.setAttribute ("class", "msg-nested-td");
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
td.setAttribute ("colspan", "3");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
tr.appendChild(td);
|
|
|
|
var table = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:table");
|
|
|
|
table.setAttribute ("class", "msg-nested-table");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
td.appendChild (table);
|
2001-12-04 03:20:48 +03:00
|
|
|
var tbody = document.createElementNS ("http://www.w3.org/1999/xhtml",
|
|
|
|
"html:tbody");
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
tbody.appendChild(msgRow);
|
|
|
|
table.appendChild(tbody);
|
2001-03-14 05:35:29 +03:00
|
|
|
msgRow = tr;
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Actually add the item.
|
2003-08-19 01:35:33 +04:00
|
|
|
addHistory (this, msgRow, canMergeData);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Update attention states...
|
2001-03-14 05:35:29 +03:00
|
|
|
if (isImportant || getAttention)
|
2002-02-03 07:35:26 +03:00
|
|
|
{
|
|
|
|
setTabState(this, "attention");
|
2003-08-19 01:35:33 +04:00
|
|
|
if (client.prefs["notify.aggressive"])
|
2002-02-09 06:36:55 +03:00
|
|
|
window.getAttention();
|
2002-02-03 07:35:26 +03:00
|
|
|
}
|
2000-01-18 06:32:43 +03:00
|
|
|
else
|
2002-02-03 07:35:26 +03:00
|
|
|
{
|
|
|
|
if (isSuperfluous)
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
{
|
2002-02-03 07:35:26 +03:00
|
|
|
setTabState(this, "superfluous");
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
}
|
2002-02-03 07:35:26 +03:00
|
|
|
else
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
{
|
2002-02-03 07:35:26 +03:00
|
|
|
setTabState(this, "activity");
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
}
|
2002-02-03 07:35:26 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Copy Important Messages [to network view].
|
|
|
|
if (isImportant && client.prefs["copyMessages"] && (o.network != this))
|
2002-01-31 06:25:41 +03:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
o.network.displayHere("{" + this.unicodeName + "} " + message, msgtype,
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
sourceObj, destObj);
|
2002-01-31 06:25:41 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Log file time!
|
2003-08-19 01:35:33 +04:00
|
|
|
if (this.prefs["log"])
|
2003-06-22 04:17:55 +04:00
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!this.logFile)
|
|
|
|
client.openLogFile(this);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-06-22 04:17:55 +04:00
|
|
|
try
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
this.logFile.write(fromUnicode(logString + client.lineEnd, "utf-8"));
|
2003-06-22 04:17:55 +04:00
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
2004-10-18 17:22:20 +04:00
|
|
|
// Stop logging before showing any messages!
|
|
|
|
this.prefs["log"] = false;
|
|
|
|
dd("Log file write error: " + formatException(ex));
|
2004-12-20 01:52:37 +03:00
|
|
|
this.displayHere(getMsg(MSG_LOGFILE_WRITE_ERROR, getLogPath(this)),
|
|
|
|
"ERROR");
|
2003-06-22 04:17:55 +04:00
|
|
|
}
|
|
|
|
}
|
2001-03-14 05:35:29 +03:00
|
|
|
}
|
2000-01-18 06:32:43 +03:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
function addHistory (source, obj, mergeData)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2002-08-02 01:08:59 +04:00
|
|
|
if (!("messages" in source) || (source.messages == null))
|
|
|
|
createMessages(source);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
var tbody = source.messages.firstChild;
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var appendTo = tbody;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
var needScroll = false;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (mergeData)
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var inobj = obj;
|
|
|
|
// This gives us the non-nested row when there is nesting.
|
|
|
|
if (inobj.className == "msg-nested-tr")
|
|
|
|
inobj = inobj.firstChild.firstChild.firstChild.firstChild;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var thisUserCol = inobj.firstChild;
|
|
|
|
while (thisUserCol && !thisUserCol.className.match(/^(msg-user|msg-type)$/))
|
|
|
|
thisUserCol = thisUserCol.nextSibling;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
var thisMessageCol = inobj.firstChild;
|
|
|
|
while (thisMessageCol && !(thisMessageCol.className == "msg-data"))
|
|
|
|
thisMessageCol = thisMessageCol.nextSibling;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
var ci = findPreviousColumnInfo(source.messages);
|
|
|
|
var nickColumns = ci.nickColumns;
|
|
|
|
var rowExtents = ci.extents;
|
|
|
|
var nickColumnCount = nickColumns.length;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-09-06 01:12:03 +04:00
|
|
|
var lastRowSpan, sameNick, sameDest, haveSameType, needSameType;
|
|
|
|
var isAction, collapseActions;
|
|
|
|
if (nickColumnCount == 0) // No message to collapse to.
|
|
|
|
{
|
|
|
|
sameNick = sameDest = needSameType = haveSameType = false;
|
|
|
|
lastRowSpan = 0;
|
|
|
|
}
|
|
|
|
else // 1 or more messages, check for doubles
|
|
|
|
{
|
|
|
|
var lastRow = nickColumns[nickColumnCount - 1].parentNode;
|
|
|
|
// What was the span last time?
|
|
|
|
lastRowSpan = Number(nickColumns[0].getAttribute("rowspan"));
|
|
|
|
// Are we the same user as last time?
|
|
|
|
sameNick = (lastRow.getAttribute("msg-user") ==
|
|
|
|
inobj.getAttribute("msg-user"));
|
|
|
|
// Do we have the same destination as last time?
|
|
|
|
sameDest = (lastRow.getAttribute("msg-dest") ==
|
|
|
|
inobj.getAttribute("msg-dest"));
|
|
|
|
// Is this message the same type as the last one?
|
|
|
|
haveSameType = (lastRow.getAttribute("msg-type") ==
|
|
|
|
inobj.getAttribute("msg-type"));
|
|
|
|
// Is either of the messages an action? We may not want to collapse
|
|
|
|
// depending on the collapseActions pref
|
2006-01-19 01:28:31 +03:00
|
|
|
isAction = ((inobj.getAttribute("msg-type") == "ACTION") ||
|
2005-09-06 01:12:03 +04:00
|
|
|
(lastRow.getAttribute("msg-type") == "ACTION"));
|
|
|
|
// Do we collapse actions?
|
|
|
|
collapseActions = source.prefs["collapseActions"];
|
|
|
|
|
|
|
|
// Does the motif collapse everything, regardless of type?
|
|
|
|
// NOTE: the collapseActions pref can override this for actions
|
2005-10-25 02:03:02 +04:00
|
|
|
needSameType = !(("motifSettings" in source) &&
|
|
|
|
source.motifSettings &&
|
|
|
|
("collapsemore" in source.motifSettings));
|
2005-09-06 01:12:03 +04:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2005-09-06 01:12:03 +04:00
|
|
|
if (sameNick && sameDest && (haveSameType || !needSameType) &&
|
|
|
|
(!isAction || collapseActions))
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
obj = inobj;
|
|
|
|
if (ci.nested)
|
|
|
|
appendTo = source.messages.firstChild.lastChild.firstChild.firstChild.firstChild;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (obj.getAttribute("important"))
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
nickColumns[nickColumnCount - 1].setAttribute("important",
|
|
|
|
true);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Remove nickname column from new row.
|
|
|
|
obj.removeChild(thisUserCol);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Expand previous grouping's nickname cell(s) to fill-in the gap.
|
2003-08-19 01:35:33 +04:00
|
|
|
for (var i = 0; i < nickColumns.length; ++i)
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
nickColumns[i].setAttribute("rowspan", rowExtents.length + 1);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if ("frame" in source)
|
|
|
|
needScroll = checkScroll(source.frame);
|
|
|
|
if (obj)
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
appendTo.appendChild(obj);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
if (source.MAX_MESSAGES)
|
|
|
|
{
|
|
|
|
if (typeof source.messageCount != "number")
|
|
|
|
source.messageCount = 1;
|
|
|
|
else
|
|
|
|
source.messageCount++;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
if (source.messageCount > source.MAX_MESSAGES)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
if (client.PRINT_DIRECTION == 1)
|
|
|
|
{
|
2003-01-24 10:44:55 +03:00
|
|
|
var height = tbody.firstChild.scrollHeight;
|
2003-08-19 01:35:33 +04:00
|
|
|
var window = getContentWindow(source.frame);
|
|
|
|
var x = window.pageXOffset;
|
|
|
|
var y = window.pageYOffset;
|
2001-12-04 03:20:48 +03:00
|
|
|
tbody.removeChild (tbody.firstChild);
|
|
|
|
--source.messageCount;
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
while (tbody.firstChild && tbody.firstChild.childNodes[1] &&
|
|
|
|
tbody.firstChild.childNodes[1].getAttribute("class") ==
|
2001-12-04 03:20:48 +03:00
|
|
|
"msg-data")
|
|
|
|
{
|
|
|
|
--source.messageCount;
|
|
|
|
tbody.removeChild (tbody.firstChild);
|
|
|
|
}
|
2003-01-24 10:44:55 +03:00
|
|
|
if (!checkScroll(source.frame) && (y > height))
|
2003-08-19 01:35:33 +04:00
|
|
|
window.scrollTo(x, y - height);
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tbody.removeChild (tbody.lastChild);
|
|
|
|
--source.messageCount;
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
while (tbody.lastChild && tbody.lastChild.childNodes[1] &&
|
|
|
|
tbody.lastChild.childNodes[1].getAttribute("class") ==
|
2001-12-04 03:20:48 +03:00
|
|
|
"msg-data")
|
|
|
|
{
|
|
|
|
--source.messageCount;
|
|
|
|
tbody.removeChild (tbody.lastChild);
|
|
|
|
}
|
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2002-08-02 01:08:59 +04:00
|
|
|
if (needScroll)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2002-08-02 01:08:59 +04:00
|
|
|
scrollDown(source.frame, true);
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
setTimeout(scrollDown, 500, source.frame, false);
|
|
|
|
setTimeout(scrollDown, 1000, source.frame, false);
|
|
|
|
setTimeout(scrollDown, 2000, source.frame, false);
|
2002-08-02 01:08:59 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
function findPreviousColumnInfo(table)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// All the rows in the grouping (for merged rows).
|
2001-12-04 03:20:48 +03:00
|
|
|
var extents = new Array();
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Get the last row in the table.
|
2001-12-04 03:20:48 +03:00
|
|
|
var tr = table.firstChild.lastChild;
|
2004-09-15 22:39:16 +04:00
|
|
|
// Bail if there's no rows.
|
|
|
|
if (!tr)
|
|
|
|
return {extents: [], nickColumns: [], nested: false};
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Get message type.
|
|
|
|
if (tr.className == "msg-nested-tr")
|
|
|
|
{
|
|
|
|
var rv = findPreviousColumnInfo(tr.firstChild.firstChild);
|
|
|
|
rv.nested = true;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
// Now get the read one...
|
|
|
|
var className = (tr && tr.childNodes[1]) ? tr.childNodes[1].getAttribute("class") : "";
|
|
|
|
// Keep going up rows until you find the first in a group.
|
|
|
|
// This will go up until it hits the top of a multiline/merged block.
|
|
|
|
while (tr && tr.childNodes[1] && className.search(/msg-user|msg-type/) == -1)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
|
|
|
extents.push(tr);
|
|
|
|
tr = tr.previousSibling;
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
if (tr && tr.childNodes[1])
|
2004-01-04 01:21:35 +03:00
|
|
|
className = tr.childNodes[1].getAttribute("class");
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// If we ran out of rows, or it's not a talking line, we're outta here.
|
2001-12-04 03:20:48 +03:00
|
|
|
if (!tr || className != "msg-user")
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
return {extents: [], nickColumns: [], nested: false};
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
extents.push(tr);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Time to collect the nick data...
|
2001-12-04 03:20:48 +03:00
|
|
|
var nickCol = tr.firstChild;
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// All the cells that contain nickname info.
|
2001-12-04 03:20:48 +03:00
|
|
|
var nickCols = new Array();
|
|
|
|
while (nickCol)
|
|
|
|
{
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// Just collect nickname column cells.
|
2001-12-04 03:20:48 +03:00
|
|
|
if (nickCol.getAttribute("class") == "msg-user")
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
nickCols.push(nickCol);
|
2004-01-04 01:21:35 +03:00
|
|
|
nickCol = nickCol.nextSibling;
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
// And we're done.
|
|
|
|
return {extents: extents, nickColumns: nickCols, nested: false};
|
2004-09-15 22:39:16 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
|
2004-12-20 01:52:37 +03:00
|
|
|
function getLogPath(obj)
|
|
|
|
{
|
2006-01-20 20:23:36 +03:00
|
|
|
// If we're logging, return the currently-used URL.
|
|
|
|
if (obj.logFile)
|
|
|
|
return getURLSpecFromFile(obj.logFile.path);
|
|
|
|
// If not, return the ideal URL.
|
2004-12-20 01:52:37 +03:00
|
|
|
return getURLSpecFromFile(obj.prefs["logFileName"]);
|
|
|
|
}
|
|
|
|
|
2001-06-07 04:52:57 +04:00
|
|
|
client.getConnectionCount =
|
|
|
|
function cli_gccount ()
|
|
|
|
{
|
|
|
|
var count = 0;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-06-07 04:52:57 +04:00
|
|
|
for (var n in client.networks)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2001-06-07 04:52:57 +04:00
|
|
|
if (client.networks[n].isConnected())
|
|
|
|
++count;
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2001-06-07 04:52:57 +04:00
|
|
|
|
|
|
|
return count;
|
2004-09-15 22:39:16 +04:00
|
|
|
}
|
2001-06-07 04:52:57 +04:00
|
|
|
|
2001-03-14 05:35:29 +03:00
|
|
|
client.quit =
|
|
|
|
function cli_quit (reason)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2005-12-26 01:27:56 +03:00
|
|
|
var net, netReason;
|
2001-12-04 03:20:48 +03:00
|
|
|
for (var n in client.networks)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2005-12-26 01:27:56 +03:00
|
|
|
net = client.networks[n];
|
|
|
|
if (net.isConnected())
|
|
|
|
{
|
|
|
|
netReason = (reason ? reason : net.prefs["defaultQuitMsg"]);
|
|
|
|
netReason = (netReason ? netReason : client.userAgent);
|
|
|
|
net.quit(netReason);
|
|
|
|
}
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
|
2006-01-22 19:41:31 +03:00
|
|
|
client.wantToQuit =
|
2006-03-05 01:43:53 +03:00
|
|
|
function cli_wantToQuit(reason, deliberate)
|
2006-01-22 19:41:31 +03:00
|
|
|
{
|
2006-04-21 05:42:06 +04:00
|
|
|
|
2006-01-22 19:41:31 +03:00
|
|
|
var close = true;
|
2006-03-05 01:43:53 +03:00
|
|
|
if (client.prefs["warnOnClose"] && !deliberate)
|
2006-01-22 19:41:31 +03:00
|
|
|
{
|
|
|
|
const buttons = ["!yes", "!no"];
|
|
|
|
var checkState = { value: true };
|
|
|
|
var rv = confirmEx(MSG_CONFIRM_QUIT, buttons, 0, MSG_WARN_ON_EXIT,
|
|
|
|
checkState);
|
|
|
|
close = (rv == 0);
|
|
|
|
client.prefs["warnOnClose"] = checkState.value;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (close)
|
|
|
|
{
|
|
|
|
client.userClose = true;
|
|
|
|
display(MSG_CLOSING);
|
|
|
|
client.quit(reason);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
/* gets a tab-complete match for the line of text specified by |line|.
|
|
|
|
* wordStart is the position within |line| that starts the word being matched,
|
|
|
|
* wordEnd marks the end position. |cursorPos| marks the position of the caret
|
|
|
|
* in the textbox.
|
2001-12-04 03:20:48 +03:00
|
|
|
*/
|
|
|
|
client.performTabMatch =
|
|
|
|
function gettabmatch_usr (line, wordStart, wordEnd, word, cursorPos)
|
|
|
|
{
|
|
|
|
if (wordStart != 0 || line[0] != client.COMMAND_CHAR)
|
|
|
|
return null;
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
var matches = client.commandManager.listNames(word.substr(1), CMD_CONSOLE);
|
2001-12-04 03:20:48 +03:00
|
|
|
if (matches.length == 1 && wordEnd == line.length)
|
|
|
|
{
|
|
|
|
matches[0] = client.COMMAND_CHAR + matches[0] + " ";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (var i in matches)
|
|
|
|
matches[i] = client.COMMAND_CHAR + matches[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return matches;
|
|
|
|
}
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
client.openLogFile =
|
|
|
|
function cli_startlog (view)
|
|
|
|
{
|
2006-03-06 02:32:28 +03:00
|
|
|
function getNextLogFileDate()
|
|
|
|
{
|
|
|
|
var d = new Date();
|
|
|
|
d.setMilliseconds(0);
|
|
|
|
d.setSeconds(0);
|
|
|
|
d.setMinutes(0);
|
|
|
|
switch (view.smallestLogInterval)
|
|
|
|
{
|
|
|
|
case "h":
|
|
|
|
return d.setHours(d.getHours() + 1);
|
|
|
|
case "d":
|
|
|
|
d.setHours(0);
|
|
|
|
return d.setDate(d.getDate() + 1);
|
|
|
|
case "m":
|
|
|
|
d.setHours(0);
|
|
|
|
d.setDate(1);
|
|
|
|
return d.setMonth(d.getMonth() + 1);
|
|
|
|
case "y":
|
|
|
|
d.setHours(0);
|
|
|
|
d.setDate(1);
|
|
|
|
d.setMonth(0);
|
|
|
|
return d.setFullYear(d.getFullYear() + 1);
|
|
|
|
}
|
|
|
|
//XXXhack: This should work...
|
|
|
|
return Infinity;
|
|
|
|
};
|
|
|
|
|
2004-10-18 17:22:20 +04:00
|
|
|
const NORMAL_FILE_TYPE = Components.interfaces.nsIFile.NORMAL_FILE_TYPE;
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
try
|
|
|
|
{
|
2004-10-18 17:22:20 +04:00
|
|
|
var file = new LocalFile(view.prefs["logFileName"]);
|
|
|
|
if (!file.localFile.exists())
|
|
|
|
{
|
|
|
|
// futils.umask may be 0022. Result is 0644.
|
|
|
|
file.localFile.create(NORMAL_FILE_TYPE, 0666 & ~futils.umask);
|
|
|
|
}
|
|
|
|
view.logFile = fopen(file.localFile, ">>");
|
2006-03-06 02:32:28 +03:00
|
|
|
// If we're here, it's safe to say when we should re-open:
|
|
|
|
view.nextLogFileDate = getNextLogFileDate();
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
|
|
|
view.prefs["log"] = false;
|
2004-10-18 17:22:20 +04:00
|
|
|
dd("Log file open error: " + formatException(ex));
|
2004-12-20 01:52:37 +03:00
|
|
|
view.displayHere(getMsg(MSG_LOGFILE_ERROR, getLogPath(view)), MT_ERROR);
|
2003-08-19 01:35:33 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-04-30 02:38:57 +04:00
|
|
|
if (!("logFileWrapping" in view) || !view.logFileWrapping)
|
|
|
|
view.displayHere(getMsg(MSG_LOGFILE_OPENED, getLogPath(view)));
|
|
|
|
view.logFileWrapping = false;
|
2003-08-19 01:35:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
client.closeLogFile =
|
2006-04-30 02:38:57 +04:00
|
|
|
function cli_stoplog(view, wrapping)
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2006-04-30 02:38:57 +04:00
|
|
|
if ("frame" in view && !wrapping)
|
2006-03-06 02:32:28 +03:00
|
|
|
view.displayHere(getMsg(MSG_LOGFILE_CLOSING, getLogPath(view)));
|
2003-08-19 01:35:33 +04:00
|
|
|
|
2006-04-30 02:38:57 +04:00
|
|
|
view.logFileWrapping = Boolean(wrapping);
|
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (view.logFile)
|
|
|
|
{
|
|
|
|
view.logFile.close();
|
|
|
|
view.logFile = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-06 02:32:28 +03:00
|
|
|
function checkLogFiles()
|
|
|
|
{
|
|
|
|
// For every view that has a logfile, check if we need a different file
|
|
|
|
// based on the current date and the logfile preference. We close the
|
|
|
|
// current logfile, and display will open the new one based on the pref
|
|
|
|
// when it's needed.
|
|
|
|
|
|
|
|
var d = new Date();
|
|
|
|
for (var n in client.networks)
|
|
|
|
{
|
|
|
|
var net = client.networks[n];
|
|
|
|
if (net.logFile && (d > net.nextLogFileDate))
|
2006-04-30 02:38:57 +04:00
|
|
|
client.closeLogFile(net, true);
|
2006-03-06 02:32:28 +03:00
|
|
|
if (("primServ" in net) && net.primServ && ("channels" in net.primServ))
|
|
|
|
{
|
|
|
|
for (var c in net.primServ.channels)
|
|
|
|
{
|
|
|
|
var chan = net.primServ.channels[c];
|
|
|
|
if (chan.logFile && (d > chan.nextLogFileDate))
|
2006-04-30 02:38:57 +04:00
|
|
|
client.closeLogFile(chan, true);
|
2006-03-06 02:32:28 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if ("users" in net)
|
|
|
|
{
|
|
|
|
for (var u in net.users)
|
|
|
|
{
|
|
|
|
var user = net.users[u];
|
|
|
|
if (user.logFile && (d > user.nextLogFileDate))
|
2006-04-30 02:38:57 +04:00
|
|
|
client.closeLogFile(user, true);
|
2006-03-06 02:32:28 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var dc in client.dcc.chats)
|
|
|
|
{
|
|
|
|
var dccChat = client.dcc.chats[dc];
|
|
|
|
if (dccChat.logFile && (d > dccChat.nextLogFileDate))
|
2006-04-30 02:38:57 +04:00
|
|
|
client.closeLogFile(dccChat, true);
|
2006-03-06 02:32:28 +03:00
|
|
|
}
|
|
|
|
for (var df in client.dcc.files)
|
|
|
|
{
|
|
|
|
var dccFile = client.dcc.files[df];
|
|
|
|
if (dccFile.logFile && (d > dccFile.nextLogFileDate))
|
2006-04-30 02:38:57 +04:00
|
|
|
client.closeLogFile(dccFile, true);
|
2006-03-06 02:32:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Don't forget about the client tab:
|
|
|
|
if (client.logFile && (d > client.nextLogFileDate))
|
2006-04-30 02:38:57 +04:00
|
|
|
client.closeLogFile(client, true);
|
2006-03-06 02:32:28 +03:00
|
|
|
|
|
|
|
// We use the same line again to make sure we keep a constant offset
|
|
|
|
// from the full hour, in case the timers go crazy at some point.
|
2006-07-14 16:02:17 +04:00
|
|
|
setTimeout("checkLogFiles()", 3602000 - (Number(new Date()) % 3600000));
|
2006-03-06 02:32:28 +03:00
|
|
|
}
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
CIRCChannel.prototype.getLCFunction =
|
|
|
|
CIRCNetwork.prototype.getLCFunction =
|
|
|
|
CIRCUser.prototype.getLCFunction =
|
|
|
|
CIRCDCCChat.prototype.getLCFunction =
|
|
|
|
CIRCDCCFileTransfer.prototype.getLCFunction =
|
|
|
|
function getlcfn()
|
|
|
|
{
|
|
|
|
var details = getObjectDetails(this);
|
|
|
|
var lcFn;
|
|
|
|
|
|
|
|
if (details.server)
|
|
|
|
{
|
|
|
|
lcFn = function(text)
|
|
|
|
{
|
|
|
|
return details.server.toLowerCase(text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return lcFn;
|
|
|
|
}
|
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
CIRCChannel.prototype.performTabMatch =
|
|
|
|
CIRCNetwork.prototype.performTabMatch =
|
|
|
|
CIRCUser.prototype.performTabMatch =
|
Bug 243629 - Landing of ChatZilla 0.9.63.
Lots of bugs fixed, including: 226223, 230328, 127662, 185729, 226410, 231150, 235650, 238551, 238716, 73257, 226408, 238612, 108087, 180577, 211461, 218070, 242381
and 147452.
r=samuel@sieb.net
2004-06-09 07:33:50 +04:00
|
|
|
CIRCDCCChat.prototype.performTabMatch =
|
2004-09-15 22:39:16 +04:00
|
|
|
CIRCDCCFileTransfer.prototype.performTabMatch =
|
|
|
|
function gettabmatch_other (line, wordStart, wordEnd, word, cursorpos, lcFn)
|
2001-03-14 05:35:29 +03:00
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
if (wordStart == 0 && line[0] == client.COMMAND_CHAR)
|
2003-01-22 08:49:52 +03:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
return client.performTabMatch(line, wordStart, wordEnd, word,
|
|
|
|
cursorpos);
|
2003-01-22 08:49:52 +03:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-01-22 08:49:52 +03:00
|
|
|
var matchList = new Array();
|
|
|
|
var users;
|
|
|
|
var channels;
|
2004-09-15 22:39:16 +04:00
|
|
|
var userIndex = -1;
|
2003-01-22 08:49:52 +03:00
|
|
|
|
|
|
|
var details = getObjectDetails(this);
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
if (details.channel && word == details.channel.unicodeName[0])
|
2003-01-22 08:49:52 +03:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
/* When we have #<tab>, we just want the current channel,
|
2003-08-19 01:35:33 +04:00
|
|
|
if possible. */
|
2004-09-15 22:39:16 +04:00
|
|
|
matchList.push(details.channel.unicodeName);
|
2003-01-22 08:49:52 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Ok, not #<tab> or no current channel, so get the full list. */
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2003-08-19 01:35:33 +04:00
|
|
|
if (details.channel)
|
|
|
|
users = details.channel.users;
|
|
|
|
|
|
|
|
if (details.server)
|
2003-01-22 08:49:52 +03:00
|
|
|
{
|
|
|
|
channels = details.server.channels;
|
|
|
|
for (var c in channels)
|
2004-09-15 22:39:16 +04:00
|
|
|
matchList.push(channels[c].unicodeName);
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!users)
|
|
|
|
users = details.server.users;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (users)
|
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
userIndex = matchList.length;
|
2003-08-19 01:35:33 +04:00
|
|
|
for (var n in users)
|
2004-09-15 22:39:16 +04:00
|
|
|
matchList.push(users[n].unicodeName);
|
2003-01-22 08:49:52 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
var matches = matchEntry(word, matchList, lcFn);
|
|
|
|
|
|
|
|
var list = new Array();
|
|
|
|
for (var i = 0; i < matches.length; i++)
|
|
|
|
list.push(matchList[matches[i]]);
|
|
|
|
|
|
|
|
if (list.length == 1)
|
2001-12-04 03:20:48 +03:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
if (users && (userIndex >= 0) && (matches[0] >= userIndex))
|
2003-01-22 08:49:52 +03:00
|
|
|
{
|
|
|
|
if (wordStart == 0)
|
2004-09-15 22:39:16 +04:00
|
|
|
list[0] += client.prefs["nickCompleteStr"];
|
2003-01-22 08:49:52 +03:00
|
|
|
}
|
2001-12-04 03:20:48 +03:00
|
|
|
|
|
|
|
if (wordEnd == line.length)
|
|
|
|
{
|
|
|
|
/* add a space if the word is at the end of the line. */
|
2004-09-15 22:39:16 +04:00
|
|
|
list[0] += " ";
|
2001-12-04 03:20:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
return list;
|
2000-01-18 06:32:43 +03:00
|
|
|
}
|
|
|
|
|
2000-05-13 02:30:21 +04:00
|
|
|
CIRCChannel.prototype.getGraphResource =
|
|
|
|
function my_graphres ()
|
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
if (!("rdfRes" in this))
|
2000-05-13 02:30:21 +04:00
|
|
|
{
|
2004-09-15 22:39:16 +04:00
|
|
|
var id = RES_PFX + "CHANNEL:" + this.parent.parent.unicodeName + ":" +
|
|
|
|
escape(this.unicodeName);
|
2003-08-19 01:35:33 +04:00
|
|
|
this.rdfRes = client.rdf.GetResource(id);
|
2000-05-13 02:30:21 +04:00
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-05-13 02:30:21 +04:00
|
|
|
return this.rdfRes;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCUser.prototype.getGraphResource =
|
|
|
|
function usr_graphres()
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!ASSERT(this.TYPE == "IRCChanUser",
|
|
|
|
"cuser.getGraphResource called on wrong object"))
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-05-13 02:30:21 +04:00
|
|
|
var rdf = client.rdf;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
if (!("rdfRes" in this))
|
2000-05-13 02:30:21 +04:00
|
|
|
{
|
2001-12-04 03:20:48 +03:00
|
|
|
if (!("nextResID" in CIRCUser))
|
2000-05-13 02:30:21 +04:00
|
|
|
CIRCUser.nextResID = 0;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
this.rdfRes = rdf.GetResource(RES_PFX + "CUSER:" +
|
|
|
|
this.parent.parent.parent.unicodeName + ":" +
|
|
|
|
this.parent.unicodeName + ":" +
|
|
|
|
CIRCUser.nextResID++);
|
2001-07-02 08:36:29 +04:00
|
|
|
|
2000-05-13 02:30:21 +04:00
|
|
|
//dd ("created cuser resource " + this.rdfRes.Value);
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
rdf.Assert (this.rdfRes, rdf.resNick, rdf.GetLiteral(this.unicodeName));
|
|
|
|
rdf.Assert (this.rdfRes, rdf.resUniName, rdf.GetLiteral(this.unicodeName));
|
2003-08-19 01:35:33 +04:00
|
|
|
rdf.Assert (this.rdfRes, rdf.resUser, rdf.litUnk);
|
|
|
|
rdf.Assert (this.rdfRes, rdf.resHost, rdf.litUnk);
|
|
|
|
rdf.Assert (this.rdfRes, rdf.resSortName, rdf.litUnk);
|
2006-03-05 04:13:34 +03:00
|
|
|
rdf.Assert (this.rdfRes, rdf.resFounder, rdf.litUnk);
|
|
|
|
rdf.Assert (this.rdfRes, rdf.resAdmin, rdf.litUnk);
|
2003-08-19 01:35:33 +04:00
|
|
|
rdf.Assert (this.rdfRes, rdf.resOp, rdf.litUnk);
|
2003-12-04 18:35:22 +03:00
|
|
|
rdf.Assert (this.rdfRes, rdf.resHalfOp, rdf.litUnk);
|
2003-08-19 01:35:33 +04:00
|
|
|
rdf.Assert (this.rdfRes, rdf.resVoice, rdf.litUnk);
|
2004-09-15 22:39:16 +04:00
|
|
|
rdf.Assert (this.rdfRes, rdf.resAway, rdf.litUnk);
|
2003-08-19 01:35:33 +04:00
|
|
|
this.updateGraphResource();
|
2000-05-13 02:30:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return this.rdfRes;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIRCUser.prototype.updateGraphResource =
|
|
|
|
function usr_updres()
|
|
|
|
{
|
2003-08-19 01:35:33 +04:00
|
|
|
if (!ASSERT(this.TYPE == "IRCChanUser",
|
|
|
|
"cuser.updateGraphResource called on wrong object"))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2000-05-13 02:30:21 +04:00
|
|
|
|
2001-12-04 03:20:48 +03:00
|
|
|
if (!("rdfRes" in this))
|
2003-08-19 01:35:33 +04:00
|
|
|
{
|
2000-05-13 02:30:21 +04:00
|
|
|
this.getGraphResource();
|
2003-08-19 01:35:33 +04:00
|
|
|
return;
|
|
|
|
}
|
2004-09-15 22:39:16 +04:00
|
|
|
|
2000-05-13 02:30:21 +04:00
|
|
|
var rdf = client.rdf;
|
2004-09-15 22:39:16 +04:00
|
|
|
|
|
|
|
rdf.Change (this.rdfRes, rdf.resUniName, rdf.GetLiteral(this.unicodeName));
|
2000-05-13 02:30:21 +04:00
|
|
|
if (this.name)
|
|
|
|
rdf.Change (this.rdfRes, rdf.resUser, rdf.GetLiteral(this.name));
|
|
|
|
else
|
|
|
|
rdf.Change (this.rdfRes, rdf.resUser, rdf.litUnk);
|
|
|
|
if (this.host)
|
|
|
|
rdf.Change (this.rdfRes, rdf.resHost, rdf.GetLiteral(this.host));
|
|
|
|
else
|
|
|
|
rdf.Change (this.rdfRes, rdf.resHost, rdf.litUnk);
|
2003-08-19 01:35:33 +04:00
|
|
|
|
2004-09-15 22:39:16 +04:00
|
|
|
// Check for the highest mode the user has.
|
|
|
|
const userModes = this.parent.parent.userModes;
|
|
|
|
var modeLevel = 0;
|
2006-03-05 04:13:34 +03:00
|
|
|
var mode;
|
2004-09-15 22:39:16 +04:00
|
|
|
for (var i = 0; i < this.modes.length; i++)
|
|
|
|
{
|
|
|
|
for (var j = 0; j < userModes.length; j++)
|
|
|
|
{
|
|
|
|
if (userModes[j].mode == this.modes[i])
|
|
|
|
{
|
|
|
|
if (userModes.length - j > modeLevel)
|
|
|
|
{
|
|
|
|
modeLevel = userModes.length - j;
|
2006-03-05 04:13:34 +03:00
|
|
|
mode = userModes[j];
|
2004-09-15 22:39:16 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-04 02:47:42 +04:00
|
|
|
// Counts numerically down from 9.
|
|
|
|
var sortname = (9 - modeLevel) + "-" + this.unicodeName;
|
2003-08-19 01:35:33 +04:00
|
|
|
|
2006-03-05 04:13:34 +03:00
|
|
|
// We want to show mode symbols, but only for modes we don't 'style'.
|
|
|
|
var displayname = this.unicodeName;
|
|
|
|
if (mode && !mode.mode.match(/^[qaohv]$/))
|
|
|
|
displayname = mode.symbol + " " + displayname;
|
|
|
|
|
|
|
|
rdf.Change(this.rdfRes, rdf.resNick, rdf.GetLiteral(displayname));
|
2004-09-15 22:39:16 +04:00
|
|
|
rdf.Change(this.rdfRes, rdf.resSortName, rdf.GetLiteral(sortname));
|
2006-03-05 04:13:34 +03:00
|
|
|
rdf.Change(this.rdfRes, rdf.resFounder,
|
|
|
|
this.isFounder ? rdf.litTrue : rdf.litFalse);
|
|
|
|
rdf.Change(this.rdfRes, rdf.resAdmin,
|
|
|
|
this.isAdmin ? rdf.litTrue : rdf.litFalse);
|
2004-09-15 22:39:16 +04:00
|
|
|
rdf.Change(this.rdfRes, rdf.resOp,
|
|
|
|
this.isOp ? rdf.litTrue : rdf.litFalse);
|
|
|
|
rdf.Change(this.rdfRes, rdf.resHalfOp,
|
|
|
|
this.isHalfOp ? rdf.litTrue : rdf.litFalse);
|
|
|
|
rdf.Change(this.rdfRes, rdf.resVoice,
|
|
|
|
this.isVoice ? rdf.litTrue : rdf.litFalse);
|
|
|
|
rdf.Change(this.rdfRes, rdf.resAway,
|
|
|
|
this.isAway ? rdf.litTrue : rdf.litFalse);
|
2000-05-13 02:30:21 +04:00
|
|
|
}
|