mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 3 1 2 3
#160902 01/10/06 11:06 AM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
I've been searching for a good blacklist, quite some time now. But I've been unable to find one that really meet my needs. I've searched all the normal scripting site's, but like I said, none of em are real quality in my opinion.

Below are some of the requirements I have. If someone feels like giving it a try, making it, it would be very appreciated:
- All info should be stored in hash table (instead of user-list)
- All bans should be done on hostmask (*!*@host)
- All bans should be global (all networks, all channels)
- All bans should automaticly ignore the user
- Kick-counter included in the kick-message
- Default blacklist reasons, like PM-spammer, Flooder
- Custom blacklist reason option
- on Query, right-click menu, select reason, ignore user and close query.
- on JOIN, echo in active window, that blacklisted user has joined.
- on JOIN, kick the user if I have ops.
- Scan for blacklisted users when I get ops.

I think that's most of the requirements I can now think of.
So, if someone has time for it, and thinks he can do it, please give it a shot.

And if someone is currently using a blacklist, one that's really recommendable, I would like to give it a try also.
I just haven't been able to find one that's real quality.

Thank for the help in advance!

#160903 01/10/06 07:43 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
you have been scripting a while, how about you make it and ask for help in parts that dont work?

#160904 01/10/06 08:05 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
yeah I did think about that, and it would be best since it would be 100% what I want. But my problem is the hash tables, it's hard to visualise how they work, and I just don't have a lot of experience with them. And since they would be the backbone on this script, it's hard to even find a place to start.

But indead, If I don't get a reply on this threat, I have to try something myself.
Just thought I'll give it a shot on here.

#160905 01/10/06 09:08 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I saw your last post about half-an-hour after you posted it, and wrote this up in about the remaining half-hour. It has been tested to a degree, but I don't guarantee that it's 100%. If you find problems, let me know and I'll see what I can do.
Code:
on *:start:{
  if !$hget(Blacklist) { .hmake Blacklist 100 }
  if $exists(Blacklist.hsh) { .hload Blacklist Blacklist.hsh }
}
on *:exit:{
  .hsave -uo Blacklist Blacklist.hsh
}
on *:disconnect:{
  .hsave -uo Blacklist Blacklist.hsh
}
on !*:join:#:{
  if $hget(Blacklist,$nick) {
    echo -a Blacklisted $nick has joined $chan
    if $me isop $chan {
      .ban -k $chan $nick 2 $hget(Blacklist,$nick) Kick $chr(35) $hget(Blacklist,$+(Count,.,$nick))
    }
  }
}
on *:op:#:{
  blacklist scan $chan
}
on *:serverop:#:{
  blacklist scan $chan
}
on *:ban:#:{
  .ignore $bmask
  updatenl
}
on *:kick:#:{
  hinc Blacklist $+(Count,.,$knick))
  updatenl
}
alias blacklist {
  if $1 == add {
    var %a = 1, %b = $numtok($2-,44)
    while %a <= %b {
      .hadd -m Blacklist $gettok($2-,%a,44) $iif($3-,$3-,$$?="Blacklist Reason")
      inc %a
    }
  }
  elseif $1 == scan {
    if $me isop $2 {
      var %a = 1
      while %a <= $nick($2,0) {
        if $hget(Blacklist,$nick($2,%a)) {
          .ban -k $1 $nick($2,%a) 2 $hget(Blacklist,$nick($2,%a)) Kick $chr(35) $hget(Blacklist,$+(Count,.,$nick($2,%a)))
          dec %a
        }
        inc %a
      }
    }
  }
}
menu query {
  Blacklist Reason : .hadd -m Blacklist $nick $$?="Reason"
}
menu channel,nicklist,status {
  Blacklist
  .PM Spammer blacklist add $iif(!$snicks,$$?="Nick or nicks to be added",$snicks) PM Spammer
  .Flooder blacklist add $iif(!$snicks,$$?="Nick or nicks to be added",$snicks) Flooder
  .Custom : blacklist add $iif(!$snicks,$$?="Nick or nicks to be added",$snicks) $?="Common Reason"
  ; If common reason isn't included, you will be asked for a reason for each nick
}
menu channel,status {
  Blacklist
  .Remove : .hdel Blacklist $$?="Name to be removed"
}

  


I think I got everything you asked for, as well as some items you didn't ask for.

