Bug 799068 - Land in comm-central Instantbird's changes to chat/ - 3 - Bio 1657 - Unhandled IRC message 475 ERR_BADCHANNELKEY, r=aleth.

This commit is contained in:
Patrick Cloke 2012-08-26 16:39:40 -04:00
Родитель 1751f2c28c
Коммит 0dee902a3c
3 изменённых файлов: 30 добавлений и 18 удалений

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

@ -135,6 +135,7 @@ error.noSuchChannel=There is no channel: %S.
error.cannotSendToChannel=You cannot send messages to %S.
error.nonUniqueTarget=%S is not a unique user@host or shortname or you have tried to join too many channels at once.
error.notChannelOp=You are not a channel operator on %S.
error.wrongKey=Cannot join %S, invalid channel key.
# LOCALIZATION NOTE (tooltip.*):
# These are the descriptions given in a tooltip with information received

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

@ -177,15 +177,6 @@ function ircChannel(aAccount, aName, aNick) {
this._init(aAccount, aName, aNick);
this._modes = [];
this._observedNicks = [];
// Ensure chatRoomFields information is available for reconnection.
let nName = aAccount.normalize(this.name);
if (hasOwnProperty(aAccount._chatRoomFieldsList, nName))
this._chatRoomFields = aAccount._chatRoomFieldsList[nName];
else {
WARN("Opening a MUC without storing its prplIChatRoomFieldValues first.");
this._chatRoomFields = aAccount.getChatRoomDefaultFieldValues(this.name);
}
}
ircChannel.prototype = {
__proto__: GenericConvChatPrototype,
@ -973,13 +964,13 @@ ircAccount.prototype = {
return;
}
let params = [channel];
let password = aComponents.getValue("password");
if (password)
params.push(password);
let key = aComponents.getValue("password");
if (key)
params.push(key);
this._chatRoomFieldsList[this.normalize(channel)] = aComponents;
// Send the join command, but don't log the channel key.
this.sendMessage("JOIN", params,
"JOIN " + channel + (password ? " <key not logged>" : ""));
"JOIN" + channel + (key ? " <key not logged>" : ""));
},
chatRoomFields: {

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

@ -194,12 +194,23 @@ var ircBase = {
let conversation = this.getConversation(channelName);
if (this.normalize(aMessage.nickname, this.userPrefixes) ==
this.normalize(this._nickname)) {
// If you join, clear the participants list to avoid errors w/
// If you join, clear the participants list to avoid errors with
// repeated participants.
conversation.removeAllParticipants();
conversation.left = false;
conversation.notifyObservers(conversation, "update-conv-chatleft");
delete this._chatRoomFieldsList[this.normalize(conversation.name)];
// Ensure chatRoomFields information is available for reconnection.
let nName = this.normalize(channelName);
if (hasOwnProperty(this._chatRoomFieldsList, nName)) {
conversation._chatRoomFields = this._chatRoomFieldsList[nName];
delete this._chatRoomFieldsList[nName];
}
else {
WARN("Opening a MUC without storing its prplIChatRoomFieldValues first.");
conversation._chatRoomFields =
this.getChatRoomDefaultFieldValues(channelName);
}
}
else {
// Don't worry about adding ourself, RPL_NAMES takes care of that
@ -1249,9 +1260,18 @@ var ircBase = {
},
"475": function(aMessage) { // ERR_BADCHANNELKEY
// <channel> :Cannot join channel (+k)
// TODO need to inform the user.
delete this._chatRoomFieldsList[this.normalize(aMessage.params[1])];
return false;
let channelName = aMessage.params[1];
// Display an error message to the user.
let msg = _("error.wrongKey", channelName);
let conversation = this.getConversation(channelName);
conversation.writeMessage(aMessage.servername, msg, {system: true});
// The stored information is out of date, remove it.
delete conversation._chatRoomFields;
delete this._chatRoomFieldsList[this.normalize(channelName)];
return true;
},
"476": function(aMessage) { // ERR_BADCHANMASK
// <channel> :Bad Channel Mask