mIRC Home    About    Download    Register    News    Help

Print Thread
(solved) Hash table issue #218565 17/02/10 10:06 PM
Joined: Mar 2004
Posts: 359
L
LostServ Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Mar 2004
Posts: 359
Replacing $address($nick,2) with $wildsite has seemed to fix it.

I've written a bot that lets me store strings to match against spoken text with the end result being a kick from the channel for being a spambot. It uses hash tables to store this information, and another hash table (the one I'm having an issue with below) to store stats. The stats are the time,date,etc and nick!user@host along with the message.

In case an innocent user gets banned/etc, I'm trying to create a method with which they can make the bot stop auto kicking them. This is where the problem is occurring.

I have the hash table that is setup like this:

ITEM: 17-02-2010.15:42:22.-0600.430048371
DATA: IAmPhase!IAmPhase@919ED048.ECFAB7AE.559BA39.IP Any boy would like to chat or anything else messg me


And here's the code to remove the entry so they can join without being kicked:
Php Code:

on *:text:*iamhuman*:?: {
  if ($hfind(nospamstats,$+(*,$remove($address($nick,2),*!*@),*),1,w).data) {
	hdel -s nospamstats $hfind(nospamstats,$+(*,$remove($address($nick,2),*!*@),*),1,w).data
	msg $nick $hfind(nospamstats,$+(*,$remove($address($nick,2),*!*@),*),1,w).data
	if (!$hfind(nospamstats,$+(*,$remove($address($nick,2),*!*@),*),1,w).data) { msg $nick [AUTOMATED RESPONSE] I won't automatically kick you anymore. Sorry for any inconvenience this may have caused you. }
	elseif ($hfind(nospamstats,$+(*,$remove($address($nick,2),*!*@),*),1,w).data) { msg $nick [AUTOMATED RESPONSE] An error occured when trying to remove you from the auto kick list. Please try again, or PM Phase with all relevant information. }
  }
  else {
	msg $nick [AUTOMATED RESPONSE] You are not in the auto kick list. If you are being kicked by me, and see this message please PM Phase with any information you may find relevant. Sorry for any inconveniences this may have caused.
  }
}
 


Here's the point of view from my test client (IAmPhase):
Quote:

<IAmPhase> iamhuman
<nospam> 17-02-2010.13:45:02.-0600.423008527
<nospam> [AUTOMATED RESPONSE] An error occured when trying to remove you from the auto kick list. Please try again, or PM Phase with all relevant information.


This is the point of view from my bot:
Quote:

-
* Deleted item '17-02-2010.14:06:57.-0600.424323605' from hash table 'nospamstats'
-
-> *IAmPhase* 17-02-2010.13:45:02.-0600.423008527
-
-> *IAmPhase* [AUTOMATED RESPONSE] An error occured when trying to remove you from the auto kick list. Please try again, or PM Phase with all relevant information.
-


In the bot's point of view, you can see it's removing and referencing 2 different ITEM entries. I've looked over the code a few times and still can't spot the inconsistency.

I appreciate anyone trying to help me. smile

Last edited by LostServ; 17/02/10 10:28 PM.
Re: (solved) Hash table issue [Re: LostServ] #218568 17/02/10 10:46 PM
Joined: Feb 2009
Posts: 133
C
chacha Offline
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
u can replace $address($nick,2) by $wildsite


WorldDMT