strict mode cleanup
clear message count when view is /cleared, bug 113101
add charset support for input and output areas, bug 41564
bump revision to 0.8.5-rc5
This commit is contained in:
rginda%netscape.com 2001-12-12 04:40:02 +00:00
Родитель 8cfd709099
Коммит 483ca3222a
3 изменённых файлов: 69 добавлений и 32 удалений

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

@ -553,6 +553,7 @@ function onClearCurrentView()
client.output.removeChild (client.output.firstChild);
client.currentObject.messages = null;
client.currentObject.messageCount = 0;
client.currentObject.display (getMsg("onClearCurrentViewMsg"), "INFO");
@ -1250,7 +1251,8 @@ function cli_testdisplay (e)
var me = o.server.me;
var viewType = client.currentObject.TYPE;
var sampleUser = {TYPE: "IRCUser", nick: "ircmonkey",
name: "IRCMonkey", properNick: "IRCMonkey"};
name: "IRCMonkey", properNick: "IRCMonkey",
host: ""};
var sampleChannel = {TYPE: "IRCChannel", name: "#mojo"};
function test (from, to)
@ -1620,7 +1622,7 @@ function cli_ime (e)
e.inputData = filterOutput (e.inputData, "ACTION", "ME!");
client.currentObject.display (e.inputData, "ACTION", "ME!",
client.currentObject);
client.currentObject.act (e.inputData);
client.currentObject.act (fromUnicode(e.inputData));
return true;
}
@ -1648,7 +1650,7 @@ function cli_iquery (e)
{
var msg = filterOutput(ary[2], "PRIVMSG", "ME!");
tab.display (msg, "PRIVMSG", "ME!", tab);
tab.say (ary[2]);
tab.say (fromUnicode(ary[2]));
}
e.user = tab;
@ -1674,7 +1676,7 @@ function cli_imsg (e)
var msg = filterOutput(ary[2], "PRIVMSG", "ME!");
client.currentObject.display (msg, "PRIVMSG", "ME!", usr);
usr.say (ary[2]);
usr.say (fromUnicode(ary[2]));
return true;
@ -1931,7 +1933,7 @@ function cli_itopic (e)
}
else
{
if (!e.channel.setTopic(e.inputData))
if (!e.channel.setTopic(fromUnicode(e.inputData)))
client.currentObject.display (getMsg("cli_itopicMsg2"), "ERROR");
}
@ -2881,7 +2883,7 @@ function my_cprivmsg (e)
}
catch (ex)
{
this.say (e.user.nick + ": " + String(ex));
this.say (fromUnicode(e.user.nick + ": " + String(ex)));
return false;
}
@ -2900,7 +2902,7 @@ function my_cprivmsg (e)
rsp += " ";
this.display (rsp + v, "PRIVMSG", e.server.me, this);
this.say (rsp + v);
this.say (fromUnicode(rsp + v));
}
}

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

@ -100,13 +100,16 @@
modifiers="control" keycode="VK_TAB"/>
<key id="key_prev_view" observes="cmd_prev_view"
modifiers="control shift" keycode="VK_TAB"/>
<key id="key_next_view" observes="cmd_next_view"
modifiers="control" keycode="VK_PAGE_DOWN"/>
<key id="key_prev_view" observes="cmd_prev_view"
modifiers="control" keycode="VK_PAGE_UP"/>
<key id="key_tab_complete" oncommand="onTabCompleteRequest(event);"
keycode="VK_TAB"/>
<!-- File:Options keys -->
<key id="key_debug" observes="cmd_debug"
modifiers="accel shift" key="D"/>
<key id="key_close"/>
<!-- Edit Keys -->
<key id="key_undo"/>

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

@ -36,7 +36,7 @@ const MSG_UNKNOWN = getMsg ("unknown");
client.defaultNick = getMsg( "defaultNick" );
client.version = "0.8.5-rc2";
client.version = "0.8.5-rc5";
client.TYPE = "IRCClient";
client.COMMAND_CHAR = "/";
@ -129,16 +129,33 @@ function ()
function ucConvertIncomingMessage (e)
{
e.meat = client.ucConverter.ConvertToUnicode(e.meat);
e.meat = toUnicode(e.meat);
return true;
}
function ucConvertOutgoingMessage (msg)
function toUnicode (msg)
{
if (client.ucConverter)
return client.ucConverter.ConvertFromUnicode(msg);
if (!("ucConverter" in client))
return msg;
/* if we're in a stateful charset, return to ascii mode before starting */
if (client.CHARSET.search(/iso-2022/i) != -1)
client.ucConverter.ConvertToUnicode("\x1B(B");
return msg;
msg = client.ucConverter.ConvertToUnicode(msg);
/* if we're in a stateful charset, return to ascii mode at the end */
if (client.CHARSET.search(/iso-2022/i) != -1)
client.ucConverter.ConvertToUnicode("\x1B(B");
return msg
}
function fromUnicode (msg)
{
if (!("ucConverter" in client))
return msg;
return client.ucConverter.ConvertFromUnicode(msg);
}
function setCharset (charset)
@ -149,25 +166,40 @@ function setCharset (charset)
{
delete client.ucConverter;
client.eventPump.removeHookByName("uc-hook");
return;
return true;
}
if (!("ucConverter" in client))
var ex;
try
{
const UC_CTRID = "@mozilla.org/intl/scriptableunicodeconverter";
const nsIUnicodeConverter =
Components.interfaces.nsIScriptableUnicodeConverter;
client.ucConverter =
Components.classes[UC_CTRID].createInstance(nsIUnicodeConverter);
if (!("ucConverter" in client))
{
const UC_CTRID = "@mozilla.org/intl/scriptableunicodeconverter";
const nsIUnicodeConverter =
Components.interfaces.nsIScriptableUnicodeConverter;
client.ucConverter =
Components.classes[UC_CTRID].getService(nsIUnicodeConverter);
}
client.ucConverter.charset = charset;
if (!client.eventPump.getHook("uc-hook"))
{
client.eventPump.addHook ([{type: "parseddata", set: "server"}],
ucConvertIncomingMessage, "uc-hook");
}
}
catch (ex)
{
dd ("Caught exception setting charset to " + charset + "\n" + ex);
client.CHARSET = "";
client.eventPump.removeHookByName("uc-hook");
return false;
}
client.ucConverter.charset = charset;
if (!client.eventPump.getHook("uc-hook"))
{
client.eventPump.addHook ([{type: "privmsg", set: "server"}],
ucConvertIncomingMessage, "uc-hook");
}
return true;
}
function initStatic()
@ -750,7 +782,7 @@ function cycleView (amount)
function playSounds (list)
{
ary = list.split (" ");
var ary = list.split (" ");
if (ary.length == 0)
return;
@ -1356,7 +1388,7 @@ function gotoIRCURL (url)
targetObject.display (msg, "PRIVMSG", "ME!",
client.currentObject);
}
targetObject.say (msg);
targetObject.say (fromUnicode(msg));
setCurrentObject (targetObject);
}
}
@ -1961,7 +1993,7 @@ function filterOutput (msg, msgtype)
}
}
return ucConvertOutgoingMessage(msg);
return msg;
}
client.connectToNetwork =
@ -2039,7 +2071,7 @@ function cli_say(msg)
msg = filterOutput (msg, "PRIVMSG");
client.currentObject.display (msg, "PRIVMSG", "ME!",
client.currentObject);
client.currentObject.say (msg);
client.currentObject.say (fromUnicode(msg));
break;
case "IRCClient":