thelounge/lib/plugins/inputs/part.js

21 lines
440 B
JavaScript
Raw Normal View History

2014-07-07 00:44:31 +00:00
var _ = require("lodash");
2014-07-02 22:00:11 +00:00
module.exports = function(network, chan, cmd, args) {
2014-07-07 00:44:31 +00:00
if (cmd != "part" && cmd != "leave" && cmd != "close") {
2014-07-02 22:00:11 +00:00
return;
}
2014-07-07 00:44:31 +00:00
var client = this;
if (chan.type == "query") {
network.channels = _.without(network.channels, chan);
client.emit("part", {
chan: chan.id
});
} else {
var irc = network.irc;
if (args.length === 0) {
args.push(chan.name);
}
irc.part(args);
2014-07-02 22:00:11 +00:00
}
2014-06-26 23:05:47 +00:00
};