Merge pull request #453 from thelounge/xpaw/fix-autojoin

Only auto join actual channels
This commit is contained in:
Jérémie Astori 2016-07-03 09:25:38 -04:00 committed by GitHub
commit d231a4b583
4 changed files with 12 additions and 4 deletions

View File

@ -74,7 +74,7 @@ Network.prototype.export = function() {
]);
network.join = _.map(
_.filter(this.channels, {type: "channel"}),
_.filter(this.channels, {type: Chan.Type.CHANNEL}),
"name"
).join(",");

View File

@ -1,3 +1,5 @@
var Chan = require("../../models/chan");
exports.commands = ["invite"];
exports.input = function(network, chan, cmd, args) {
@ -5,7 +7,7 @@ exports.input = function(network, chan, cmd, args) {
if (args.length === 2) {
irc.raw("INVITE", args[0], args[1]); // Channel provided in the command
} else if (args.length === 1 && chan.type === "channel") {
} else if (args.length === 1 && chan.type === Chan.Type.CHANNEL) {
irc.raw("INVITE", args[0], chan.name); // Current channel
}

View File

@ -1,11 +1,12 @@
var _ = require("lodash");
var Msg = require("../../models/msg");
var Chan = require("../../models/chan");
exports.commands = ["close", "leave", "part"];
exports.allowDisconnected = true;
exports.input = function(network, chan, cmd, args) {
if (chan.type === "lobby") {
if (chan.type === Chan.Type.LOBBY) {
chan.pushMessage(this, new Msg({
type: Msg.Type.ERROR,
text: "You can not part from networks, use /quit instead."
@ -18,7 +19,7 @@ exports.input = function(network, chan, cmd, args) {
chan: chan.id
});
if (chan.type === "channel") {
if (chan.type === Chan.Type.CHANNEL) {
this.save();
if (network.irc) {

View File

@ -1,6 +1,7 @@
var _ = require("lodash");
var identd = require("../../identd");
var Msg = require("../../models/msg");
var Chan = require("../../models/chan");
module.exports = function(irc, network) {
var client = this;
@ -32,6 +33,10 @@ module.exports = function(irc, network) {
}
network.channels.forEach(function(chan) {
if (chan.type !== Chan.Type.CHANNEL) {
return;
}
setTimeout(function() {
network.irc.join(chan.name);
}, delay);