diff --git a/server/src/commands/core/join.js b/server/src/commands/core/join.js index 8174a67..d832104 100644 --- a/server/src/commands/core/join.js +++ b/server/src/commands/core/join.js @@ -131,6 +131,7 @@ export async function run({ userid: newPeerList[i].userid, channel, isme: false, + isBot: newPeerList[i].isBot, }); } @@ -144,7 +145,7 @@ export async function run({ // socket.channels.push(channel); nicks.push(userInfo.nick); /* @legacy */ - users.push({ ...{ isme: true }, ...userInfo }); + users.push({ ...{ isme: true, isBot: socket.isBot }, ...userInfo }); // reply with channel peer list server.reply({ diff --git a/server/src/commands/core/session.js b/server/src/commands/core/session.js index 1012400..2d02810 100644 --- a/server/src/commands/core/session.js +++ b/server/src/commands/core/session.js @@ -14,7 +14,7 @@ const createSessionID = () => { }; // module main -export async function run({ server, socket }) { +export async function run({ server, socket, payload }) { // gather connection and channel count let ips = {}; let channels = {}; @@ -54,6 +54,7 @@ export async function run({ server, socket }) { socket.hcProtocol = 2; socket.userid = Math.floor(Math.random() * 9999999999999); socket.hash = server.getSocketHash(socket); + socket.isBot = payload.isBot || false; // dispatch info server.reply({ diff --git a/server/src/commands/utility/_LegacyFunctions.js b/server/src/commands/utility/_LegacyFunctions.js index 5568da8..6662267 100644 --- a/server/src/commands/utility/_LegacyFunctions.js +++ b/server/src/commands/utility/_LegacyFunctions.js @@ -19,8 +19,9 @@ export function upgradeLegacyJoin(server, socket, payload) { // `join` is the legacy entry point, so apply protocol version socket.hcProtocol = 1; - // this would have been applied in the `session` module, apply it now + // these would have been applied in the `session` module, apply it now socket.hash = server.getSocketHash(socket); + socket.isBot = false; // pull the password from the nick const nickArray = payload.nick.split('#', 2);