How to use: Right-click a user on the nicklist or add a user manually via the dialog.
[size=10](To open the dialog, right-click on any channel or select it on your menubar.)[/size]
Updates
First Submitted Version: 2.19b
Current Version: 2.31b
Last Updated: 9/13/08
Comments are welcome!
;##### MENUS
menu menubar,channel {
Blacklist v2.31b
.Open:{
if ($dialog(black) == $null) {
.dialog -mod black black black
}
}
.Logs
..View(Windowed):{ .openblacklistlog }
..Clear:{ .remove -b Blacklist.log }
}
menu nicklist {
$iif($me !isop $chan,$style(2) Blacklist User,Blacklist User):{
if ($$1 != $null) {
.set -u5 %r $$?="Reason:"
.write Blacklist.blklist %r $+ $chr(35) $+ $address($$1,2) $+ $chr(35) $+ $asctime(h:nn:ss TT) $+ $chr(35) $+ $asctime(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) $+ $chr(35)
if ($group(#KickAllCommon) == on) { .kickallcommon $$1 }
elseif ($group(#KickAllCommon) == off) { .mode $chan +bb $$1 $address($$1,2) | .kick $chan $$1 %r • Blacklisted }
.write Blacklist.log $asctime(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) $chr(124) $asctime(h:nn:ss TT) $chr(124) $$1 ( $+ $address($$1,2) $+ ) was blacklisted in $chan $+ .
}
}
}
;##### EXTRAS
#LoadBlacklistLog on
#LoadBlacklistLog End
#KickAllCommon on
#KickAllCommon End
;##### ALIASES
alias kickallcommon {
.var %x = 1
while (%x <= $comchan($1,0)) {
if ($me isop $comchan($1,%x)) {
.mode $comchan($1,%x) +bb $1 $address($1,2)
.kick $comchan($1,%x) $1 %r • Blacklisted
.write Blacklist.log $asctime(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) $chr(124) $asctime(h:nn:ss TT) $chr(124) $$1 ( $+ $address($1,2) $+ ) was blacklisted in $comchan($1,%x) $+ .
}
.inc %x
}
}
alias refreshlogs {
.did -r black 22
if ($exists(Blacklist.log) == $true) {
.var %x = 1
while (%x <= $lines(Blacklist.log)) {
.did -a black 22 $read(Blacklist.log,%x)
.inc %x
}
}
if ($did(black,22).lines > 0) { .did -e black 23 }
}
alias openblacklistlog {
.window -mkz @Blacklist
if ($exists(Blacklist.log) == $true) {
.var %x = 1
.echo @Blacklist -
while (%x <= $lines(Blacklist.log)) {
.echo @Blacklist $read(Blacklist.log,%x)
.inc %x
}
}
}
;##### MAIN DIALOG
dialog black {
title "Blacklist v2.31b"
size -1 -1 582 199
option pixels
tab "Entries", 20, -3 1 589 206
tab "Logs", 21
list 1, 12 51 285 119, tab 20 size
box "Blacklist Entry Information:", 2, 306 33 269 80, tab 20
text "Date Added:", 3, 317 53 63 17, tab 20
text "Time Added:", 4, 317 69 63 17, tab 20
text "Reason:", 5, 317 85 44 17, tab 20
text "N/A", 6, 361 85 202 17, tab 20
text "N/A", 7, 380 69 183 17, tab 20
text "N/A", 8, 380 53 183 17, tab 20
box "Blacklisted Addresses:", 9, 7 34 295 158, tab 20
button "Add New", 10, 317 136 60 19, tab 20
button "Delete", 11, 317 161 60 20, tab 20 disable
button "Edit", 12, 395 136 59 19, tab 20 disable
button "Clear", 13, 395 161 59 20, tab 20 disable
box "Commands:", 14, 307 115 158 77, tab 20
radio "On", 16, 481 134 39 17, tab 20
radio "Off", 17, 523 134 40 17, tab 20
box "Status:", 18, 473 116 97 43, tab 20
button "Exit", 19, 476 165 95 24, tab 20 ok
list 22, 6 32 570 135, tab 21 size
button "Clear", 23, 159 171 65 22, tab 21 disable
button "Close", 24, 509 172 65 21, tab 21 cancel
button "Refresh", 25, 17 171 65 22, tab 21
button "Window Version", 27, 229 171 90 22, tab 21
button "Delete", 28, 88 171 65 22, tab 21 disable
check "Load When Opened", 29, 329 173 119 17, tab 21
text "Blacklist v2.31b", 15, 496 4 78 15, tab 21 disable
text "Blacklist v2.31b", 26, 496 4 78 15, tab 20 disable
check "Kick From All Common Channels", 30, 15 171 177 17, tab 20
}
on *:dialog:black:sclick:30:{
if ($group(#KickAllCommon) == on) { .disable #KickAllCommon }
elseif ($group(#KickAllCommon) == off) { .enable #KickAllCommon }
}
on *:dialog:black:init:0:{
if ($group(#Blklist) == on) { .did -c black 16 }
if ($group(#Blklist) == off) { .did -c black 17 }
if ($group(#KickAllCommon) == on) { .did -c black 30 }
if ($read(Blacklist.blklist,1) != $null) { .did -e black 13 }
if ($exists(Blacklist.blklist) == $true) {
if ($read(Blacklist.blklist,1) != $null) {
var %x = 1
while (%x <= $lines(Blacklist.blklist)) {
.did -a black 1 $gettok($read(Blacklist.blklist,%x),2,35)
.inc %x
}
}
}
if ($group(#LoadBlacklistLog) == on) {
.did -c black 29
if ($exists(Blacklist.log) == $true) {
.var %x = 1
while (%x <= $lines(Blacklist.log)) {
.did -a black 22 $read(Blacklist.log,%x)
.inc %x
}
}
}
if ($did(black,22).lines > 0) { .did -e black 23 }
}
on *:dialog:black:sclick:1:{
if ($did(black,1).seltext != $null) {
.did -e black 11
.did -e black 12
.did -ar black 7 $gettok($read(Blacklist.blklist,$did(black,1).sel),3,35)
.did -ar black 8 $gettok($read(Blacklist.blklist,$did(black,1).sel),4,35)
if ($numtok($gettok($read(Blacklist.blklist,$did(black,1).sel),1,35),32) > 5) { .did -ar black 6 $gettok($gettok($read(Blacklist.blklist,$did(black,1).sel),1,35),1-5,32) $+ ... }
elseif ($numtok($gettok($read(Blacklist.blklist,$did(black,1).sel),1,35),32) <= 5) { .did -ar black 6 $gettok($read(Blacklist.blklist,$did(black,1).sel),1,35) }
}
}
on *:dialog:black:sclick:10:{
.dialog -mod addnew addnew
}
on *:dialog:black:sclick:11:{
if ($did(black,1).sel != $null) {
.write -dl $+ $did(black,1).sel Blacklist.blklist
.did -ar black 6-8 N/A
.did -d black 1 $did(black,1).sel
.did -b black 11,12
}
}
on *:dialog:black:sclick:12:{
.dialog -mod editblk editblk
}
on *:dialog:black:sclick:13:{
if ($exists(Blacklist.blklist) == $true) { .remove -b Blacklist.blklist | .did -r black 1 | .did -b black 11-13 | .did -ar black 6-8 N/A | .write Blacklist.log $asctime(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) $chr(124) $asctime(h:nn:ss TT) $chr(124) Blacklist cleared. }
else { .halt }
}
on *:dialog:black:sclick:16:{
if ($group(#Blklist) == off) { .enable #Blklist | .write Blacklist.log $asctime(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) $chr(124) $asctime(h:nn:ss TT) $chr(124) Blacklist was enabled. }
elseif ($group(#Blklist) == on) { .halt }
}
on *:dialog:black:sclick:17:{
if ($group(#Blklist) == on) { .disable #Blklist | .write Blacklist.log $asctime(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) $chr(124) $asctime(h:nn:ss TT) $chr(124) Blacklist was disabled. }
elseif ($group(#Blklist) == off) { .halt }
}
on *:dialog:black:sclick:22:{
if ($did(black,28).enabled == $false) {
if ($did(black,22).seltext != $null) {
.did -e black 28
}
}
}
on *:dialog:black:dclick:22:{ .clipboard $did(black,22).seltext }
on *:dialog:black:sclick:23:{ .did -r black 22 | .remove -b Blacklist.log | .did -b black 23 }
on *:dialog:black:sclick:25:{ .refreshlogs }
on *:dialog:black:sclick:27:{ .openblacklistlog }
on *:dialog:black:sclick:28:{
if ($did(black,22).sel != $null) {
.write -dl $+ $did(black,22).sel Blacklist.log
.did -d black 22 $did(black,22).sel
.did -b black 28
if ($did(black,22).lines == 0) { .did -b black 23 }
}
}
on *:dialog:black:sclick:29:{
if ($group(#LoadBlacklistLog) == off) { .enable #LoadBlacklistLog }
elseif ($group(#LoadBlacklistLog) == on) { .disable #LoadBlacklistLog }
}
;##### ADD DIALOG
dialog addnew {
title "Blacklist v2.31b | Add New Entry"
size -1 -1 356 105
option pixels
text "Username/Address:", 1, 15 18 100 16
text "Reason:", 2, 15 42 45 16
edit "Undefined", 3, 62 40 277 20
edit "*!*", 4, 115 16 224 20
box "", 5, 8 2 338 65
button "Add", 6, 110 74 56 23, disable ok
button "Cancel", 7, 182 74 56 23, cancel
}
on *:dialog:addnew:edit:3:{
if ($did(addnew,4).edited == $true) { .did -e addnew 6 }
if ($did(addnew,3).text == $null) { .did -b addnew 6 }
}
on *:dialog:addnew:edit:4:{
if ($did(addnew,3).edited == $true) { .did -e addnew 6 }
if ($did(addnew,4).text == $null) { .did -b addnew 6 }
}
on *:dialog:addnew:sclick:6:{
if ($did(addnew,3).text != $null) {
if ($did(addnew,3).edited == $true) && ($did(addnew,4).edited == $true) {
.write Blacklist.blklist $did(addnew,3).text $+ $chr(35) $+ $did(addnew,4).text $+ $chr(35) $+ $asctime(h:nn:ss TT) $+ $chr(35) $+ $asctime(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) $+ $chr(35)
.did -a black 1 $gettok($read(Blacklist.blklist,$lines(Blacklist.blklist)),2,35)
if ($did(black,13).enabled == $false) { .did -e black 13 }
}
}
}
;##### EDIT DIALOG
dialog editblk {
title "Blacklist v2.31b | Edit Entry"
size -1 -1 327 115
option pixels
text "Reason:", 1, 16 47 42 17
edit "", 2, 58 45 247 20, autohs
button "Save", 3, 94 82 55 23, ok
button "Cancel", 4, 167 82 55 23, cancel
box "", 5, 5 5 314 67
text "Address:", 6, 13 22 44 17
edit "", 7, 59 20 247 20, autohs
}
on *:dialog:editblk:init:0:{
.did -a editblk 2 $gettok($read(Blacklist.blklist,$did(black,1).sel),1,35)
.did -a editblk 7 $gettok($read(Blacklist.blklist,$did(black,1).sel),2,35)
}
on *:dialog:editblk:sclick:3:{
if ($did(editblk,2).edited == $true) {
.write -l $+ $did(black,1).sel Blacklist.blklist $replace($gettok($read(Blacklist.blklist,$did(black,1).sel),1-,35),$gettok($read(Blacklist.blklist,$did(black,1).sel),1,35),$did(editblk,2).text)
if ($numtok($gettok($read(Blacklist.blklist,$did(black,1).sel),1,35),32) > 5) { .did -ra black 6 $gettok($gettok($read(Blacklist.blklist,$did(black,1).sel),1,35),1-5,32) $+ ... }
elseif ($numtok($gettok($read(Blacklist.blklist,$did(black,1).sel),1,35),32) <= 5) { .did -ra black 6 $gettok($read(Blacklist.blklist,$did(black,1).sel),1,35) }
}
}
;##### BLACKLIST CODE
#Blklist on
on *:JOIN:#:{
if ($exists(Blacklist.blklist) == $true) {
var %x = 1
while (%x <= $lines(Blacklist.blklist)) {
if ($gettok($read(Blacklist.blklist,%x),2,35) == $address($nick,2)) {
if ($me isop $chan) {
.write Blacklist.log $asctime(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) $chr(124) $asctime(h:nn:ss TT) $chr(124) $nick ( $+ $address($nick,2) $+ ) was blacklisted in $chan $+ .
if ($group(#KickAllCommon) == on) { .set -u3 %r $gettok($read(Blacklist.blklist,%x),1,35) | .kickallcommon $$1 }
elseif ($group(#KickAllCommon) == off) { .mode $chan +bb $nick $address($nick,2) | .kick $chan $nick $gettok($read(Blacklist.blklist,%x),1,35) • Blacklisted }
.halt
}
elseif ($me !isop $chan) { /write Blacklist.log $asctime(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) $chr(124) $asctime(h:nn:ss TT) $chr(124) $nick ( $+ $address($nick,2) $+ ) joined $chan but could not be kicked. | .halt }
}
.inc %x
}
}
}
#Blklist end
;##### END BLACKLIST SCRIPT
@ a careful warchild: Unfortunately it's not my responsibility to make up scripts to fit in with other scripts. I can make it to use to my own advantage, which in fact, is /black for me.
@ Bullet_Dodger: With the coding available above, any user with the general knowledge of mIRC scripting should be able to piece together an alias for it; good luck.
@ Stapler: I'm not quite sure what the problem is there for you. I've tested it thoroughly and have not had any problems. I believe some of the other users have not had m/any problems with it. Be sure you pasted it in an empty mIRC file. If the problem persists, oh well, I guess you're out of luck.
I will not be updating this script any further. Any updates made will be mandatory updates that I find actually improve the usage of the script, and is not just another feature to get in the way.
I'm sorry if I seem a little blunt with my answers, but I've pretty much stopped mIRC scripting. I will make for-fun scripts every once-in-awhile or other "useful" scripts if I find something that I haven't already coded. I've covered just about all there is to make that can still be considered "useful."
Anyways, good luck with your personal updates to the code, and have fun!
I've noticed a few problems upon using a few of the new features. I'm in class right now trying to fix it, and I'll work on it when I get home, so I should have an updated, better working version later this evening.
Here's a couple of problems I found:
Double logging of kicks when having "Kick From All Common Channels" enabled
No logs recorded when adding a blacklist entry via the dialog