mysticbbs/mystic/bbs_userchat.pas

158 lines
3.3 KiB
ObjectPascal
Raw Normal View History

2012-03-08 13:39:52 -08:00
Unit bbs_UserChat;
{$I M_OPS.PAS}
Interface
Procedure PageUserForChat;
Procedure OpenUserChat (Split, Forced: Boolean; ToNode: Byte);
2012-03-08 13:39:52 -08:00
Implementation
Uses
m_Strings,
m_FileIO,
m_DateTime,
bbs_Core,
bbs_Common,
bbs_NodeInfo;
Procedure PageUserForChat;
Var
2012-03-10 00:58:11 -08:00
Str : String;
ToNode : Byte;
ReqType : Byte = 8;
TempChat : ChatRec;
2012-03-08 13:39:52 -08:00
Begin
Repeat
Session.io.OutFull (Session.GetPrompt(479));
2012-03-08 13:39:52 -08:00
Str := Session.io.GetInput(3, 3, 12, '');
2012-08-21 09:23:47 -07:00
If Str = '?' Then WhosOnline Else
2012-03-08 13:39:52 -08:00
If Str = 'Q' Then Exit Else Break;
Until False;
ToNode := strS2I(Str);
2012-03-10 00:58:11 -08:00
If (Not GetChatRecord(ToNode, TempChat)) or (ToNode = Session.NodeNum) or
(Not TempChat.Active) or (Not TempChat.Available) Then Begin
Session.io.OutFull(Session.GetPrompt(480));
2012-03-10 00:58:11 -08:00
Exit;
2012-03-08 13:39:52 -08:00
End;
If Session.User.Access(Config.ACSSysop) Then
If Session.io.GetYN(Session.GetPrompt(481), False) Then
2012-03-08 13:39:52 -08:00
ReqType := 9;
FileErase (Config.DataPath + 'userchat.' + strI2S(ToNode));
FileErase (Config.DataPath + 'userchat.' + strI2S(Session.NodeNum));
2012-03-10 00:58:11 -08:00
Session.io.PromptInfo[1] := TempChat.Name;
Session.io.PromptInfo[2] := strI2S(ToNode);
2012-03-10 00:58:11 -08:00
Session.io.OutFull(Session.GetPrompt(482));
2012-03-08 13:39:52 -08:00
Send_Node_Message (ReqType, strI2S(ToNode) + ';' + strI2S(Session.io.Graphics), 0);
2012-03-08 13:39:52 -08:00
End;
Procedure OpenUserChat (Split, Forced: Boolean; ToNode: Byte);
2012-03-10 00:58:11 -08:00
Var
fOut : File;
fIn : File;
Ch : Char;
Str1 : String = '';
Str2 : String = '';
InRemote : Byte;
2012-03-17 11:11:50 -07:00
Procedure SplitChat;
Begin
End;
Procedure LineChat;
Begin
Session.io.BufFlush;
2012-03-10 00:58:11 -08:00
Repeat
If Not Eof(fIn) Then Begin
BlockRead (fIn, Ch, 1);
2012-03-10 00:58:11 -08:00
If Ch = #255 Then Break;
2012-03-10 00:58:11 -08:00
InRemote := 1;
2012-03-10 00:58:11 -08:00
2012-06-30 17:23:39 -07:00
Session.io.AnsiColor (Session.Theme.LineChat1);
End Else Begin
Ch := Session.io.InKey(200);
2012-03-10 00:58:11 -08:00
If Ch = #255 Then Continue;
2012-03-10 00:58:11 -08:00
2012-06-30 17:23:39 -07:00
Session.io.AnsiColor (Session.Theme.LineChat2);
2012-03-10 00:58:11 -08:00
BlockWrite (fOut, Ch, 1);
InRemote := 0;
End;
Case Ch of
#08 : If Length(Str1) > 0 Then Begin
Session.io.OutBS(1, True);
Dec (Str1[0]);
End;
#10 : ;
#13 : Begin
Str1 := '';
Session.io.OutRawLn('');
End;
#27 : If Not Forced And (InRemote = 0) Then Begin
Ch := #255;
BlockWrite(fOut, Ch, 1);
Break;
End;
Else
Str1 := Str1 + Ch;
If Length(Str1) > 79 Then Begin
strWrap(Str1, Str2, 79);
Session.io.OutBS(Length(Str2), True);
Session.io.OutRawLn('');
Str1 := Str2;
Session.io.OutRaw(Str1);
End Else
Session.io.OutRaw(Ch);
2012-03-10 00:58:11 -08:00
End;
Session.io.BufFlush;
Until False;
End;
Begin
Session.io.OutFullLn(Session.GetPrompt(483));
Assign (fOut, Config.DataPath + 'userchat.' + strI2S(ToNode));
Assign (fIn, Config.DataPath + 'userchat.' + strI2S(Session.NodeNum));
FileMode := 66;
ReWrite (fOut, 1);
ReWrite (fIn, 1);
Case Split of
False : LineChat;
True : LineChat;
2012-03-10 00:58:11 -08:00
End;
Close(fOut);
Close(fIn);
Erase(fOut);
Erase(fIn);
Session.io.OutFullLn(Session.GetPrompt(484));
2012-03-08 13:39:52 -08:00
End;
2012-06-30 17:23:39 -07:00
End.