All pastes #637163 Raw Edit

Unnamed

public text v1 · immutable
#637163 ·published 2007-07-28 16:43 UTC
rendered paste body
dialog blk {
  title "Blacklist"
  size -1 -1 229 103
  option dbu
  list 1, 2 2 183 99, size
  button "Global Ban", 3, 188 61 37 12
  button "Ban All", 4, 188 73 37 12
  button "Add", 5, 188 19 37 12
  button "Remove", 6, 188 31 37 12
  button "Edit", 7, 188 43 37 12
  check "Enable", 8, 193 4 25 10
}
on *:DIALOG:blk:init:*:{
  if ($readini(blacklist.ini,-n,set,e)) { did -c blk 8 }
  var %x = 1
  while ($ini(blacklist.ini,bans,%x)) {
    did -a blk 1 $ifmatch
    inc %x
  }
}
on *:DIALOG:blk:close:*:{ writeini blacklist.ini set e $did(8).state }
on *:DIALOG:blk:sclick:3:{
  if ($did(1).seltext) {
    var %x = 1
    while (%x <= $chan(0)) {
      if ($me isop $chan(%x) || $me ishop $chan(%x)) { mode $chan(%x) +b $did(1).seltext }
      inc %x
    }
  }
}
on *:DIALOG:blk:sclick:4:{ 
  var %x = 1
  while ($did(blk,1,%x)) {
    var %c = 1
    while (%c <= $chan(0)) {
      if ($me isop $chan(%c) || $me ishop $chan(%c)) { mode $chan(%c) +b $did(blk,1,%x) }
      inc %c
    }
    inc %x
  }
}
on *:DIALOG:blk:sclick:5:{ dialog -ma blke blke }
on *:DIALOG:blk:sclick:6:{ 
  if ($did(blk,1).seltext) {
    remini blacklist.ini bans $did(1).seltext
    did -d blk 1 $did(1).sel
  }
}
on *:DIALOG:blk:sclick:7:{
  if ($did(1).seltext) {
    set %blk.edit $ifmatch
    dialog -ma blke blke
  }
}
dialog blke {
  title "Blacklist"
  size -1 -1 116 73
  option dbu
  check "Enable", 1, 4 2 26 10
  box "*!*@Host/Nickname", 2, 1 13 113 21
  edit "", 3, 4 21 108 10, autohs
  box "Reason", 4, 1 36 113 21
  edit "", 5, 4 44 108 10, autohs
  button "Ok", 6, 3 59 25 12, ok
  button "Cancel", 7, 31 59 25 12, cancel
}
on *:DIALOG:blke:init:*:{
  if (%blk.edit) {
    tokenize 32 $readini(blacklist.ini,-n,bans,$ifmatch)
    did -a blke 3 $ifmatch
    if ($1) { did -c blke 1 }
    did -a blke 5 $2-
  }
}
on *:DIALOG:blke:sclick:6:{
  if ($did(blke,3)) {
    if (%blk.edit) { 
      remini blacklist.ini bans %blk.edit
      did -d blk 1 $did(blk,1).sel
      did -a blk 1 $did(3)
    }
    writeini blacklist.ini bans $did(3) $did(1).state $iif($did(5),$ifmatch,No Reason)
    if (!%blk.edit) { did -a blk 1 $did(3) }
    unset %blk.edit
  }
}
on *:DIALOG:blke:sclick:7:{ unset %blk.edit }
on *:DIALOG:blke:close:*:{ unset %blk.edit }
on *:JOIN:#:{
  if ($readini(blacklist.ini,-n,bans,$wildsite) || $readini(blacklist.ini,-n,bans,$nick)) {
    tokenize 32 $ifmatch
    if ($1 && $readini(blacklist.ini,-n,set,e)) && ($me isop $chan || $me ishop $chan) { ban -k $chan $nick 2 Blacklist Match • Reason: $2- }
  }
}