| 198 | return word; |
| 199 | } |
| 200 | |
| 201 | void NetworkServer::DebugAsk(RString str, int from, bool fullAccess) |
| 202 | { |
| 203 | // check for some special debug commands |
| 204 | RString line = str; |
| 205 | RString word = ExtractWord(line); |
| 206 | if (!strcmpi(word, "version")) |
| 207 | { |
| 208 | RString versionText = GetVersionString(); |
| 209 | |
| 210 | DebugAnswer(RString("Debug: version ") + versionText); |
| 211 | |
| 212 | ChatMessage chat; |
| 213 | chat.channel = CCGlobal; |
| 214 | chat.text = RString("Server Version: ") + versionText; |
| 215 | chat.sender = nullptr; |
| 216 | chat.name = ""; |
| 217 | SendMsg(from, &chat, NMFGuaranteed); |
| 218 | return; |
| 219 | } |
| 220 | if (!fullAccess) |
| 221 | { |
| 222 | return; |
| 223 | } |
| 224 | if (!strcmpi(word, "checkfile")) |
| 225 | { |
| 226 | // get file name |
| 227 | RString filename = ExtractWord(line); |
| 228 | if (filename.GetLength() > 0) |
| 229 | { |
| 230 | // check file CRC |
| 231 | if (!IsRelativePath(filename)) |
| 232 | { |
| 233 | RString message = RString("Only relative path check allowed: ") + filename; |
| 234 | GChatList.Add(CCGlobal, nullptr, message, false, true); |
| 235 | } |
| 236 | else |
| 237 | { |
| 238 | // if there is no ID, check all players |
| 239 | PerformFileIntegrityCheck(filename); |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | else if (!strcmpi(word, "checkexe")) |
| 244 | { |
| 245 | // format: offset:size offset:size, offset:size |
| 246 | for (;;) |
| 247 | { |
| 248 | RString location = ExtractWord(line); |
| 249 | if (location.GetLength() <= 0) |
| 250 | { |
| 251 | break; |
| 252 | } |
| 253 | PerformExeIntegrityCheck(location); |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | // check if string is only numbers |
nothing calls this directly
no test coverage detected