Merge pull request #283 from fbm-static/patch/02
fix commands magically being removed
This commit is contained in:
commit
c3c2b5487c
@ -135,9 +135,9 @@ Client.prototype.connect = function(args) {
|
|||||||
server.socket = socket;
|
server.socket = socket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var stream = args.tls ? tls.connect(server) : net.connect(server);
|
var stream = args.tls ? tls.connect(server) : net.connect(server);
|
||||||
|
|
||||||
stream.on("error", function(e) {
|
stream.on("error", function(e) {
|
||||||
console.log("Client#connect():\n" + e);
|
console.log("Client#connect():\n" + e);
|
||||||
stream.end();
|
stream.end();
|
||||||
@ -173,6 +173,7 @@ Client.prototype.connect = function(args) {
|
|||||||
password: args.password,
|
password: args.password,
|
||||||
username: username,
|
username: username,
|
||||||
realname: realname,
|
realname: realname,
|
||||||
|
commands: args.commands
|
||||||
});
|
});
|
||||||
|
|
||||||
network.irc = irc;
|
network.irc = irc;
|
||||||
@ -329,7 +330,7 @@ Client.prototype.save = function(force) {
|
|||||||
if(config.public) {
|
if(config.public) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!force) {
|
if (!force) {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
timer = setTimeout(function() {
|
timer = setTimeout(function() {
|
||||||
@ -337,24 +338,24 @@ Client.prototype.save = function(force) {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = this.name;
|
var name = this.name;
|
||||||
var path = Helper.HOME + "/users/" + name + ".json";
|
var path = Helper.HOME + "/users/" + name + ".json";
|
||||||
|
|
||||||
var networks = _.map(
|
var networks = _.map(
|
||||||
this.networks,
|
this.networks,
|
||||||
function(n) {
|
function(n) {
|
||||||
return n.export();
|
return n.export();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
var json = {};
|
var json = {};
|
||||||
fs.readFile(path, "utf-8", function(err, data) {
|
fs.readFile(path, "utf-8", function(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
json = JSON.parse(data);
|
json = JSON.parse(data);
|
||||||
json.networks = networks;
|
json.networks = networks;
|
||||||
@ -362,7 +363,7 @@ Client.prototype.save = function(force) {
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.writeFile(
|
fs.writeFile(
|
||||||
path,
|
path,
|
||||||
JSON.stringify(json, null, " "),
|
JSON.stringify(json, null, " "),
|
||||||
|
@ -12,6 +12,7 @@ function Network(attr) {
|
|||||||
port: 6667,
|
port: 6667,
|
||||||
tls: false,
|
tls: false,
|
||||||
password: "",
|
password: "",
|
||||||
|
commands: [],
|
||||||
username: "",
|
username: "",
|
||||||
realname: "",
|
realname: "",
|
||||||
channels: [],
|
channels: [],
|
||||||
@ -41,7 +42,8 @@ Network.prototype.export = function() {
|
|||||||
"tls",
|
"tls",
|
||||||
"password",
|
"password",
|
||||||
"username",
|
"username",
|
||||||
"realname"
|
"realname",
|
||||||
|
"commands"
|
||||||
]);
|
]);
|
||||||
network.nick = (this.irc || {}).me;
|
network.nick = (this.irc || {}).me;
|
||||||
network.join = _.pluck(
|
network.join = _.pluck(
|
||||||
|
Loading…
Reference in New Issue
Block a user