mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-09 09:12:20 +02:00
d5e67d6503
Fixes the /part command closing the wrong window. The current implementation simply passes all arguments to slate, which ended up parting every arguments. This changes the command to `/part message`, and always parts the current window. This will be fixed further once irc-framework is merged.
30 lines
585 B
JavaScript
30 lines
585 B
JavaScript
var _ = require("lodash");
|
|
var Msg = require("../../models/msg");
|
|
|
|
exports.commands = ["close", "leave", "part"];
|
|
|
|
exports.input = function(network, chan, cmd, args) {
|
|
if (chan.type === "lobby") {
|
|
this.emit("msg", {
|
|
chan: chan.id,
|
|
msg: new Msg({
|
|
type: Msg.Type.ERROR,
|
|
text: "You can not part from networks, use /quit instead."
|
|
})
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (chan.type === "channel") {
|
|
var irc = network.irc;
|
|
irc.part(chan.name, args.join(" "));
|
|
}
|
|
|
|
network.channels = _.without(network.channels, chan);
|
|
this.emit("part", {
|
|
chan: chan.id
|
|
});
|
|
|
|
return true;
|
|
};
|