on *:START: { echo -a /BLIST v2.0 - Creating and loading hashtables if (!$hget(blist)) { hmake blist 100 if ($isfile(blist.hsh)) { hload blist blist.hsh } echo -a Hashtable "blist" created $iif($isfile(blist.hsh),and loaded,$null) } if (!$hget(chan)) { hmake chan 50 if ($isfile(chan.hsh)) { hload chan chan.hsh } echo -a Hashtable "chan" created $iif($isfile(chan.hsh),and loaded,$null) } if (%blist.chan == $null) { set %blist.chan 0 } if (%blist.banmsk == $null) { set %blist.banmsk 2 3 } } on *:LOAD: { echo -a /BLIST v2.0 - Load Successfull echo -a Now creating and loading hashtables if (!$hget(blist)) { hmake blist 100 if ($isfile(blist.hsh)) { hload blist blist.hsh } echo -a Hashtable "blist" created $iif($isfile(blist.hsh),and loaded,$null) } if (!$hget(chan)) { hmake chan 50 if ($isfile(chan.hsh)) { hload chan chan.hsh } echo -a Hashtable "chan" created $iif($isfile(chan.hsh),and loaded,$null) } if (%blist.chan == $null) { set %blist.chan 0 } if (%blist.banmsk == $null) { set %blist.banmsk 2 3 } } alias blist { $dialog(blist,blist) } #blacklist on on *:JOIN:#: { if ((%blist.chan == 1) && ($chan !isin %blist.chans)) { halt } var %bmask = $gettok(%blist.banmsk,1,32) if (($me isop $chan) && ($hget(blist,$address($nick,%bmask)))) { mode $chan -o+b $nick $address($nick,%bmask) kick $chan $nick $gettok($hget(blist,$address($nick,%bmask)),2-,32) Blacklisted } } #blacklist end alias -l blist.add { var %bmask = $gettok(%blist.banmsk,1,32) if (%blist.chan == 0) { var %x = $chan(0) while (%x) { mode $chan(%x) +b $1 if ($2 != nomsg) { msg $chan(%x) Blacklisted: $1 } var %y = $nick($chan(%x),0) while (%y) { if (($address($nick($chan(%x),%y),%bmask) == $1) && ($me isop $chan(%x))) { kick $chan(%x) $nick($chan(%x),%y) $gettok($hget(blist,$1),2-,32) Blacklisted } dec %y 1 } dec %x 1 } listpop } else { var %x = $hget(chan,0).data while (%x) { if ($me isop $hget(chan,%x).data) { mode $hget(chan,%x).data +b $1 var %y = $nick($hget(chan,%x).data,0) } while (%y) { if ($2 != nomsg) { msg $hget(chan,%x).data Blacklisted: $1 } if (($address($nick($hget(chan,%x).data,%y),%bmask) == $1) && ($me isop $hget($chan,%x))) { kick $chan(%x) $nick($chan(%x),%y) $gettok($hget(blist,$1),2-,32) Blacklisted } dec %y 1 } dec %x 1 } listpop } } alias -l blist.enf { var %x = $chan(0) while (%x) { var %y = $nick($chan(%x),0) while (%y) { if ($hget(blist,$address($nick($chan(%x),%y),2))) { if ($me isop $chan(%x)) { mode $chan(%x) -o+b $nick($chan(%x),%y) $address($nick($chan(%x),%y),2) kick $chan(%x) $nick($chan(%x),%y) $gettok($hget(blist,$address($nick($chan(%x),%y),2)),2-,32) Blacklisted } } dec %y 1 } dec %x 1 } } alias -l blist.del { var %x = $chan(0) var %y = $hget(blist,$did(blist,1).seltext).item while (%x) { mode $chan(%x) -b $hget(blist,%y).item dec %x 1 } hdel blist $hget(blist,%y).item listpop } alias -l listpop { did -r blist 1 var %x = $hget(blist,0).data if (!%x) { did -b blist 13,15 } else { did -e blist 13,15 } while (%x) { did -a blist 1 $gettok($hget(blist,%x).data,1,32) dec %x 1 } hsave blist blist.hsh $scriptdir } alias -l clistpop { did -r blist.set 4 unset %blist.chans var %x = $hget(chan,0).data if (!%x) { did -b blist.set 6,7 } else { did -e blist.set 6,7 } while (%x) { did -a blist.set 4 $hget(chan,%x).item set %blist.chans %blist.chans $hget(chan,%x).item dec %x 1 } hsave chan chan.hsh $scriptdir } alias -l err { set %msg Error: $1- $dialog(err,err,-4) } dialog blist { title "Blacklist [/blist]" size -1 -1 164 88 option dbu list 1, 2 2 134 84, sort size vsbar button "Add", 2, 138 4 23 12 button "Edit", 3, 138 20 23 12 button "Del", 4, 138 36 23 12 button "Ok", 5, 138 74 23 12, ok menu "&File", 6 item "&Close", 7, 6 menu "&Options", 8 item "&Add Entry", 9, 8 item "&Edit Entry", 10, 8 item break, 11, 8 item "&Delete Entry", 12, 8 item "&Clear List", 13, 8 item break, 14, 8 item "&Enforce", 15, 8 item break, 16, 8 item "&Settings", 17, 8 } dialog blist.ae { title "Blacklist" size -1 -1 140 64 option dbu text "Nickname:", 1, 8 8 25 8 edit "", 2, 38 6 94 10 text "Address:", 3, 8 22 21 8 edit "", 4, 38 20 94 10 text "Kick Msg:", 5, 8 36 23 8 edit "", 6, 38 34 94 10 autohs button "&Ok", 7, 62 50 37 12, button "&Cancel", 8, 102 50 37 12, cancel } dialog blist.set { title "Blacklist Settings" size -1 -1 138 102 option dbu text "Ban mask", 1, 4 4 25 8 combo 2, 74 2 60 50, drop check "Only blacklist in the following channels", 3, 4 16 128 10 list 4, 4 28 102 44, size vsbar button "Add", 5, 110 28 25 12 button "Del", 6, 110 44 25 12 button "Clear", 7, 110 60 25 12 box "Blacklist Status", 8, 4 76 90 24 radio "Enabled", 9, 14 86 36 10 radio "Disabled", 10, 54 86 36 10 button "&Ok", 13, 98 88 37 12, ok cancel } dialog err { title "Blacklist" size -1 -1 182 40 option dbu text "", 1, 2 2 177 22 button "Ok", 2, 142 26 37 12, ok cancel } dialog clear { title "Blacklist" size -1 -1 182 40 option dbu text "Are you sure you want to clear the blacklist?", 1, 2 2 177 22 button "Yes", 2, 102 26 37 12, ok button "No", 3, 142 26 37 12, cancel } on *:DIALOG:blist:*:*: { if (!$did(blist,1).seltext) { did -b blist 3,4,10,12 } if ($did(blist,1).seltext) { did -e blist 3,4,10,12 } if ($devent == init) { listpop } if ($devent == sclick) { if ($did == 2) { $dialog(blist.a,blist.ae,-4) } elseif ($did == 3) { $dialog(blist.e,blist.ae,-4) } elseif ($did == 4) { blist.del } } if ($devent == menu) { if ($did == 7) { dialog -c blist } elseif ($did == 9) { $dialog(blist.a,blist.ae,-4) } elseif ($did == 10) { $dialog(blist.e,blist.ae,-4) } elseif ($did == 12) { blist.del } elseif ($did == 13) { $dialog(clear,clear,-4) } elseif ($did == 15) { blist.enf } elseif ($did == 17) { $dialog(blist.set,blist.set,-4) } } } on *:DIALOG:blist.a:*:*: { if (($devent == sclick) && ($did == 7)) { if (!$did(blist.a,2).text) { err You forgot to enter a nickname! } elseif (!$did(blist.a,4).text) { err You forgot to enter an address! } elseif ($hget(blist,$did(blist.a,4).text)) { err You already have that address blacklisted! } elseif ($did(blist.a,4).text == *!*@*) { err Invalid address! You cannot blacklist everyone. } elseif ($did(blist.a,4).text == $address($me,2)) { err Invalid address! You cannot blacklist yourself. } else { hadd blist $did(blist.a,4).text $did(blist.a,2).text $did(blist.a,6).text blist.add $did(blist.a,4).text dialog -c blist.a } } } on *:DIALOG:blist.e:*:*: { if ($devent == init) { var %x = $hget(blist,$did(blist,1).seltext).item did -a blist.e 2 $gettok($hget(blist,%x).data,1,32) did -a blist.e 4 $hget(blist,%x).item did -a blist.e 6 $gettok($hget(blist,%x).data,2-,32) } if (($devent == sclick) && ($did == 7)) { if (!$did(blist.e,2).text) { err You forgot to enter a nickname! } elseif (!$did(blist.e,4).text) { err You forgot to enter an address! } elseif ($did(blist.e,4).text == *!*@*) { err Invalid address! You cannot blacklist everyone. } elseif ($did(blist.e,4).text == $address($me,2)) { err Invalid address! You cannot blacklist yourself. } else { var %x = $hget(blist,$did(blist,1).seltext).item hdel blist $hget(blist,%x).item hadd blist $did(blist.e,4) $did(blist.e,2) $did(blist.e,6) blist.add $did(blist.e,4) nomsg dialog -c blist.e } } } on *:DIALOG:blist.set:*:*: { if (!$did(blist.set,4).seltext) { did -b blist.set 6 } if ($did(blist.set,4).seltext) { did -e blist.set 6 } if ($devent == init) { clistpop if (%blist.chan == 1) { did -c blist.set 3 } if ($group(#blacklist).status == on) { did -c blist.set 9 } elseif ($group(#blacklist).status == off) { did -c blist.set 10 } did -a blist.set 2 0: *!user@host did -a blist.set 2 1: *!*user@host did -a blist.set 2 2: *!*@host did -a blist.set 2 3: *!*user@*.host did -a blist.set 2 4: *!*@*.host did -a blist.set 2 5: nick!user@host did -a blist.set 2 6: nick!*user@host did -a blist.set 2 7: nick!*@host did -a blist.set 2 8: nick!*user@*.host did -a blist.set 2 9: nick!*@*.host did -c blist.set 2 $gettok(%blist.banmsk,2,32) } if ($devent == sclick) { if ($did == 3) { set %blist.chan $did(blist.set,3).state } if ($did == 5) { set %chan $input(Channel Name:,-e,Blacklist) hadd chan %chan yes unset %chan clistpop } if ($did == 6) { hdel chan $hget(chan,$did(blist.set,4).seltext).item clistpop } if ($did == 7) { hfree chan hmake chan 50 clistpop } if ($did == 9) { enable #blacklist } if ($did == 10) { disable #blacklist } if ($did == 13) { set %blist.banmsk $left($gettok($did(blist.set,2).seltext,1,32),1) $did(blist.set,2).sel } } } on *:DIALOG:err:*:*:{ if ($devent == init) { did -ra err 1 %msg unset %msg } } on *:DIALOG:clear:*:*:{ if (($devent == sclick) && ($did == 2)) { var %y = $hget(blist,0).item, %x = $chan(0) while (%y) { set %blist.un %blist.un $hget(blist,%y).item dec %y 1 set %b $+(%b,b) } while (%x) { mode $chan(%x) $+(-,%b) %blist.un dec %x 1 } unset %blist.un unset %b hfree blist hmake blist listpop } }