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