private void receiveRenamed ( ClientSocket client , DataInputStream buffer , byte from , StateConnection expected ) throws IOException { if ( ServerImpl . checkValidity ( client , from , expected ) ) { // Receive the name final byte [ ] name = new byte [ buffer . readByte ( ) ] ; if ( buffer . read ( name ) == - 1 ) { throw new IOException ( "Unable to read client name on rename !" ) ; } final String newName = new String ( name , NetworkMessage . CHARSET ) ; Verbose . info ( SERVER , client . getName ( ) , " rennamed to " , newName ) ; client . setName ( newName ) ; for ( final ClientListener listener : listeners ) { listener . notifyClientNameChanged ( Byte . valueOf ( client . getId ( ) ) , client . getName ( ) ) ; } // Notify all clients for ( final ClientSocket other : clients . values ( ) ) { other . getOut ( ) . writeByte ( NetworkMessageSystemId . OTHER_CLIENT_RENAMED ) ; ServerImpl . writeIdAndName ( other , client . getId ( ) , client . getName ( ) ) ; other . getOut ( ) . flush ( ) ; } } }
Update the receive renamed state .