; /listinfo [nick|address|IP|mail]
alias listinfo {
if ($findtok(nick address IP mail,$1,32)) { var %column = $v1 }
else { echo -a Syntax: /info [nick|address|IP|mail] | return }
if (!$hget(ipinfo,1).item) { echo -a table "ipinfo" is empty. }
else {
var %tempfile = $qt($+($mircdir,IPinfoDump.txt))
var %outfile = $qt($+($mircdir,Report_IPInfo.txt))
var %denote = Nick: Address: IP: eMail:
; dump table to tempfile
write -c %tempfile
hsave -i ipinfo %tempfile
; sort data in tempfile
write -dl1 %tempfile
filter -ffct %column 44 %tempfile %tempfile
; fopen outfile
if ($fopen(listinfo.out)) { .fclose listinfo.out }
.fopen -o listinfo.out %outfile
; fwrite heading lines to outfile
.fwrite -n listinfo.out Report runtime: $+($asctime(ddd mmm dd @ HH:nn:ss),.) There are $lines(%tempfile) item(s) listed.
.fwrite -n listinfo.out Report compiled by: $replace($1,ip,IP address,mail,E-mail)
.fwrite -n listinfo.out $str(-,30) $crlf $crlf
; fopen tempfile
if ($fopen(listinfo.temp)) { .fclose listinfo.temp }
.fopen listinfo.temp %tempfile
; loop lines of tempfile
while ($fread(listinfo.temp)) {
var %read = $gettok($v1,2-,61), %line, %t = 1
; insert denotations
while ($gettok(%read,%t,44)) {
var %line = $addtok(%line,$gettok(%denote,%t,32) $v1,44)
inc %t
}
; fwrite lines to outfile; sortby-column in first place
tokenize 44 $deltok(%line,%column,44)
.fwrite -n listinfo.out $gettok(%line,%column,44) >>> $1- $crlf
}
; fclose tempfile and outfile
.fclose listinfo.*
.remove %tempfile
run %outfile
}
}