From 99386510d8d2cf5258266e078e9d46e1a6e119ab Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Tue, 10 Apr 2018 16:15:44 +0300 Subject: [PATCH] Replace client ids with guids --- src/client.js | 4 ++-- src/plugins/irc-events/connection.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client.js b/src/client.js index b5f1c655..76562aa8 100644 --- a/src/client.js +++ b/src/client.js @@ -11,10 +11,10 @@ const ircFramework = require("irc-framework"); const Helper = require("./helper"); const UAParser = require("ua-parser-js"); const MessageStorage = require("./plugins/sqlite"); +const uuidv4 = require("uuid/v4"); module.exports = Client; -let id = 0; const events = [ "away", "connection", @@ -71,7 +71,7 @@ function Client(manager, name, config = {}) { lastActiveChannel: -1, attachedClients: {}, config: config, - id: id++, + id: uuidv4(), name: name, networks: [], sockets: manager.sockets, diff --git a/src/plugins/irc-events/connection.js b/src/plugins/irc-events/connection.js index 1b45111d..780b52e3 100644 --- a/src/plugins/irc-events/connection.js +++ b/src/plugins/irc-events/connection.js @@ -106,7 +106,7 @@ module.exports = function(irc, network) { if (Helper.config.debug.ircFramework) { irc.on("debug", function(message) { - log.debug("[" + client.name + " (#" + client.id + ") on " + network.name + " (#" + network.id + ")]", message); + log.debug("[" + client.name + " (" + client.id + ") on " + network.name + " (#" + network.id + ")]", message); }); }