home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
new
/
comm
/
bbs
/
4d-bbsdemo
/
arexx
/
4dmultichat.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-12-28
|
5KB
|
268 lines
/* Program : 4DMultiChat.rexx
* Copyright : © Copyright 1993 Robert T. Davis and CornerStone Software
* Author : Dale E. Reed Jr. and Robert T. Davis
* Creation Date : September 5, 1993
* Current version : 1.1d
* Translator : AREXX/4D-BBS
*
*
* This Program lets multiple users "chat" with each other in a public
* on-line forum.
*
* REVISION HISTORY
*
* Date Version Comment
* --------- ------- ------------------------------------------
* 24-AUG-93 0.90a 4D-BBS Internode conference, Created
*
* 05-Sep-93 1.1d Polished up several problems. Got it working!
*
*/
options results
signal on syntax
signal on error
ARG port stdio
logfile='Text:Logs/ConfError.Log'
IF length(port)=0 THEN
port = '4D-BBS'
MAXLINES = 10 /* optimize to your # of lines */
basename = port /* for strippage later ;) */
thisline = port /* Name of this port */
users = 0 /* for user command whos here */
running = 1 /* flag set if we are running */
if datatype( right(basename,1)) = 'NUM' then
do
num = right(basename,1) /* our port number sendmessage */
basename=left(basename, (length(basename)-1))
end
else if datatype( right(basename,2)) = 'NUM' then
do
num = right(basename,2) /* our port number sendmessage */
basename=left(basename, (length(basename)-2))
end
address value(thisline)
'userinfo' 'A'
localname=RESULT
call sas('SR%SR%6 4D-BBS 4Multiuser Chat 6Enter /Q to quit or /? for Help')
call sas('3---------------------------------------------------------------')
call sas('0SR%SR%')
/*
call sendmessage('Just Entered The Public Chat Forum')
*/
do FOREVER
address value(thisline) /* Just in case !!! */
'systemstatus' 80
mqprompt num||">>" /* this will display messages until a key is pressed */
memo = RESULT
if left(memo,1) = '/' then
call user_command( left(memo,2) )
else if memo ~= '' then
call sendmessage(memo)
if ~running then BREAK
end /* FOREVER LOOP */
/**********************/
/* cleanup and go */
/********************/
leave:
address value(thisline) /* Just in case !!! */
'systemstatus' 17
call sendmessage('Just Exited The Public Chat Forum')
call sendmessage(' ')
shutdown
exit
/***********************************************************************/
/* sendmessage: Handles sending of strings to other copies of 4D-BBS */
/***********************************************************************/
sendmessage:
parse arg str
do numb = 0 to MAXLINES
portname=basename||numb
if show(p, portname) then
do
address value(portname)
'systemstatus' 0
st=RESULT
/* send message to this system */
bigstr = '('||num||') '||localname||': '||str
if st = 80 then
messqueue bigstr
end
end
return
/***********************************************************************/
/* user_command: Handles users commands while in conference mode */
/***********************************************************************/
user_command:
parse arg CMD
select
when CMD = '/w' then do
do numb=0 to MAXLINES
portname=basename||numb
if show(p, portname) then do
address value(portname)
first = ' '
'systemstatus' 0
st=RESULT
if st = 80 then do
'userinfo' 'A'
name=RESULT
'baud' '0'
ubaud=RESULT
if ubaud = 0 then
ubaud='LOCAL'
/* display users in conference */
bigstr = left(portname, 9, ' ') || first || left(name, 21, ' ') || left(ubaud, 8, ' ')
address value(thisline) /* switch back to local port */
call sas(bigstr)
end
end
end
call sas('SR%')
end
when CMD = '/q' then
running = 0
when CMD = '/m' then
do
prompt 'Enter Line Number to Send to: '
sline=RESULT
sportname=basename||sline
if show(p, sportname) then
do
address value(sportname)
prompt 'Enter Message: '
smess=RESULT
smess=localname||' ('||num||'):'||smess
messqueue smess
end
end
when CMD = '/?' then
do
address value(thisline)
transmit 'SR% /w - whos in chat mode'
transmit 'SR% /m - send a message to someone'
transmit ' /q - quit chat mode'
end
OTHERWISE transmit 'SR%3***0 Unknown command 3***0SR%'
end
return
/*****************************************************************/
/* this routine will handle printing to either the arexx port or */
/* to this local stdio if the port name was "STDIO" */
sas:
parse arg op
if stdio ~= '' then
say op
else
do
address value(thisline)
transmit op
end
return
/*************************************************************
* ERROR HANDLING *
*************************************************************/
syntax:
parse source . . . me .
if open(log, logfile, 'Append') = 1 then do
writeln(log, 'rc 'in line' sigl 'of' me')
close(log)
shutdown
end
exit
error:
parse source . . . me .
if rc < 1000 then do
if open(log, logfile, 'Append') = 1 then do
writeln(log, 'rc 'in line' sigl 'of' me')
close(log)
shutdown
end
end
exit