KoProt - Personal Flood Protection — File Browser

KoProt-PersonalFloodProtectionv1.0 / KoProt-PersonalFloodProtectionv1.0 / KoProt / KoProt.mrc

KoProt.mrc — 6.8 KB — Download this file

;KoProt Personal Flood Protection - By Kanophis
;Bugs, comments, suggestions go to Kanophis@msn.com
;Thanks for using this :)

alias -l udll return $scriptdirdll/mdx.dll
alias -l mdx return $dll($udll,$1,$2-)
alias -l vdx return $scriptdirdll/views.mdx
alias -l adll return $scriptdirdll/aircdll.dll
alias -l flood return $dll($adll,Flood,$1-)
alias -l mdxl mdx SetMircVersion $version | mdx MarkDialog $dname
alias -l add did -a $dname 3 $1-
alias -l comdx did -i $dname 3 1 $1-
alias -l addtok var %i = 1 | while $gettok($2-,%i,$1) { did -a $dname 3 $ifmatch | inc %i }
alias -l ct did -ao $dname 19 $1 $+ $2 | did -ao $dname 15 $replace($1,MSG,Message) Flood | ref $1
alias core if ($isid) { return $hget(koprot,$1) } | hadd koprot $1- 
alias -l addex var %d = $$?"Enter Username" | set %ex $addtok(%ex,%d,44) | refex
alias -l delex var %d = $iif($1,$1,$$?"Enter Username") | set %ex $remtok(%ex,%d,1,44) | refex $dname
alias -l refex did -r $iif($1,$1,$dname) 33 | didtok $iif($1,$1,$dname) 33 44 %ex
alias -l ref did -r $dname 18,20,24 | did -u $dname 22 | set %edit.f $$1 | did -a $dname 18 $core($1 $+ .max) | did -a $dname 20 $core($1 $+ .sec) | did $iif($core($1 $+ .ignore),-c,-u) $dname 22 | did -a $dname 24 $core($1 $+ .len) | did -c $dname 27 $core($1 $+ .igt) 
alias -l comkick var %i = 1 | while $comchan($$1,%i) { if ($comchan($$1,%i).op) { kick $ifmatch $1 $2- } } 

dialog koprot {
  title "KoProt - Personal Flood Protection"
  size -1 -1 208 109
  option dbu
  icon $scriptdiricons/koprot.ico, 0
  box "", 1, 76 2 128 90
  button "&OK", 2, 161 95 43 12, ok
  list 3, 3 4 69 88, size
  tab "sets", 4, 61 121 99 22
  check "Notify me on trigger", 13, 83 79 68 10, tab 4
  check "Common channel kick on trigger", 12, 83 68 97 10, tab 4
  combo 11, 94 56 104 50, tab 4 size drop
  combo 9, 94 31 104 50, tab 4 size drop
  check "Default Ignore Type:", 8, 84 20 78 10, tab 4
  check "On/Off", 6, 84 9 56 10, tab 4
  check "On Trigger:", 10, 83 44 37 10, tab 4
  tab "floods", 7
  text "Ignore Address:", 26, 85 66 39 8, tab 7
  text "Length", 23, 86 53 17 8, tab 7
  edit "", 24, 105 52 18 10, tab 7
  text "seconds", 25, 125 53 20 8, tab 7
  check "Ignore the user", 22, 83 40 48 10, tab 7
  edit "", 18, 105 28 18 10, tab 7 autohs
  text "Trigger:", 17, 83 29 21 8, tab 7
  text "                   ", 19, 124 29 24 8, tab 7 center
  edit "", 20, 149 28 18 10, tab 7
  text "seconds", 21, 168 29 25 8, tab 7
  button "", 16, 82 22 117 2, disable tab 7 flat
  text "", 15, 82 9 117 11, tab 7 center
  combo 27, 127 65 73 50, tab 7 size drop
  tab "exempt", 32
  list 33, 82 38 117 49, tab 32 size
  button "Remove", 35, 128 25 43 12, tab 32
  button "Add", 34, 82 25 43 12, tab 32
  text "These users will not be ignored when a flood is triggered", 36, 82 9 117 14, tab 32
  text "Using aIRCdll.dll flood protection routines", 28, 4 97 101 8, disable
}

