Bug 799068 - Land in comm-central Instantbird's changes to chat/ - 3 - Bio 1655 - Unhandled IRC messages around bans, r=aleth.

This commit is contained in:
Patrick Cloke 2012-10-05 16:32:30 -04:00
Родитель fa63997a8f
Коммит 3432f359b2
3 изменённых файлов: 37 добавлений и 5 удалений

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

@ -119,6 +119,11 @@ message.unknownNick=%S is an unknown nickname.
# channel key (password).
message.channelKeyAdded=%1$S changed the channel key to %2$S.
message.channelKeyRemoved=%S removed the channel key.
# This will be followed by a list of ban masks.
message.banMasks=Users connected from the following locations are banned from %S:
message.noBanMasks=There are no banned locations for %S.
message.banMaskAdded=Users connected from locations matching %1$S have been banned by %2$S.
message.banMaskRemoved=Users connected from locations matching %1$S are no longer banned by %2$S.
# LOCALIZATION NOTE (error.*):
# These are shown as error messages in the server tab.

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

@ -176,6 +176,7 @@ function ircChannel(aAccount, aName, aNick) {
this._init(aAccount, aName, aNick);
this._modes = [];
this._observedNicks = [];
this.banMasks = [];
}
ircChannel.prototype = {
__proto__: GenericConvChatPrototype,
@ -184,6 +185,7 @@ ircChannel.prototype = {
// For IRC you're not in a channel until the JOIN command is received, open
// all channels (initially) as left.
_left: true,
banMasks: [],
// Overwrite the writeMessage function to apply CTCP formatting before
// display.
@ -363,7 +365,22 @@ ircChannel.prototype = {
this._chatRoomFields =
this._account.getChatRoomDefaultFieldValues(newFields);
}
else if (["b", "e", "I", "l"].indexOf(aNewMode[i]) != -1) {
else if (aNewMode[i] == "b") {
// A banmask was added or removed.
let banMask = getNextParam();
let msgKey = "message.banMask";
if (addNewMode) {
this.banMasks.push(banMask);
msgKey += "Added";
}
else {
this.banMasks =
this.banMasks.filter(function (aBanMask) banMask != aBanMask);
msgKey += "Removed";
}
this.writeMessage(aSetter, _(msgKey, banMask, aSetter), {system: true});
}
else if (["e", "I", "l"].indexOf(aNewMode[i]) != -1) {
// TODO The following have parameters that must be accounted for.
getNextParam();
}

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

@ -913,13 +913,23 @@ var ircBase = {
*/
"367": function(aMessage) { // RPL_BANLIST
// <channel> <banmask>
// TODO
return false;
let conv = this.getConversation(aMessage.params[1]);
if (conv.banMasks.indexOf(aMessage.params[2]) == -1)
conv.banMasks.push(aMessage.params[2]);
return true;
},
"368": function(aMessage) { // RPL_ENDOFBANLIST
// <channel> :End of channel ban list
// TODO
return false;
let conv = this.getConversation(aMessage.params[1]);
let msg;
if (conv.banMasks.length) {
msg = [_("message.banMasks", aMessage.params[1])]
.concat(conv.banMasks).join("\n");
}
else
msg = _("message.noBanMasks", aMessage.params[1]);
conv.writeMessage(aMessage.servername, msg, {system: true});
return true;
},
"369": function(aMessage) { // RPL_ENDOFWHOWAS
// <nick> :End of WHOWAS