# HG changeset patch # User Teemu Piippo # Date 1418581442 -7200 # Node ID 12e4ff8bb471167df92bedfca74873c172fa7124 # Parent 5f8cdc8febbbb37670953a0b7d53e0e1a715e0ce - cleaned up rcon session messages diff -r 5f8cdc8febbb -r 12e4ff8bb471 sources/network/rconsession.cpp --- a/sources/network/rconsession.cpp Sun Dec 14 20:20:43 2014 +0200 +++ b/sources/network/rconsession.cpp Sun Dec 14 20:24:02 2014 +0200 @@ -101,14 +101,11 @@ METHOD RCONSession::handle_packet (Bytestream& packet, const IPAddress& from) -> void { - print ("Processing packet of %1 bytes\n", packet.written_length()); - try { while (packet.bytes_left() > 0) { int header = packet.read_byte(); - print ("Recieved packet with header %1\n", header); switch (ServerResponse (header)) { @@ -141,12 +138,12 @@ String message = packet.read_string(); if (message.ends_with ("\n")) message.remove_from_end (1); - print ("message: %1\n", message); + print ("%1\n", message); } break; case SVRC_LOGGEDIN: - print ("login successful\n"); + print ("Login successful!\n"); m_serverProtocol = packet.read_byte(); m_hostname = packet.read_string(); m_state = RCON_CONNECTED; @@ -154,12 +151,14 @@ for (int i = packet.read_byte(); i > 0; --i) process_server_updates (packet); + print ("Previous messages:\n"); for (int i = packet.read_byte(); i > 0; --i) { String message = packet.read_string(); message.normalize(); print ("--- %1\n", message); } + print ("End of previous messages.\n"); break; case SVRC_UPDATE: @@ -184,16 +183,16 @@ Vector players; for (int i = packet.read_byte(); i > 0; --i) players << packet.read_string(); - print ("players: %1\n", players); + print ("Players: %1\n", players); } break; case SVRCU_ADMINCOUNT: - print ("num admins: %d1\n", packet.read_byte()); + print ("Admin count: %d1\n", packet.read_byte()); break; case SVRCU_MAP: - print ("new map: %1\n", packet.read_string()); + print ("New level: %1\n", packet.read_string()); break; } } @@ -211,7 +210,7 @@ METHOD RCONSession::send_hello() -> void { - print ("connecting to %1...\n", m_address.to_string (IP_WITH_PORT)); + print ("Connecting to %1...\n", m_address.to_string (IP_WITH_PORT)); Bytestream packet; packet.write_byte (CLRC_BEGINCONNECTION); packet.write_byte (RCON_PROTOCOL_VERSION); @@ -224,10 +223,9 @@ METHOD RCONSession::send_password() -> void { - print ("sending password...\n"); + print ("Authenticating...\n"); Bytestream packet; packet.write_byte (CLRC_PASSWORD); - print ("password: %1\nsalt: %2\nhashed password: %3\n", m_password, m_salt, (m_salt + m_password).md5()); packet.write_string ((m_salt + m_password).md5()); send (packet); bump_last_ping();