219 m_interface->print ("- %s\n", splice.join (", ").chars()); |
219 m_interface->print ("- %s\n", splice.join (", ").chars()); |
220 } |
220 } |
221 } |
221 } |
222 } |
222 } |
223 break; |
223 break; |
|
224 |
|
225 case SVRC_WATCHINGCVAR: |
|
226 m_interface->print ("You are now watching %s\n", packet.read_string().chars()); |
|
227 m_interface->print ("Its value is: %s\n", packet.read_string().chars()); |
|
228 break; |
|
229 |
|
230 case SVRC_ALREADYWATCHINGCVAR: |
|
231 m_interface->print ("You are already watching %s\n", packet.read_string().chars()); |
|
232 break; |
|
233 |
|
234 case SVRC_WATCHCVARNOTFOUND: |
|
235 m_interface->print ("CVar %s not found\n", packet.read_string().chars()); |
|
236 break; |
|
237 |
|
238 case SVRC_CVARCHANGED: |
|
239 m_interface->print ("The value of CVar %s", packet.read_string().chars()); |
|
240 m_interface->print (" is now %s\n", packet.read_string().chars()); |
|
241 break; |
|
242 |
|
243 case SVRC_YOUREDISCONNECTED: |
|
244 m_interface->print ("You have been disconnected: %s", packet.read_string().chars()); |
|
245 m_interface->disconnected(); |
|
246 break; |
224 } |
247 } |
225 } |
248 } |
226 } |
249 } |
227 catch (std::exception& e) |
250 catch (std::exception& e) |
228 { |
251 { |
324 { |
347 { |
325 if (m_state != RCON_CONNECTED or message.is_empty()) |
348 if (m_state != RCON_CONNECTED or message.is_empty()) |
326 return false; |
349 return false; |
327 |
350 |
328 Bytestream packet; |
351 Bytestream packet; |
329 packet.write_byte (CLRC_COMMAND); |
352 |
330 packet.write_string (message); |
353 // Let's hardcode a /watch for CVar watching testing purposes |
|
354 if (message.starts_with ("/watch ")) |
|
355 { |
|
356 StringList cvars = message.mid(String("/watch ").length(), -1).split(','); |
|
357 packet.write_byte(CLRC_WATCHCVAR); |
|
358 |
|
359 for (int i = 0 ; i < cvars.size(); ++i) |
|
360 { |
|
361 String cvar = cvars[i].normalized(); |
|
362 |
|
363 if (not cvar.is_empty()) |
|
364 { |
|
365 packet.write_string(cvar); |
|
366 m_interface->print("Requesting watch of %s\n", cvar.chars()); |
|
367 } |
|
368 } |
|
369 |
|
370 packet.write_string(""); |
|
371 } |
|
372 else |
|
373 { |
|
374 packet.write_byte (CLRC_COMMAND); |
|
375 packet.write_string (message); |
|
376 } |
|
377 |
331 send (packet); |
378 send (packet); |
332 bump_last_ping(); |
379 bump_last_ping(); |
333 return true; |
380 return true; |
334 } |
381 } |
335 |
382 |