--- a/sources/network/rconsession.cpp Mon Dec 15 20:18:56 2014 +0200 +++ b/sources/network/rconsession.cpp Mon Dec 15 20:19:18 2014 +0200 @@ -187,6 +187,37 @@ case SVRC_UPDATE: process_server_updates (packet); break; + + case SVRC_TOOMANYTABCOMPLETES: + { + unsigned int numCompletions = packet.read_short(); + print ("%1 completions for '%2'.\n", + int (numCompletions), m_lastTabComplete); + } + break; + + case SVRC_TABCOMPLETE: + { + StringList completes; + + for (signed int i = packet.read_byte(); i > 0; --i) + completes << packet.read_string(); + + if (completes.size() == 1) + Interface::tab_complete (m_lastTabComplete, completes[0]); + else if (not completes.is_empty()) + { + print ("Completions for '%1':\n", m_lastTabComplete); + + for (int i = 0; i < completes.size(); i += 8) + { + Range<int> spliceRange (i, min (i + 8, completes.size() - 1)); + StringList splice (completes.splice (spliceRange)); + print ("- %1\n", splice.join (", ")); + } + } + } + break; } } } @@ -340,3 +371,21 @@ { return m_level; } + +// ------------------------------------------------------------------------------------------------- +// +METHOD +RCONSession::request_tab_complete (const String& part) -> void +{ + if (m_serverProtocol >= 4) + { + Bytestream packet; + packet.write_byte (CLRC_TABCOMPLETE); + packet.write_string (part); + send (packet); + bump_last_ping(); + m_lastTabComplete = part; + } + else + print ("Server protocol is %1, cannot tab-complete\n", m_serverProtocol); +}