/* Finger script for use with AmIRC 1.x */ Version='1.05' /*
// Written by Deryk Robosson 11.3.96
//
// newlook@ameritech.net newlook on #amiga IRC (EfNet & IRCnet)
//
// 01.03.97 (1.01) - Now deletes tempfile
//                   Supports showing a user the output - Suggested by SimD
// 01.07.97 (1.02) - Supports passing user nick for input - Suggested by SimD
// 03.03.97 (1.03) - Changed all ' to ' for AmIRC commands per the docs.
// 04.03.97 (1.04) - Prettied up the display of information
//                   Corrected command parsing error.
//                   Script wasn't deleting the temp file. Corrected.
// 18.03.97 (1.05) - cleaned up the code
*/
bold = d2c(2)
underline = '1F'x

tempfile = 't:finger.temp'

options results
parse arg param

if param = ''|upper(param)='VER' then signal version
if upper(param) = 'HELP' then signal help

parse var param who' 'command' 'user
command = upper(command)

'USERHOST 'who
if result ~= 'RESULT' then who = result

ADDRESS COMMAND 'amitcp:bin/finger' who' >T:finger.temp'

if open(file, tempfile,'R') then do
    do until eof(file)
        line = ReadLn(file)
        if line ~= '' then do
            select
                when command = 'SAY' then 'SAY' line
                when command = 'SHOW' then 'RAW NOTICE' user ':'line
                otherwise
                    if command = '' then 'echo P='ESC||BOLD'«Finger» 'line
            end
    end
end
close(file)
address command 'delete' tempfile 'quiet force'
exit

version:    /* show the user version information */
    call echo(bold'Finger.AMIRX'bold' Version 'bold||version)
    call echo('Read the top of Finger.AMIRX script for history.')
    call echo(bold'©1996,1997'bold' Deryk Robosson 'bold'(newlook)'bold' - [newlook@newlook@ameritech.net]')
    call echo(bold'Type /<alias> help for command information')
exit

help:   /* show the user help examples */
    call echo(bold'Finger.AMIRC'bold' Help')
    call echo(bold'SAY  - 'bold'ECHOs output to window')
    call echo(bold'VER  - 'bold'displays script version')
    call echo(bold'SHOW - 'bold'displays outout to user')
    call echo(bold'HELP - 'bold'displays this file')
    call echo(bold||underline'EXAMPLES:'bold||underline)
    call echo(bold'/Finger usernick 'bold' to see output yourself')
    call echo(bold'/Finger user@site 'bold' to see output yourself')
    call echo(bold'/Finger usernick SAY 'bold' to show output to channel')
    call echo(bold'/Finger user@site SHOW usernick 'bold' to show output to a user')
exit

echo: procedure
	parse arg a
	'echo P='d2c(27)'b«Finger» 'a
return 1
