File: floodprot

package info (click to toggle)
teknap 1.4-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,428 kB
  • ctags: 6,297
  • sloc: ansic: 55,591; makefile: 545; sh: 112
file content (84 lines) | stat: -rw-r--r-- 1,487 bytes parent folder | download
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Flood protection for TekNap
 * Author: Brian Weiss <brian@got.net> - 2000, 2001
 *
 * *NOTE* If AUTO_MUZZLE is true then this will do nothing for PUBLIC
 *        floods.
 */

assign AUTO_IGNORE_TIME 60
assign FLOOD_PROTECTION 0

alias fprot (arg, void)
{
	switch ($tolower($arg))
	{
		(0)
		(off)
		{
			^assign FLOOD_PROTECTION 0
		}
		(1)
		(on)
		{
			^assign FLOOD_PROTECTION 1
		}
		(*)
		{
			@ FLOOD_PROTECTION = FLOOD_PROTECTION ? [0] : [1]
		}
	}

	xecho -b Flood protection has been ${FLOOD_PROTECTION ? [activated] : [de-activated]}
}

alias unignore (nick, void)
{
	if (nick)
	{
		//ignore -REMOVE $nick
	}
}

on #^flood 420 "*" if (FLOOD_PROTECTION)
{
	^local chan $2
	^local nick $0
	^local type $1
	switch ($type)
	{
		(PUBLIC)
		{
			/* If auto-muzzle is enabled, let it handle the flooder */
			if (!AUTO_MUZZLE)
			{
				xecho -b PUBLIC flooding detected from $nick - Ignoring for $AUTO_IGNORE_TIME seconds
				//ignore $nick
				timer $AUTO_IGNORE_TIME //ignore -REMOVE $nick
			}
		}
		(JOINS)
		{
			xecho -b JOIN flooding detected from $nick - Ignoring for $AUTO_IGNORE_TIME seconds
			//ignore $nick
			timer $AUTO_IGNORE_TIME //ignore -REMOVE $nick
		}
		(MSGS)
		{
			if (!match($nick ChanServ NickServ OperServ))
			{
				xecho -b MSG flooding detected from $nick - Ignoring for $AUTO_IGNORE_TIME seconds
				//ignore $nick
				timer $AUTO_IGNORE_TIME //ignore -REMOVE $nick
			}
		}
	}
}

on ^322 ^"*"
on ^323 ^"*"

set FLOOD_WARNING OFF


/* bmw '01 */