Added /kick command

This commit is contained in:
Mattias Erming 2014-03-14 15:26:00 +01:00
parent 5a7a93947f
commit b5571f8fdb
1 changed files with 49 additions and 2 deletions

View File

@ -163,14 +163,34 @@ function handleInput(input) {
case "NICK":
var irc = network.irc;
if (typeof irc !== "undefined") {
irc.send(cmd, argv[1] || config.nick);
irc.send("NICK", argv[1] || config.nick);
}
break;
case "KICK":
var irc = network.irc;
if (argv[1] && typeof irc !== "undefined") {
irc.send(
"KICK",
target.channel.get("name"),
argv[1]
);
}
break;
case "WHOIS":
var irc = network.irc;
if (typeof irc !== "undefined") {
irc.send(cmd, argv[1] || target.channel.get("name"));
irc.send("WHOIS", argv[1] || target.channel.get("name"));
}
break;
// This command is used for debugging purposes.
// Send raw commands.
case "SEND":
var irc = network.irc;
if (typeof irc !== "undefined") {
irc.send.apply(irc, argv.splice(1));
}
break;
@ -273,6 +293,7 @@ function handleEvent(argv) {
name: argv.nick
})
);
var messages = channel.get("messages");
messages.add(
new models.Message({
@ -303,6 +324,32 @@ function handleEvent(argv) {
}
break;
case "KICK":
var channel = channels.findWhere({
name: argv.args[0]
});
var users = channel.get("users");
if (argv.args[1] == network.get("nick")) {
users.reset();
} else {
users.remove(
users.findWhere({
name: argv.args[1]
})
);
}
var messages = channel.get("messages");
messages.add(
new models.Message({
user: argv.args[1],
text: "was kicked from " + argv.args[0] + " by " + argv.nick,
type: "kick"
})
);
break;
case "TOPIC":
var channel = channels.findWhere({name: argv.args[0]});
var messages = channel.get("messages");