Example #1
0
        void Clients_ClientAccepted(object sender, System.Net.Sockets.TcpClient e)
        {
            Print("Accepted client from " + e.Client.RemoteEndPoint.ToString());
            UnknownClient _client = new UnknownClient(e);

            _client.ClientRegistered += _client_ClientRegistered;
        }
Example #2
0
        private void _client_ClientRegistered(object sender, string[] e)
        {
            UnknownClient _client = (sender as UnknownClient);

            Print(e[0] + " logged in (" + _client.ClientAddress + ") (" + e[1] + ")");

            if (ClientList.GetClientByGuid(new Guid(e[1])) == null)
            {
                Client i = new Client(_client.Socket, e[0], new Guid(e[1]));
                Channels.MoveClient(i, Channels.DefaultChannel);
                i.ClientDisconnected     += I_ClientDisconnected;
                i.SentMessage            += I_SentMessage;
                i.SentImage              += I_SentImage;
                i.RequestedCreateChannel += I_RequestedCreateChannel;
                i.RequestedSwitchChannel += I_RequestedSwitchChannel;
                i.NotifyLogin();
                ClientList.AddClient(i);
                VoiceServer.AddClient(i);
                BroadcastMessage(i.Username + " connected...");
                UpdateUi();
            }
            else
            {
                _client.SendCommand(TalkLib.ServerCommand.ClientAlreadyConnected);
            }
        }