Last edited by RusselB; 01/10/06 09:57 PM.
#160906 01/10/06 09:15 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Quote:
I saw your last post about half-an-hour after you posted it, and wrote this up in about the remaining half-hour.


That's what I mean, I will take me at least a week, to get anything decent going.

Thank you VERY much for this RusselB, I'm gonna test it and I will let you know. Thx a lot!

#160907 01/10/06 09:35 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If something like that would take you a week, then I suggest you cringe at the thought of trying something like my Channel Control Dialog (which I'm still working on, so don't bother looking for it), which I've been working on for the past 9 months (I hope to have it done for the new year)

#160908 01/10/06 09:42 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
omg, now thats called patience.

I've testing a little, and found these points:
- it seems to ban on nick but not on address. Can it work by address (*!*@host)?
- the serverop event, how does that work? I'm not an server op, just a channel op.
- BLACKLISTSCAN Unknown command (triggered when someone joined the channel) smile
- The right-click menu in a query, gives me "Blacklist reason", can that be changed to:
Blacklist -->
.PM spammer
.Flooder
.Specify Reason

Thx in advance again!

#160909 01/10/06 09:47 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
* /inc: insufficient parameters (line 30, Blacklist.mrc)

Hmm, that one also popped up.
Dont know when it triggered, but noticed it in the status window.

#160910 01/10/06 09:59 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
original code edited & corrected

#160911 01/10/06 10:05 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The mask 2 in the ban command makes mIRC look up the address for the nick, then ban using the format you wanted. It shows to you as the nick being banned, but in reality it's the address that's being banned.
The serverop event is for if the server ops you in the channel, rather than a person/bot that's in the channel.

Other errors and requests changed in original code.

#160912 01/10/06 10:06 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Thank you!
Have to work tomorrow, so bedtime for me now.
But I'll test it some more tomorrow!

Thanks Russel

#160913 01/10/06 10:32 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Hmm, I still cant really get the blacklist to work, when I am chatting with someone in a query, and I want to add him to the blacklist.

I also seem to get some errors, when I'm right-clicking the channel or status windows. It starts asking for reasons and nicks :tongue:

I dunno, I'll check it some more tomorrow.

#160914 01/10/06 10:51 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
OK...and I'll give the script a bit more of a work out tonight, and see if I can catch any other problems.

#160915 02/10/06 07:34 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Ok, I've been testing some more tonight, and I have some remarks:

- When no nick/nicks have been selected from the nicklist and I right-click the channel window, it asks me to input nicks. I obviously use right-click channel menu also for other things, then blacklisting people smile

- When I right-click a user in a channel, it shows me PM Spammer and Flooder, but both options are grayed out. I'm not able to select them.

- When I right-click a user in a channel, and I specify a custom reason, it adds the user to the blacklist, but the reason is added twice (nick reason reason).

- When I right-click the channel or status menu, there should be no blacklist option. Since I'm not gonna blacklist an entire channel. It should only be present in the nicklist and query menu's.

- I don't really understand the kick-counter. It should be a global counter, in the variables list or something. And only increase when I kick someone.
At the moment it seems to count how many times someone was kicked (count.nick). But not only by me, also by others.

Would it be possible, to remove the aliasses from the script, and just replace the actual commands for it?
That way I should be able to tune the script a little more myself as well. Just the basic adding users to the hash with pre-set reason or with specified reason, looking the user up when he joins the channel and the ability to remove people from the list?

Again, I really appreciate your efforts in this RusselB!

#160916 02/10/06 09:35 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Going through your points one at a time, in the order you mentioned them (I'll post a re-code later).
1) Right clicking on the channel should've given you a Blacklist option along with the rest of your channel right click options. I have found the problem with it defaulting to asking for nicks, and resolved it. The option was added in case you wanted to add someone to the black list that was no longer in the channel (eg: someone joining, spamming the channel with an advertisement, then leaving)

2) The greyed out options have been resolved, and were due to the same problem that was causing the problem solved in #1.

3) I noticed this also, and while I can see what is causing it, I'm going to need a bit more time to figure out a proper resolution for it.

4) Reference answer #1 for my reasoning on having the options available in the status & channel menus. Removing the option is easily enough done if you really don't want it.

5) The kick counter is stored in the hash file, and tracks the number of times the particular nick was kicked, rather than the total number of kicks. When you said about a kick counter, I didn't realize that you only wanted it to count when you kicked someone. Adding that condition is easy.

