| 154 | } |
| 155 | |
| 156 | ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type) |
| 157 | { |
| 158 | ConCmdInfo *pInfo = FindInTrie(cmd); |
| 159 | |
| 160 | if (pInfo == NULL) |
| 161 | { |
| 162 | return type; |
| 163 | } |
| 164 | |
| 165 | cell_t result = type; |
| 166 | for (CmdHookList::iterator iter = pInfo->hooks.begin(); iter != pInfo->hooks.end(); iter++) |
| 167 | { |
| 168 | CmdHook *hook = *iter; |
| 169 | |
| 170 | if (hook->type == CmdHook::Server || !hook->pf->IsRunnable()) |
| 171 | continue; |
| 172 | |
| 173 | if (hook->admin && !CheckAccess(client, cmd, hook->admin.get())) |
| 174 | { |
| 175 | if (result < Pl_Handled) |
| 176 | result = Pl_Handled; |
| 177 | continue; |
| 178 | } |
| 179 | |
| 180 | hook->pf->PushCell(client); |
| 181 | hook->pf->PushCell(args); |
| 182 | |
| 183 | cell_t tempres = result; |
| 184 | |
| 185 | if (hook->pf->Execute(&tempres) == SP_ERROR_NONE) |
| 186 | { |
| 187 | if (tempres > result) |
| 188 | result = tempres; |
| 189 | if (result == Pl_Stop) |
| 190 | break; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | return (ResultType)result; |
| 195 | } |
| 196 | |
| 197 | bool ConCmdManager::InternalDispatch(int client, const ICommandArgs *args) |
| 198 | { |
no test coverage detected