Protection³ — File Browser
Protectionv3.2 / Protectionv3.2 / personal.mrc
personal.mrc — 10.41 KB — Download this file
;## Protection² v3.2
;## Most likely final version unless bad bugs are reported.
;## Contact: oracel_17@hotmail.com or on Undernet as Oracel
;## Dialog table
Dialog fp {
title "Personal Flood Protection"
size -1 -1 147 92
option dbu
button "Ok", 1, 61 77 39 12,ok default
button "Cancel", 2, 105 77 38 12,cancel
tab "Ctcp-Flood", 5, 3 1 139 71
check "Enabled", 10, 14 19 50 8, tab 5
text "Trigger After", 11, 14 33 35 8, tab 5
edit "", 12, 46 32 15 10, tab 5
text "Ctcp`s in", 13, 65 33 30 8, tab 5
edit "", 14, 90 32 15 10, tab 5
text "Seconds", 15, 108 33 30 8, tab 5
text "Ignore For", 16, 14 44 35 8, tab 5
edit "", 17, 46 43 15 10, tab 5 multi autovs
text "Seconds", 18, 65 44 30 10, tab 5
combo 3, 47 54 61 52, tab 5 size drop
text "Ignore Type:", 4, 14 55 33 10, tab 5
tab "Notice-Flood", 6
check "Enabled", 19, 14 19 50 8, tab 6
text "Trigger After", 20, 14 33 35 8, tab 6
edit "", 21, 46 32 15 10, tab 6
text "Notices in", 22, 65 33 30 8, tab 6
edit "", 23, 90 32 15 10, tab 6
text "Seconds", 24, 108 33 30 8, tab 6
text "Ignore For", 25, 14 44 30 8, tab 6
edit "", 26, 46 43 15 10, tab 6 multi autovs
text "Seconds", 27, 65 44 30 10, tab 6
text "Ignore Type:", 56, 14 55 33 10, tab 6
combo 57, 47 54 61 52, tab 6 size drop
tab "Msg-Flood", 7
check "Enabled", 28, 14 19 50 8, tab 7
text "Trigger After", 29, 14 33 35 8, tab 7
edit "", 30, 46 32 15 10, tab 7
text "Msg`s in", 31, 65 33 30 8, tab 7
edit "", 32, 90 32 15 10, tab 7
text "Seconds", 33, 108 33 30 8, tab 7
text "Ignore For", 34, 14 44 30 8, tab 7
edit "", 35, 46 43 15 10, tab 7 multi autovs
text "Seconds", 36, 65 44 30 10, tab 7
text "Ignore Type:", 58, 14 55 33 10, tab 7
combo 59, 47 54 61 52, tab 7 size drop
tab "Query-Flood", 8
check "Enabled", 37, 14 19 50 8, tab 8
text "Trigger After", 38, 14 33 35 8, tab 8
edit "", 39, 46 32 15 10, tab 8
text "Queries in", 40, 65 33 30 8, tab 8
edit "", 41, 90 32 15 10, tab 8
text "Seconds", 42, 108 33 30 8, tab 8
text "Ignore For", 43, 14 44 30 8, tab 8
edit "", 44, 46 43 15 10, tab 8 multi autovs
text "Seconds", 45, 65 44 30 10, tab 8
text "Ignore Type:", 60, 14 55 33 10, tab 8
combo 61, 47 54 61 52, tab 8 size drop
tab "Dcc-Flood", 9
check "Enabled", 46, 14 19 50 8, tab 9
text "Trigger After", 47, 14 33 35 8, tab 9
edit "", 48, 46 32 15 10, tab 9
text "DCC`s in", 49, 65 33 30 8, tab 9
edit "", 50, 90 32 15 10, tab 9
text "Seconds", 51, 108 33 30 8, tab 9
text "Ignore For", 52, 14 44 30 8, tab 9
edit "", 53, 46 43 15 10, tab 9 multi autovs
text "Seconds", 54, 65 44 30 10, tab 9
text "Ignore Type:", 62, 14 55 33 10, tab 9
combo 63, 47 54 61 52, tab 9 size drop
tab "Invite-Flood", 100
check "Enabled", 146, 14 19 50 8, tab 100
text "Trigger After", 147, 14 33 35 8, tab 100
edit "", 148, 46 32 15 10, tab 100
text "Invites in", 149, 65 33 30 8, tab 100
edit "", 150, 90 32 15 10, tab 100
text "Seconds", 151, 108 33 30 8, tab 100
text "Ignore For", 152, 14 44 30 8, tab 100
edit "", 153, 46 43 15 10, tab 100 multi autovs
text "Seconds", 154, 65 44 30 10, tab 100
text "Ignore Type:", 162, 14 55 33 10, tab 100
combo 163, 47 54 61 52, tab 100 size drop
tab "Options",200
check "Use silence-command", 201, 14 19 80 8, tab 200
check "Warn me", 202, 14 29 80 8, tab 200
Check "Filter these hosts: (separated by comma)",203,14 39 120 8, tab 200
Edit "", 204, 22 48 105 10, multi return autohs autovs tab 200
check "Let P² submit basic info to a website", 205, 14 59 100 8, tab 200
}
On *:Dialog:Fp:*:*: {
if ($devent == init) {
var %i = 0 | while (%i <= 9) { a 3,57,59,61,63,163 %i $mask(nick!user@stuff.host.com,%i) | inc %i }
did $iif($rh(p_ctcp_enabled) == 1,-c,-u) fp 10 | a 12 $rh(p_ctcp_maxlines) | a 14 $rh(p_ctcp_seconds) | a 17 $rh(p_ctcp_ignoretime) | it 3 $rh(p_ctcp_ignoretype)
did $iif($rh(p_notice_enabled) == 1,-c,-u) fp 19 | a 21 $rh(p_notice_maxlines) | a 23 $rh(p_notice_seconds) | a 26 $rh(p_notice_ignoretime) | it 57 $rh(p_notice_ignoretype)
did $iif($rh(p_msg_enabled) == 1,-c,-u) fp 28 | a 30 $rh(p_msg_maxlines) | a 32 $rh(p_msg_seconds) | a 35 $rh(p_msg_ignoretime) | it 59 $rh(p_msg_ignoretype)
did $iif($rh(p_query_enabled) == 1,-c,-u) fp 37 | a 39 $rh(p_query_maxlines) | a 41 $rh(p_query_seconds) | a 44 $rh(p_query_ignoretime) | it 61 $rh(p_query_ignoretype)
did $iif($rh(p_dcc_enabled) == 1,-c,-u) fp 46 | a 48 $rh(p_dcc_maxlines) | a 50 $rh(p_dcc_seconds) | a 53 $rh(p_dcc_ignoretime) | it 63 $rh(p_dcc_ignoretype)
did $iif($rh(p_invite_enabled) == 1,-c,-u) fp 146 | a 148 $rh(p_invite_maxlines) | a 150 $rh(p_invite_seconds) | a 153 $rh(p_invite_ignoretime) | it 163 $rh(p_invite_ignoretype)
did $iif($rh(p_usesilence) == 1,-c,-u) fp 201 | did $iif($rh(p_warnme) == 1,-c,-u) fp 202 | did $iif($rh(p_fhost_enabled) == 1,-c,-u) fp 203 | a 204 $rh(p_fhost_list)
did $iif($rh(p_submit_info) == 1,-c,-u) fp 205
}
if ($devent == sclick) && ($did == 1) {
i p_ctcp_enabled $s(10) | i p_ctcp_maxlines $t(12) | i p_ctcp_seconds $t(14) | i p_ctcp_ignoretime $t(17) | i p_ctcp_ignoretype $sl(3)
i p_notice_enabled $s(19) | i p_notice_maxlines $t(21) | i p_notice_seconds $t(23) | i p_notice_ignoretime $t(26) | i p_notice_ignoretype $sl(57)
i p_msg_enabled $s(28) | i p_msg_maxlines $t(30) | i p_msg_seconds $t(32) | i p_msg_ignoretime $t(35) | i p_msg_ignoretype $sl(59)
i p_query_enabled $s(37) | i p_query_maxlines $t(39) | i p_query_seconds $t(41) | i p_query_ignoretime $t(44) | i p_query_ignoretype $sl(61)
i p_dcc_enabled $s(46) | i p_dcc_maxlines $t(48) | i p_dcc_seconds $t(50) | i p_dcc_ignoretime $t(53) | i p_dcc_ignoretype $sl(63)
i p_invite_enabled $s(146) | i p_invite_maxlines $t(148) | i p_invite_seconds $t(150) | i p_invite_ignoretime $t(153) | i p_invite_ignoretype $sl(163) | i p_usesilence $s(201) | i p_warnme $s(202)
i p_fhost_enabled $s(203) | i p_fhost_list $t(204) | i p_submit_info $s(205)
pp.rehash
} }
Alias -l a did -a fp $1 $2-
Alias -l i wi $inif pp $1 $2
Alias -l wh hadd -m Main $1 $2
Alias -l idir return $scriptdir
Alias -l t return $did($1).text
Alias -l sl return $did($1).sel
Alias -l s return $did($1).state
Alias -l rh return $hget(Main,$1)
Alias -l it did -c fp $1 $iif(!$2,4,$2)
Alias -l inif return $remove($idir $+ \P3.dat,$mircdir)
Alias -l ri return $readini($1,$2,$3)
Alias -l wi writeini $1 $2 $3 $iif($4,$4,0)
Alias -l ie { echo -s * $1- }
Alias -l ini2hash { var %f = " $+ $1- $+ ", %i = 1, %t = $ini(%f,0) | while (%i <= %t) { var %i2 = 1, %t2 = $ini(%f,$ini(%f,%i),0) | while (%i2 <= %t2) { wh $ini(%f,%i,%i2) $readini(%f,$ini(%f,%i),$ini(%f,%i,%i2)) | inc %i2 } | inc %i } }
Alias -l pignore { var %t = $1, %t2 = $2, %it = $calc($rh(p_ $+ %t $+ _ignoretype) - 1), %ho, %us = $rh(p_usesilence), %ti = $rh(p_ $+ %t $+ _ignoretime) | if (%t2 == m) { %ho = *!*@* | if (%us == 1) { .silence + $+ %ho | .timer 1 %ti .silence - $+ %ho } | ignore -u [ $+ [ %ti ] ] %ho } | if (%t2 == c) { %ho = $wildsite | if (%us == 1) { .silence + $+ %ho | .timer 1 %ti .silence - $+ %ho } | ignore -u [ $+ [ %ti ] ] %ho } | if (%t2 == s) { %ho = $mask($fulladdress,%it) | if (%us == 1) { .silence + $+ %ho | .timer 1 %ti .silence - $+ %ho } | ignore -u [ $+ [ %ti ] ] %ho } | pwarn %t2 %t }
Alias -l pwarn { if ($rh(p_warnme) != 1) { halt } | var %t = $1, %type = $2, %us = $rh(p_usesilence), %ti = $rh(p_ $+ %type $+ _ignoretime) | if (%t == s) { %t2 = Single-user flood from $nick ( $+ $wildsite $+ ), user will be ignored for %ti seconds. $iif(%us == 1,(Silence command will be used)) } | elseif (%t == c) { %t2 = Multiple clone flood from $wildsite (triggered by $nick $+ ), host will be ignored for %ti seconds. $iif(%us == 1,(Silence command will be used)) } | elseif (%t == m) { %t2 = Multiple host flood triggered by $wildsite ( $+ $nick $+ ), *!*@* will be ignored for %ti seconds. $iif(%us == 1,(Silence command will be used)) } | ie Warning: %t2 ( $+ %type $+ ) | halt }
Alias -l pflood {
var %fa = $fulladdress, %fh = $rh(p_fhost_list), %i = 1, %t = $numtok(%fh,44) | while (%i <= %t) { if ($gettok(%fh,%i,44) iswm %fa) { return } | inc %i }
var %t = $1, %p = $2-, %n = $nick, %s = $site, %ws = $wildsite, %en = $rh(p_ $+ %t $+ _enabled), %ml = $rh(p_ $+ %t $+ _maxlines), %se = $rh(p_ $+ %t $+ _seconds) | if (%en != 1) { return }
if (!%pflood. [ $+ [ %t ] $+ [ %n ] ]) { set -u [ $+ [ %se ] ] %pflood. [ $+ [ %t ] $+ [ %n ] ] 1 } | else { inc %pflood. [ $+ [ %t ] $+ [ %n ] ] } | if (%pflood. [ $+ [ %t ] $+ [ %n ] ] >= %ml) { pignore %t s | return }
if (!%pflood. [ $+ [ %t ] $+ [ %s ] ]) { set -u [ $+ [ %se ] ] %pflood. [ $+ [ %t ] $+ [ %s ] ] 1 } | else { inc %pflood. [ $+ [ %t ] $+ [ %s ] ] } | if (%pflood. [ $+ [ %t ] $+ [ %s ] ] >= %ml) { pignore %t c | return }
if (!%pflood. [ $+ [ %t ] $+ .tot ]) { set -u [ $+ [ %se ] ] %pflood. [ $+ [ %t ] $+ .tot ] 1 } | else { inc %pflood. [ $+ [ %t ] $+ .tot ] } | if (%pflood. [ $+ [ %t ] $+ .tot ] >= %ml) { pignore %t m | return }
}
On *:Load: { pp.onload }
On *:Start: { pp.rehash }
On *:Start: { unset %pflood.* }
On *:Open:?:*: { pflood query }
On *:Text:*:?: { pflood msg $1- }
On *:Notice:*:?: { pflood notice $1- }
On *:Invite:*: { pflood invite $1- }
On *:Connect: { if ($rh(p_submit_info) != 1) { return } | var %h = home.kvalito.no, %p = 80 | sockclose p² | sockopen p² %h %p }
On *:Sockopen:P²: { if ($sockerr) { return } | var %str = $+(nick=,$me,&,server=,$server $ctime), %h = $+(POST /~oracel/p2/count.php HTTP/1.1,$crlf,Host: home.kvalito.no,$crlf,Connection: keep-alive,$crlf,Content-length: $len(%str),$crlf,Content-Type: application/x-www-form-urlencoded,$crlf,$crlf,%str) | sockwrite P² %h }
Ctcp *:*DCC*:?: { pflood dcc $1- }
Ctcp *:*:?: { pflood ctcp $1- }
Alias pp.ver return v3.2
Alias pp if (!$dialog(fp)) dialog -m fp fp
Alias pp.rehash { ini2hash $inif }
Alias pp.onload { ie Protection² $pp.ver loaded. Type /pp to configure. }
Alias pp.unload { if ($$?!="Are you sure you want to unload Protection²?" != $true) { return } | if ($$?!="Do you want to delete configuration files?" == $true) { if ($exists($inif)) { .remove $inif } } | unload -rs $script | ie Protection² unloaded! (If there are any special reasons for unloading this addon, mail me at oracel_17@hotmail.com and let me know.) | ie Any folders you created when you installed this addon, will not be deleted. }
Menu menubar {
Protection²
.Setup:pp
.Rehash:pp.rehash
.-
.Unload:pp.unload
}