aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--server/src/commands/core/join.js4
-rw-r--r--server/src/commands/mod/ban.js4
-rw-r--r--server/src/commands/utility/UAC/_info.js17
3 files changed, 23 insertions, 2 deletions
diff --git a/server/src/commands/core/join.js b/server/src/commands/core/join.js
index b17e1fc..c4f4f4f 100644
--- a/server/src/commands/core/join.js
+++ b/server/src/commands/core/join.js
@@ -144,7 +144,7 @@ export async function run(core, server, socket, data) {
nick: newPeerList[i].nick,
trip: newPeerList[i].trip,
utype: newPeerList[i].uType, /* @legacy */
- hash: newPeerList[i].userHash,
+ hash: newPeerList[i].hash,
level: newPeerList[i].level,
userid: newPeerList[i].userid,
channel: data.channel,
@@ -166,7 +166,7 @@ export async function run(core, server, socket, data) {
nick: socket.nick,
trip: socket.trip,
utype: socket.uType,
- hash: socket.userHash,
+ hash: socket.hash,
level: socket.level,
userid: socket.userid,
channel: data.channel,
diff --git a/server/src/commands/mod/ban.js b/server/src/commands/mod/ban.js
index b33b55e..994bc1c 100644
--- a/server/src/commands/mod/ban.js
+++ b/server/src/commands/mod/ban.js
@@ -46,12 +46,16 @@ export async function run(core, server, socket, data) {
server.broadcast({
cmd: 'info',
text: `Banned ${targetNick}`,
+ user: UAC.getUserDetails(badClient),
}, { channel: socket.channel, level: (level) => level < UAC.levels.moderator });
// notify mods
server.broadcast({
cmd: 'info',
text: `${socket.nick}#${socket.trip} banned ${targetNick} in ${socket.channel}, userhash: ${badClient.hash}`,
+ channel: socket.channel,
+ user: UAC.getUserDetails(badClient),
+ banner: UAC.getUserDetails(socket),
}, { level: UAC.isModerator });
// force connection closed
diff --git a/server/src/commands/utility/UAC/_info.js b/server/src/commands/utility/UAC/_info.js
index c5010a6..7981afc 100644
--- a/server/src/commands/utility/UAC/_info.js
+++ b/server/src/commands/utility/UAC/_info.js
@@ -91,6 +91,23 @@ export function isTrustedUser(level) {
}
/**
+ * Return an object containing public information about the socket
+ * @public
+ * @param {WebSocket} socket Target client
+ * @return {Object}
+ */
+export function getUserDetails(socket) {
+ return {
+ uType: socket.uType,
+ nick: socket.nick,
+ trip: socket.trip || 'null',
+ hash: socket.hash,
+ level: socket.level,
+ userid: socket.userid,
+ };
+}
+
+/**
* Returns true if the nickname is valid
* @public
* @param {string} nick Nickname to verify