| 1 | #ifndef GAME_CLIENT_COMPONENTS_CENSOR_H |
| 2 | #define GAME_CLIENT_COMPONENTS_CENSOR_H |
| 3 | /* |
| 4 | #include <base/lock.h> |
| 5 | |
| 6 | #include <engine/console.h> |
| 7 | #include <engine/shared/config.h> |
| 8 | #include <engine/shared/http.h> |
| 9 | #include <engine/shared/jobs.h> |
| 10 | |
| 11 | #include <game/client/component.h> |
| 12 | |
| 13 | #include <memory> |
| 14 | #include <optional> |
| 15 | #include <string> |
| 16 | #include <vector> |
| 17 | |
| 18 | class CCensor : public CComponent |
| 19 | { |
| 20 | private: |
| 21 | std::vector<std::string> m_vCensoredWords; |
| 22 | |
| 23 | class CCensorListDownloadJob : public IJob |
| 24 | { |
| 25 | public: |
| 26 | CCensorListDownloadJob(CCensor *pCensor, const char *pUrl, const char *pSaveFilePath); |
| 27 | |
| 28 | bool Abort() override REQUIRES(!m_Lock); |
| 29 | |
| 30 | std::optional<std::vector<std::string>> m_vLoadedWords; |
| 31 | |
| 32 | protected: |
| 33 | void Run() override REQUIRES(!m_Lock); |
| 34 | |
| 35 | private: |
| 36 | CCensor *m_pCensor; |
| 37 | char m_aUrl[IO_MAX_PATH_LENGTH]; |
| 38 | char m_aSaveFilePath[IO_MAX_PATH_LENGTH]; |
| 39 | CLock m_Lock; |
| 40 | std::shared_ptr<CHttpRequest> m_pGetRequest; |
| 41 | }; |
| 42 | |
| 43 | std::shared_ptr<CCensorListDownloadJob> m_pCensorListDownloadJob = nullptr; |
| 44 | |
| 45 | static void ConchainRefreshCensorList(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData); |
| 46 | |
| 47 | public: |
| 48 | CCensor(); |
| 49 | int Sizeof() const override { return sizeof(*this); } |
| 50 | |
| 51 | void Reset(); |
| 52 | void OnInit() override; |
| 53 | void OnConsoleInit() override; |
| 54 | void OnRender() override; |
| 55 | void OnShutdown() override; |
| 56 | |
| 57 | std::optional<std::vector<std::string>> LoadCensorListFromFile(const char *pFilePath) const; |
| 58 | std::optional<std::vector<std::string>> LoadCensorList(const void *pListText, size_t ListTextLen) const; |
| 59 | void CensorMessage(char *pMessage) const; |
| 60 | }; |
| 61 | */ |
| 62 | |
| 63 | #include <game/client/component.h> |
| 64 | |
| 65 | class CCensor : public CComponent |
| 66 | { |
| 67 | public: |
| 68 | int Sizeof() const override { return sizeof(*this); } |
| 69 | }; |
| 70 | |
| 71 | #endif // GAME_CLIENT_COMPONENTS_CENSOR_H |
| 72 | |