| 439 | |
| 440 | |
| 441 | void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output) |
| 442 | { |
| 443 | AStringVector split = StringSplit(a_Cmd, " "); |
| 444 | if (split.empty()) |
| 445 | { |
| 446 | return; |
| 447 | } |
| 448 | |
| 449 | // Special handling: "stop" and "restart" are built in |
| 450 | if ((split[0].compare("stop") == 0) || (split[0].compare("restart") == 0)) |
| 451 | { |
| 452 | return; |
| 453 | } |
| 454 | |
| 455 | // "help" and "reload" are to be handled by MCS, so that they work no matter what |
| 456 | if (split[0] == "help") |
| 457 | { |
| 458 | PrintHelp(split, a_Output); |
| 459 | return; |
| 460 | } |
| 461 | if (split[0] == "reload") |
| 462 | { |
| 463 | cPluginManager::Get()->ReloadPlugins(); |
| 464 | cRoot::Get()->ReloadGroups(); |
| 465 | return; |
| 466 | } |
| 467 | if (split[0] == "reloadplugins") |
| 468 | { |
| 469 | cPluginManager::Get()->ReloadPlugins(); |
| 470 | return; |
| 471 | } |
| 472 | if (split[0] == "reloadgroups") |
| 473 | { |
| 474 | cRoot::Get()->ReloadGroups(); |
| 475 | a_Output.Out("Groups reloaded!"); |
| 476 | a_Output.Finished(); |
| 477 | return; |
| 478 | } |
| 479 | |
| 480 | // There is currently no way a plugin can do these (and probably won't ever be): |
| 481 | if (split[0].compare("chunkstats") == 0) |
| 482 | { |
| 483 | cRoot::Get()->LogChunkStats(a_Output); |
| 484 | a_Output.Finished(); |
| 485 | return; |
| 486 | } |
| 487 | #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER) |
| 488 | if (split[0].compare("dumpmem") == 0) |
| 489 | { |
| 490 | LeakFinderXmlOutput Output("memdump.xml"); |
| 491 | DumpUsedMemory(&Output); |
| 492 | return; |
| 493 | } |
| 494 | |
| 495 | if (split[0].compare("killmem") == 0) |
| 496 | { |
| 497 | for (;;) |
| 498 | { |
nothing calls this directly
no test coverage detected