Sort users
This commit is contained in:
parent
541e41e804
commit
7c3cf140d8
@ -220,7 +220,7 @@ $(function() {
|
||||
var id = parseInt(link.closest(".window").attr("id").replace("window-", ""));
|
||||
socket.emit("input", {
|
||||
id: id,
|
||||
text: "/whois " + link.text(),
|
||||
text: "/whois " + link.text().trim(),
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -219,7 +219,9 @@ function event(event, data) {
|
||||
|
||||
case "join":
|
||||
var chan = channels.findWhere({name: data[0].channel}) || channels.add({name: data[0].channel});
|
||||
chan.addUser({name: data[0].nick});
|
||||
var users = chan.get("users");
|
||||
users.add({name: data[0].nick});
|
||||
users.sort();
|
||||
chan.addMessage({
|
||||
from: data[0].nick,
|
||||
type: "join",
|
||||
@ -271,11 +273,13 @@ function event(event, data) {
|
||||
|
||||
case "names":
|
||||
var chan = channels.findWhere({name: data[0].channel});
|
||||
chan.get("users").reset(
|
||||
_.map(data[0].names, function(n) {
|
||||
return {name: n};
|
||||
})
|
||||
var users = chan.get("users");
|
||||
users.reset(
|
||||
_.map(data[0].names, function(n) { return {name: n}; }),
|
||||
{silent: true}
|
||||
);
|
||||
users.sort();
|
||||
users.trigger("reset", {}, users);
|
||||
break;
|
||||
|
||||
case "nick":
|
||||
@ -292,6 +296,8 @@ function event(event, data) {
|
||||
}
|
||||
|
||||
user.set("name", data[0]["new"]);
|
||||
|
||||
users.sort();
|
||||
users.trigger("change", {}, users);
|
||||
|
||||
chan.addMessage({
|
||||
@ -317,6 +323,7 @@ function event(event, data) {
|
||||
}
|
||||
var users = chan.get("users");
|
||||
users.remove(users.findWhere({name: data[0].nick}));
|
||||
users.sort();
|
||||
chan.addMessage({
|
||||
from: data[0].nick,
|
||||
type: "part",
|
||||
@ -329,6 +336,7 @@ function event(event, data) {
|
||||
var user = users.findWhere({name: data[0].nick});
|
||||
if (user) {
|
||||
users.remove(user);
|
||||
users.sort();
|
||||
chan.addMessage({
|
||||
from: data[0].nick,
|
||||
type: "quit",
|
||||
|
Loading…
Reference in New Issue
Block a user