mIRC Home    About    Download    Register    News    Help

Print Thread
hash table #161516 08/10/06 10:46 AM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
Good afternoon to all.

When writing a shitlist i learned i can do that best with hash tables, so with the helpfile i made this

/hmake shitlist 10
/hadd shitlist $address($$1,2) $chan

so in the list i have an IP, a name and channelname

What do i need to do to have IP kick/ban from channelname as mention in the shitlist. They need to be kick/ban only from the channelname where i put him/her on the shitlist.
P.s. I'm in several cnhannels.

Thanxs in advange.
Aaron

Last edited by AaronL; 08/10/06 10:49 AM.

Deridio fatum
Re: hash table #161517 08/10/06 03:32 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
 /ban -k $hget(shitlist,$address($1,2)) $1 2 

Now for an explanation:
/ban is the actual ban command
-k tells mIRC that there needs to be a kick as well
$hget(shitlist,$address($1,2)) looks up the address in the shitlist hash table and returns the data stored (in this case the channel)
$1 is the person's nick
2 is the address mask for the ban

Re: hash table #161518 08/10/06 07:02 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
Hi RusselB

Thanxs for your reply.
i tested it, but i got this error
/ban: no such user 2

in the table should be a line like this:
*!*@123456.123456.nl nickname

since i'm in several channels where a person is allowed except in one channel, i would like to see if that person joins the other channels, nothing happens, but when that person joins #nl-irc he/she is going to be banned and kicked out of #nl-irc
Perhaps its best to have a line like this: IP name channel.
not sure ofcourse since i'm a noob with hash tables. smile

greetz
Aaron


Deridio fatum
Re: hash table #161519 08/10/06 07:49 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Post your entire code, so that I can go over it and figure out just where the problems are. Based on the little bit that you did give, the hash table entries would be in the format of *!*@123456.123456.nl #channel

The person's nick would not be stored in the hash table.

Re: hash table #161520 08/10/06 08:24 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
Code:
menu nicklist { 
  -
   Auto Manager
  . Shitlist 
  ..Add $$1 : { /hadd shitlist $address($$1,2) $chan | .echo 4 =[ you added $$1 ]= }
  ..Remove $$1 : { /hdel shitlist $address($$1,2) | .echo 3 =[ you removed $$1 ]= }
}


in the table should be: *!*@123456.123456.nl #room


Deridio fatum
Re: hash table #161521 08/10/06 09:36 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The only thing I can think of, is that the * that are being generated in the $address($$1,2) section of the /hdel command aren't being interpreted correctly. Try using the -w switch so that mIRC does a wilcard match.
Since there's only going to be one entry (maximum), then even a wildcard match will only return one match.

Re: hash table #161522 09/10/06 05:40 AM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
point is, that, with using the Add command, there will be a line in the hash table that looks like *!*@123456.123456.nl #room.

As soon someone with that IP joins the channel as mentioned in the hash table, he/she will be ban/kicked in only that channel.
The ..Remove will be changed in a window with all the IP's in it so its easyer to remove them if needed.

the reason i use the *!*@ is that a ident can be changed and thus the person won't be kicked.. (not sure of that tho)

Greetz
Aaron

Last edited by AaronL; 09/10/06 05:41 AM.

Deridio fatum
Re: hash table #161523 09/10/06 06:37 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
With the -w switch, mIRC will delete any items that match the non-wilcarded part of the supplied informationi

If $address($nick,2) returned *!*@ServerAdmin.Maximum-IRC.com
using /hdel -w $address($nick,2) will search for a wildcard match on *!*@ServerAdmin.Maximum-IRC.com

The fact that the two happen to match exactly is irrelevant.

If you wanted, you could add to the hash table using $address($nick,5) and the same /hdel command would still work.

Regarding changing ident, yes, that definetely can be done, almost as easily as changing a person's nick. So using that format is a good idea, especially since the /ban command will work with a specified address (even one containing wildcards)

Re: hash table #161524 09/10/06 07:50 AM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
RusselB

i made the changings like the -w and its working now..
thank you very much for your help.

Greetz
Aaron


Deridio fatum