Added '/partall' command

This commit is contained in:
Mattias Erming 2014-05-16 15:12:57 +02:00
parent 05920b3ee3
commit 8d5514ea65
4 changed files with 19 additions and 3 deletions

View file

@ -22,7 +22,7 @@ These are the commands currently implemented:
- [x] /notice
- [x] /op
- [x] /part
- [ ] /partall
- [x] /partall
- [x] /query
- [x] /quit
- [x] /raw

View file

@ -17,6 +17,7 @@ $(function() {
"/notice",
"/op",
"/part",
"/partall",
"/query",
"/quit",
"/raw",

View file

@ -6,7 +6,7 @@ function Chan(attr) {
_.merge(this, _.extend({
id: global.id = ++global.id || 1,
name: "",
type: "",
type: "channel",
messages: [],
users: [],
}, attr));

View file

@ -200,9 +200,15 @@ function input(data) {
}
break;
case "part":
if (chan.type != "channel") {
return;
}
case "close":
case "leave":
case "part":
if (chan.type == "lobby") {
return;
}
var id = chan.id;
if (chan.type == "query" || !chan.users.length) {
remove(id);
@ -214,6 +220,14 @@ function input(data) {
}
break;
case "partall":
var part = [];
network.channels.forEach(function(c) {
if (c.type == "channel") part.push(c.name);
});
client.part(part.join(","));
break;
case "topic":
if (client) {
var msg = "TOPIC";
@ -280,6 +294,7 @@ function input(data) {
case "raw":
case "send":
if (client) {
console.log(args.slice(1).join(" "));
client.write(args.slice(1).join(" "));
}
break;