1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00

Add command to get information about users to broadcast to clients

This commit is contained in:
MinusGix 2020-03-16 10:29:16 -05:00
parent 2b6e771383
commit 713f00f99f

View File

@ -90,6 +90,23 @@ export function isTrustedUser(level) {
return level >= levels.trustedUser; return level >= levels.trustedUser;
} }
/**
* 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 * Returns true if the nickname is valid
* @public * @public