File: deban

package info (click to toggle)
epic4 1%3A3.0-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,780 kB
  • sloc: ansic: 56,285; makefile: 630; sh: 161; perl: 30
file content (72 lines) | stat: -rw-r--r-- 1,247 bytes parent folder | download | duplicates (10)
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
/*
 * ban removers, 1993, 1997
 * This script requires ircII-EPIC4.
 */

# returns non-0 if $0 matches or is matched by $1-, 0 if not.
alias comatch @ function_return = match($*) || rmatch($*)

alias deban_mode 
{
        fe ($*) bx by bz {
                @ :moder = bz?[-bbb]:by?[-bb]:bx?[-b]:[]
                if (moder) {
                        mode * $moder $bx $by $bz
                }
        }
}

# remove all bans on current channel
alias deban uniban *

# remove all bans that could cover nickname
alias unban uniban $0!$uh($0)

# remove all bans matching or matched by pattern
alias uniban 
{
	^local unbanlist
	^local p $0

	stack push on 367
	stack push on 368
        ^on ^367 * {
		bless
		if (comatch($2 $p)) 
			{ push unbanlist $2 }
	}
        ^on ^368 * {
		bless
		stack pop on 367
		stack pop on 368
		deban_mode $unbanlist
	}
        ^mode ${[$1]?[$1]:C} +b
	wait
}


# remove all bans that contain a literal text substring
alias nban 
{
	local unbanlist
	local p $0
	stack push on 367
	stack push on 368

        ^on ^367 * {
		bless
		if (rmatch($2 *$p*))
			{ push unbanlist $2 }
	}
	^on ^368 * {
		bless
		stack pop on 367
		stack pop on 368
		deban_mode $unbanlist
	}
        ^mode ${[$1]?[$1]:C} +b
	wait
}

#hop'93