Bug 920801 - Port chat/ changes from Instantbird to comm-central - 6 - Bio 2006 - The /invite command should support taking more than one nick as parameter, r=aleth.

This commit is contained in:
Patrick Cloke 2013-06-29 11:44:23 -04:00
Родитель dd25f22f8b
Коммит 78eb0848bf
3 изменённых файлов: 34 добавлений и 9 удалений

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

@ -55,7 +55,7 @@ command.ctcp=%S <nick> <msg>: Sends a CTCP message to the nick.
command.chanserv=%S <command>: Send a command to ChanServ.
command.deop=%S <nick1>[,<nick2>]*: Remove channel operator status from someone. You must be a channel operator to do this.
command.devoice=%S <nick1>[,<nick2>]*: Remove channel voice status from someone, preventing them from speaking if the channel is moderated (+m). You must be a channel operator to do this.
command.invite=%S <nick> [<room>]: Invite someone to join you in the specified channel, or the current channel.
command.invite2=%S <nick>[ <nick>]* [<channel>]: Invite one or more nicks to join you in the current channel, or to join the specified channel.
command.join=%S <room1>[ <key1>][,<room2>[ <key2>]]*: Enter one or more channels, optionally providing a channel key for each if needed.
command.kick=%S <nick> [<message>]: Remove someone from a channel. You must be a channel operator to do this.
command.list=%S: Display a list of chat rooms on the network. Warning, some servers may disconnect you upon doing this.
@ -121,6 +121,9 @@ message.inviteReceived=%1$S has invited you to %2$S.
# %1$S is the nickname of the invited user, %2$S is the conversation name
# they were invited to.
message.invited=%1$S was successfully invited to %2$S.
# %1$S is the nickname of the invited user, %2$S is the conversation name
# they were invited to but are already in
message.alreadyInChannel=%1$S is already in %2$S.
# %S is the nickname of the user who was summoned.
message.summoned=%S was summoned.
# %S is the nickname of the user whose WHOIS information follows this message.

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

@ -1225,8 +1225,11 @@ var ircBase = {
},
"443": function(aMessage) { // ERR_USERONCHANNEL
// <user> <channel> :is already on channel
// TODO
return false;
this.getConversation(aMessage.params[2])
.writeMessage(aMessage.servername,
_("message.alreadyInChannel", aMessage.params[1],
aMessage.params[2]), {system: true});
return true;
},
"444": function(aMessage) { // ERR_NOLOGIN
// <user> :User not logged in

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

@ -146,17 +146,36 @@ var commands = [
},
{
name: "invite",
get helpString() _("command.invite", "invite"),
get helpString() _("command.invite2", "invite"),
run: function(aMsg, aConv) {
let params = splitInput(aMsg);
// If no parameters are given.
// Try to find one, and only one, channel in the list of parameters.
let channel;
let account = getAccount(aConv);
// Find the first param that could be a channel name.
for (let i = 0; i < params.length; ++i) {
if (account.isMUCName(params[i])) {
// If channel is set, two channel names have been found.
if (channel)
return false;
// Remove that parameter and store it.
channel = params.splice(i, 1)[0];
}
}
// If no parameters or only a channel are given.
if (!params[0].length)
return false;
// If only a nick is given, append the current channel name.
if (params.length == 1)
params.push(aConv.name);
return simpleCommand(aConv, "INVITE", params);
// Default to using the current conversation as the channel to invite to.
if (!channel)
channel = aConv.name;
params.forEach(function(p)
simpleCommand(aConv, "INVITE", [p, channel]));
return true;
}
},
{