All pastes #291683 Raw Edit

Unnamed

public text v1 · immutable
#291683 ·published 2006-12-25 16:33 UTC
rendered paste body
dialog hamLIST {
  title "HamLIST Blacklist Script"
  size -1 -1 294 215
  option dbu
  list 1, 20 32 238 90, size
  box "Hostmasks:", 2, 11 17 259 124
  button "Remove", 3, 98 124 37 12
  button "Update", 4, 60 124 37 12
  edit "", 5, 20 152 238 10
  button "Add", 6, 22 124 37 12
  box "Add Hostmask:", 7, 11 143 260 24
  text "HamLIST Blacklist Script", 8, 15 4 121 12
  button "OK", 9, 43 179 37 12, ok
  button "Cancel", 10, 81 179 37 12, cancel
}

on *:DIALOG:HamLIST:sclick:6:{
  set %hlist.hmask $did(HamLIST,5).text
  write HamLIST.txt %hlist.hmask
  did -a HamLIST 1 %hlist.hmask
  scanchannels
}

on *:DIALOG:HamLIST:sclick:3:{
  set %hlist.remove $did(HamLIST,1,1).sel
  write -ds $+ $did(HamLIST,1,1).seltext HamLIST.txt
  did -d HamLIST 1 %hlist.remove
}

on *:DIALOG:HamLIST:sclick:4:{
  set %hlist.update $did(HamLIST,5).text
  write -ds $+ $did(HamLIST,1,1).seltext HamLIST.txt
  write HamLIST.txt %hlist.update
  did -o $did(HamLIST,1,1).sel %hlist.update
}

alias hamlist {
  dialog -ma hamlist hamlist
}

on *:join:#:{
  if (!$readini(halt.ini,Channels,$chan)) {
    if ( $nick == $me ) {
      scanchannel $chan
    }
    else {
      docheck $nick $chan
    }
  }
}
 
alias docheck {
  var %hlist.read2 1
  while (%hlist.read2 <= $lines(hamlist.txt)) {
    if ( $mask($read(hamlist.txt,%hlist.read2),5) iswm $address($$1,5) ) {
      mode $chan +b $read(hamlist.txt,%hlist.read2)
      inc %kicks 1
      kick $2 $$1 You have been HamLISTED) ( $+ %kicks dudes kicked
    }
    inc %hlist.read2 1
  }
}

menu * {
  HamLIST Halt:{
    var %channels $$?="Channels to halt on, separated by commas:"
    var %a 1
    while (%a <= $numtok(%channels,44)) {
       writeini halt.ini Channels $gettok(%channels,%a,44) on
       inc %a 1
    }
  }
}
menu channel {
  HamLIST:/HamLIST
}
menu status {
  HamLIST:/HamLIST
}
menu query {
  HamLIST:/HamLIST
}
menu menubar {
  HamLIST:/HamLIST
}

menu nicklist {
  HamLIST
  .Add Address
  ..$+ $address($$1,1) $+ :/hamlist | /set %hlist.hmask $address($$1,1) | /did -a HamLIST 5 %hlist.hmask
  ..$+ $address($$1,2) $+ :/hamlist | /set %hlist.hmask $address($$1,2) | /did -a HamLIST 5 %hlist.hmask
  ..$+ $address($$1,3) $+ :/hamlist | /set %hlist.hmask $address($$1,3) | /did -a HamLIST 5 %hlist.hmask
  ..$+ $address($$1,4) $+ :/hamlist | /set %hlist.hmask $address($$1,4) | /did -a HamLIST 5 %hlist.hmask
  ..$+ $address($$1,5) $+ :/hamlist | /set %hlist.hmask $address($$1,5) | /did -a HamLIST 5 %hlist.hmask
}

on *:DIALOG:hamLIST:init:0:{
  var %hlist.read 1
  while (%hlist.read <= $lines(hamlist.txt)) {
    did -a hamLIST 1 $read(hamlist.txt,%hlist.read)
    inc %hlist.read 1
  }
}

alias scanchannel {
  var %sn 1
  while (%sn <= $nick($1,0)) {
    var %hlist.read2 1
    while (%hlist.read2 <= $lines(hamlist.txt)) {
      if ( $mask($read(hamlist.txt,%hlist.read2),5) iswm $address($nick($1,%sn),5) ) {
        mode $1 +b $read(hamlist.txt,%hlist.read2)
        inc %kicks 1
        kick $1 $nick($1,%sn) You have been HamLISTED) ( $+ %kicks dudes kicked
      }
      inc %hlist.read2 1
    }
    inc %sn 1
  }
}