bool ChatHandler::HandleAccountLockCommand(char* args) { // allow use from RA, but not from console (not have associated account id) if (!GetAccountId()) { SendSysMessage (LANG_RA_ONLY_COMMAND); SetSentErrorMessage (true); return false; } bool value; if (!ExtractOnOff(&args, value)) { SendSysMessage(LANG_USE_BOL); SetSentErrorMessage(true); return false; } if (value) { LoginDatabase.PExecute( "UPDATE account SET locked = '1' WHERE id = '%u'", GetAccountId()); PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED); } else { LoginDatabase.PExecute( "UPDATE account SET locked = '0' WHERE id = '%u'", GetAccountId()); PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED); } return true; }
/// Set the filters of logging bool ChatHandler::HandleServerLogFilterCommand(char* args) { if (!*args) { uint32 logfiler = sLog.getLogFilter(); SendSysMessage(LANG_LOG_FILTERS_STATE_HEADER); for(int i = 0; i < LOG_FILTER_COUNT; ++i) if (*logFilterData[i].name) PSendSysMessage(" %-20s = %s",logFilterData[i].name,(logfiler & (1 << i)) !=0 ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF)); return true; } char *filtername = ExtractLiteralArg(&args); if (!filtername) return false; bool value; if (!ExtractOnOff(&args, value)) { SendSysMessage(LANG_USE_BOL); SetSentErrorMessage(true); return false; } if (strncmp(filtername, "all", 4) == 0) { sLog.SetLogFilter(LogFilters(0xFFFFFFFF), value); PSendSysMessage(LANG_ALL_LOG_FILTERS_SET_TO_S, value ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF)); return true; } for(int i = 0; i < LOG_FILTER_COUNT; ++i) { if (!*logFilterData[i].name) continue; if (!strncmp(filtername,logFilterData[i].name,strlen(filtername))) { sLog.SetLogFilter(LogFilters(1 << i),value); PSendSysMessage(" %-20s = %s",logFilterData[i].name,value ? GetMangosString(LANG_ON) : GetMangosString(LANG_OFF)); return true; } } return false; }
/// Set the filters of logging bool ChatHandler::HandleServerLogFilterCommand(char* args) { if (!*args) { SendSysMessage(LANG_LOG_FILTERS_STATE_HEADER); for (int i = 0; i < LOG_FILTER_COUNT; ++i) if (*logFilterData[i].name) PSendSysMessage(" %-20s = %s", logFilterData[i].name, GetOnOffStr(sLog.HasLogFilter(1 << i))); return true; } char* filtername = ExtractLiteralArg(&args); if (!filtername) return false; bool value; if (!ExtractOnOff(&args, value)) { SendSysMessage(LANG_USE_BOL); SetSentErrorMessage(true); return false; } if (strncmp(filtername, "all", 4) == 0) { sLog.SetLogFilter(LogFilters(0xFFFFFFFF), value); PSendSysMessage(LANG_ALL_LOG_FILTERS_SET_TO_S, GetOnOffStr(value)); return true; } size_t _len = strlen(filtername); for (int i = 0; i < LOG_FILTER_COUNT; ++i) { if (!*logFilterData[i].name) continue; if (!strncmp(filtername, logFilterData[i].name, _len)) { sLog.SetLogFilter(LogFilters(1 << i), value); PSendSysMessage(" %-20s = %s", logFilterData[i].name, GetOnOffStr(value)); return true; } } return false; }
bool ChatHandler::HandleAccountLockCommand(char* args) { // allow use from RA, but not from console (not have associated account id) if (!GetAccountId()) { SendSysMessage (LANG_RA_ONLY_COMMAND); SetSentErrorMessage (true); return false; } bool value; if (!ExtractOnOff(&args, value)) { SendSysMessage(LANG_USE_BOL); SetSentErrorMessage(true); return false; } sAccountMgr.LockAccount(GetAccountId(), value); PSendSysMessage(value ? LANG_COMMAND_ACCLOCKLOCKED : LANG_COMMAND_ACCLOCKUNLOCKED); return true; }