| 287 | |
| 288 | |
| 289 | bool LuaClientScripts::LuaBzOrgCommand(const std::string& cmdLine) { |
| 290 | const std::string prefix = "luabzorg"; |
| 291 | const char* c = cmdLine.c_str(); |
| 292 | if (strncmp(c, prefix.c_str(), prefix.size()) != 0) { |
| 293 | return false; |
| 294 | } |
| 295 | c = TextUtils::skipWhitespace(c + prefix.size()); |
| 296 | |
| 297 | const std::string cmd = c; |
| 298 | if (cmd == "reload") { |
| 299 | LuaBzOrg::FreeHandler(); |
| 300 | if (BZDB.isTrue("_forbidLuaBzOrg")) { |
| 301 | showMessage("This server forbids LuaBzOrg scripts"); |
| 302 | return false; |
| 303 | } |
| 304 | else { |
| 305 | LuaBzOrg::LoadHandler(); |
| 306 | } |
| 307 | } |
| 308 | else if (cmd == "disable") { |
| 309 | const bool active = LuaBzOrg::IsActive(); |
| 310 | LuaBzOrg::FreeHandler(); |
| 311 | if (active) { |
| 312 | showMessage("LuaBzOrg disabled"); |
| 313 | } |
| 314 | } |
| 315 | else if (cmd == "status") { |
| 316 | if (luaBzOrg != NULL) { |
| 317 | showMessage("LuaBzOrg is enabled"); |
| 318 | } |
| 319 | else if (LuaBzOrg::IsActive()) { |
| 320 | showMessage("LuaBzOrg is loading"); |
| 321 | } |
| 322 | else { |
| 323 | showMessage("LuaBzOrg is disabled"); |
| 324 | } |
| 325 | } |
| 326 | else if (cmd == "") { |
| 327 | addMessage(NULL, |
| 328 | "/luabzorg < status | reload | disable | custom_command ... >"); |
| 329 | } |
| 330 | else if (luaBzOrg != NULL) { |
| 331 | return luaBzOrg->RecvCommand(c); |
| 332 | } |
| 333 | else { |
| 334 | return false; |
| 335 | } |
| 336 | |
| 337 | return true; |
| 338 | } |
| 339 | |
| 340 | |
| 341 | bool LuaClientScripts::LuaWorldCommand(const std::string& cmdLine) { |
nothing calls this directly
no test coverage detected