78 m_state = RCON_DISCONNECTED; |
78 m_state = RCON_DISCONNECTED; |
79 } |
79 } |
80 |
80 |
81 // ------------------------------------------------------------------------------------------------- |
81 // ------------------------------------------------------------------------------------------------- |
82 // |
82 // |
83 bool RCONSession::send(const ByteArray& packet) |
83 bool RCONSession::send(const std::vector<unsigned char>& packet) |
84 { |
84 { |
85 std::stringstream errors; |
85 std::stringstream errors; |
86 const bool result = m_socket.send(m_address, packet, errors); |
86 const bool result = m_socket.send(m_address, packet, errors); |
87 if (not result) |
87 if (not result) |
88 { |
88 { |
297 // ------------------------------------------------------------------------------------------------- |
297 // ------------------------------------------------------------------------------------------------- |
298 // |
298 // |
299 void RCONSession::sendPassword() |
299 void RCONSession::sendPassword() |
300 { |
300 { |
301 m_interface->print("Authenticating...\n"); |
301 m_interface->print("Authenticating...\n"); |
302 ByteArray message; |
302 std::vector<unsigned char> message; |
303 Bytestream stream(message); |
303 Bytestream stream(message); |
304 stream.writeByte(CLRC_PASSWORD); |
304 stream.writeByte(CLRC_PASSWORD); |
305 stream.writeString(md5((m_salt + m_password).data())); |
305 stream.writeString(md5((m_salt + m_password).data())); |
306 send(message); |
306 send(message); |
307 bumpLastPing(); |
307 bumpLastPing(); |
336 bool RCONSession::sendCommand(const std::string& commandString) |
336 bool RCONSession::sendCommand(const std::string& commandString) |
337 { |
337 { |
338 if (m_state != RCON_CONNECTED or commandString.empty()) |
338 if (m_state != RCON_CONNECTED or commandString.empty()) |
339 return false; |
339 return false; |
340 |
340 |
341 ByteArray message; |
341 std::vector<unsigned char> message; |
342 Bytestream stream(message); |
342 Bytestream stream(message); |
343 stream.writeByte(CLRC_COMMAND); |
343 stream.writeByte(CLRC_COMMAND); |
344 stream.writeString(commandString); |
344 stream.writeString(commandString); |
345 send(message); |
345 send(message); |
346 bumpLastPing(); |
346 bumpLastPing(); |
379 // |
379 // |
380 void RCONSession::requestTabCompletion(const std::string& part) |
380 void RCONSession::requestTabCompletion(const std::string& part) |
381 { |
381 { |
382 if (m_serverProtocol >= 4) |
382 if (m_serverProtocol >= 4) |
383 { |
383 { |
384 ByteArray message; |
384 std::vector<unsigned char> message; |
385 Bytestream stream(message); |
385 Bytestream stream(message); |
386 stream.writeByte(CLRC_TABCOMPLETE); |
386 stream.writeByte(CLRC_TABCOMPLETE); |
387 stream.writeString(part); |
387 stream.writeString(part); |
388 send(message); |
388 send(message); |
389 bumpLastPing(); |
389 bumpLastPing(); |