175 |
175 |
176 m_interface->print("Previous messages:\n"); |
176 m_interface->print("Previous messages:\n"); |
177 |
177 |
178 for (int i = stream.readByte(); i > 0; --i) |
178 for (int i = stream.readByte(); i > 0; --i) |
179 { |
179 { |
180 String message = stream.readString(); |
180 std::string message = stream.readString(); |
181 normalize(message); |
181 normalize(message); |
182 m_interface->printText("--- %s\n", message.data()); |
182 m_interface->printText("--- %s\n", message.data()); |
183 } |
183 } |
184 |
184 |
185 m_interface->print("End of previous messages.\n"); |
185 m_interface->print("End of previous messages.\n"); |
197 } |
197 } |
198 break; |
198 break; |
199 |
199 |
200 case SVRC_TABCOMPLETE: |
200 case SVRC_TABCOMPLETE: |
201 { |
201 { |
202 StringList completes; |
202 std::vector<std::string> completes; |
203 completes.resize(stream.readByte()); |
203 completes.resize(stream.readByte()); |
204 |
204 |
205 for (String& completion : completes) |
205 for (std::string& completion : completes) |
206 completion = stream.readString(); |
206 completion = stream.readString(); |
207 |
207 |
208 if (completes.size() == 1) |
208 if (completes.size() == 1) |
209 { |
209 { |
210 m_interface->tabComplete(m_lastTabComplete, completes[0]); |
210 m_interface->tabComplete(m_lastTabComplete, completes[0]); |
214 m_interface->print("Completions for '%s':\n", m_lastTabComplete.data()); |
214 m_interface->print("Completions for '%s':\n", m_lastTabComplete.data()); |
215 |
215 |
216 for (int i : range(0, static_cast<int>(completes.size()), 8)) |
216 for (int i : range(0, static_cast<int>(completes.size()), 8)) |
217 { |
217 { |
218 const int end = min(i + 8, static_cast<int>(completes.size())); |
218 const int end = min(i + 8, static_cast<int>(completes.size())); |
219 StringList splices = splice(completes, i, end); |
219 std::vector<std::string> splices = splice(completes, i, end); |
220 m_interface->print("- %s\n", join_string_list(splices, ", ").data()); |
220 m_interface->print("- %s\n", join_string_list(splices, ", ").data()); |
221 } |
221 } |
222 } |
222 } |
223 } |
223 } |
224 break; |
224 break; |
239 |
239 |
240 switch (RCONUpdateType(header)) |
240 switch (RCONUpdateType(header)) |
241 { |
241 { |
242 case SVRCU_PLAYERDATA: |
242 case SVRCU_PLAYERDATA: |
243 { |
243 { |
244 StringList players; |
244 std::vector<std::string> players; |
245 |
245 |
246 for (int i = packet.readByte(); i > 0; --i) |
246 for (int i = packet.readByte(); i > 0; --i) |
247 players.push_back(packet.readString()); |
247 players.push_back(packet.readString()); |
248 |
248 |
249 m_interface->setPlayerNames(players); |
249 m_interface->setPlayerNames(players); |
356 return m_adminCount; |
356 return m_adminCount; |
357 } |
357 } |
358 |
358 |
359 // ------------------------------------------------------------------------------------------------- |
359 // ------------------------------------------------------------------------------------------------- |
360 // |
360 // |
361 const String& RCONSession::getLevel() const |
361 const std::string& RCONSession::getLevel() const |
362 { |
362 { |
363 return m_level; |
363 return m_level; |
364 } |
364 } |
365 |
365 |
366 // ------------------------------------------------------------------------------------------------- |
366 // ------------------------------------------------------------------------------------------------- |
367 // |
367 // |
368 void RCONSession::requestTabCompletion(const String& part) |
368 void RCONSession::requestTabCompletion(const std::string& part) |
369 { |
369 { |
370 if (m_serverProtocol >= 4) |
370 if (m_serverProtocol >= 4) |
371 { |
371 { |
372 ByteArray message; |
372 ByteArray message; |
373 Bytestream stream(message); |
373 Bytestream stream(message); |