rendered paste body;
; NoNameScript v4.01 - channel protections - coded by greeny
; Don't edit anything in here unless you REALLY know what you're doing!
;
on *:dialog:cprot.*.edit:sclick:7:{
tokenize 32 $did($did,1)
if (slclick select * iswm $1-) {
if ($5) { did -e $dname 11 }
else { did -b $dname 11,30 }
if ($5) && (!$6) { did -e $dname 30 }
else { did -b $dname 30 }
}
}
on *:dialog:cprot.*.edit:sclick:30:{
did -i $dname 7 1 page select
did -i $dname 7 1 cb root $wd($did(7,1),4-5)
set %cprot.editaction $gettok($wd($prot.svac,$calc($wd($did(7,1),5) -1)),2-,58)
.echo -q $dialog(cp.actionadd,cp.actionadd,-4)
unset %cprot.editaction
}
on *:dialog:cprot.*.edit:sclick:11:{ prot.delocc }
on *:dialog:cprot.*.edit:sclick:15:{ prot.addocc }
dialog cprot.ctcpflood.edit,cprot.join-/partflood.edit,cprot.mass-deop.edit,cprot.noticeflood.edit,cprot.repeating.edit,cprot.textflood.edit {
title "Edit channel protection"
size -1 -1 124 133
option dbu
box "", 1, 2 1 120 43
check "&Enable protection", 14, 6 10 54 9
text "Times", 2, 16 21 16 8
text "Seconds", 3, 16 32 23 8
edit "", 5, 59 19 59 11, limit 3
edit "", 6, 59 30 59 11, limit 3
list 7, 6 56 71 56, size
box "Actions to perform", 4, 2 48 120 68
button "&Add occasion", 15, 79 57 38 12
button "&Edit actions", 30, 79 69 38 12, disable
button "&Remove", 11, 79 84 38 12, disable
button "&Ok", 8, 40 119 40 12
button "&Cancel", 9, 82 119 40 12, cancel
}
on *:dialog:cprot.ctcpflood.edit:*:*:{ cprot.genflooddlg }
on *:dialog:cprot.join-/partflood.edit:*:*:{ cprot.genflooddlg }
on *:dialog:cprot.mass-deop.edit:*:*:{ cprot.genflooddlg }
on *:dialog:cprot.noticeflood.edit:*:*:{ cprot.genflooddlg }
on *:dialog:cprot.repeating.edit:*:*:{ cprot.genflooddlg }
on *:dialog:cprot.textflood.edit:*:*:{ cprot.genflooddlg }
alias cprot.genflooddlg {
if ($devent == init) {
mdx SetControlMDX $dname 7 TreeView haslines hasbuttons showsel notooltips > script\dlls\views.mdx
cprot.edload
did -a $dname 1 $cell(settings,115,1) protection $nbr($did(settings,112).seltext)
cprot.chkstate 2,3,4,5,6,7,15
}
elseif ($devent == sclick) {
if ($did == 8) {
if ($did(5) isnum 1-999) && ($did(6) isnum 1-999) {
cprot.edsave
dialog -c $dname
}
else { errdialog please enter valid numbers for the "Times" and "Seconds" fields! }
}
elseif ($did == 14) {
if ($did($did).state) {
did -e $dname 2,5,7,4,15
if ($did(5) != 1) { did -e $dname 3,6 }
}
else { did -b $dname 2,3,5,6,7,4,11,15 }
did -u $dname 7
}
}
elseif ($devent == edit) {
if ($istok(5 6,$did,32)) { numonlyedit $dname $did }
if ($did == 5) { did $iif($did($did) == 1,-b,-e) $dname 3,6 }
}
}
dialog cprot.codes.edit {
title "Edit channel protection"
size -1 -1 124 183
option dbu
box "", 1, 2 1 120 43
check "&Enable protection", 14, 6 10 54 9
text "Times", 2, 16 21 16 8
text "Seconds", 3, 16 32 23 8
edit "", 5, 59 19 59 11, limit 3
edit "", 6, 59 30 59 11, limit 3
box "Trigger on these control codes", 12, 2 47 120 48
check "A&ll", 13, 6 56 20 9
check "Color&s", 16, 35 56 28 9
check "Re&verse", 20, 73 56 32 9
check "&Bold", 17, 35 64 23 9
check "Rese&t", 19, 73 64 28 9
check "&Underline", 18, 35 72 35 9
text "Min. number of codes in text", 21, 7 82 70 8
edit "", 22, 81 80 37 11, limit 3
box "Actions to perform", 4, 2 98 120 68
list 7, 6 106 71 56, size
button "&Add occasion", 15, 79 107 38 12
button "&Edit actions", 30, 79 119 38 12, disable
button "&Remove", 11, 79 134 38 12, disable
button "&Ok", 8, 40 169 40 12
button "&Cancel", 9, 82 169 40 12, cancel
}
on *:dialog:cprot.codes.edit:*:*:{
if ($devent == init) {
mdx SetControlMDX $dname 7 TreeView haslines hasbuttons showsel notooltips > script\dlls\views.mdx
cprot.edload
var %s = $did(settings,112).seltext,%t = %cprot. [ $+ [ %s ] $+ ] .codes.trig
did -a $dname 1 Control codes protection $nbr(%s)
did -a $dname 22 %cprot. [ $+ [ %s ] $+ ] .codes.mincodes
if ( isin %t) { did -c $dname 16 }
if ( isin %t) { did -c $dname 17 }
if ( isin %t) { did -c $dname 18 }
if ( isin %t) { did -c $dname 20 }
if ( isin %t) { did -c $dname 19 }
if ($regex(%t,/[]/g) == 5) {
did -c $dname 13
did -b $dname 16,17,18,19,20
}
cprot.chkstate 2,3,4,5,6,7,12,15,13,16,17,18,19,20,21,22
}
elseif ($devent == sclick) {
if ($did == 8) {
if ($did(5) isnum 1-999) && ($did(6) isnum 1-999) {
set %cprot. [ $+ [ $did(settings,112).seltext ] $+ ] .codes.mincodes $iif($did(22),$did(22),1)
set %cprot. [ $+ [ $did(settings,112).seltext ] $+ ] .codes.trig $+(/[,$iif($did(13).state,,$+($iif($did(16).state,),$iif($did(17).state,),$iif($did(18).state,),$iif($did(20).state,),$iif($did(19).state,))),]/g)
cprot.edsave
dialog -c $dname
}
else { errdialog please enter valid numbers for the "Times" and "Seconds" fields! }
}
elseif ($did == 13) { did $iif($did($did).state,-b,-e) $dname 16,17,18,19,20 }
elseif ($did == 14) {
if ($did($did).state) {
if ($did(13).state) { did -e $dname 2,5,7,4,15,12,13 }
else { did -e $dname 2,5,7,4,15,12,13,16,17,18,19,20 }
if ($did(5) != 1) { did -e $dname 3,6 }
did -e $dname 21,22
}
else { did -b $dname 2,3,5,6,7,4,11,15,12,13,16,17,18,19,20,21,22 }
did -u $dname 7
}
}
elseif ($devent == edit) {
if ($istok(5 6 22,$did,32)) { numonlyedit $dname $did }
if ($did == 5) { did $iif($did($did) == 1,-b,-e) $dname 3,6 }
}
}
alias cprot.chkstate {
if ($wd($did(settings,115).seltext,5) == 2) { did -c $dname 14 }
else { did -b $dname $1 }
}
dialog cprot.caps.edit {
title "Edit channel protection"
size -1 -1 124 154
option dbu
box "", 1, 2 1 120 55
check "&Enable protection", 14, 6 10 54 9
text "Times", 2, 16 21 16 8
edit "", 5, 59 19 59 11, limit 3
text "Seconds", 3, 16 32 23 8
edit "", 6, 59 30 59 11, limit 3
text "Caps amount", 12, 16 43 35 8
edit "", 13, 59 41 48 11, limit 3
text "%", 16, 109 43 8 7
box "Actions to perform", 4, 2 59 120 78
list 7, 6 67 71 66, size
button "&Add occasion", 15, 79 68 38 12
button "&Edit actions", 30, 79 80 38 12, disable
button "&Remove", 11, 79 95 38 12, disable
button "&Ok", 8, 40 140 40 12
button "&Cancel", 9, 82 140 40 12, cancel
}
on *:dialog:cprot.caps.edit:*:*:{
if ($devent == init) {
mdx SetControlMDX $dname 7 TreeView haslines hasbuttons showsel notooltips > script\dlls\views.mdx
cprot.edload
var %s = $did(settings,112).seltext
did -a $dname 1 Caps protection $nbr(%s)
did -a $dname 13 $calc(%cprot. [ $+ [ %s ] $+ ] .caps.percent *100)
cprot.chkstate 2,3,4,5,6,7,12,15,13,16
}
elseif ($devent == sclick) {
if ($did == 8) {
if ($did(5) isnum 1-999) && ($did(6) isnum 1-999) {
set %cprot. [ $+ [ $did(settings,112).seltext ] $+ ] .caps.percent $calc($did(13) /100)
cprot.edsave
dialog -c $dname
}
else { errdialog please enter valid numbers for the "Times" and "Seconds" fields! }
}
elseif ($did == 14) {
if ($did($did).state) {
did -e $dname 2,5,7,4,12,13,15,16
if ($did(5) != 1) { did -e $dname 3,6 }
}
else { did -b $dname 2,3,5,6,7,4,11,15,12,13,16 }
did -u $dname 7
}
}
elseif ($devent == edit) {
if ($istok(5 6 13,$did,32)) { numonlyedit $dname $did }
if ($did == 5) { did $iif($did($did) == 1,-b,-e) $dname 3,6 }
}
}
dialog cprot.badword.edit {
title "Edit channel protection"
size -1 -1 124 182
option dbu
box "", 1, 2 1 120 43
check "&Enable protection", 14, 6 10 54 9
text "Times", 2, 16 21 16 8
edit "", 5, 59 19 59 11, limit 3
text "Seconds", 3, 16 32 23 8
edit "", 6, 59 30 59 11, limit 3
box "Bad words", 12, 2 47 120 47
list 100, 6 55 71 34, sort size extsel vsbar
button "&Add", 101, 79 56 38 12
button "Re&move", 102, 79 68 38 12
box "Actions to perform", 4, 2 97 120 68
list 7, 6 105 71 56, size
button "Add o&ccasion", 15, 79 106 38 12
button "&Edit actions", 30, 79 118 38 12, disable
button "&Remove", 11, 79 133 38 12, disable
button "&Ok", 8, 40 168 40 12
button "&Cancel", 9, 82 168 40 12, cancel
}
on *:dialog:cprot.badword.edit:*:*:{
if ($devent == init) {
mdx SetControlMDX $dname 7 TreeView haslines hasbuttons showsel notooltips > script\dlls\views.mdx
cprot.edload
var %s = $did(settings,112).seltext
did -a $dname 1 Badword protection $nbr(%s)
didtok $dname 100 44 $mkregex(%cprot. [ $+ [ %s ] $+ ] .badword.words).re
cprot.chkstate 2,3,4,5,6,7,12,15,100,101,102
}
elseif ($devent == sclick) {
if ($did == 8) {
if ($did(5) isnum 1-999) && ($did(6) isnum 1-999) {
set %cprot. [ $+ [ $did(settings,112).seltext ] $+ ] .badword.words $mkregex($didtok(100,44))
cprot.edsave
dialog -c $dname
}
else { errdialog please enter valid numbers for the "Times" and "Seconds" fields! }
}
elseif ($did == 101) {
var %x = $$eddialog(Enter a new bad word!)
if (!$didwm(100,%x)) { did -a $dname 100 %x }
else { errdialog this bad word is already in the list! }
}
elseif ($did == 100) { did $iif($did($did).sel,-e,-b) $dname 102 }
elseif ($did == 102) {
while ($did(100).sel) { did -d $dname 100 $v1 }
did -b $dname 102
}
elseif ($did == 14) {
if ($did($did).state) {
did -e $dname 2,5,7,4,15,12,100,101
if ($did(5) != 1) { did -e $dname 3,6 }
}
else { did -b $dname 2,3,5,6,7,4,11,15,12,100,101,102 }
did -u $dname 100,7
}
}
elseif ($devent == edit) {
if ($istok(5 6,$did,32)) { numonlyedit $dname $did }
if ($did == 5) { did $iif($did($did) == 1,-b,-e) $dname 3,6 }
}
}
dialog cprot.advertising.edit {
title "Edit channel protection"
size -1 -1 124 182
option dbu
box "", 1, 2 1 120 43
check "&Enable protection", 14, 6 10 54 9
text "Times", 2, 16 21 16 8
edit "", 5, 59 19 59 11, limit 3
text "Seconds", 3, 16 32 23 8
edit "", 6, 59 30 59 11, limit 3
box "Strictness", 12, 2 47 120 47
list 13, 8 54 16 36, size
text "", 16, 31 55 86 8
text "", 17, 31 63 86 26
box "Actions to perform", 4, 2 97 120 68
list 7, 6 105 71 56, size
button "&Add occasion", 15, 79 106 38 12
button "&Edit actions", 30, 79 118 38 12, disable
button "&Remove", 11, 79 133 38 12, disable
button "&Ok", 8, 40 168 40 12
button "&Cancel", 9, 82 168 40 12, cancel
}
on *:dialog:cprot.advertising.edit:*:*:{
if ($devent == init) {
mdx SetControlMDX $dname 7 TreeView haslines hasbuttons showsel notooltips > script\dlls\views.mdx
mdx SetControlMDX $dname 13 TrackBar vertical > script\dlls\bars.mdx
mdx SetBorderStyle $dname 13
var %s = $did(settings,112).seltext
did -i $dname 13 1 params %cprot. [ $+ [ %s ] $+ ] .advertising.strict 1 3 * * * * 20
did -i $dname 13 1 ticfreq 1
bold $dname 16
adprot.sref
cprot.edload
cprot.chkstate 2,3,4,5,6,7,12,13,15,16,17
did -a $dname 1 Advertising protection $nbr(%s)
}
elseif ($devent == sclick) {
if ($did == 13) { adprot.sref }
elseif ($did == 8) {
if ($did(5) isnum 1-999) && ($did(6) isnum 1-999) {
set %cprot. [ $+ [ $did(settings,112).seltext ] $+ ] .advertising.strict $gettok($did(13,1),1,32)
cprot.edsave
dialog -c $dname
}
else { errdialog please enter valid numbers for the "Times" and "Seconds" fields! }
}
elseif ($did == 14) {
if ($did($did).state) {
did -e $dname 2,5,7,4,15,12,13,16,17
if ($did(5) != 1) { did -e $dname 3,6 }
}
else { did -b $dname 2,3,5,6,7,4,11,15,12,13,16,17 }
did -u $dname 7
}
}
elseif ($devent == edit) {
if ($istok(5 6,$did,32)) { numonlyedit $dname $did }
if ($did == 5) { did $iif($did($did) == 1,-b,-e) $dname 3,6 }
}
}
alias prot.addocc {
did -i $dname 7 1 cb root 2
var %n = $did(7).lines
if (%n < 6) {
did -i $dname 7 1 cb root 2
did -a $dname 7 +e 1 1 0 0 0 $ord(%n) occasion
}
else { errdialog you can only add up to 5 occasions! }
}
alias prot.cleanini {
hmake cleanini
var %v = $var(%?prot.*.action,0)
while (%v) {
var %c = $var(%?prot.*.action,%v),%e = [ [ %c ] ]
if ($regex(num,%e,/(?:cm|cc|s|es|k|kl|bn)\-([0-9A-Z]+)|(?:wu\-\d\-([0-9A-Z]+))/g)) {
var %z = 1
while ($regml(num,%z)) {
hadd cleanini $v1 1
inc %z
}
}
dec %v
}
.fopen $iif(!$isfile(script\txt\paction.ini),-o) paction.old script\txt\paction.ini
.fopen -o paction.new script\txt\paction.new
while (!$feof) {
var %l = $fread(paction.old)
if (%l) && (($hget(cleanini,$gettok(%l,1,61))) || ([*] iswm %l)) { .fwrite -n paction.new %l }
}
.fclose paction.*
.remove script\txt\paction.ini
.rename script\txt\paction.new script\txt\paction.ini
hfree cleanini
}
alias prot.delocc {
did -i $dname 7 1 page select
var %t = $gettok($did(7,1),4-,32)
did -i $dname 7 1 cb root $deltok(%t,-1,32)
did -d $dname 7 $wd(%t,-1)
if ($numtok(%t,32) == 2) {
var %i = $did(7).lines
while (%i > 1) {
did -i $dname 7 1 replaceitem %i $puttok($did(7,%i),$ord($calc(%i -1)),7,32)
dec %i
}
}
did -u $dname 7
did -b $dname 11,30
}
alias cprot.edsave {
var %s = $did(settings,112).seltext,%t = $cell(settings,115,1),%r = $prot.svac,%d,%z
set %cprot. [ $+ [ %s ] $+ ] . [ $+ [ %t ] ] $did(14).state
set %cprot. [ $+ [ %s ] $+ ] . [ $+ [ %t ] $+ ] .action %r
if ($1 != -c) {
set %cprot. [ $+ [ %s ] $+ ] . [ $+ [ %t ] $+ ] .secs $did(6)
%d = $did(6)
}
if ($1 != -i) {
set %cprot. [ $+ [ %s ] $+ ] . [ $+ [ %t ] $+ ] .times $did(5)
%z = $did(5)
}
did -o settings 115 $did(settings,115).sel 0 +fs 0 0 $calc($did(14).state +1) $cell(settings,115,1) $+ + 0 0 0 $iif(%z,%z,n/a) $+ + 0 0 0 $iif(%d && %z != 1,%d $+ $iif($1 == -i,*60),n/a) $+ + 0 0 0 $prot.traction(%r) $+ $+ $gettok($did(settings,115).seltext,2-,4)
prot.cleanini
}
alias cprot.aload {
var %i = 1
did -i $dname 7 1 cb root
did -a $dname 7 +be 1 1 0 0 0 Actions
did -i $dname 7 1 cb last
while (%i <= $0) {
did -a $dname 7 +e 1 1 0 0 0 $ord(%i) occasion
did -i $dname 7 1 cb last
var %v = 1,%z = $numtok($ [ $+ [ %i ] ],43)
while (%v <= %z) {
var %u = $gettok($gettok($ [ $+ [ %i ] ],2-,58),%v,43)
if (%u) { did -a $dname 7 + 1 1 0 0 0 $+($prot.naction(%u), ,%u) }
inc %v
}
did -i $dname 7 1 cb up
inc %i
}
}
alias cprot.edload {
var %x = $cell(settings,115,1),%s = $did(settings,112).seltext
if ($1 != -c) { did -a $dname 6 %cprot. [ $+ [ %s ] $+ ] . [ $+ [ %x ] $+ ] .secs }
if ($1 != -i) { did -a $dname 5 %cprot. [ $+ [ %s ] $+ ] . [ $+ [ %x ] $+ ] .times }
if (!$1) && ($did(5) == 1) { did -b $dname 3,6 }
cprot.aload %cprot. [ $+ [ %s ] $+ ] . [ $+ [ %x ] $+ ] .action
}
alias adprot.sref {
var %x = $wd($did(13,1),1)
if (%x == 1) {
did -ra $dname 16 High:
did -ra $dname 17 The protection immediately triggers whenever a #channel or URL is mentioned in the channel you are protecting.
}
elseif (%x == 2) {
did -ra $dname 16 Medium (recommended):
did -ra $dname 17 The protection is only triggered when a #channel/URL along with a trigger like "join" or "visit" is mentioned.
}
else {
did -ra $dname 16 Low:
did -ra $dname 17 The protection is only triggered when a #chan/URL along with a trigger like "visit" is mentioned and there are control codes in the text.
}
}
alias cprot.edit {
var %s = $+(cprot.,$cell(115,1),.edit)
.echo -q $dialog(%s,%s,-4)
}
alias cprot.setsave {
var %i = $did(settings,115).lines
while (%i > 1) {
set $+(%,cprot.,$did(settings,112).seltext,.,$cell(settings,115,%i,1)) $calc($wd($did(settings,115,%i),5) -1)
dec %i
}
}
alias cprot.loaddef {
var %c = $+(cprot.,$did(settings,112).seltext,.)
set % $+ %c $+ advertising 0 | set % $+ %c $+ advertising.strict 2 | set % $+ %c $+ advertising.times 1 | set % $+ %c $+ advertising.secs 30 | set % $+ %c $+ advertising.action 1:wu-1-d 2:b-1800-3+k-d
set % $+ %c $+ badword 0 | set % $+ %c $+ badword.times 1 | set % $+ %c $+ badword.secs 30 | set % $+ %c $+ badword.action 1:wu-1-d 2:b-1800-3+k-d | unset % [ $+ [ %c ] $+ ] badword.words
set % $+ %c $+ caps 0 | set % $+ %c $+ caps.times 2 | set % $+ %c $+ caps.secs 30 | set % $+ %c $+ caps.percent 0.9 | set % $+ %c $+ caps.action 1:wu-1-d 2:b-1800-3+k-d
set % $+ %c $+ codes 0 | set % $+ %c $+ codes.mincodes 3 | set % $+ %c $+ codes.trig /[]/g | set % $+ %c $+ codes.times 2 | set % $+ %c $+ codes.secs 30 | set % $+ %c $+ codes.action 1:wu-1-d 2:b-1800-3+k-d
set % $+ %c $+ ctcpflood 1 | set % $+ %c $+ ctcpflood.times 2 | set % $+ %c $+ ctcpflood.secs 10 | set % $+ %c $+ ctcpflood.action 1:wu-1-d 2:b-1800-3+k-d
set % $+ %c $+ join-/partflood 0 | set % $+ %c $+ join-/partflood.times 5 | set % $+ %c $+ join-/partflood.secs 10 | set % $+ %c $+ join-/partflood.action 1:wu-1-d 2:b-1800-3+k-d
set % $+ %c $+ mass-deop 0 | set % $+ %c $+ mass-deop.times 4 | set % $+ %c $+ mass-deop.secs 10 | set % $+ %c $+ mass-deop.action 1:wu-1-d 2:b-1800-3+k-d
set % $+ %c $+ noticeflood 1 | set % $+ %c $+ noticeflood.times 2 | set % $+ %c $+ noticeflood.secs 20 | set % $+ %c $+ noticeflood.action 1:wu-1-d 2:b-1800-3+k-d
set % $+ %c $+ repeating 1 | set % $+ %c $+ repeating.times 3 | set % $+ %c $+ repeating.secs 10 | set % $+ %c $+ repeating.action 1:wu-1-d 2:b-1800-3+k-d
set % $+ %c $+ textflood 0 | set % $+ %c $+ textflood.times 8 | set % $+ %c $+ textflood.secs 6 | set % $+ %c $+ textflood.action 1:wu-1-d 2:b-1800-3+k-d
if ($dialog(settings)) { cprot.setload }
prot.cleanini
}
alias cprot.setload {
var %s = $did(settings,112).seltext,%c = cprot. $+ %s,%t,%x = Advertising Badword Caps Codes CTCPflood Join-/Partflood Mass-deop Noticeflood Repeating Textflood,%i = 1
did -b settings 117
if ((% [ $+ [ %c ] $+ ] .usepreset) || (%cprot.presetonly)) && (%s != Preset) { did -b settings 37,145,146,147,36,115 }
else { did -e settings 37,145,146,147,36,115 }
if (%s != Preset) && (!%cprot.presetonly) { did -e $dname 144 }
else { did -b $dname 144 }
did $iif(%s == Preset,-b,-e) settings 114
did $iif(% [ $+ [ %c ] $+ ] .usepreset,-c,-u) settings 144
did $iif(% [ $+ [ %c ] $+ ] .punishops,-c,-u) settings 145
did $iif(% [ $+ [ %c ] $+ ] .punishvoiced,-c,-u) settings 146
window -h @cprot.setload
while ($wd(%x,%i)) {
var %u = $v1,%t = [ % [ $+ [ %c ] $+ ] . [ $+ [ %u ] $+ ] .times ]
echo @cprot.setload 0 + 0 0 $iif( [ % [ $+ [ %c ] $+ ] . [ $+ [ %u ] ] ] ,2,1) %u $+ + 0 0 0 %t $+ + 0 0 0 $iif(%t == 1,n/a, [ % [ $+ [ %c ] $+ ] . [ $+ [ %u ] $+ ] .secs ] ) $+ + 0 0 0 $prot.traction( [ % [ $+ [ %c ] $+ ] . [ $+ [ %u ] $+ ] .action ] )
inc %i
}
filter -cwo @cprot.setload settings 115
close -@ @cprot.setload
}
alias prot.naction {
if ($1 == bl) { return Blacklist user }
elseif ($1 == do) { return Deop/devoice user }
elseif ($1 == bp) { return Beep }
elseif ($1 == cq) { return Close query }
elseif ($1 == fl) { return Flash mIRC }
elseif (es-* iswm $1) { return Echo msg. }
elseif (bn-* iswm $1) { return Show balloon }
elseif (wu-* iswm $1) { return Warn user }
elseif ($regex(cp2,$1,/^b-(\d+)-.+$/)) { return Ban user $iif($regml(cp2,1),$nbr($calc($v1 /60) $+ m)) }
elseif (k-* iswm $1) { return Kick user }
elseif (kl-* iswm $1) { return Kill user }
elseif ($regex(cp1,$1,/^i-.+-(\d+)-.+$/)) { return Ignore user $iif($regml(cp1,1),$nbr($calc($v1 /60) $+ m)) }
elseif (cc-* iswm $1) { return Custom command }
elseif (cm-* iswm $1) { return Change channel modes }
elseif (s-* iswm $1) { return Play sound }
elseif ($1 == us) { return Unban self }
elseif ($1 == is) { return Ignore spam }
}
dialog cp.actionadd {
title "Add action"
size -1 -1 151 136
option dbu
tab "Warnings", 1, 2 0 146 118
check "&Beep (if sounds are enabled)", 7, 7 16 81 9, tab 1
check "&Flash mIRC (if minimized)", 6, 7 24 71 9, tab 1
check "&Show echo message to self:", 24, 7 32 79 9, tab 1
edit "<nick> triggered your <type> protection in <chan>! Taking countermeasures...", 15, 15 41 128 11, disable tab 1 autohs limit 200
check "S&how balloon tip (if enabled), message:", 8, 7 53 107 9, tab 1
edit "<nick> triggered your <type> protection in <chan>! Taking countermeasures...", 9, 15 62 128 11, disable tab 1 autohs limit 200
check "W&arn user, message:", 22, 7 75 64 9, tab 1
edit "Don't <flood> in <chan>! Taking countermeasures...", 23, 15 84 128 11, disable tab 1 autohs limit 200
text "Send as", 3, 16 97 22 8, disable tab 1
radio "¬ice", 2, 41 96 27 9, disable tab 1
radio "&private message", 4, 41 105 52 9, disable tab 1
tab "Control", 13
check "&Ban user", 35, 7 16 34 9, tab 13
check "&Unban after", 32, 16 24 42 9, disable tab 13
combo 51, 62 23 28 67, disable tab 13 size edit limit 3 drop
text "minutes", 34, 96 25 21 8, disable tab 13
text "Ban mask:", 21, 25 37 27 8, disable tab 13
combo 36, 62 35 81 85, disable tab 13 size drop
check "&Deop/devoice user", 29, 7 48 58 9, tab 13
check "&Kick user, reason:", 25, 7 56 55 9, tab 13
edit "Don't <flood>!", 26, 15 65 128 11, disable tab 13 autohs limit 200
check "K&ill user (IRCop only), reason:", 55, 7 78 84 9, tab 13
edit "Don't <flood>!", 56, 15 87 128 11, disable tab 13 autohs limit 200
tab "Ignore", 14
check "&Ignore", 38, 7 16 28 9, tab 14
check "&Complete", 54, 16 24 34 9, disable tab 14
check "&Private", 39, 16 32 30 9, disable tab 14
check "&DCC", 43, 61 32 24 9, disable tab 14
check "C&hannel", 40, 16 40 32 9, disable tab 14
check "I&nvite", 44, 61 40 27 9, disable tab 14
check "N&otice", 41, 16 48 27 9, disable tab 14
check "Co&des", 45, 61 48 27 9, disable tab 14
check "C&TCP", 42, 16 56 26 9, disable tab 14
check "&Remove after", 46, 16 64 44 9, disable tab 14
combo 33, 62 63 28 67, disable tab 14 size edit limit 3 drop
text "minutes", 48, 96 65 21 8, disable tab 14
text "Ignore mask:", 49, 25 77 33 8, disable tab 14
combo 50, 62 75 81 85, disable tab 14 size drop
tab "Misc.", 5
check "&Blacklist user", 16, 7 16 43 9, tab 5
check "&Custom command:", 30, 7 24 55 9, tab 5
edit "", 31, 15 33 128 11, disable tab 5 autohs limit 200
check "&Set channel mode(s):", 27, 7 46 62 9, tab 5
edit "+", 28, 15 55 128 11, disable tab 5 autohs limit 50
check "&Play sound:", 47, 7 67 40 9, tab 5
edit "", 52, 15 76 110 11, disable tab 5 autohs limit 400
button "&...", 53, 126 76 17 11, disable tab 5
tab "Help", 37
text "Here is a list of identifiers you can use in your custom kick messages and warnings:", 11, 7 17 131 13, tab 37
list 10, 6 39 57 75, tab 37 sort size vsbar
text "Description:", 17, 68 32 30 7, tab 37
text "No item selected.", 18, 68 39 74 74, tab 37
text "Identifiers:", 12, 7 32 28 7, tab 37
button "&Ok", 19, 67 122 40 12
button "&Cancel", 20, 109 122 40 12, cancel
}
on *:dialog:cp.actionadd:*:*:{
if ($devent == init) {
didtok $dname 33,51 44 2,5,10,30,60,120,300
did -c $dname 2,33,51 3
var %i = 0
while (%i <= 9) {
did -a $dname 36,50 $+([,%i,]) $mask(nick!ident@some.host.com,%i)
inc %i
}
did -c $dname 36 %ban.mask
did -c $dname 50 %ignore.mask
didtok $dname 10 44 <action>,<chan>,<type>,<flood>,<next>,<nick>,<occasion>,<secs>,<times>
var %i = 1,%t = $numtok(%cprot.editaction,43)
while (%i <= %t) {
tokenize 45 $gettok(%cprot.editaction,%i,43)
if ($1 == bl) { did -c $dname 16 }
elseif ($1 == do) { did -c $dname 29 }
elseif ($1 == bp) { did -c $dname 7 }
elseif ($1 == fl) { did -c $dname 6 }
elseif ($1 == es) {
did -c $dname 24
did -e $dname 15
if ($2 != d) { did -ra $dname 15 $decode($readini(script\txt\paction.ini,cpaction,$2),m) }
}
elseif ($1 == bn) {
did -c $dname 8
did -e $dname 9
if ($2 != d) { did -ra $dname 9 $decode($readini(script\txt\paction.ini,cpaction,$2),m) }
}
elseif ($1 == wu) {
did -c $dname 22
did -e $dname 23,2,3,4
if (!$2) {
did -u $dname 2
did -c $dname 4
}
if ($3 != d) { did -ra $dname 23 $decode($readini(script\txt\paction.ini,cpaction,$3),m) }
}
elseif ($1 == b) {
did -c $dname 35
did -e $dname 32,34,21,36
if ($2) {
did -c $dname 32
did -e $dname 51
if ($didwm(51,$calc($2 /60))) { did -c $dname 51 $v1 }
else { did -ac $dname 51 $calc($2 /60) }
}
did -c $dname 36 $calc($3 +1)
}
elseif ($1 == k) {
did -c $dname 25
did -e $dname 26
if ($2 != d) { did -ra $dname 26 $decode($readini(script\txt\paction.ini,cpaction,$2),m) }
}
elseif ($1 == kl) {
did -c $dname 55
did -e $dname 56
if ($2 != d) { did -ra $dname 56 $decode($readini(script\txt\paction.ini,cpaction,$2),m) }
}
elseif ($1 == i) {
did -c $dname 38
did -e $dname 54,48,46,49,50
if ($2 == a) { did -c $dname 54 }
else {
did -e $dname 39,40,41,42,43,44,45
if (p isin $2) { did -c $dname 39 }
if (c isin $2) { did -c $dname 40 }
if (n isin $2) { did -c $dname 41 }
if (t isin $2) { did -c $dname 42 }
if (d isin $2) { did -c $dname 43 }
if (i isin $2) { did -c $dname 44 }
if (k isin $2) { did -c $dname 45 }
}
if ($3) {
did -c $dname 46
did -e $dname 33
if ($didwm(33,$calc($3 /60))) { did -c $dname 33 $v1 }
else { did -ac $dname 33 $calc($3 /60) }
}
did -c $dname 50 $calc($4 +1)
}
elseif ($1 == cc) {
did -c $dname 30
did -e $dname 31
if ($2 != d) { did -ra $dname 31 $decode($readini(script\txt\paction.ini,cpaction,$2),m) }
}
elseif ($1 == cm) {
did -c $dname 27
did -e $dname 28
if ($2 != d) { did -ra $dname 28 $decode($readini(script\txt\paction.ini,cpaction,$2),m) }
}
elseif ($1 == s) {
did -c $dname 47
did -e $dname 52,53
if ($2 != d) { did -ra $dname 52 $decode($readini(script\txt\paction.ini,cpaction,$2),m) }
}
inc %i
}
}
elseif ($devent == sclick) {
if ($did == 10) {
var %s = $did($did).seltext
if (%s == <chan>) { did -ra $dname 18 <chan> is replaced with the channel the protection is triggered in. }
elseif (%s == <flood>) { did -ra $dname 18 <flood> is replaced with the action the user shouldn't have taken (e.g: "use too many control codes"). }
elseif (%s == <type>) { did -ra $dname 18 <type> is replaced with the type of protection that triggered. }
elseif (%s == <nick>) { did -ra $dname 18 <nick> is replaced with the nick of the person who triggered the protection. }
elseif (%s == <times>) { did -ra $dname 18 <times> is replaced with the amount of times the nickname needed to flood/repeat/etc. until the protection triggered. }
elseif (%s == <secs>) { did -ra $dname 18 <secs> is replaced with the amount of seconds the nickname needed to perform the flood to trigger the protection. }
elseif (%s == <occasion>) { did -ra $dname 18 <occasion> is replaced with the occasion number the nickname is flooding. }
elseif (%s == <action>) { did -ra $dname 18 <action> is replaced with the type of reaction the protection triggers. }
elseif (%s == <next>) { did -ra $dname 18 <next> is replaced with the type of reaction the protection triggers when the user is flooding again. }
}
elseif ($did == 24) { did $iif($did($did).state,-e,-b) $dname 15 }
elseif ($did == 8) { did $iif($did($did).state,-e,-b) $dname 9 }
elseif ($did == 22) { did $iif($did($did).state,-e,-b) $dname 23,2,3,4 }
elseif ($did == 35) {
did $iif($did($did).state,-e,-b) $dname 32,34,21,36
if ($did($did).state) && ($did(32).state) { did -e $dname 51 }
else { did -b $dname 51 }
}
elseif ($did == 32) { did $iif($did($did).state,-e,-b) $dname 51 }
elseif ($did == 25) { did $iif($did($did).state,-e,-b) $dname 26 }
elseif ($did == 55) { did $iif($did($did).state,-e,-b) $dname 56 }
elseif ($did == 38) {
did $iif($did($did).state,-e,-b) $dname 54,48,46,49,50
if (!$did(54).state) || (!$did($did).state) { did $iif($did($did).state,-e,-b) $dname 39,40,41,42,43,44,45 }
if ($did($did).state) && ($did(46).state) { did -e $dname 33 }
else { did -b $dname 33 }
}
elseif ($did == 54) { did $iif($did($did).state,-b,-e) $dname 39,40,41,42,43,44,45 }
elseif ($did == 46) { did $iif($did($did).state,-e,-b) $dname 33 }
elseif ($did == 30) { did $iif($did($did).state,-e,-b) $dname 31 }
elseif ($did == 27) { did $iif($did($did).state,-e,-b) $dname 28 }
elseif ($did == 47) { did $iif($did($did).state,-e,-b) $dname 52,53 }
elseif ($did == 53) { did -ra $dname 52 $relpath($$sfile(*.wav;*.mid;*.mp3;*.ogg;*.wma,Choose a sound file to play!)) }
elseif ($did == 19) {
var %r,%t = $cell(settings,115,1),%d = $+(cprot.,%t,.edit),%f = script\txt\paction.ini,%u
if ($did(7).state) { %r = bp }
if ($did(6).state) { %r = %r fl }
if ($did(24).state) {
if ($did(15)) {
var %u = $trnum,%r = %r es- $+ %u
writeini -n %f cpaction %u $encode($v1,m)
}
else { %r = %r es-d }
}
if ($did(8).state) {
if ($did(9)) {
var %u = $trnum,%r = %r bn- $+ %u
writeini -n %f cpaction %u $encode($v1,m)
}
else { %r = %r bn-d }
}
if ($did(22).state) {
var %z = $did(2).state
if ($did(23)) {
var %u = $trnum,%r = %r $+(wu-,%z,-,%u)
writeini -n %f cpaction %u $encode($v1,m)
}
else { %r = %r $+(wu-,%z,-d) }
}
if ($did(35).state) { %r = %r $+(b-,$iif($did(32).state,$iif($int($did(51)) isnum,$calc($v1 *60),0),0),-,$calc($did(36).sel -1)) }
if ($did(29).state) { %r = %r do }
if ($did(25).state) {
if ($did(26)) {
var %u = $trnum,%r = %r k- $+ %u
writeini -n %f cpaction %u $encode($v1,m)
}
else { %r = %r k-d }
}
if ($did(55).state) {
if ($did(56)) {
var %u = $trnum,%r = %r kl- $+ %u
writeini -n %f cpaction %u $encode($v1,m)
}
else { %r = %r kl-d }
}
if ($did(38).state) {
var %h
if ($did(54).state) { %h = a }
else {
if ($did(39).state) { %h = p }
if ($did(40).state) { %h = %h $+ c }
if ($did(41).state) { %h = %h $+ n }
if ($did(42).state) { %h = %h $+ t }
if ($did(43).state) { %h = %h $+ d }
if ($did(44).state) { %h = %h $+ i }
if ($did(45).state) { %h = %h $+ k }
if (!%h) { %h = a }
}
%r = %r $+(i-,%h,-,$iif($did(46).state,$iif($did(33) isnum,$calc($v1 *60),0),0),-,$calc($did(50).sel -1))
}
if ($did(16).state) { %r = %r bl }
if ($did(30).state) {
if ($did(31)) {
var %u = $trnum,%r = %r cc- $+ %u
writeini -n %f cpaction %u $encode($v1,m)
}
else { %r = %r cc-d }
}
if ($did(27).state) {
if ($did(28)) {
var %u = $trnum,%r = %r cm- $+ %u
writeini -n %f cpaction %u $encode($v1,m)
}
else { %r = %r cm-d }
}
if ($did(47).state) {
if ($did(52)) {
var %u = $trnum,%r = %r s- $+ %u
writeini -n %f cpaction %u $encode($v1,m)
}
else { %r = %r s-d }
}
did -i %d 7 1 page select
did -i %d 7 1 cb root $wd($did(%d,7,1),4-5)
var %i = $numtok(%r,32),%wa,%o = $did(%d,7).lines
while ($did(%d,7).lines > 1) { did -d %d 7 2 }
if (%i > 5) { var %wa = 1,%r = $wd(%r,1-5),%i = 5 }
while (%i) {
did -a %d 7 + 1 1 0 0 0 $+($prot.traction(1: $+ $wd(%r,%i)), ,$wd(%r,%i))
dec %i
}
did -i %d 7 1 sort
dialog -c $dname
if (%wa) { errdialog you have chosen more than 5 actions so only the first 5 have been added! }
}
}
}
alias cprot.dchk {
hadd -mu $+ %cprot. [ $+ [ %cprot.curchan ] $+ ] . [ $+ [ $1 ] $+ ] .secs cprot $+($1,.,$chan,.,$cid,.,$fulladdress,.t-,$trnum) 1
if ($hfind(cprot,$+($1,.,$chan,.,$cid,.,$fulladdress,.t-*),0,w) >= %cprot. [ $+ [ %cprot.curchan ] $+ ] . [ $+ [ $1 ] $+ ] .times) { cprot.dotrig $1 }
}
alias cprot.dotrig {
if ($hget(cprot)) { hdel -w cprot $+($1,.,$chan,.,$cid,.,$fulladdress,.t-*) }
hinc -mu3600 cprot $+($1,.,$chan,.,$cid,.,$fulladdress,.p)
var %j,%o = $hget(cprot,$+($1,.,$chan,.,$cid,.,$fulladdress,.p)),%r = %cprot. [ $+ [ %cprot.curchan ] $+ ] . [ $+ [ $1 ] $+ ] .action
if (%o >= $numtok(%r,32)) { hdel cprot $+($1,.,$chan,.,$cid,.,$fulladdress,.p) }
var %x = 1,%c = $gettok($wd(%r,%o),2-,58)
set %cprot.msgrep <chan>, $+ $chan $+ ,<type>, $+ $1 $+ ,<flood>, $+ $cprot.repflood($1) $+ ,<nick>, $+ $nick $+ ,<times>, $+ [ %cprot. [ $+ [ %cprot.curchan ] $+ ] . [ $+ [ $1 ] $+ ] .times ] $+ ,<secs>, $+ [ %cprot. [ $+ [ %cprot.curchan ] $+ ] . [ $+ [ $1 ] $+ ] .secs ] $+ ,<occasion>, $+ %o $+ ,<action>, $+ $prot.traction(1: $+ %c) $+ ,<next>, $+ $iif($wd(%r,$calc(%o +1)),$prot.traction($v1),n/a)
while ($gettok(%c,%x,43)) {
var %t = $v1,%d
if (%t == bp) { beep }
elseif (%t == fl) { flash }
elseif (%t == do) { mode $chan -ov $nick $nick }
elseif (%t == bl) { prot.blackadd $iif($address($nick,%ban.mask),$v1,$nick $+ !*@*) Don't $cprot.repflood($1) $+ ! }
elseif ($regex(cpt,%t,/^k-([0-9A-Z]+|d)$/)) { kick $chan $nick $iif($regml(cpt,1) != d,$cprot.getmsg($v1),Don't $cprot.repflood($1) $+ !) $kc }
elseif ($regex(cpt,%t,/^kl-([0-9A-Z]+|d)$/)) { kill $nick $iif($regml(cpt,1) != d,$cprot.getmsg($v1),Don't $cprot.repflood($1) $+ !) }
elseif ($regex(cpt,%t,/^es-([0-9A-Z]+|d)$/)) {
if ($regml(cpt,1) != d) { thmecho -a $cprot.getmsg($v1) }
else { thmecho -a $nick triggered your $1 protection in $chan $+ . }
}
elseif ($regex(cpt,%t,/^bn-([0-9A-Z]+|d)$/)) {
npop $1 protection in $+($chan,,$iif($regml(cpt,1) != d,$cprot.getmsg($v1),$nick triggered your $1 protection in $chan $+ .))
%j = 1
}
elseif ($regex(cpt,%t,/^wu-(1|0)-([0-9A-Z]+|d)$/)) { $iif($regml(cpt,1),.notice,.msg) $nick $iif($regml(cpt,2) != d,$cprot.getmsg($v1),Don't $cprot.repflood($1) in $chan $+ !) }
elseif ($regex(cpt,%t,/^b-(\d+)-([0-9])$/)) { ban $iif($regml(cpt,1),-u $+ $v1) $chan $nick $regml(cpt,2) }
elseif ($regex(cpt,%t,/^i-([pcntdik]+|a)-(\d+)-([0-9])$/)) { .ignore $+(-,$iif($regml(cpt,1) != a,$v1),$iif($regml(cpt,2),u $+ $v1)) $nick $regml(cpt,3) }
elseif ($regex(cpt,%t,/^cc-([0-9A-Z]+|d)$/)) {
if ($regml(cpt,1) != d) { $cprot.getmsg($v1) }
else { thmerror -a no command for the $1 protection in $chan specified! }
}
elseif ($regex(cpt,%t,/^cm-([0-9A-Z]+|d)$/)) {
if ($regml(cpt,1) != d) { mode $chan $cprot.getmsg($v1) }
else { thmerror -a no channel mode change for the $1 protection in $chan specified! }
}
elseif ($regex(cpt,%t,/^s-([0-9A-Z]+|d)$/)) {
var %s = $cprot.getmsg($regml(cpt,1))
if ($regml(cpt,1) != d) && ($isfile(%s)) { splay %s }
else { thmerror -a no sound for the $1 protection in $chan specified! }
}
inc %x
}
if ($balloon.trig(c)) && (!%j) { npop Channel protection $+($iif($scid(0) > 1,$nbr($curconserv)),,$nick) triggered your $1 protection in $chan $+ ! Taking countermeasures... }
unset %cprot.msgrep
}
alias prot.blackadd {
if ($1 !iswm $address($me,5)) {
hadd black $1-
hsave -ob black script\tables\black.tbl
if ($dialog(black)) {
did -a black 5 0 + 0 0 0 $1 $+ + 0 0 0 $2
did -e black 17
}
scon -at1 bkacs
}
}
alias cprot.repflood { return $replacex($1-,advertising,advertise,badword,use bad words,caps,write in caps,codes,use too many control codes,ctcpflood,ctcp flood,join-/partflood,join-/partflood,mass-deop,mass-deop,noticeflood,notice flood,repeating,repeat yourself,textflood,text flood) }
alias cprot.getmsg { return $replacex($decode($readini(script\txt\paction.ini,cpaction,$1),m), [ %cprot.msgrep ] ) }
alias cprot.chkst {
if (!$ccontrol($2)) || (!$prot.exclps($address($1,5))) { return 0 }
if (%cprot. [ $+ [ $2 ] $+ ] .usepreset) || (%cprot.presetonly) { set %cprot.curchan Preset }
else { set %cprot.curchan $2 }
if (($1 isop $2) || ($1 ishop $2)) { if (%cprot. [ $+ [ %cprot.curchan ] $+ ] .punishops) { return 1 } }
elseif ($1 isvoice $2) { if (%cprot. [ $+ [ %cprot.curchan ] $+ ] .punishvoiced) { return 1 } }
else { return 1 }
}
alias cprot.chktxtevent {
if ($cprot.chkst($nick,$chan)) {
var %t = $strip($1-)
if (%cprot. [ $+ [ %cprot.curchan ] $+ ] .advertising) {
var %s = %cprot. [ $+ [ %cprot.curchan ] $+ ] .advertising.strict
if ($regex(%t,/#[^\s]+|http://[^\s]+\.[^\s]+|www\.[^\s]+\.[^\s]+/)) {
if (%s == 1) { cprot.dchk advertising }
elseif ($regex(%t,/j[o0][i1]n|amsg|need|visit|brauch|besuch|komm|verlos|live|check|support|free|p[o0]rn|pr[o0]n|sex|pussy|idle|pl(?:s|z|ease)|perform/i)) {
if (%s == 2) { cprot.dchk advertising }
elseif ($1- != %t) { cprot.dchk advertising }
}
}
}
if (%cprot. [ $+ [ %cprot.curchan ] $+ ] .repeating) {
var %b = $+(repeating.,$md5(%t),.,$chan,.,$cid,.,$fulladdress,.t-)
hadd -mu $+ %cprot. [ $+ [ %cprot.curchan ] $+ ] .repeating.secs cprot $+(%b,$trnum) 1
if ($hfind(cprot,%b $+ *,0,w) >= %cprot. [ $+ [ %cprot.curchan ] $+ ] .repeating.times) {
cprot.dotrig repeating
hdel -w cprot %b $+ *
}
}
var %bwl = %cprot. [ $+ [ %cprot.curchan ] $+ ] .badword.words
if (%cprot. [ $+ [ %cprot.curchan ] $+ ] .badword) && (%bwl) && ($regex(bwprot,%t,%bwl)) { cprot.dchk badword }
if (%cprot. [ $+ [ %cprot.curchan ] $+ ] .caps) && ($len(%t) > 4) && ($calc($regex(%t,/[A-ZÄÖÜ]/g) / $len(%t)) >= %cprot. [ $+ [ %cprot.curchan ] $+ ] .caps.percent) { cprot.dchk caps }
if (%cprot. [ $+ [ %cprot.curchan ] $+ ] .textflood) { cprot.dchk textflood }
if (%cprot. [ $+ [ %cprot.curchan ] $+ ] .codes) && ($regex($1-,%cprot. [ $+ [ %cprot.curchan ] $+ ] .codes.trig) >= [ %cprot. [ $+ [ %cprot.curchan ] $+ ] .codes.mincodes ] ) { cprot.dchk codes }
}
}
;
; End of file
;