RegConsoleCmd is now case insensitive for client-only commands (bug 3602, r=ds).

This commit is contained in:
David Anderson 2009-02-01 02:13:17 -05:00
parent a017e4820a
commit 6048144310

View File

@ -229,46 +229,67 @@ void ConCmdManager::SetCommandClient(int client)
ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type) ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type)
{ {
ConCmdInfo *pInfo; ConCmdInfo *pInfo;
if (sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
{ {
cell_t result = type; List<ConCmdInfo *>::iterator iter;
cell_t tempres = result;
List<CmdHook *>::iterator iter; pInfo = NULL;
CmdHook *pHook; iter = m_CmdList.begin();
for (iter=pInfo->conhooks.begin(); while (iter != m_CmdList.end())
iter!=pInfo->conhooks.end();
iter++)
{ {
pHook = (*iter); if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
if (!pHook->pf->IsRunnable())
{ {
continue; pInfo = (*iter);
break;
} }
if (pHook->pAdmin && !CheckAccess(client, cmd, pHook->pAdmin)) iter++;
}
if (pInfo == NULL)
{
return type;
}
}
cell_t result = type;
cell_t tempres = result;
List<CmdHook *>::iterator iter;
CmdHook *pHook;
for (iter=pInfo->conhooks.begin();
iter!=pInfo->conhooks.end();
iter++)
{
pHook = (*iter);
if (!pHook->pf->IsRunnable())
{
continue;
}
if (pHook->pAdmin && !CheckAccess(client, cmd, pHook->pAdmin))
{
if (result < Pl_Handled)
{ {
if (result < Pl_Handled) result = Pl_Handled;
{
result = Pl_Handled;
}
continue;
} }
pHook->pf->PushCell(client); continue;
pHook->pf->PushCell(args); }
if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE) pHook->pf->PushCell(client);
pHook->pf->PushCell(args);
if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
{
if (tempres > result)
{ {
if (tempres > result) result = tempres;
{ }
result = tempres; if (result == Pl_Stop)
} {
if (result == Pl_Stop) break;
{
break;
}
} }
} }
type = (ResultType)result;
} }
type = (ResultType)result;
return type; return type;
} }