/* Askhost script for use with AmIRC 1.x */ version='1.05'/*
// Written by Deryk Robosson 11.18.96
//
// newlook@ameritech.net newlook on #amiga IRC (EfNet)
//
// 03.01.97 - Corrected problem with SAY. Reported by SimD
// 15.01.97 - Supports showing a user the output
//            Supports passing user nick for input
// 03.03.97 - Corrected typo in my name ;)
// 04.03.97 - Prettied up the help/ver info a bit
// 06.03.97 - added hostname info to output
// 18.03.97 - Cleaned up the code
// 21.03.97 - Corrected problem when echoing to yourself
*/
bold = d2c(2)
underline = '1F'x
tempfile = 't:Askhost.temp'
options results
parse arg param

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

if param~ = '' then do
    parse var param where' 'command
    parse var where domain'.'whatever
    if whatever = '' then do
        'USERHOST 'where
        if result~ = 'RESULT' then parse var result blah'@'host
    end
    else host=where

    if command~ = '' then do
        parse var command command' 'user
    end
    else command = ''
end

ADDRESS COMMAND 'amitcp:bin/Askhost 'host' >T:Askhost.temp'

if open(file, tempfile,'R') then do
    do until eof(file)
        line = ReadLn(file)
        select
            when line = ' ' then nop
            otherwise
                select
                    when command = 'SAY' then 'SAY 'line
                    when command = 'SAY /NOTICE' user||" "||line
                    otherwise
                        if command = '' then call echo(line)
                end
        end
    end
    close(file)
    ADDRESS COMMAND 'delete >NIL:' tempfile 'quiet force'
end
Exit

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

help:      /* show the user help examples */
    call echo(bold'Askhost.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'/Askhost site 'bold' to see output yourself')
    call echo(bold'/Askhost usernick 'bold' to see output yourself')
    call echo(bold'/Askhost site SAY 'bold' to show output to channel')
    call echo(bold'/Askhost site SHOW nick 'bold' to show output to a user')
exit

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