--- a/sources/network/rconsession.cpp Wed Jul 20 17:57:35 2016 +0300 +++ b/sources/network/rconsession.cpp Wed Jul 20 18:24:13 2016 +0300 @@ -123,19 +123,18 @@ // void RCONSession::handle_packet (Datagram& datagram) { - if (datagram.from != m_address) + if (datagram.address != m_address) return; try { - Bytestream& packet = datagram.data; - int32_t header = packet.read_long(); - int32_t sequenceNumber = (header != 0) ? packet.read_long() : 0; + int32_t header = datagram.message.read_long(); + int32_t sequenceNumber = (header != 0) ? datagram.message.read_long() : 0; m_interface->print("Recieved packet with header 0x%x and sequence number #%d\n", header, sequenceNumber); - while (packet.bytes_left() > 0) + while (datagram.message.bytes_left() > 0) { - int header = packet.read_byte(); + int header = datagram.message.read_byte(); switch (ServerResponse (header)) { @@ -150,7 +149,7 @@ break; case SVRC_SALT: - m_salt = packet.read_string(); + m_salt = datagram.message.read_string(); m_state = RCON_AUTHENTICATING; send_password(); break; @@ -162,7 +161,7 @@ case SVRC_MESSAGE: { - String message = packet.read_string(); + String message = datagram.message.read_string(); message.normalize(); m_interface->printText ("%s\n", message.chars()); } @@ -170,19 +169,19 @@ case SVRC_LOGGEDIN: m_interface->print ("Login successful!\n"); - m_serverProtocol = packet.read_byte(); - m_hostname = packet.read_string(); + m_serverProtocol = datagram.message.read_byte(); + m_hostname = datagram.message.read_string(); m_interface->setTitle (m_hostname); m_state = RCON_CONNECTED; - for (int i = packet.read_byte(); i > 0; --i) - process_server_updates (packet); + for (int i = datagram.message.read_byte(); i > 0; --i) + process_server_updates (datagram.message); m_interface->print ("Previous messages:\n"); - for (int i = packet.read_byte(); i > 0; --i) + for (int i = datagram.message.read_byte(); i > 0; --i) { - String message = packet.read_string(); + String message = datagram.message.read_string(); message.normalize(); m_interface->printText ("--- %s\n", message.chars()); } @@ -195,12 +194,12 @@ break; case SVRC_UPDATE: - process_server_updates (packet); + process_server_updates (datagram.message); break; case SVRC_TOOMANYTABCOMPLETES: { - unsigned int numCompletions = packet.read_short(); + unsigned int numCompletions = datagram.message.read_short(); m_interface->print ("%d completions for '%s'.\n", int (numCompletions), m_lastTabComplete.chars()); } @@ -209,10 +208,10 @@ case SVRC_TABCOMPLETE: { StringList completes; - completes.resize(packet.read_byte()); + completes.resize(datagram.message.read_byte()); for (String& completion : completes) - completion = packet.read_string(); + completion = datagram.message.read_string(); if (completes.size() == 1) { @@ -233,22 +232,22 @@ break; case SVRC_WATCHINGCVAR: - m_interface->print ("You are now watching %s\n", packet.read_string().chars()); - m_interface->print ("Its value is: %s\n", packet.read_string().chars()); + m_interface->print ("You are now watching %s\n", datagram.message.read_string().chars()); + m_interface->print ("Its value is: %s\n", datagram.message.read_string().chars()); break; case SVRC_ALREADYWATCHINGCVAR: - m_interface->print ("You are already watching %s\n", packet.read_string().chars()); + m_interface->print ("You are already watching %s\n", datagram.message.read_string().chars()); break; case SVRC_WATCHCVARNOTFOUND: - m_interface->print ("CVar %s not found\n", packet.read_string().chars()); + m_interface->print ("CVar %s not found\n", datagram.message.read_string().chars()); break; case SVRC_CVARCHANGED: { - String name = packet.read_string(); - String value = packet.read_string(); + String name = datagram.message.read_string(); + String value = datagram.message.read_string(); m_interface->print ("The value of CVar %s", name.chars()); m_interface->print (" is now %s\n", value.chars()); @@ -262,7 +261,7 @@ break; case SVRC_YOUREDISCONNECTED: - m_interface->print ("You have been disconnected: %s\n", packet.read_string().chars()); + m_interface->print ("You have been disconnected: %s\n", datagram.message.read_string().chars()); m_interface->disconnected(); break; }