Пример #1
0
 public IReadOnlyCollection<ServerClient> Find(TalkyChannel channel)
 {
     lock (_lock)
     {
         return _clients.FindAll(client => Equals(client.Channel, channel));
     }
 }
Пример #2
0
        public void Kick(ServerClient client, string reason = null)
        {
            if (!(this is LobbyChannel))
            {
                LobbyChannel lobby = ChannelRepository.Instance.GetLobby();
                if (lobby == null)
                {
                    return;
                }

                if (client.Channel.Equals(lobby))
                {
                    return;
                }

                TalkyChannel oldChannel = client.Channel;
                client.JoinChannel(lobby, false);

                if (reason != null)
                {
                    oldChannel.BroadcastMessage(client.Username + " was kicked from the channel (" + reason + ").");
                }
                oldChannel.BroadcastMessage(client.Username + " was kicked from the channel.");
            }
        }
Пример #3
0
 public void Store(TalkyChannel channel)
 {
     lock (_lock)
     {
         _channels.Add(channel);
     }
 }
Пример #4
0
 public void Remove(TalkyChannel channel)
 {
     lock (_lock)
     {
         _channels.Remove(channel);
     }
 }
Пример #5
0
        public void JoinChannel(TalkyChannel channel, bool announce = true)
        {
            if (channel.Locked)
            {
                if (Account == null || !Account.Role.Equals("admin"))
                {
                    SendMessage("§2That channel is locked!");
                    return;
                }
            }

            if (Channel != null)
            {
                Channel.BroadcastMessage(Username + " left " + "§4" + Channel.Name + "§0.");
            }

            Channel = channel;

            if (announce)
            {
                channel.BroadcastMessage(Username + " joined " + "§4" + channel.Name + "§0!");
            }
        }