Added kick
This commit is contained in:
parent
a23a446145
commit
b5f85b422a
|
@ -16,7 +16,7 @@ models.User = Backbone.Model.extend({
|
|||
|
||||
models.Users = Backbone.Collection.extend({
|
||||
model: models.User,
|
||||
sort: function(options) {
|
||||
sort: function() {
|
||||
this.models = _.sortBy(
|
||||
this.models,
|
||||
function(user) {
|
||||
|
|
|
@ -133,7 +133,7 @@ function input(json) {
|
|||
case "part":
|
||||
case "nick":
|
||||
if (client && args[1]) {
|
||||
client[cmd](args[1]);
|
||||
client[cmd].apply(client, args.slice(1));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -150,11 +150,17 @@ function input(json) {
|
|||
case "query":
|
||||
case "whois":
|
||||
if (client && args[1]) {
|
||||
client["whois"](args[1]);
|
||||
client.whois(args[1]);
|
||||
}
|
||||
break;
|
||||
|
||||
case "kick":
|
||||
if (client && args[1]) {
|
||||
client.kick(channel.get("name"), args[1]);
|
||||
}
|
||||
break;
|
||||
|
||||
case "mode":
|
||||
break;
|
||||
|
||||
case "quit":
|
||||
|
@ -177,10 +183,40 @@ function event(event, data) {
|
|||
chan.addMessage({
|
||||
from: data[0].nick,
|
||||
type: "join",
|
||||
});
|
||||
break;
|
||||
|
||||
case "part":
|
||||
var chan = channels.findWhere({name: data[0].channels[0]});
|
||||
if (data[0].nick == this.get("client").me) {
|
||||
channels.remove(chan);
|
||||
return;
|
||||
}
|
||||
var users = chan.get("users");
|
||||
users.remove(users.findWhere({name: data[0].nick}));
|
||||
chan.addMessage({
|
||||
from: data[0].nick,
|
||||
type: "part",
|
||||
});
|
||||
break;
|
||||
|
||||
case "kick":
|
||||
var chan = channels.findWhere({name: data[0].channel});
|
||||
var users = chan.get("users");
|
||||
|
||||
if (data[0].client == this.get("client").me) {
|
||||
users.reset();
|
||||
} else {
|
||||
users.remove(
|
||||
users.findWhere({name: data[0].client})
|
||||
);
|
||||
}
|
||||
|
||||
chan.addMessage({
|
||||
from: data[0].nick,
|
||||
message: data[0].client,
|
||||
type: "kick",
|
||||
});
|
||||
break;
|
||||
|
||||
case "motd":
|
||||
|
@ -238,23 +274,6 @@ function event(event, data) {
|
|||
channels.first().addMessage(data[0]);
|
||||
break;
|
||||
|
||||
case "part":
|
||||
var i = data[0].channels.length;
|
||||
while (i--) {
|
||||
var chan = channels.findWhere({name: data[0].channels[i]});
|
||||
if (data[0].nick == this.get("client").me) {
|
||||
channels.remove(chan);
|
||||
return;
|
||||
}
|
||||
var users = chan.get("users");
|
||||
users.remove(users.findWhere({name: data[0].nick}));
|
||||
chan.addMessage({
|
||||
from: data[0].nick,
|
||||
type: "part",
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case "quit":
|
||||
channels.each(function(chan) {
|
||||
var users = chan.get("users");
|
||||
|
@ -290,7 +309,6 @@ function event(event, data) {
|
|||
break;
|
||||
|
||||
case "whois":
|
||||
// If this value is null, an error has occured.
|
||||
if (data[1] == null) {
|
||||
channels.first().addMessage({
|
||||
type: "error",
|
||||
|
|
Loading…
Reference in New Issue