sources/network/rconsession.cpp

branch
experimental
changeset 40
cf85b5f77541
parent 39
052393cf9016
child 41
9ab869656b9e
equal deleted inserted replaced
39:052393cf9016 40:cf85b5f77541
185 break; 185 break;
186 186
187 case SVRC_UPDATE: 187 case SVRC_UPDATE:
188 process_server_updates (packet); 188 process_server_updates (packet);
189 break; 189 break;
190
191 case SVRC_TOOMANYTABCOMPLETES:
192 {
193 unsigned int numCompletions = packet.read_short();
194 print ("%1 completions for '%2'.\n",
195 int (numCompletions), m_lastTabComplete);
196 }
197 break;
198
199 case SVRC_TABCOMPLETE:
200 {
201 StringList completes;
202
203 for (signed int i = packet.read_byte(); i > 0; --i)
204 completes << packet.read_string();
205
206 if (completes.size() == 1)
207 Interface::tab_complete (m_lastTabComplete, completes[0]);
208 else if (not completes.is_empty())
209 {
210 print ("Completions for '%1':\n", m_lastTabComplete);
211
212 for (int i = 0; i < completes.size(); i += 8)
213 {
214 Range<int> spliceRange (i, min (i + 8, completes.size() - 1));
215 StringList splice (completes.splice (spliceRange));
216 print ("- %1\n", splice.join (", "));
217 }
218 }
219 }
220 break;
221 } 190 }
222 } 191 }
223 } 192 }
224 catch (std::exception& e) 193 catch (std::exception& e)
225 { 194 {
369 METHOD 338 METHOD
370 RCONSession::level() const -> const String& 339 RCONSession::level() const -> const String&
371 { 340 {
372 return m_level; 341 return m_level;
373 } 342 }
374
375 // -------------------------------------------------------------------------------------------------
376 //
377 METHOD
378 RCONSession::request_tab_complete (const String& part) -> void
379 {
380 if (m_serverProtocol >= 4)
381 {
382 Bytestream packet;
383 packet.write_byte (CLRC_TABCOMPLETE);
384 packet.write_string (part);
385 send (packet);
386 bump_last_ping();
387 m_lastTabComplete = part;
388 }
389 else
390 print ("Server protocol is %1, cannot tab-complete\n", m_serverProtocol);
391 }

mercurial