home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
BBS
/
CEL141.ZIP
/
CEL141C.ZIP
/
TOOLKIT.ZIP
/
CHAT-SA.PAS
next >
Wrap
Pascal/Delphi Source File
|
1992-08-14
|
4KB
|
202 lines
program ChatSa; {Standalone Multinode Chat}
uses dos,crt,winttt5,fastttt5,gensubs;
type setuprec=record
nodechatpath:string[80];
forec,
backc:byte;
nodes:byte;
end;
type
NodeIDRec=record
Username:string[15];
ChatAvail:boolean;
ChatRequest:byte;
Activity:byte;
Update:longint;
end;
ChatRec=record
node:byte;
who:string[30];
CurTalk:byte;
talk:array[1..10] of string[80];
end;
const
nodes=6;
forec=7;
backc=1;
var
Save1CVector: Procedure;
OldVector,
Eproc : pointer;
TimePtr : ^longint;
timeclicks : Longint;
Last : Longint;
LastLine : Byte;
NodeChatPath: string;
procedure ListWhosOn;
var NodeFile:file of NodeIdRec;
NodeID:NodeIDRec;
cnt:byte;
Notice:string[80];
s:string;
begin
{$I-}
assign(NodeFile,nodechatpath+'nodelist.nod');
reset(NodeFile);
if ioresult<>0 then begin
close(NodeFile);
exit;
end;
notice:='';
for cnt:=0 to 8 do begin
seek(nodefile,cnt);
read(NodeFile,NodeID);
if NodeID.Activity<>0 then begin
writeAT(4,cnt+2,forec,backc,'Node #'+strr(cnt)+' active at '+timestr(nodeid.update));
case NodeID.Activity of
0:s:='Unknown ';
1:s:='Node Down ';
2:s:='Waiting for Call ';
3:s:='User logging on ';
4:s:='Main system ';
5:s:='In Sub-boards ';
6:s:='In Xfer Section ';
7:s:='Xfering Files ';
8:s:='Multinode Chat ';
9:s:='Sysop chat ';
10:s:='New User Applying ';
11:s:='QWK Processor ';
12:s:='Using a Door ';
end;
if nodeid.activity>3 then begin
s:=s+'User : '+copy(nodeid.Username+spcpad,1,16);
if nodeid.ChatRequest>0 then s:=s+' Paging';
end;
writeAT(34,cnt+2,forec,backc,s);
end;
end;
close(NodeFile);
end;
procedure WriteTranscript(TransText:string);
var TransFile:Text;
begin
{$I-}
assign(TransFile,'multchat.nd0');
append(TransFile);
if ioresult<>0 then
rewrite(TransFile);
writeln(TransFile,StripControl(TransText));
close(TransFile);
end;
procedure CheckChat;
var ChatFile:File of ChatRec;
Chat:ChatRec;
Cnt,Count:byte;
begin
Window(1,Nodes+3,22,80);
gotoxy(1,22);
writeln;
assign(ChatFile,NodeChatPath+'Chat.dat');
reset(Chatfile);
seek(chatfile,0);
read(chatfile,chat);
if (chat.curtalk>0) then begin
for count:=1 to chat.curtalk do begin
writeln(stripcontrol(chat.talk[count]));
WriteTranscript(chat.talk[count]);
end;
chat.curtalk:=0;
seek(chatfile,0);
write(chatfile,chat);
end;
close(chatfile);
end;
{$F+}
procedure UpdateChat; interrupt;
begin
if now>last then begin
writecenter(1,backc,forec,'Node Status');
ListWhosOn;
writecenter(1,forec,backc,'Node Status');
last:=now+2;
end;
{ inline ($9C);} {PUSHF}
{ Save1CVector;}
end;
{$F-}
{$F+}
procedure Exit_Proc;
begin
SetIntVec($1C,addr(Save1CVector));
end;
{$F-}
procedure InitChatIsr;
begin
Last:=0;
TimePtr:=ptr(0,$046c);
TimeClicks:=TimePtr^;
Eproc:=ExitProc;
ExitProc:=@Exit_Proc;
GetIntVec($1C,Addr(Save1CVector) );
SetIntVec($1C,Addr(UpdateChat) );
end;
procedure DrawChatBox;
begin
mkwin(1,1,79,nodes+2,forec,backc,1);
writecenter(1,forec,backc,'Node Status');
InitChatIsr;
end;
{ get path locations }
{ draw chat lines }
{ draw data entry box }
{ isr - get data, update }
{ get chat data }
begin
clrscr;
if paramcount>0 then
nodechatpath:=paramstr(1)
else
nodechatpath:='';
drawchatbox;
{do chat work}
readln;
end.
(*
Chat-Standalone was begun, but never completed. The system will
nicely monitor the line status of each node on the system, but does
not allow chatting
*)