diff --git a/server/BanchoServer.ts b/server/BanchoServer.ts index edabed5..5cfda62 100644 --- a/server/BanchoServer.ts +++ b/server/BanchoServer.ts @@ -234,11 +234,11 @@ export default async function HandleRequest(req:IncomingMessage, res:ServerRespo break; case Packets.Client_ChannelJoin: - //ChannelJoin(PacketUser, CurrentPacket.data); + PacketUser.joinChannel(CurrentPacket.data); break; case Packets.Client_ChannelPart: - //ChannelPart(PacketUser, CurrentPacket.data); + PacketUser.leaveChannel(CurrentPacket.data); break; case Packets.Client_SetAwayMessage: diff --git a/server/objects/User.ts b/server/objects/User.ts index 283605b..112e366 100644 --- a/server/objects/User.ts +++ b/server/objects/User.ts @@ -5,6 +5,7 @@ import DataStream from "./DataStream"; import StatusUpdate from "../packets/StatusUpdate"; import Shared from "../objects/Shared"; import Slot from "./Slot"; +import Channel from "./Channel"; const rankingModes = [ "pp_raw", @@ -144,4 +145,18 @@ export default class User { StatusUpdate(this, this.id); } } + + joinChannel(channelName:string) { + const channel = this.shared.chatManager.GetChannelByName(channelName); + if (channel instanceof Channel) { + channel.Join(this); + } + } + + leaveChannel(channelName:string) { + const channel = this.shared.chatManager.GetChannelByName(channelName); + if (channel instanceof Channel) { + channel.Leave(this); + } + } } \ No newline at end of file