Added modes

This commit is contained in:
Mattias Erming 2014-04-08 00:03:21 +02:00
parent dd4c9a400a
commit 87d1883eda
3 changed files with 44 additions and 2 deletions

View File

@ -180,7 +180,7 @@ h2 {
padding: 0 8px; padding: 0 8px;
} }
#chat .messages { #chat .messages {
border-left: 8px solid #f0f0f0; border-left: 8px solid #fafafa;
bottom: 30px; bottom: 30px;
left: 0; left: 0;
overflow-y: auto; overflow-y: auto;

View File

@ -12,6 +12,7 @@ var networks = new models.Networks;
var events = [ var events = [
"join", "join",
"kick", "kick",
"mode",
"motd", "motd",
"message", "message",
"names", "names",
@ -169,7 +170,37 @@ function input(json) {
} }
break; break;
case "op":
case "deop":
case "voice":
case "devoice":
case "mode": case "mode":
if (!client || !args[1]) {
break;
}
var mode;
var user;
if (cmd != "mode") {
user = args[1];
mode = {
"op": "+o",
"deop": "-o",
"voice": "+v",
"devoice": "-v",
}[cmd];
} else if (!args[2]) {
break;
} else {
mode = args[1];
user = args[2];
}
client.mode(
channel.get("name"),
mode,
user
);
break; break;
case "quit": case "quit":
@ -212,6 +243,17 @@ function event(event, data) {
}); });
break; break;
case "mode":
var chan = channels.findWhere({name: data[0].target});
if (typeof chan !== "undefined") {
chan.addMessage({
from: data[0].nick,
message: data[0].mode + " " + data[0].client,
type: "mode",
});
}
break;
case "motd": case "motd":
var messages = data[0].motd; var messages = data[0].motd;
messages.forEach(function(msg) { messages.forEach(function(msg) {

2
node_modules/slate-irc generated vendored

@ -1 +1 @@
Subproject commit d2421f44df1683ccf7b2e6f956fc6c6a6d5d7a2a Subproject commit f992e474d7ad7a79b129c289fb744c2522a99e8c