java.lang.Object
nl.andrewl.concord_server.channel.ChannelManager
This manager is responsible for keeping track of all the channels in the
server, and controlling modifications to them.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.dizitart.no2.NitriteCollection
private final ConcordServer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChannel
(Channel channel) getChannelById
(UUID id) getChannelByName
(String name) getPrivateChannel
(Set<UUID> clientIds) Gets or creates a private channel for the given client ids to be able to communicate together.getPrivateChannel
(UUID clientId, UUID channelId) Gets a private channel, given the id of a client who is part of the channel, and the id of the channel.private Channel
getPrivateChannelFromDatabase
(Set<UUID> clientIds) Gets and instantiates a private channel from information stored in the "private-channels" collection of the database, or creates it if it does not exist yet.void
moveToChannel
(ClientThread client, Channel channel) Moves a client to the given channel.void
removeChannel
(Channel channel)
-
Field Details
-
server
-
channelNameMap
-
channelIdMap
-
privateChannels
-
privateChannelCollection
private final org.dizitart.no2.NitriteCollection privateChannelCollection
-
-
Constructor Details
-
ChannelManager
-
-
Method Details
-
getChannels
-
getDefaultChannel
-
addChannel
-
removeChannel
-
getChannelByName
-
getChannelById
-
moveToChannel
Moves a client to the given channel. This involves removing the client from whatever channel they're currently in, if any, moving them to the new channel, and sending them a message to indicate that it has been done.- Parameters:
client
- The client to move.channel
- The channel to move the client to.
-
getPrivateChannel
Gets or creates a private channel for the given client ids to be able to communicate together. No other clients are allowed to access the channel.- Parameters:
clientIds
- The id of each client which should have access to the channel.- Returns:
- The private channel.
-
getPrivateChannel
Gets a private channel, given the id of a client who is part of the channel, and the id of the channel.- Parameters:
clientId
- The id of the client that's requesting the channel.channelId
- The id of the private channel.- Returns:
- The private channel.
-
getPrivateChannelFromDatabase
Gets and instantiates a private channel from information stored in the "private-channels" collection of the database, or creates it if it does not exist yet.- Parameters:
clientIds
- The set of client ids that the channel is for.- Returns:
- The private channel.
-