159 break; |
159 break; |
160 |
160 |
161 case SVRC_UPDATE: |
161 case SVRC_UPDATE: |
162 process_server_updates (packet); |
162 process_server_updates (packet); |
163 break; |
163 break; |
|
164 |
|
165 case SVRC_TOOMANYTABCOMPLETES: |
|
166 { |
|
167 unsigned int numCompletions = packet.read_short(); |
|
168 print ("%1 completions for '%2'.\n", |
|
169 int (numCompletions), m_lastTabComplete); |
|
170 } |
|
171 break; |
|
172 |
|
173 case SVRC_TABCOMPLETE: |
|
174 { |
|
175 StringList completes; |
|
176 |
|
177 for (signed int i = packet.read_byte(); i > 0; --i) |
|
178 completes << packet.read_string(); |
|
179 |
|
180 if (completes.size() == 1) |
|
181 Interface::tab_complete (m_lastTabComplete, completes[0]); |
|
182 else if (not completes.is_empty()) |
|
183 { |
|
184 print ("Completions for '%1':\n", m_lastTabComplete); |
|
185 |
|
186 for (int i = 0; i < completes.size(); i += 8) |
|
187 { |
|
188 Range<int> spliceRange (i, min (i + 8, completes.size() - 1)); |
|
189 StringList splice (completes.splice (spliceRange)); |
|
190 print ("- %1\n", splice.join (", ")); |
|
191 } |
|
192 } |
|
193 } |
|
194 break; |
164 } |
195 } |
165 } |
196 } |
166 } |
197 } |
167 catch (std::exception& e) |
198 catch (std::exception& e) |
168 { |
199 { |
319 METHOD |
350 METHOD |
320 RCONSession::level() const -> const String& |
351 RCONSession::level() const -> const String& |
321 { |
352 { |
322 return m_level; |
353 return m_level; |
323 } |
354 } |
|
355 |
|
356 // ------------------------------------------------------------------------------------------------- |
|
357 // |
|
358 METHOD |
|
359 RCONSession::request_tab_complete (const String& part) -> void |
|
360 { |
|
361 if (m_serverProtocol >= 4) |
|
362 { |
|
363 Bytestream packet; |
|
364 packet.write_byte (CLRC_TABCOMPLETE); |
|
365 packet.write_string (part); |
|
366 send (packet); |
|
367 bump_last_ping(); |
|
368 m_lastTabComplete = part; |
|
369 } |
|
370 else |
|
371 print ("Server protocol is %1, cannot tab-complete\n", m_serverProtocol); |
|
372 } |