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