summaryrefslogtreecommitdiff
path: root/modules/pseudoclients/botserv.h
blob: 5fa03f870e4cc4c44adaa1df1073f9757c7c61a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef BOTSERV_H
#define BOTSERV_H

struct UserData
{
	UserData()
	{
		this->Clear();
	}

	void Clear()
	{
		last_use = last_start = Anope::CurTime;
		lines = times = 0;
		lastline.clear();
	}

	/* Data validity */
	time_t last_use;

	/* for flood kicker */
	int16 lines;
	time_t last_start;

	/* for repeat kicker */
	Anope::string lastline;
	Anope::string lasttarget;
	int16 times;
};

struct BanData
{
	Anope::string mask;
	time_t last_use;
	int16 ttb[TTB_SIZE];

	BanData()
	{
		this->Clear();
	}

	void Clear()
	{
		last_use = 0;
		for (int i = 0; i < TTB_SIZE; ++i)
			this->ttb[i] = 0;
	}
};

class BotServService : public Service
{
 public:
	BotServService(Module *m) : Service(m, "BotServ") { }

	virtual UserData *GetUserData(User *u, Channel *c) = 0;

	virtual BanData *GetBanData(User *u, Channel *c) = 0;
};

static service_reference<BotServService> botserv("BotServ");

#endif // BOTSERV_H