parent
5eb5b99115
commit
d6d7df62fe
@ -66,8 +66,9 @@ function Client(manager, name, config) {
|
||||
if (typeof config !== "object") {
|
||||
config = {};
|
||||
}
|
||||
|
||||
_.merge(this, {
|
||||
awayMessage: "",
|
||||
awayMessage: config.awayMessage || "",
|
||||
lastActiveChannel: -1,
|
||||
attachedClients: {},
|
||||
config: config,
|
||||
@ -482,8 +483,6 @@ Client.prototype.clientAttach = function(socketId) {
|
||||
var client = this;
|
||||
var save = false;
|
||||
|
||||
client.attachedClients[socketId] = client.lastActiveChannel;
|
||||
|
||||
if (client.awayMessage && _.size(client.attachedClients) === 0) {
|
||||
client.networks.forEach(function(network) {
|
||||
// Only remove away on client attachment if
|
||||
@ -494,6 +493,8 @@ Client.prototype.clientAttach = function(socketId) {
|
||||
});
|
||||
}
|
||||
|
||||
client.attachedClients[socketId] = client.lastActiveChannel;
|
||||
|
||||
// Update old networks to store ip and hostmask
|
||||
client.networks.forEach(network => {
|
||||
if (!network.ip) {
|
||||
@ -539,7 +540,6 @@ Client.prototype.save = _.debounce(function SaveClient() {
|
||||
|
||||
const client = this;
|
||||
let json = {};
|
||||
json.awayMessage = client.awayMessage;
|
||||
json.networks = this.networks.map(n => n.export());
|
||||
client.manager.updateUser(client.name, json);
|
||||
}, 1000, {maxWait: 10000});
|
||||
|
@ -104,6 +104,7 @@ ClientManager.prototype.addUser = function(name, password, enableLog) {
|
||||
user: name,
|
||||
password: password || "",
|
||||
log: enableLog,
|
||||
awayMessage: "",
|
||||
networks: []
|
||||
};
|
||||
fs.writeFileSync(
|
||||
|
@ -14,4 +14,6 @@ exports.input = function(network, chan, cmd, args) {
|
||||
}
|
||||
|
||||
network.awayMessage = reason;
|
||||
|
||||
this.save();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user