2020-12-10 17:46:15 +01:00
|
|
|
import {
|
|
|
|
ServerToAdminClientMessage,
|
2021-06-08 16:30:58 +02:00
|
|
|
UserJoinedRoomMessage, UserLeftRoomMessage
|
2020-12-10 17:46:15 +01:00
|
|
|
} from "../Messages/generated/messages_pb";
|
|
|
|
import {AdminSocket} from "../RoomManager";
|
|
|
|
|
|
|
|
|
|
|
|
export class Admin {
|
|
|
|
public constructor(
|
|
|
|
private readonly socket: AdminSocket
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
2021-01-15 03:19:58 +01:00
|
|
|
public sendUserJoin(uuid: string, name: string, ip: string): void {
|
2021-01-18 15:31:19 +01:00
|
|
|
const serverToAdminClientMessage = new ServerToAdminClientMessage();
|
2021-01-18 15:07:40 +01:00
|
|
|
|
2021-01-18 15:31:19 +01:00
|
|
|
const userJoinedRoomMessage = new UserJoinedRoomMessage();
|
2021-01-18 15:07:40 +01:00
|
|
|
userJoinedRoomMessage.setUuid(uuid);
|
|
|
|
userJoinedRoomMessage.setName(name);
|
|
|
|
userJoinedRoomMessage.setIpaddress(ip);
|
|
|
|
|
|
|
|
serverToAdminClientMessage.setUserjoinedroom(userJoinedRoomMessage);
|
|
|
|
|
2020-12-10 17:46:15 +01:00
|
|
|
this.socket.write(serverToAdminClientMessage);
|
|
|
|
}
|
|
|
|
|
2021-01-18 15:07:40 +01:00
|
|
|
public sendUserLeft(uuid: string/*, name: string, ip: string*/): void {
|
2021-01-18 15:31:19 +01:00
|
|
|
const serverToAdminClientMessage = new ServerToAdminClientMessage();
|
2021-01-18 15:07:40 +01:00
|
|
|
|
2021-01-18 15:31:19 +01:00
|
|
|
const userLeftRoomMessage = new UserLeftRoomMessage();
|
2021-01-18 15:07:40 +01:00
|
|
|
userLeftRoomMessage.setUuid(uuid);
|
|
|
|
|
|
|
|
serverToAdminClientMessage.setUserleftroom(userLeftRoomMessage);
|
|
|
|
|
2020-12-10 17:46:15 +01:00
|
|
|
this.socket.write(serverToAdminClientMessage);
|
|
|
|
}
|
|
|
|
}
|