on *:DIALOG:koprot:*:*:{
  if ($devent == init) {
    mdxl
    mdx SetControlMDX $dname 3 treeview haslines fullrowselect hasbuttons showsel > $vdx
    mdx SetFont $dname 15 +b Russian 20 700 Tahoma    
    mdx SetFont $dname 34,35 +b Russian 15 700 Tahoma
    add +eb Configuration
    comdx cb last
    add +e Options
    add +eb Floods
    comdx cb last
    addtok 32 CTCP Message Notice Query DCC Invite
    comdx cb up
    add +eb Exempts
    didtok $dname 9,27 44 0) *!user@userid.host.com,1) *!*@*user@userid.host.com,2) *!*@userid.host.com,3) *!*user@*.host.com,4) *!*@*.host.com,5) Nick!User@userid.host.com
    didtok $dname 11 44 Ignore Everything from User,Ignore the specific flood type   
    did $iif($core(stat),-c,-u) $dname 6  
    did $iif($core(DI),-c,-u) $dname 8
    did $iif($core(OT),-c,-u) $dname 10
    did $iif($core(CC),-c,-u) $dname 12
    did $iif($core(NT),-c,-u) $dname 13
    did -c $dname 9 $didwm($dname,9,$+($core(DI.Type),*),1)
    did -c $dname 11 $core(ot.line)  
  }
  if ($devent == edit) {
    if ($did == 18) { core %edit.f $+ .max $did($did) }
    if ($did == 20) { core %edit.f $+ .sec $did($did) }
    if ($did == 24) { core %edit.f $+ .len $did($did) }
  }
  if ($devent == sclick) {
    if ($did == 22) { core %edit.f $+ .ignore $did(22).state }
    if ($did == 27) { core %edit.f $+ .igt $did(27).sel }
    if ($did == 9) { core DI.Type $left($did(9).seltext,1) }
    if ($did == 11) { core ot.Line $did(11).sel } 
    if ($did == 3) {
      var %clicked = $gettok($did(3,1),4-,32)
      if (%clicked == 2 2) { did -f $dname 4 }
      if (%clicked == 2 3 2) { did -f $dname 7 | ct CTCP 's }
      if (%clicked == 2 3 3) { did -f $dname 7 | ct MSG 's }
      if (%clicked == 2 3 4) { did -f $dname 7 | ct Notice 's }
      if (%clicked == 2 3 5) { did -f $dname 7 | ct Query 's }
      if (%clicked == 2 3 6) { did -f $dname 7 | ct DCC 's }
      if (%clicked == 2 3 7) { did -f $dname 7 | ct Invite s }    
      if (%clicked == 2 4) { did -f $dname 32 }    
    }
    if ($did == 34) { addex }
    if ($did == 35) { if ($did(33).seltext) { delex $ifmatch } }
    if ($did == 6) { core Stat $did(6).state }
    if ($did == 8) { core DI $did(8).state }
    if ($did == 10) { core OT $did(10).state }
    if ($did == 12) { core CC $did(12).state }
    if ($did == 13) { core NT $did(13).state }
  }
}

alias switch {
  var %sw = ctcp,t,notice,n,invite,i,dcc,d,msg,p,query,p
  var %i = 1 | while $gettok(%sw,%i,44) {
    if ($ifmatch == $1) { return $gettok(%sw,$calc(%i +1),44) }
    inc %i
  }
}

on *:exit:{ hsave -o KoProt $scriptdirSettings.hs }
on *:start:{ if ($exists($scriptdirSettings.hs)) hmake KoProt 40 | hload KoProt $scriptdirSettings.hs }
ctcp *:*:?:{ cff ctcp }
on *:text:*:?:{ cff msg }
on *:notice:*:?:{ cff notice }
ctcp *:*dcc*:?:{ cff dcc }
on *:open:?:{ cff query }
on *:inite:#:{ cff invite }

alias cff {
  if ($core(STAT)) && ($nick != NickServ) && ($nick != ChanServ) {
    var %i = 1 | while $gettok(%ex,%i,44) { if ($ifmatch == $nick) || ($ifmatch iswm $address($nick,5)) { halt } | inc %i }    
    var %a = $flood($+($$1,.,$wildsite) 1 $core($+($1,.,max)) $core($+($1,.,sec))) 
    if (+Flood* iswm %a) {
      if ($core(NT)) { echo $color(info) -a *** $upper($1) Flood Detected from $nick $+($chr(40),$address($nick,2),$chr(41)) }
      if ($core($+($1,.,ignore))) && ($core($+($1,.,len)) !isalpha) {
        .ignore $iif($core(ot.Line) == 2,$+(-,$switch($1)),-) $+ $+(u,$core($+($1,.,len))) $iif($calc($core($+($1,.,igt)) -1) > 0,$address($nick,$ifmatch),$address($nick,$core(DI.Type)))
      }
      if ($core(CC)) {
        var %i = 1 
        while $comchan($nick,%i) {
          if ($comchan($nick,%i).op) && ($nick ison $comchan($nick,%i)) { kick $comchan($nick,%i) $nick $upper($1) Flood }
          inc %i
        }
      }
    }
  }
}

menu menubar {
  - 
  &KoProt:dialog $iif($dialog(koprot),-v,-m) koprot koprot
  -
}

;The end :P

//say