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] /notice
- [x] /op - [x] /op
- [x] /part - [x] /part
- [ ] /partall - [x] /partall
- [x] /query - [x] /query
- [x] /quit - [x] /quit
- [x] /raw - [x] /raw

View file

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

View file

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

View file

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