234 case SVRC_WATCHCVARNOTFOUND: |
237 case SVRC_WATCHCVARNOTFOUND: |
235 m_interface->print ("CVar %s not found\n", packet.read_string().chars()); |
238 m_interface->print ("CVar %s not found\n", packet.read_string().chars()); |
236 break; |
239 break; |
237 |
240 |
238 case SVRC_CVARCHANGED: |
241 case SVRC_CVARCHANGED: |
239 m_interface->print ("The value of CVar %s", packet.read_string().chars()); |
242 { |
240 m_interface->print (" is now %s\n", packet.read_string().chars()); |
243 String name = packet.read_string(); |
|
244 String value = packet.read_string(); |
|
245 m_interface->print ("The value of CVar %s", name.chars()); |
|
246 m_interface->print (" is now %s\n", value.chars()); |
|
247 |
|
248 // If sv_hostname changes, update the titlebar |
|
249 if (name == "sv_hostname") |
|
250 { |
|
251 m_hostname = value; |
|
252 m_interface->set_title(m_hostname); |
|
253 } |
|
254 } |
241 break; |
255 break; |
242 |
256 |
243 case SVRC_YOUREDISCONNECTED: |
257 case SVRC_YOUREDISCONNECTED: |
244 m_interface->print ("You have been disconnected: %s", packet.read_string().chars()); |
258 m_interface->print ("You have been disconnected: %s", packet.read_string().chars()); |
245 m_interface->disconnected(); |
259 m_interface->disconnected(); |
351 Bytestream packet; |
365 Bytestream packet; |
352 |
366 |
353 // Let's hardcode a /watch for CVar watching testing purposes |
367 // Let's hardcode a /watch for CVar watching testing purposes |
354 if (message.starts_with ("/watch ")) |
368 if (message.starts_with ("/watch ")) |
355 { |
369 { |
356 StringList cvars = message.mid(String("/watch ").length(), -1).split(','); |
370 request_watch(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 } |
371 } |
372 else |
372 else |
373 { |
373 { |
374 packet.write_byte (CLRC_COMMAND); |
374 packet.write_byte (CLRC_COMMAND); |
375 packet.write_string (message); |
375 packet.write_string (message); |
424 else |
424 else |
425 { |
425 { |
426 m_interface->print ("This server does not support tab-completion\n", m_serverProtocol); |
426 m_interface->print ("This server does not support tab-completion\n", m_serverProtocol); |
427 } |
427 } |
428 } |
428 } |
|
429 |
|
430 // ------------------------------------------------------------------------------------------------- |
|
431 // |
|
432 void RCONSession::request_watch (const String& cvar) |
|
433 { |
|
434 StringList cvars; |
|
435 cvars.append(cvar); |
|
436 request_watch(cvars); |
|
437 } |
|
438 |
|
439 // ------------------------------------------------------------------------------------------------- |
|
440 // |
|
441 void RCONSession::request_watch (const StringList& cvars) |
|
442 { |
|
443 Bytestream packet; |
|
444 packet.write_byte(CLRC_WATCHCVAR); |
|
445 |
|
446 for (int i = 0; i < cvars.size(); ++i) |
|
447 packet.write_string(cvars[i].normalized()); |
|
448 |
|
449 packet.write_string(""); |
|
450 send(packet); |
|
451 } |