public void Add_Connected_Player( ESessionID session_id, EPersistenceID persistence_id, CClientHelloRequest request )
        {
            if ( Get_Player_By_Session_ID( session_id ) != null )
            {
                Send_Message( new CClientHelloResponse( request.RequestID, EConnectRefusalReason.Name_Already_Connected ), session_id );
                Add_Network_Operation( new CDisconnectRequestOperation( session_id, EDisconnectReason.Server_Request ) );
                return;
            }

            if ( Get_Active_Player_By_Persistence_ID( persistence_id ) != null )
            {
                Send_Message( new CClientHelloResponse( request.RequestID, EConnectRefusalReason.Name_Already_Connected ), session_id );
                Add_Network_Operation( new CDisconnectRequestOperation( session_id, EDisconnectReason.Server_Request ) );
                return;
            }

            CPersistentPlayerData player_data = CDatabaseProxy.Instance.Get_Player_Data( persistence_id );
            if ( player_data == null )
            {
                Send_Message( new CClientHelloResponse( request.RequestID, EConnectRefusalReason.Internal_Persistence_Error ), session_id );
                Add_Network_Operation( new CDisconnectRequestOperation( session_id, EDisconnectReason.Server_Request ) );
                return;
            }

            CConnectedPlayer player = null;
            if ( m_SuspendedPlayers.TryGetValue( persistence_id, out player ) )
            {
                m_SuspendedPlayers.Remove( persistence_id );
                m_ConnectedPlayers.Add( persistence_id, player );
                player.Resume( session_id );
                CServerResource.Output_Text( EServerTextID.Server_Player_Reconnected_Notice, player.Name );
                CLog.Log( ELoggingChannel.Logic, ELogLevel.Low, CServerResource.Get_Text( EServerTextID.Server_Player_Reconnected_Notice, player.Name ) );
            }
            else
            {
                player = new CConnectedPlayer( persistence_id, session_id, request.Name );
                m_ConnectedPlayers.Add( persistence_id, player );
                CServerResource.Output_Text( EServerTextID.Server_Player_Connected_Notice, player.Name );
                CLog.Log( ELoggingChannel.Logic, ELogLevel.Low, CServerResource.Get_Text( EServerTextID.Server_Player_Connected_Notice, player.Name ) );
            }

            m_ActiveSessions.Add( session_id, persistence_id );

            // add to chat
            CAsyncBackendOperations.New_Player_Announce_To_Chat( player, player_data, request.RequestID );
        }
        public static void New_Player_Announce_To_Chat( CConnectedPlayer player, CPersistentPlayerData player_data, EMessageRequestID client_request_id )
        {
            ESessionID session_id = player.SessionID;
            CAnnouncePlayerToChatServerRequest announce_request = new CAnnouncePlayerToChatServerRequest( session_id, player.PersistenceID, player.Name, player_data.IgnoreList );
            announce_request.Handler = delegate( CResponseMessage response ) { On_Chat_Server_Announce_Response( response, session_id, client_request_id ); };

            CServerMessageRouter.Send_Message_To_Chat_Server( announce_request );
        }
 public void On_Chat_Server_Announce_Response( CConnectedPlayer player, bool success, EMessageRequestID hello_request_id )
 {
     ESessionID session_id = player.SessionID;
     if ( success == false )
     {
         Send_Message( new CClientHelloResponse( hello_request_id, EConnectRefusalReason.Unable_To_Announce_To_Chat_Server ), session_id );
         Add_Network_Operation( new CDisconnectRequestOperation( session_id, EDisconnectReason.Server_Request ) );
     }
     else
     {
         Join_Required_Channel_On_Connect( player.PersistenceID, hello_request_id );
     }
 }