Allow users to join chat channels
This commit is contained in:
parent
469cbb9bc9
commit
a00aba5825
2 changed files with 17 additions and 2 deletions
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue