| 238 | //============================================================================// |
| 239 | |
| 240 | bool LuaClientScripts::LuaUserCommand(const std::string& cmdLine) { |
| 241 | const std::string prefix = "luauser"; |
| 242 | const char* c = cmdLine.c_str(); |
| 243 | if (strncmp(c, prefix.c_str(), prefix.size()) != 0) { |
| 244 | return false; |
| 245 | } |
| 246 | c = TextUtils::skipWhitespace(c + prefix.size()); |
| 247 | |
| 248 | const std::string cmd = c; |
| 249 | if (cmd == "reload") { |
| 250 | LuaUser::FreeHandler(); |
| 251 | if (BZDB.isTrue("_forbidLuaUser")) { |
| 252 | showMessage("This server forbids LuaUser scripts"); |
| 253 | return false; |
| 254 | } |
| 255 | else { |
| 256 | LuaUser::LoadHandler(); |
| 257 | } |
| 258 | } |
| 259 | else if (cmd == "disable") { |
| 260 | const bool active = (luaUser != NULL); |
| 261 | LuaUser::FreeHandler(); |
| 262 | if (active) { |
| 263 | showMessage("LuaUser disabled"); |
| 264 | } |
| 265 | } |
| 266 | else if (cmd == "status") { |
| 267 | if (luaUser != NULL) { |
| 268 | showMessage("LuaUser is enabled"); |
| 269 | } |
| 270 | else { |
| 271 | showMessage("LuaUser is disabled"); |
| 272 | } |
| 273 | } |
| 274 | else if (cmd == "") { |
| 275 | addMessage(NULL, |
| 276 | "/luauser < status | reload | disable | custom_command ... >"); |
| 277 | } |
| 278 | else if (luaUser != NULL) { |
| 279 | return luaUser->RecvCommand(c); |
| 280 | } |
| 281 | else { |
| 282 | return false; |
| 283 | } |
| 284 | |
| 285 | return true; |
| 286 | } |
| 287 | |
| 288 | |
| 289 | bool LuaClientScripts::LuaBzOrgCommand(const std::string& cmdLine) { |
nothing calls this directly
no test coverage detected