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