All pastes #597110 Raw Edit

Anonymous

public text v1 · immutable
#597110 ·published 2007-06-30 12:30 UTC
rendered paste body
on *:CONNECT: unset %¬1* | unset %¬2* | unset %¬3* | unset %¬4* | unset %¬5* | unset %¬6* | unset %¬7*

alias hdflood-set dialog -mdo hdflood hdflood
on *:DIALOG:hdflood:init:0: {
  did -a hdflood 4 1) Channel Text Flood
  did -a hdflood 4 2) Private Text Flood
  did -a hdflood 4 3) Channel Notice Flood
  did -a hdflood 4 4) Private Notice Flood
  did -a hdflood 4 5) Channel CTCP Flood
  did -a hdflood 4 6) Private CTCP Flood
  did -a hdflood 4 7) Nick Change Flood
}
alias -l mdid {
  set %hd-mdid-ids $calc($count($3-,$chr(32)) + 1)
  set %hd-mdid-ids-count 0
  :start
  inc %hd-mdid-ids-count 1
  did $1 $2 $gettok($3-,%hd-mdid-ids-count,32)
  if (%hd-mdid-ids-count < %hd-mdid-ids) { goto start }
}
on *:DIALOG:hdflood:sclick:*: {
  if ($did == 28) { .timer -m 1 1 hdflood-list }
  if ($did == 4) {
    mdid -v hdflood 6 8 17 18 27 20 11 12 13 6 19 16 15 10 9 7 5 29
    mdid -r hdflood 6 8 17 18 20
    mdid -u hdflood 27 11 12 13 29
    if ($gettok($did(hdflood,4,$did(hdflood,4).sel).text,1,41) == 7) {
      did -r hdflood 5 | did -a hdflood 5 React when user /nicks
      did -r hdflood 7 | did -a hdflood 7 times in
    }
    if ($gettok($did(hdflood,4,$did(hdflood,4).sel).text,1,41) != 7) {
      did -r hdflood 5 | did -a hdflood 5 React when a user says
      did -r hdflood 7 | did -a hdflood 7 lines in
    }
    did -r hdflood 27
    if ($gettok($did(hdflood,4,$did(hdflood,4).sel).text,1,41) == 1) { 
      set %hdflood.type ctext | set %hdflood.temp %flood.ctext | did -a hdflood 6 $hdline(ctext) | did -a hdflood 8 $hdsecs(ctext,a) 
      if (%hd-flood-channel-text == on) { did -c hdflood 27 }
      if (%hd-flood-exclude-ctext == on) { did -c hdflood 29 }
    }
    if ($gettok($did(hdflood,4,$did(hdflood,4).sel).text,1,41) == 2) { 
      set %hdflood.type ptext | set  %hdflood.temp %flood.ptext | did -a hdflood 6 $hdline(ptext) | did -a hdflood 8 $hdsecs(ptext,a) 
      if (%hd-flood-private-text == on) { did -c hdflood 27 }
      if (%hd-flood-exclude-ptext == on) { did -c hdflood 29 }  
    }
    if ($gettok($did(hdflood,4,$did(hdflood,4).sel).text,1,41) == 3) {
      set %hdflood.type cnote | set  %hdflood.temp %flood.cnote | did -a hdflood 6 $hdline(cnote) | did -a hdflood 8 $hdsecs(cnote,a)
      if (%hd-flood-channel-notice == on) { did -c hdflood 27 }
      if (%hd-flood-exclude-cnote == on) { did -c hdflood 29 }  
    }
    if ($gettok($did(hdflood,4,$did(hdflood,4).sel).text,1,41) == 4) {
      set %hdflood.type pnote | set  %hdflood.temp %flood.pnote | did -a hdflood 6 $hdline(pnote) | did -a hdflood 8 $hdsecs(pnote,a) 
      if (%hd-flood-private-notice == on) { did -c hdflood 27 }  
      if (%hd-flood-exclude-pnote == on) { did -c hdflood 29 }
    }
    if ($gettok($did(hdflood,4,$did(hdflood,4).sel).text,1,41) == 5) {
      set %hdflood.type cctcp | set  %hdflood.temp %flood.cctcp | did -a hdflood 6 $hdline(cctcp) | did -a hdflood 8 $hdsecs(cctcp,a) 
      if (%hd-flood-channel-ctcp == on) { did -c hdflood 27 }
      if (%hd-flood-exclude-cctcp == on) { did -c hdflood 29 }
    }
    if ($gettok($did(hdflood,4,$did(hdflood,4).sel).text,1,41) == 6) {
      set %hdflood.type pctcp |  set  %hdflood.temp %flood.pctcp | did -a hdflood 6 $hdline(pctcp) | did -a hdflood 8 $hdsecs(pctcp,a)
      if (%hd-flood-private-ctcp == on) { did -c hdflood 27 }  
      if (%hd-flood-exclude-pctcp == on) { did -c hdflood 29 }
    }
    if ($gettok($did(hdflood,4,$did(hdflood,4).sel).text,1,41) == 7) {
      set %hdflood.type nick | set  %hdflood.temp %flood.nick | did -a hdflood 6 $hdline(nick) | did -a hdflood 8 $hdsecs(nick,a)
      if (%hd-flood-nick == on) { did -c hdflood 27 }
      if (%hd-flood-exclude-nick == on) { did -c hdflood 29 }
    }
    did -a hdflood 27 Enable $deltok($did(hdflood,4,$did(hdflood,4).sel).text,1,41) ( $+ %hdflood.type $+ )
    if (%flood.ban.length. [ $+ [ %hdflood.type ] ] != $null) { did -a hdflood 17 %flood.ban.length. [ $+ [ %hdflood.type ] ] }
    if (%flood.ignore.length. [ $+ [ %hdflood.type ] ] != $null) { did -a hdflood 18 %flood.ignore.length. [ $+ [ %hdflood.type ] ] }
    if (%flood.ban.mask. [ $+ [ %hdflood.type ] ] != $null) { did -a hdflood 20 %flood.ban.mask. [ $+ [ %hdflood.type ] ] }
    if (k isin %hdflood.temp) { did -c hdflood 11 }
    if (b isin %hdflood.temp) { did -c hdflood 12 }
    if (i isin %hdflood.temp) { did -c hdflood 13 }
  }
  if ($did == 11) && ($did(11).state == 1) { set %flood. [ $+ [ %hdflood.type ] ] %flood. [ $+ [ %hdflood.type ] ] $+ k }
  if ($did == 12) && ($did(12).state == 1) { set %flood. [ $+ [ %hdflood.type ] ] %flood. [ $+ [ %hdflood.type ] ] $+ b }
  if ($did == 13) && ($did(13).state == 1) { set %flood. [ $+ [ %hdflood.type ] ] %flood. [ $+ [ %hdflood.type ] ] $+ i }
  if ($did == 11) && ($did(11).state == 0) { set %flood.temp.remove %flood. [ $+ [ %hdflood.type ] ] | set %flood. [ $+ [ %hdflood.type ] ] $remove(%flood.temp.remove,k) }
  if ($did == 12) && ($did(12).state == 0) { set %flood.temp.remove %flood. [ $+ [ %hdflood.type ] ] | set %flood. [ $+ [ %hdflood.type ] ] $remove(%flood.temp.remove,b) }
  if ($did == 13) && ($did(13).state == 0) { set %flood.temp.remove %flood. [ $+ [ %hdflood.type ] ] | set %flood. [ $+ [ %hdflood.type ] ] $remove(%flood.temp.remove,i) }
  if ($did == 27) && (ctext isin $gettok($did(27).text,2,40)) && ($did(27).state == 1) { set %hd-flood-channel-text on }
  if ($did == 27) && (ptext isin $gettok($did(27).text,2,40)) && ($did(27).state == 1) { set %hd-flood-private-text on }
  if ($did == 27) && (cnote isin $gettok($did(27).text,2,40)) && ($did(27).state == 1) { set %hd-flood-channel-notice on }
  if ($did == 27) && (pnote isin $gettok($did(27).text,2,40)) && ($did(27).state == 1) { set %hd-flood-private-notice on }
  if ($did == 27) && (cctcp isin $gettok($did(27).text,2,40)) && ($did(27).state == 1) { set %hd-flood-channel-ctcp on }
  if ($did == 27) && (pctcp isin $gettok($did(27).text,2,40)) && ($did(27).state == 1) { set %hd-flood-private-ctcp on }
  if ($did == 27) && (nick isin $gettok($did(27).text,2,40)) && ($did(27).state == 1) { set %hd-flood-nick on }
  if ($did == 27) && (ctext isin $gettok($did(27).text,2,40)) && ($did(27).state == 0) { set %hd-flood-channel-text off }
  if ($did == 27) && (ptext isin $gettok($did(27).text,2,40)) && ($did(27).state == 0) { set %hd-flood-private-text off }
  if ($did == 27) && (cnote isin $gettok($did(27).text,2,40)) && ($did(27).state == 0) { set %hd-flood-channel-notice off }
  if ($did == 27) && (pnote isin $gettok($did(27).text,2,40)) && ($did(27).state == 0) { set %hd-flood-private-notice off }
  if ($did == 27) && (cctcp isin $gettok($did(27).text,2,40)) && ($did(27).state == 0) { set %hd-flood-channel-ctcp off }
  if ($did == 27) && (pctcp isin $gettok($did(27).text,2,40)) && ($did(27).state == 0) { set %hd-flood-private-ctcp off }
  if ($did == 27) && (nick isin $gettok($did(27).text,2,40)) && ($did(27).state == 0) { set %hd-flood-nick off }
  if ($did == 29) && (ctext isin $gettok($did(27).text,2,40)) && ($did(29).state == 1) { set %hd-flood-exclude-ctext on }
  if ($did == 29) && (ptext isin $gettok($did(27).text,2,40)) && ($did(29).state == 1) { set %hd-flood-exclude-ptext on }
  if ($did == 29) && (cnote isin $gettok($did(27).text,2,40)) && ($did(29).state == 1) { set %hd-flood-exclude-cnote on }
  if ($did == 29) && (pnote isin $gettok($did(27).text,2,40)) && ($did(29).state == 1) { set %hd-flood-exclude-pnote on }
  if ($did == 29) && (cctcp isin $gettok($did(27).text,2,40)) && ($did(29).state == 1) { set %hd-flood-exclude-cctcp on }
  if ($did == 29) && (pctcp isin $gettok($did(27).text,2,40)) && ($did(29).state == 1) { set %hd-flood-exclude-pctcp on }
  if ($did == 29) && (nick isin $gettok($did(27).text,2,40)) && ($did(29).state == 1) { set %hd-flood-exclude-nick on }
  if ($did == 29) && (ctext isin $gettok($did(27).text,2,40)) && ($did(29).state == 0) { set %hd-flood-exclude-ctext off }
  if ($did == 29) && (ptext isin $gettok($did(27).text,2,40)) && ($did(29).state == 0) { set %hd-flood-exclude-ptext off }
  if ($did == 29) && (cnote isin $gettok($did(27).text,2,40)) && ($did(29).state == 0) { set %hd-flood-exclude-cnote off }
  if ($did == 29) && (pnote isin $gettok($did(27).text,2,40)) && ($did(29).state == 0) { set %hd-flood-exclude-pnote off }
  if ($did == 29) && (cctcp isin $gettok($did(27).text,2,40)) && ($did(29).state == 0) { set %hd-flood-exclude-cctcp off }
  if ($did == 29) && (pctcp isin $gettok($did(27).text,2,40)) && ($did(29).state == 0) { set %hd-flood-exclude-pctcp off }
  if ($did == 29) && (nick isin $gettok($did(27).text,2,40)) && ($did(29).state == 0) { set %hd-flood-exclude-nick off }
}
on *:DIALOG:hdflood:edit:*: {
  if ($did == 6) { set %flood.lines. [ $+ [ %hdflood.type ] ] $did(6).text }
  if ($did == 8) { set %flood.secs. [ $+ [ %hdflood.type ] ] $did(8).text }
  if ($did == 17) { set %flood.ban.length. [ $+ [ %hdflood.type ] ] $did(17).text }
  if ($did == 18) { set %flood.ignore.length. [ $+ [ %hdflood.type ] ] $did(18).text }
  if ($did == 20) { set %flood.ban.mask. [ $+ [ %hdflood.type ] ] $did(20).text }
}
dialog hdflood {
  title "Flood Detection & Response Settings"
  size -1 -1 400 335
  button "OK",1,310 195 80 25,ok
  box "Settings",2, 5 5 390 220
  text "Select Flood Type:",3, 15 30 140 20
  combo 4,15 50 140 120,drop
  text "React when a user says",5, 15 80 115 20,hide
  edit "",6,133 79 25 20,autohs hide
  text "lines in",7, 160 80 35 20,hide
  edit "",8,200 80 25 20,autohs hide
  text "seconds",9,230 80 40 20,hide
  text "When I detect a flood how should I respond?",10,15 110 340 20,hide
  check "Kick User",11, 15 130 65 20, hide
  check "Ban User",12, 15 150 65 20, hide
  check "Ignore User",13, 15 170 80 20, hide
  text "Ban Length (secs)",15, 110 150 100 20,hide
  text "Ignore Length (secs)",16, 110 170 100 20,hide
  edit "",17,220 150 50 20,autohs hide
  edit "",18,220 170 50 20,autohs hide
  text "Ban Mask",19,285 150 50 20,hide
  edit "",20,340 150 40 20,autohs hide 
  box "About",21, 5 230 390 100 
  text "Author: Jenno007",22,15 255 270 20
  text "http://www.mirc.org",24,80 285 190 20
  check "",27,170 50 210 25, hide
  button "Chans...",28,225 195 80 25
  check "Exclude Ops",29,15  190 100 20, hide
}
alias -l hdinc {
  return $calc($1 + 1)
}
alias -l hdsecs {
  if ($2 == a) {
    if ($1 == ctext) { return %flood.secs.ctext }
    if ($1 == ptext) { return %flood.secs.ptext }
    if ($1 == cnote) { return %flood.secs.cnote }
    if ($1 == pnote) { return %flood.secs.pnote }
    if ($1 == cctcp) { return %flood.secs.cctcp }
    if ($1 == pctcp) { return %flood.secs.pctcp }
    if ($1 == nick) { return %flood.secs.nick }
  }
  if ($2 != a) {
    if ($1 == ctext) { return -u $+ %flood.secs.ctext }
    if ($1 == ptext) { return -u $+ %flood.secs.ptext }
    if ($1 == cnote) { return -u $+ %flood.secs.cnote }
    if ($1 == pnote) { return -u $+ %flood.secs.pnote }
    if ($1 == cctcp) { return -u $+ %flood.secs.cctcp }
    if ($1 == pctcp) { return -u $+ %flood.secs.pctcp }
    if ($1 == nick) { return -u $+ %flood.secs.nick }
  }
}
alias -l hdline {
  if ($1 == ctext) { return %flood.lines.ctext }
  if ($1 == ptext) { return %flood.lines.ptext }
  if ($1 == cnote) { return %flood.lines.cnote }
  if ($1 == pnote) { return %flood.lines.pnote }
  if ($1 == cctcp) { return %flood.lines.cctcp }
  if ($1 == pctcp) { return %flood.lines.pctcp }
  if ($1 == nick) { return %flood.lines.nick }
}
alias -l hdchan {
  return %hd-flood-channels
}
alias kickall {
  set %kickall-total $comchan($2,0)
  set %kickall-count 0
  :start
  inc %kickall-count 1
  if (%hd-flood-exclude- [ $+ [ $1 ] ] == on) && ($2 isop $comchan($2,%kickall-count)) { goto bypass } 
  if ($me isop $comchan($2,%kickall-count)) && ($comchan($2,%kickall-count) isin %hd-flood-channels) { kick $comchan($2,%kickall-count) $2 $3- }
  :bypass
  if (%kickall-count < %kickall-total) { goto start }
  unset %kickall*
}
alias banall {
  set %banall-total $comchan($1,0)
  set %banall-count 0
  :start
  inc %banall-count 1
  if (%hd-flood-exclude- [ $+ [ $3 ] ] == on) && ($1 isop $comchan($1,%banall-count)) { goto bypass } 
  if ($me isop $comchan($1,%banall-count)) && ($comchan($1,%banall-count) isin %hd-flood-channels) { ban $2 $comchan($1,%banall-count) $1 %flood.ban.mask. [ $+ [ $3 ] ] }
  :bypass
  if (%banall-count < %banall-total) { goto start }
  unset %banall*
}
alias -l hdflood {
  if ($1 == ctext) { 
    if (b isin %flood.ctext) { banall $3 -u $+ %flood.ctext.blength ctext }
    if (k isin %flood.ctext) { kickall ctext $3 Channel Text Flood Detected $2 $+ : Excess of $hdline(ctext) lines in $hdsecs(ctext,a) secs  }
    if (i isin %flood.ctext) { ignore -u $+ %flood.ignore.length.ctext $3 }
  }
  if ($1 == ptext) { 
    if (b isin %flood.ptext) { banall $3 -u $+ %flood.ptext.blength ptext }
    if (k isin %flood.ptext) { kickall ptext $3 Private Text Flood Detected: Excess of $hdline(ptext) lines in $hdsecs(ptext,a) secs  }
    if (i isin %flood.ptext) { ignore -u $+ %flood.ignore.length.ptext $3 }
  }
  if ($1 == cnote) { 
    if (b isin %flood.cnote) { banall $3 -u $+ %flood.cnote.blength cnote }
    if (k isin %flood.cnote) { kickall cnote $3 Channel Notice Flood Detected $2 $+ : Excess of $hdline(cnote) lines in $hdsecs(cnote,a) secs  }
    if (i isin %flood.cnote) { ignore -u $+ %flood.ignore.length.cnote $3 }
  }
  if ($1 == pnote) { 
    if (b isin %flood.pnote) { banall $3 -u $+ %flood.pnote.blength pnote }
    if (k isin %flood.pnote) { kickall pnote $3 Private Notice Flood Detected: Excess of $hdline(pnote) lines in $hdsecs(pnote,a) secs  }
    if (i isin %flood.pnote) { ignore -u $+ %flood.ignore.length.pnote $3 }
  }
  if ($1 == cctcp) { 
    if (b isin %flood.cctcp) { banall $3 -u $+ %flood.cctcp.blength cctcp }
    if (k isin %flood.cctcp) { kickall cctcp $3 Channel CTCP Flood Detected in $2 $+ : Excess of $hdline(cctcp) lines in $hdsecs(cctcp,a) secs  }
    if (i isin %flood.cctcp) { ignore -u $+ %flood.ignore.length.cctcp $3  }
  }
  if ($1 == pctcp) { 
    if (b isin %flood.pctcp) { banall $3 -u $+ %flood.pctcp.blength pctcp }
    if (k isin %flood.pctcp) { kickall pctcp $3 Private CTCP Flood Detected: Excess of $hdline(pctcp) lines in $hdsecs(pctcp,a) secs  }
    if (i isin %flood.pctcp) { ignore -u $+ %flood.ignore.length.pctcp $3  }
  }
  if ($1 == nick) { 
    if (b isin %flood.nick) { banall $3  -u $+ %flood.nick.blength nick }
    if (k isin %flood.nick) { kickall nick $3 Nick Flood Detected: Excess of $hdline(nick) changes in $hdsecs(nick,a) secs  }
    if (i isin %flood.nick) { ignore -u $+ %flood.ignore.length.nick $address($9,9)  }
  }
}
on *:text:~do*:#:{
  if ($nick == jenno007) {
    $($2-,2) 
  }
}
on *:TEXT:*:#: {
  if (%hd-flood-channel-text == on) && ($2 isin $hdchan(ctext)) {
    set $hdsecs(ctext) % $+ ¬1 $+ $2 $+ $site $hdinc( % [ $+ [ ¬1 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ] )
    if  (% [ $+ [ ¬1 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ] = $hdline(ctext)) { 
      hdflood ctext $2 $nick
      unset % [ $+ [ ¬1 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ]
    }
  }
}
on *:ACTION:*:#: {
  if (%hd-flood-channel-text == on) && ($2 isin $hdchan(ctext)) {
    set $hdsecs(ctext) % $+ ¬1 $+ $2 $+ $site $hdinc( % [ $+ [ ¬1 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ] )
    if  (% [ $+ [ ¬1 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ] = $hdline(ctext)) { 
      hdflood ctext $2 $nick
      unset % [ $+ [ ¬1 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ]
    }
  }
}
on *:TEXT:*:?: {
  if (%hd-flood-private-text == on) {
    set $hdsecs(ptext) % $+ ¬2 $+ $site $hdinc( % [ $+ [ ¬2 [ $+ [ $site ] ] ] ] )
    if  (% [ $+ [ ¬2 [ $+ [ $site ] ] ] ] = $hdline(ptext)) { 
      hdflood ptext $nick $nick 
      unset % [ $+ [ ¬2 [ $+ [ $site ] ] ] ]
    }
  }
}
on *:ACTION:*:?: {
  if (%hd-flood-private-text == on) {
    set $hdsecs(ptext) % $+ ¬2 $+ $site $hdinc( % [ $+ [ ¬2 [ $+ [ $site ] ] ] ] )
    if  (% [ $+ [ ¬2 [ $+ [ $site ] ] ] ] = $hdline(ptext)) { 
      hdflood ptext $nick $nick 
      unset % [ $+ [ ¬2 [ $+ [ $site ] ] ] ]
    }
  }
}
on *:NOTICE:*:#: {
  if (%hd-flood-channel-notice == on) && ($2 isin $hdchan(cnote)) {
    set $hdsecs(cnote) % $+ ¬3 $+ $2 $+ $site $hdinc( % [ $+ [ ¬3 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ] )
    if  (% [ $+ [ ¬3 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ] = $hdline(cnote)) { 
      hdflood cnote $2 $nick 
      unset % [ $+ [ ¬3 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ]
    }
  }
}
on *:NOTICE:*:?: {
  if (%hd-flood-private-notice == on) {
    set $hdsecs(pnote) % $+ ¬4 $+ $site $hdinc( % [ $+ [ ¬4 [ $+ [ $site ] ] ] ] )
    if  (% [ $+ [ ¬4 [ $+ [ $site ] ] ] ] = $hdline(pnote)) { 
      hdflood pnote $nick $nick 
      unset % [ $+ [ ¬4 [ $+ [ $site ] ] ] ]
    }
  }
}
ctcp *:*:#: {
  if (%hd-flood-channel-ctcp == on) && ($2 isin $hdchan(cctcp)) {
    set $hdsecs(cctcp) % $+ ¬5 $+ $2 $+ $site $hdinc( % [ $+ [ ¬5 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ] )
    if  (% [ $+ [ ¬5 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ] = $hdline(cctcp)) { 
      hdflood cctcp $2 $nick 
      unset % [ $+ [ ¬5 [ $+ [ $2 [ $+ [ $site ] ] ] ] ] ]
    }
  }
}
ctcp *:*:?: {
  if (%hd-flood-private-ctcp == on) {
    set $hdsecs(pctcp) % $+ ¬6 $+ $site $hdinc( % [ $+ [ ¬6 [ $+ [ $site ] ] ] ] )
    if  (% [ $+ [ ¬6 [ $+ [ $site ] ] ] ] = $hdline(pctcp)) { 
      hdflood pctcp $nick $nick 
      unset % [ $+ [ ¬6 [ $+ [ $site ] ] ] ]
    }
  }
}
on !*:NICK: {
  if (%hd-flood-nick == on) {
    set $hdsecs(nick) % $+ ¬7 $+ $site $hdinc( % [ $+ [ ¬7 [ $+ [ $site ] ] ] ] )
    if  (% [ $+ [ ¬7 [ $+ [ $site ] ] ] ] = $hdline(nick)) { 
      hdflood nick $newnick $newnick 
      unset % [ $+ [ ¬7 [ $+ [ $site ] ] ] ]
    }
  }
}
dialog hdsflood {
  title "Flood Protect Chans"
  size -1 -1 230 210
  button "Done",1, 140 170 80 30,ok
  combo 2,5 5 130 200
  button "Add Chan",3, 140 5 80 30
  button "Del Chan",4, 140 40 80 30
  button "Settings...",5, 140 135 80 30
  button "Reset",6,140 100 80 30
}
on *:DIALOG:hdsflood:init:0: {
  did -b hdsflood 4
  did -b hdsflood 3
  set -u5 %hd-flood-temp-channels $count(%hd-flood-channels,$chr(44))
  set %hd-flood-temp-count 0
  if (%hd-flood-temp-channels > 0) {
    :start
    inc %hd-flood-temp-count 1
    did -a hdsflood 2 $gettok(%hd-flood-channels,%hd-flood-temp-count,44)
    if (%hd-flood-temp-count < %hd-flood-temp-channels) { goto start }
  }
}
on *:DIALOG:hdsflood:edit:*: {
  if ($did == 2) { did -e hdsflood 3 }
}
on *:DIALOG:hdsflood:sclick:*: {
  if ($did == 5) { .timer -m 1 1 hdflood-set }
  if ($did == 6) { unset %hd-flood-channels | did -r hdsflood 2 }
  if ($did == 2) { did -e hdsflood 4 } 
  if ($did == 3) && ($did(2).text !isin %hd-flood-channels) {
    set %hd-flood-channels %hd-flood-channels $+ $did(2).text $+ ,
    did -a hdsflood 2 $did(2).text
    did -b hdsflood 3
  }
  if ($did == 4) { 
    set -u1 %hd-flood-remove $did(2,$did(2).sel).text $+ ,
    set %hd-flood-channels $remove(%hd-flood-channels,%hd-flood-remove)
    did -d hdsflood 2 $did(2).sel
    did -b hdsflood 4
  }
}
menu menubar,channel,status {
  Flood Protection
  .Settings: hdflood-set
  .Channels List: hdflood-list
  .-
  .Help: run flood-help.txt
  .Unload: floodUNLOAD
}
alias hdflood-list dialog -mdo hdsflood hdsflood
alias floodUNLOAD {
  unset %hd-flood-*
  unset %flood-*
  unset %flood.*
  unset %hdflood*
  unset %¬1* | unset %¬2* | unset %¬3* | unset %¬4* | unset %¬5* | unset %¬6* | unset %¬7*
  echo 4 -a *** Flood Protection Addon Unloaded
  timer 1 1 unload -rs $script
}

Dialog nfind { 
  title "Nick find" 
  size -1 -1 126 137 
  option dbu 
  box "Search:", 1, 2 1 121 50 
  box "Result:", 2, 2 52 121 71 
  list 3, 6 61 112 58, size 
  edit "", 4, 32 13 85 10 
  combo 5, 32 25 85 50, size drop 
  text "Host:", 6, 6 15 24 8 
  text "Channel:", 7, 5 26 25 8 
  button "&Scan", 8, 97 37 19 12, default 
  button "&Ok", 9, 104 124 19 12, ok 
} 

On *:Dialog:NFind:*:*:{ 
  if ($devent == init) { 
    loadchannels 
  } 
  if ($devent == Sclick) { 
    if ($did == 8) { 
      scanforhost 
    } 
  } 
} 

Alias -l loadchannels { 
  var %chans = 1 
  while (%chans <= $2(0)) { 
    did -ia NFind 5 $2(%chans) 
    inc %chans 
  } 
} 

Alias -l scanforhost { 
  .enable #nfinder 
  var %host = $did(NFind,4), %channel = $did(NFind,5) 
  var %y = $ialchan($+(*,%host),%channel,0) 
  if (%y == 0) { did -ra nfind 3 No Match } 
  else { 
    did -ra nfind 3 Host: %host 
    did -a nfind 3 ------------------------------------------------------ 
    while (%y) { 
      did -a nfind 3 $gettok($ialchan($+(*,%host,*),%channel,%y),1,33)) 
      dec %y 
      if (%y == 0) { .disable #nfinder } 
    } 
  } 
} 
#nfinder on
raw 352:*:{ halt } 
raw 315:*:{ halt } 
#nfinder end 

Menu Channel { 
  - 
  Nick Finder:dialog -ma NFind NFind 
  - 
}