Bug 486746 - Process IRC numerics 401/402/403 to display a useful error message.
ChatZilla only. r=gijs git-svn-id: svn://10.0.0.236/trunk@257440 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
c16b7533b5
commit
1e3af2eb28
@ -806,6 +806,9 @@ msg.need.oper.password = Please enter a password for obtaining IRC Operator priv
|
||||
|
||||
# Better IRC error messages
|
||||
msg.irc.381 = You are now an IRC Operator.
|
||||
msg.irc.401 = The nickname ``$S'' does not exist.
|
||||
msg.irc.402 = The server ``$S'' does not exist.
|
||||
msg.irc.403 = The channel ``$S'' does not exist.
|
||||
msg.irc.464 = Incorrect password, please try again with the correct password.
|
||||
msg.irc.464.login = Please specify your password using the "/pass" command to continue connecting.
|
||||
msg.irc.471 = This channel has reached its set capacity; you cannot join it.
|
||||
|
||||
@ -1592,32 +1592,39 @@ function my_listrply (e)
|
||||
}
|
||||
}
|
||||
|
||||
CIRCNetwork.prototype.on401 =
|
||||
function my_401 (e)
|
||||
CIRCNetwork.prototype.on401 = /* ERR_NOSUCHNICK */
|
||||
CIRCNetwork.prototype.on402 = /* ERR_NOSUCHSERVER */
|
||||
CIRCNetwork.prototype.on403 = /* ERR_NOSUCHCHANNEL */
|
||||
function my_401(e)
|
||||
{
|
||||
var target = e.server.toLowerCase(e.params[2]);
|
||||
if (target in this.users && "messages" in this.users[target])
|
||||
{
|
||||
this.users[target].displayHere(e.params[3]);
|
||||
}
|
||||
else if (target in this.primServ.channels &&
|
||||
"messages" in this.primServ.channels[target])
|
||||
{
|
||||
this.primServ.channels[target].displayHere(e.params[3]);
|
||||
}
|
||||
var server, channel, user;
|
||||
|
||||
/* Note that servers generally only send 401 and 402, sharing the former
|
||||
* between nicknames and channels, but we're ready for anything.
|
||||
*/
|
||||
if (e.code == 402)
|
||||
server = e.decodeParam(2);
|
||||
else if (arrayIndexOf(e.server.channelTypes, e.params[2][0]) != -1)
|
||||
channel = new CIRCChannel(e.server, null, e.params[2]);
|
||||
else
|
||||
user = new CIRCUser(e.server, null, e.params[2]);
|
||||
|
||||
if (user && this.whoisList && (user.canonicalName in this.whoisList))
|
||||
{
|
||||
if (this.whoisList && (target in this.whoisList))
|
||||
{
|
||||
// if this is from a whois, send a whowas and don't display anything
|
||||
this.primServ.whowas(target, 1);
|
||||
this.whoisList[target] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
display(toUnicode(e.params[3], this));
|
||||
}
|
||||
// If this is from a /whois, send a /whowas and don't display anything.
|
||||
this.primServ.whowas(user.unicodeName, 1);
|
||||
this.whoisList[user.canonicalName] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (user)
|
||||
user.display(getMsg(MSG_IRC_401, [user.unicodeName]), e.code);
|
||||
else if (server)
|
||||
this.display(getMsg(MSG_IRC_402, [server]), e.code);
|
||||
else if (channel)
|
||||
channel.display(getMsg(MSG_IRC_403, [channel.unicodeName]), e.code);
|
||||
else
|
||||
dd("on401: unreachable code.");
|
||||
}
|
||||
|
||||
/* 464; "invalid or missing password", occurs as a reply to both OPER and
|
||||
|
||||
@ -4004,28 +4004,53 @@ function my_splitlinesforsending(line)
|
||||
return realLines;
|
||||
}
|
||||
|
||||
/* Displays a network-centric message on the most appropriate view.
|
||||
*
|
||||
* When |client.SLOPPY_NETWORKS| is |true|, messages will be displayed on the
|
||||
* *current* view instead of the network view, if the current view is part of
|
||||
* the same network.
|
||||
*/
|
||||
CIRCNetwork.prototype.display =
|
||||
function net_display (message, msgtype, sourceObj, destObj)
|
||||
function net_display(message, msgtype, sourceObj, destObj)
|
||||
{
|
||||
var o = getObjectDetails(client.currentObject);
|
||||
|
||||
if (client.SLOPPY_NETWORKS && client.currentObject != this &&
|
||||
o.network == this && o.server && o.server.isConnected)
|
||||
{
|
||||
client.currentObject.display (message, msgtype, sourceObj, destObj);
|
||||
client.currentObject.display(message, msgtype, sourceObj, destObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.displayHere (message, msgtype, sourceObj, destObj);
|
||||
this.displayHere(message, msgtype, sourceObj, destObj);
|
||||
}
|
||||
}
|
||||
|
||||
/* Displays a channel-centric message on the most appropriate view.
|
||||
*
|
||||
* If the channel view already exists (visible or hidden), messages are added
|
||||
* to it; otherwise, messages go to the *network* view.
|
||||
*/
|
||||
CIRCChannel.prototype.display =
|
||||
function chan_display(message, msgtype, sourceObj, destObj)
|
||||
{
|
||||
if ("messages" in this)
|
||||
this.displayHere(message, msgtype, sourceObj, destObj);
|
||||
else
|
||||
this.parent.parent.displayHere(message, msgtype, sourceObj, destObj);
|
||||
}
|
||||
|
||||
/* Displays a user-centric message on the most appropriate view.
|
||||
*
|
||||
* If the user view already exists (visible or hidden), messages are added to
|
||||
* it; otherwise, it goes to the *current* view if the current view is part of
|
||||
* the same network, or the *network* view if not.
|
||||
*/
|
||||
CIRCUser.prototype.display =
|
||||
function usr_display(message, msgtype, sourceObj, destObj)
|
||||
{
|
||||
if ("messages" in this)
|
||||
{
|
||||
this.displayHere (message, msgtype, sourceObj, destObj);
|
||||
this.displayHere(message, msgtype, sourceObj, destObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4033,19 +4058,22 @@ function usr_display(message, msgtype, sourceObj, destObj)
|
||||
if (o.server && o.server.isConnected &&
|
||||
o.network == this.parent.parent &&
|
||||
client.currentObject.TYPE != "IRCUser")
|
||||
client.currentObject.display (message, msgtype, sourceObj, destObj);
|
||||
client.currentObject.display(message, msgtype, sourceObj, destObj);
|
||||
else
|
||||
this.parent.parent.displayHere (message, msgtype, sourceObj,
|
||||
destObj);
|
||||
this.parent.parent.displayHere(message, msgtype, sourceObj,
|
||||
destObj);
|
||||
}
|
||||
}
|
||||
|
||||
/* Displays a DCC user/file transfer-centric message on the most appropriate view.
|
||||
*
|
||||
* If the DCC user/file transfer view already exists (visible or hidden),
|
||||
* messages are added to it; otherwise, messages go to the *current* view.
|
||||
*/
|
||||
CIRCDCCChat.prototype.display =
|
||||
CIRCDCCFileTransfer.prototype.display =
|
||||
function dcc_display(message, msgtype, sourceObj, destObj)
|
||||
{
|
||||
var o = getObjectDetails(client.currentObject);
|
||||
|
||||
if ("messages" in this)
|
||||
this.displayHere(message, msgtype, sourceObj, destObj);
|
||||
else
|
||||
@ -4110,7 +4138,6 @@ function this_getFontCSS(format)
|
||||
client.display =
|
||||
client.displayHere =
|
||||
CIRCNetwork.prototype.displayHere =
|
||||
CIRCChannel.prototype.display =
|
||||
CIRCChannel.prototype.displayHere =
|
||||
CIRCUser.prototype.displayHere =
|
||||
CIRCDCCChat.prototype.displayHere =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user