Change 'logs/' location

This commit is contained in:
Mattias Erming 2014-10-14 21:25:04 +02:00
parent 193b30b8a7
commit dcdec78c4e
3 changed files with 41 additions and 41 deletions

View File

@ -77,7 +77,8 @@ Client.prototype.emit = function(event, data) {
if (this.sockets !== null) { if (this.sockets !== null) {
this.sockets.in(this.id).emit(event, data); this.sockets.in(this.id).emit(event, data);
} }
if ((this.config || {}).log === true) { var config = this.config || {};
if (config.log === true) {
if (event == "msg") { if (event == "msg") {
var target = this.find(data.chan); var target = this.find(data.chan);
if (target) { if (target) {

View File

@ -81,7 +81,7 @@ ClientManager.prototype.addUser = function(name, password) {
var user = { var user = {
user: name, user: name,
password: password || "", password: password || "",
logs: false, log: false,
networks: [] networks: []
}; };
fs.mkdirSync(path); fs.mkdirSync(path);

View File

@ -3,12 +3,12 @@ var mkdirp = require("mkdirp");
var moment = require("moment"); var moment = require("moment");
var Helper = require("./helper"); var Helper = require("./helper");
module.exports = { module.exports.write = function(user, network, chan, msg) {
write: function(user, network, chan, msg) {
var path = Helper.HOME + "/users/" + user + "/logs/" + network;
try { try {
var path = Helper.HOME + "/logs/" + user + "/" + network;
mkdirp.sync(path); mkdirp.sync(path);
} catch(e) { } catch(e) {
console.log(e);
return; return;
} }
@ -42,5 +42,4 @@ module.exports = {
} }
} }
); );
}
}; };