From 331a4626a000eee5b3060134326bc9735051bc70 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sun, 6 Aug 2017 20:42:33 -0700 Subject: [PATCH] Fix borrow-rank --- src/user.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/user.js b/src/user.js index 0dc7cdba..642cb9a8 100644 --- a/src/user.js +++ b/src/user.js @@ -34,21 +34,25 @@ function User(socket, ip, loginInfo) { guest: false }); socket.emit("rank", this.account.effectiveRank); + if (this.account.globalRank >= 255) { + this.initAdminCallbacks(); + } + this.emit("login", this.account); LOGGER.info(ip + " logged in as " + this.getName()); } else { this.account = new Account.Account(this.realip, null, socket.context.aliases); socket.emit("rank", -1); this.setFlag(Flags.U_READY); + this.once("login", account => { + if (account.globalRank >= 255) { + this.initAdminCallbacks(); + } + }); } socket.once("joinChannel", data => this.handleJoinChannel(data)); socket.once("initACP", () => this.handleInitACP()); socket.on("login", data => this.handleLogin(data)); - this.once("login", account => { - if (account.globalRank >= 255) { - this.initAdminCallbacks(); - } - }); } User.prototype = Object.create(EventEmitter.prototype);