diff --git a/README.md b/README.md index 73f949c8..75f3752a 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/client/js/chat.js b/client/js/chat.js index ff02bc4b..ab73402b 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -17,6 +17,7 @@ $(function() { "/notice", "/op", "/part", + "/partall", "/query", "/quit", "/raw", diff --git a/lib/models/chan.js b/lib/models/chan.js index debe427e..a7dff4d1 100644 --- a/lib/models/chan.js +++ b/lib/models/chan.js @@ -6,7 +6,7 @@ function Chan(attr) { _.merge(this, _.extend({ id: global.id = ++global.id || 1, name: "", - type: "", + type: "channel", messages: [], users: [], }, attr)); diff --git a/lib/server.js b/lib/server.js index 9e763c60..4dc9025d 100644 --- a/lib/server.js +++ b/lib/server.js @@ -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;