6) Removal of the aliases is possible, but would increase the amount of code significantly since the code that is in each alias would have to be replicated for each part of the code where the alias is currently being called. I do not recommend this, as it would mean haing to make 5 changes to the code, rather than 1 change in the alias.

#160917 02/10/06 09:45 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Alright, cool.
Sure keep the alias, I'll learn to work with those instead in that case smile

Looking forward to the updated version!

#160918 02/10/06 10:10 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
 on *:start:{
  if !$hget(Blacklist) { .hmake Blacklist 100 }
  if $exists(Blacklist.hsh) { .hload Blacklist Blacklist.hsh }
}
on *:exit:{
  .hsave -o Blacklist Blacklist.hsh
}
on *:disconnect:{
  .hsave -o Blacklist Blacklist.hsh
}
on !*:join:#:{
  if $hget(Blacklist,$nick) {
    echo -a Blacklisted $nick has joined $chan
    if $me isop $chan {
      .ban -k $chan $nick 2 $hget(Blacklist,$nick) Kick $chr(35) $hget(Blacklist,$+(Count,.,$nick))
    }
  }
}
on *:op:#:{
  blacklist scan $chan
}
on *:serverop:#:{
  blacklist scan $chan
}
on *:ban:#:{
  if $nick = $me {
    .ignore $bmask
  }
}
on *:kick:#:{
  if $nick == $me {
    hinc Blacklist $+(Count,.,$knick))
  }
  updatenl
}
alias blacklist {
  if $1 == add {
    set %reason $gettok($2-,1--1,32)
    set %nicks $gettok($2-,-1,32)
    if %nicks == $2- {
      set %nicks $$?="Nick(s) to be added to blacklist"
    }
    set %nicks $replace(%nicks,$chr(44),$chr(32))
    var %a = 1, %b = $numtok(%nicks,32)
    while %a <= %b {
      .hadd -m Blacklist $gettok(%nicks,%a,32) $iif(%reason,$v1,$$?="Blacklist Reason")
      inc %a
    }
  }
  elseif $1 == del {
    set %nicks $2-
    set %nicks $replace(%nicks,$chr(44),$chr(32))
    var %a = 1, %b = $numtok(%nicks,32)
    while %a <= %b {
      .hdel Blacklist $gettok(%nicks,%a,32)
      inc %a
    }
  }
  elseif $1 == scan {
    if $me isop $2 {
      var %a = 1
      while %a <= $nick($2,0) {
        if $hget(Blacklist,$nick($2,%a)) {
          .ban -k $1 $nick($2,%a) 2 $hget(Blacklist,$nick($2,%a)) Kick $chr(35) $hget(Blacklist,$+(Count,.,$nick($2,%a)))
          dec %a
        }
        inc %a
      }
    }
  }
}
menu query {
  Blacklist Reason : .hadd -m Blacklist $nick $$?="Reason"
}
menu channel,nicklist,status {
  Blacklist
  .PM Spammer : blacklist add PM Spammer $snicks 
  .Flooder : blacklist add Flooder $snicks
  .Custom : blacklist add $?="Common Reason" $snicks 
  ; If common reason isn't included, you will be asked for a reason for each nick
}
menu channel,status {
  Blacklist
  .Remove : blacklist del $$?="Name(s) to be removed"
}
 


I think that should be a final code. I did test it briefly, and all of the noted problems have been resolved.

Also, in the areas where you are asked for nick(s)/name(s), the code has been set to accept multiple entries, with the entries being separated by either space or comma.

#160919 02/10/06 10:34 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Alright, that does look good.
I'll play a little with it, and see how it works.

Thanks for all the help RusselB!
Much appreciated!

Joined: Feb 2007
Posts: 28
S
Ameglian cow
Offline
Ameglian cow
S
Joined: Feb 2007
Posts: 28
It works pretty well but, there's a slight problem..

when i open ( Blacklist.hsh ) using notepad, wordpad, ms word and etc.. i cant view the list of the nicks/host/ip i placed on my blacklist.

how can i view them and edit it manually? for instance >> *!*@username.* and i want to change it to *!*hers@username.*

sorry for the narking fellaz .. i cant figure it out how to open the file.

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
I save my hash tables as a text document. This may help but you will still see it as a saved hash table.

1stItem[]data[]2ndItem[]Data[]3rdItem[]data

and so on.

Page 1 of 3 1 2 3

Link Copied to Clipboard