Merge pull request #2019 from thelounge/yamanickill/save-queries
Save query channels in user.json
This commit is contained in:
commit
c605f35335
@ -179,6 +179,7 @@ Client.prototype.connect = function(args) {
|
|||||||
channels.push(new Chan({
|
channels.push(new Chan({
|
||||||
name: chan.name,
|
name: chan.name,
|
||||||
key: chan.key || "",
|
key: chan.key || "",
|
||||||
|
type: chan.type,
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -115,13 +115,16 @@ Network.prototype.export = function() {
|
|||||||
|
|
||||||
network.channels = this.channels
|
network.channels = this.channels
|
||||||
.filter(function(channel) {
|
.filter(function(channel) {
|
||||||
return channel.type === Chan.Type.CHANNEL;
|
return channel.type === Chan.Type.CHANNEL || channel.type === Chan.Type.QUERY;
|
||||||
})
|
})
|
||||||
.map(function(chan) {
|
.map(function(chan) {
|
||||||
return _.pick(chan, [
|
const keys = ["name"];
|
||||||
"name",
|
if (chan.type === Chan.Type.CHANNEL) {
|
||||||
"key",
|
keys.push("key");
|
||||||
]);
|
} else if (chan.type === Chan.Type.QUERY) {
|
||||||
|
keys.push("type");
|
||||||
|
}
|
||||||
|
return _.pick(chan, keys);
|
||||||
});
|
});
|
||||||
|
|
||||||
return network;
|
return network;
|
||||||
|
@ -32,10 +32,9 @@ exports.input = function(network, chan, cmd, args) {
|
|||||||
this.emit("part", {
|
this.emit("part", {
|
||||||
chan: target.id,
|
chan: target.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (target.type === Chan.Type.CHANNEL) {
|
|
||||||
this.save();
|
this.save();
|
||||||
|
|
||||||
|
if (target.type === Chan.Type.CHANNEL) {
|
||||||
if (network.irc) {
|
if (network.irc) {
|
||||||
network.irc.part(target.name, partMessage);
|
network.irc.part(target.name, partMessage);
|
||||||
}
|
}
|
||||||
|
@ -50,4 +50,5 @@ exports.input = function(network, chan, cmd, args) {
|
|||||||
chan: newChan.getFilteredClone(true),
|
chan: newChan.getFilteredClone(true),
|
||||||
shouldOpen: true,
|
shouldOpen: true,
|
||||||
});
|
});
|
||||||
|
this.save();
|
||||||
};
|
};
|
||||||
|
@ -41,6 +41,7 @@ describe("Network", function() {
|
|||||||
{name: "&foobar", key: ""},
|
{name: "&foobar", key: ""},
|
||||||
{name: "#secret", key: "foo"},
|
{name: "#secret", key: "foo"},
|
||||||
{name: "&secure", key: "bar"},
|
{name: "&secure", key: "bar"},
|
||||||
|
{name: "PrivateChat", type: "query"},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user