It would be very little work to transfer from an INI file to the dual-format HASH table that I described above.
alias initohash {
var %if = myfile.ini, %is = mysection
var %hn = myhash, %hs = 100
;;;;
if ($hget(%hn)) {
if ($?!="Hash Table ' %hn ' already exists. $crlf $+ OVERWRITE the existing data?") hfree %hn
else return
}
var %ts = $ticks
hmake %hn %hs
var %ii, %id, %di, %dk, %hi, %hk
var %a = 0, %aa = $ini(%if,%is,0)
while (%a < %aa) {
inc %a
%ii = $ini(%if,%is,%a)
%id = $readini(%if,%is,%ii)
var %b = 0, %bb = $numtok(%id,44)
while (%b < %bb) {
inc %b
%di = $gettok(%id,%b,44)
%dk = %ii
%hi = $hget(%hn,%dk)
hadd %hn %dk $addtok(%hi,%di,44)
%hk = $hget(%hn,%di)
hadd %hn %di $addtok(%hk,%dk,44)
}
}
echo -at Transferred %if to %hn in $calc(($ticks - %ts) / 1000) $+ s
}
This code assumes that your ini file is structured like this:
[OnlyOneSection]
nick1=1.2.3.4
nick2=2.3.4.5
nick3=3.4.5.6,4.5.6.7,5.6.7.8
nick4=1.2.3.4,4.5.6.7
nick5=4.5.6.7
Set the variables at the top of the alias, then call /initohash.
It will transfer into the hash table like this:
1.2.3.4 nick1,nick4
3.4.5.6 nick3
5.6.7.8 nick3
2.3.4.5 nick2
4.5.6.7 nick3,nick4,nick5
nick5 4.5.6.7
nick4 1.2.3.4,4.5.6.7
nick1 1.2.3.4
nick3 3.4.5.6,4.5.6.7,5.6.7.8
nick2 2.3.4.5
To get a list of IPs used by %nick:
echo -a $hget(myhash,%nick)
To get a list of nicks who used %addr:
echo -a $hget(myhash,%addr)
-genius_at_work