User to user private chat (line mode) completed

This commit is contained in:
mysticbbs 2012-03-14 02:22:38 -04:00
parent 645be03667
commit b7579bd5a7
1 changed files with 81 additions and 60 deletions

View File

@ -5,7 +5,7 @@ Unit bbs_UserChat;
Interface Interface
Procedure PageUserForChat; Procedure PageUserForChat;
Procedure OpenUserChat (Forced: Boolean; ToNode: Byte); Procedure OpenUserChat (Split, Forced: Boolean; ToNode: Byte);
Implementation Implementation
@ -25,7 +25,7 @@ Var
TempChat : ChatRec; TempChat : ChatRec;
Begin Begin
Repeat Repeat
Session.io.OutFull ('|CR|09Enter node to chat with |01[|10?|01/|10List|01]|09: '); Session.io.OutFull (Session.GetPrompt(479));
Str := Session.io.GetInput(3, 3, 12, ''); Str := Session.io.GetInput(3, 3, 12, '');
@ -37,34 +37,96 @@ Begin
If (Not GetChatRecord(ToNode, TempChat)) or (ToNode = Session.NodeNum) or If (Not GetChatRecord(ToNode, TempChat)) or (ToNode = Session.NodeNum) or
(Not TempChat.Active) or (Not TempChat.Available) Then Begin (Not TempChat.Active) or (Not TempChat.Available) Then Begin
Session.io.OutFull('|CR|15That user is marked unavailable.|CR|CR|PA'); Session.io.OutFull(Session.GetPrompt(480));
Exit; Exit;
End; End;
If Session.User.Access(Config.ACSSysop) Then If Session.User.Access(Config.ACSSysop) Then
If Session.io.GetYN('|CR|12Force user into chat? ', False) Then If Session.io.GetYN(Session.GetPrompt(481), False) Then
ReqType := 9; ReqType := 9;
FileErase (Config.DataPath + 'userchat.' + strI2S(ToNode)); FileErase (Config.DataPath + 'userchat.' + strI2S(ToNode));
FileErase (Config.DataPath + 'userchat.' + strI2S(Session.NodeNum)); FileErase (Config.DataPath + 'userchat.' + strI2S(Session.NodeNum));
Session.io.PromptInfo[1] := TempChat.Name; Session.io.PromptInfo[1] := TempChat.Name;
Session.io.PromptInfo[2] := strI2S(ToNode);
Session.io.OutFull('|CR|15Sending chat request to |&1...|DE|DE|CR'); Session.io.OutFull(Session.GetPrompt(482));
Send_Node_Message (ReqType, strI2S(ToNode) + ';C' + Str, 0); Send_Node_Message (ReqType, strI2S(ToNode) + ';' + strI2S(Session.io.Graphics), 0);
End; End;
Procedure OpenUserChat (Forced: Boolean; ToNode: Byte); Procedure OpenUserChat (Split, Forced: Boolean; ToNode: Byte);
Var Var
fOut : File; fOut : File;
fIn : File; fIn : File;
Ch : Char; Ch : Char;
Str1 : String = ''; Str1 : String = '';
Str2 : String = ''; Str2 : String = '';
Done : Boolean = False; InRemote : Byte;
Procedure LineChat;
Begin Begin
Session.io.OutFullLn('|CR|15Chat mode begin.|CR'); Session.io.BufFlush;
Repeat
If Not Eof(fIn) Then Begin
BlockRead (fIn, Ch, 1);
If Ch = #255 Then Break;
InRemote := 1;
Session.io.AnsiColor (Session.Lang.LineChat1);
End Else Begin
Ch := Session.io.InKey(200);
If Ch = #255 Then Continue;
Session.io.AnsiColor (Session.Lang.LineChat2);
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);
End;
Session.io.BufFlush;
Until False;
End;
Begin
Session.io.OutFullLn(Session.GetPrompt(483));
Assign (fOut, Config.DataPath + 'userchat.' + strI2S(ToNode)); Assign (fOut, Config.DataPath + 'userchat.' + strI2S(ToNode));
Assign (fIn, Config.DataPath + 'userchat.' + strI2S(Session.NodeNum)); Assign (fIn, Config.DataPath + 'userchat.' + strI2S(Session.NodeNum));
@ -74,50 +136,9 @@ Begin
ReWrite (fOut, 1); ReWrite (fOut, 1);
ReWrite (fIn, 1); ReWrite (fIn, 1);
While Not Done Do Begin Case Split of
If Not Eof(fIn) Then False : LineChat;
While Not Eof(fIn) Do Begin True : LineChat;
BlockRead (fIn, Ch, 1);
If Ch = #255 Then Begin
Done := True;
Break;
End;
Session.io.AnsiColor (Session.Lang.LineChat2);
Session.io.BufAddChar (Ch);
End;
Session.io.BufFlush;
If Done Then Break;
Ch := Session.io.InKey(25);
Case Ch of
#08 : If Screen.CursorX > 1 Then Begin
Str2 := #8#32#8;
BlockWrite (fOut, Str2[1], 3);
Session.io.OutBS(1, True);
End;
#13 : Begin
Str2 := #13#10;
BlockWrite (fOut, Str2[1], 2);
Session.io.OutRawLn('');
End;
#27 : If Not Forced Then Begin
Ch := #255;
BlockWrite (fOut, Ch, 1);
Break;
End;
Else
If Ch in [#32..#254] Then Begin
BlockWrite (fOut, Ch, 1);
Session.io.AnsiColor (Session.Lang.LineChat1);
Session.io.BufAddChar (Ch);
End;
End;
End; End;
Close(fOut); Close(fOut);
@ -126,7 +147,7 @@ Begin
Erase(fOut); Erase(fOut);
Erase(fIn); Erase(fIn);
Session.io.OutFullLn('|CR|CR|15Chat mode complete.|DE|DE|DE'); Session.io.OutFullLn(Session.GetPrompt(484));
End; End;
End. End.