-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCHATSTUF.PAS
1269 lines (1212 loc) · 33.7 KB
/
CHATSTUF.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{$I DIRECT.INC}
unit chatstuf;
interface
uses Dos,Crt,Video,MkAvatar,gensubs,statret,subsovr,subs2, MainR2,
gentypes,subs1,userret,modem,windows,configrt, FileLock;
Procedure GotoDos;
Procedure SysOpCommands;
procedure Configchat (use:integer);
procedure OneLineChat;
implementation
Var U : Userrec;
procedure gotodos;
var tmp1:integer;
st:mstr;
S:Screens;
begin
SendCr('');
MultiColor(Strng^.SysopInDos+^M);
Window(1,1,80,25);
GotoXY(1,25);
ClrEol;
Tmp1:=TimeLeft;
ReadScr(S);
UpdateUserStats (false);
TextAttr:=1;
Write('[');
TextColor(11);
Write(' PiPELiNE Quick Shell ');
TextColor(1);
Write('] þ [');
TextColor(11);
Write('Type "EXIT" to Return to PiPELiNE');
TextColor(1);
WriteLn(']');
ExecuteWithSwap('','',False);
InstallFossil;
SetParam;
St := Cfg.PiPELiNEdir;
Dec(St[0]);
ChDir(St);
WriteScr(S);
SetTimeLeft(Tmp1);
SetUpBottom;
BottomLine;
Textbackground(0);
ChainStr := #13;
end;
Procedure SysOpCommands;
VAR InChat:Boolean;
procedure snoopmode;
begin
TextAttr:=31;
GotoXy(35,17);
Write('All I/O to the modem is locked.');
modeminlock:=true;
setoutlock (true)
end;
procedure unsnoop;
begin
TextAttr:=31;
GotoXy(35,17);
Write('I/O to the modem is re-enabled.');
modeminlock:=false;
setoutlock (false)
end;
{$I SCREENS.INC}
Procedure ClearBox;
Var X : Byte;
Begin
TextAttr:=31;
For X:= 7 to 17 Do Begin
Gotoxy(35,x);
Write(' ');
End;
End;
Function LookUpUser (Var UName : MStr) : Integer;
Var Cnt,
S : Integer;
WildCarding : Boolean;
K : Char;
U : UserRec;
Begin
LookUpUser := 0;
If Length(UName) = 0 Then Exit;
If UName[1] = '/' Then Exit;
If UName[1] = '#' Then Delete(UName,1,1);
WildCarding := UName[Length(UName)] = '*';
If WildCarding Then Dec(UName[0]);
Val(UName, Cnt, S);
If (S = 0) AND (Cnt > 0) AND (Cnt <= NumUsers) Then
Begin
Seek(UFile, Cnt);
NRead(UFile, U);
If Length(U.Handle) > 0 Then
Begin
LookUpUser := Cnt;
UName := U.Handle;
End;
Exit;
End;
Seek(UFile, 1);
For Cnt := 1 to NumUsers Do
Begin
NRead(UFile, U);
If WildCarding Then
If Match(Copy(U.Handle,1,Length(UName)), UName) Then
Begin
GotoXy(35,13);
textattr:=30;
Write(' ');
GotoXy(35,13);
TextAttr:=30;
Write(U.Handle,' [Y/N/X]: ');
repeat
K := UpCase(BiosKey);
until hungupon or (k in ['Y','N','X']);
Write(k);
case upcase(k) of
'Y':begin
lookupuser:=cnt;
uname:=U.Handle;
exit;
end;
'X':exit
end
end
else
else if match (U.Handle,uname)
then
begin
lookupuser:=cnt;
uname:=U.Handle;
exit
end
end
end;
Procedure ChooseUser;
Var A:Byte;
S:Integer;
Done:Boolean;
Name:Mstr;
Begin
Done:=False;
ClearBox;
GotoXy(35,8);
TextAttr:=27;
Write('Enter User Name/Number to Edit [L]ist');
GotoXy(35,9);
Write('Use ''*'' at end of string to Wildcard');
GotoXy(35,10);
Write('You a have a total of '+strr(numusers)+' Users');
GotoXy(35,12);
TextAttr:=31;
Write(' ');
TextAttr:=31;
GotoXy(35,12);
Write('User Name/# : ');
ReadLine(Name);
If Name>'' then Begin
A:=lookupuser(name);
If (A=0) and (Upcase(Name[1])='L') Then Exec(GetEnv('COMSPEC'),'/C UE.EXE') Else
IF A>0 then
Exec(GetEnv('COMSPEC'),'/C UE.EXE '+Strr(A));
End;
End;
Procedure PrintF;
Var Done:Boolean;
P:lstr;
T:Text;
K:Char;
Show:Boolean;
Begin
Done:=False;
Show:=False;
ClearBox;
GotoXy(35,8);
TextAttr:=31;
Write('Print File Procedure');
GotoXy(35,10);
Write('Enter Full Path and Filename To Print');
TextAttr:=30;
GotoXy(35,12);
Write('Print: ');
Readline(p);
If Not (p>'') then exit;
If Not (hungupon) or (local) then Begin
GotoXy(35,14);
Write('Show File to User Online? ');
Readline(K);
If Upcase(K)='Y' then Show:=True;
End;
If Exist(P) then Begin
Assign(T,P);
Reset(T);
Unsplit;
ClrScr;
While not (Eof(T)) or (done) Do Begin
Read(T,k);
If (break) or (xpressed) or (Keyhit) then done:=true;
if show then SendFull(k) else Writecon(k);
End;
If show then SendFull('Press <Enter> :') else
Write('Press <Enter> :');
Readline(P);
exit;
End Else Begin
GotoXy(35,12);
Write('File Not Found!');
GotoXy(35,13);
Write('Press <Enter> :');
Readline(p);
End;
TextClose(T);
End;
Procedure Execute;
var f:lstr;
Begin
ClearBox;
GotoXy(35,8);
TextAttr:=27;
Write('Execute File Procedure');
GotoXy(35,10);
Write('Enter Full Path and Filename to Run');
GotoXy(35,12);
Write('>');
Readline(F);
If not (F>'') then exit;
If exist(F) then Begin
Exec(GetEnv('COMSPEC'),'/C '+F);
ReadCfg(False);
ReadStrings;
End Else
Begin
GotoXy(35,13);
Write('Cannot find File! Press <Enter> :');
Readline(f);
End;
End;
Procedure SendToModem;
Var Q:lstr;
Begin
clearBox;
GotoXy(35,9);
TextAttr:=30;
Write('Enter Text to Send to Modem');
GotoXy(35,10);
Write('<CR> Exits Procedure');
GotoXy(35,11);
Write('>');
Readline(Q);
If Q[length(Q)]<>'|' then Q:=Q+'|';
SendString(Q);
End;
procedure hangupyn;
var q:sstr;
mes:mstr;
begin
ClearBox;
GotoXy(35,8);
TextAttr:=27;
Write('Hang up on '+unam+' (Y/N)? ');
readline (q);
if length(q)>0 then if upcase(q[1])='Y' then
begin
GotoXy(35,9);
TextAttr:=31;
Write('Enter Text to explain disconnection');
gotoXy(35,10);
Write('<CR> = Sorry, The System is going down!');
GotoXy(35,11); Write('>');
Readline(mes);
Unsplit;
If mes>'' then SendCr(^G+mes+^M^M) Else
SendCr(^G'Sorry, The System is going down!'^M^M);
FullDisconnect;
end
end;
CONST Name:Array [1..10] Of String[30] =
(' User Editor ',' Load Another User ',' Shell to DOS ',' Print a File ',
' Execute a File ',' Send Modem String ',' Snoop Mode On ',' Snoop Mode Off ',
' Hang Up on User ',' Engage Chat ');
BarColor=113;
NormColor=31;
X=8;
Procedure Start_Up;
VAR I:Byte;
Finished:Boolean;
Procedure PlaceBar(X,Y:Byte; Hi:Boolean);
BEGIN
If Hi then Textattr:=barcolor Else Textattr:=normcolor;
GotoXY(X,Y+7);
Write(Name[i]);
END;
Procedure ChatMenu;
CONST ChatStr:Array[1..5] of String[25]=
(' Chat Screen #1 ',
' Chat Screen #2 ',
' OneLine Chat ',
' Pick Chat Screen ',
' Exit Chat Menu ');
VAR I:Byte; Done:Boolean;
Procedure ChatBar(Hi:Boolean);
Begin
If Hi then TextAttr:=79 Else TextAttr:=NormColor;
Gotoxy(42,I+10);
Write(ChatStr[i]);
End;
VAR ChatNum : SStr;
Begin
ClearBox;
GotoXy(34,8);
Done:=False;
TextAttr:=30;
Write('PiPELiNE Chat [^Z] Toggles Crazy Colors');
TextAttr:=NormColor;
For i:=1 to 5 Do Begin
GotoXy(42,10+i);
Write(ChatStr[i]);
End;
i:=1;
ChatBar(True);
REPEAT
CASE BiosKey Of
#200:Begin
ChatBar(false);
dec(i);
IF i<=0 Then i:=5;
ChatBar(true);
End;
#208:Begin {DOWN}
ChatBar(False);
inc(i);
IF i>=6 Then i:=1;
ChatBar(true);
End;
#13: Begin
IF I in [1..3] Then Begin
UnSplit;
Done:=True;
Finished:=True;
InChat:=True;
END;
CASE I OF
1:ConfigChat(1);
2:ConfigChat(2);
3:OneLineChat;
4:Begin
GotoXy(42,17);
ChatNum[0]:=#0;
TextAttr:=NormColor;
Write('Chat Screen (1-999): ');
Readline(ChatNum);
If Valu(ChatNum)>0 Then Begin
UnSplit;
Done:=True;
Finished:=True;
InChat:=True;
TextAttr:=1;
ClrScr;
ConfigChat(Valu(ChatNum));
End Else Begin
GotoXy(42,16);
Write(' ');
End;
End;
5:Done:=True;
END;
END;
END;
UNTIL (DONE) or (HUNGUPON);
END;
Procedure DrawMenu;
Var p:byte;
Begin
DrawSysopMenu;
PlaceBar(x,i,True);
TextAttr:=30;
Gotoxy(41,7); Write(timestr(now));
Gotoxy(66,7); Write(datestr(now));
Gotoxy(48,9); Write(unam);
gotoxy(41,10);Write(urec.sysopnote);
gotoxy(46,11);If local then Write('Local Login') Else Write(connectstr);
gotoxy(46,12);Write(urec.realname);
Gotoxy(49,13); For p:=1 to 10 Do Begin
If (p=4) or (p=7) Then Write('-');
Write(urec.phonenum[p]);
End;
gotoxy(48,14); Write(urec.numon);
Gotoxy(46,15); Write(RegBBS);
Gotoxy(53,16); Write(RegSysop);
End;
BEGIN
I:=1;
Finished:=False;
InChat:=False;
DrawMenu;
REPEAT
CASE BiosKey OF
#200:Begin {UP}
PlaceBar(x,i,false);
dec(i);
IF i<=0 Then i:=10;
PlaceBar(x,i,true);
End;
#208:Begin {DOWN}
PlaceBar(x,i,False);
inc(i);
IF i>=11 Then i:=1;
PlaceBar(x,i,true);
End;
#13: Begin
CASE I OF
1:Begin Exec(GetEnv('COMSPEC'),'/C UE.EXE '+Strr(Unum));
DrawMenu; readurec; End;
2:Begin ChooseUser; DrawMenu; End;
3:Begin GotoDos; ClrScr; Bottomline; DrawMenu; End;
4:Begin PrintF; ClrScr; DrawMenu; End;
5:Begin Execute; ClrScr; DrawMenu; End;
6:Begin SendtoModem; ClrScr; DrawMenu End;
7:Snoopmode;
8:Unsnoop;
9:Begin hangupyn; DrawMenu; End;
10:Begin ChatMenu; If Not Finished then DrawMenu; End;
End;
End;
#27:Finished:=True;
End;
UNTIL Finished;
END;
VAR StartTime:Integer;
S:Screens;
XX,YY:Byte;
Begin
SendCr('');
MultiColor(Strng^.SysopWorkingStr);
XX := WhereX;
YY := WhereY;
ReadScr(S);
StartTime:=TimeLeft;
Start_Up;
UnSplit;
If Not InChat Then Begin
TextAttr:=1;
ClrScr;
WriteScr(S);
GotoXy(XX,YY);
SetUpBottom;
Bottomline;
SetTimeLeft(StartTime);
End;
ChainStr := #13;
End;
Procedure Goxy(x,y:byte);
Begin
If (WhereX = X) and (WhereY = Y)
Then Exit;
If Avatar In Urec.Config Then Begin
If Online Then SendChar(^V);
Parse_Avt1(^V);
If Online Then SendChar(^H);
Parse_Avt1(^H);
If Online Then SendChar(Chr(Y));
Parse_Avt1(Chr(Y));
If Online Then SendChar(Chr(X));
Parse_Avt1(Chr(X));
Exit;
End;
SendStr(#27'[');
If Y <> 1
Then SendStr(strr(y));
If X <> 1
Then SendStr(';'+Strr(x));
SendStr('H');
End;
Procedure ConfigChat(Use:Integer);
Type XyRec = Array[1..2] Of Byte;
ChatRec=Record
US,UF,SS,SF : Array[1..30] of XyRec;
UserEOF,SysEOF : Boolean;
SysName,UName,Time,Date,Elapsed:XyRec;
End;
Var C : ChatRec;
StartTime : Integer;
Col : Array[1..8] of Byte;
XSys, YSys, XUsr, YUsr,
CurColor, SysLine, UseLine,
SysTotal, UseTotal,
SysOpColor, UserColor,
StatColor : Byte;
SysOp1, User1 : Lstr;
SysClr, UseClr : Array[1..30] of Byte;
Ok, FromKbd, Color : Boolean;
Procedure ShowThing(Id:Byte; W:XyRec);
Begin
If (W[1]<=0) or (W[2]<=0) Then Exit;
GoXy(W[1],W[2]);
AnsiColor(StatColor);
Case Id Of
1:SendStr(RegSysop);
2:SendStr(Urec.Handle);
3:SendStr(TimeStr(Now));
4:SendStr(DateStr(Now));
5:SendStr(Strr(Timer-StartTime));
End;
End;
Function LoadScreenOk : Boolean;
Label SysOpLine,UserLine;
Var F:Text;
L:String;
V:Byte;
Procedure FixXy(Str:String; VAR XY:XyRec);
Var T1,T2:Sstr;
P:Byte;
Begin
P:=Length(Str)+1;
t1:=Copy(L,P,2);
P:=P+3;
If T1[2]=',' Then Begin
T1[0]:=Chr(1);
Dec(P);
End;
t2:=Copy(L,P,2);
Xy[1]:=Valu(t1);
Xy[2]:=Valu(t2);
{ SendCr('XY Valu for String ',str,' ',Xy[1],',',Xy[2]); }
End;
Procedure GetCol(Str:String; VAR T:Byte);
Var P:Byte;
Temp:Sstr;
Begin
P:=Pos(Str,L)+Length(Str);
Temp:=Copy(L,P,3);
While Not (Temp[Length(Temp)] in ['0'..'9']) Do
Temp[0]:=Pred(Temp[0]);
T:=Valu(Temp);
{ SendCr('Color for String ',str,' ',t); }
End;
Procedure DoXyLocation(SysOp:Boolean);
Var P,Line,x,r:Byte;
Temp:Sstr;
T1,T2:XyRec;
Begin
Temp:=L[1];
If L[2] in ['0'..'9'] Then Temp:=Temp+L[2];
Line:=Valu(Temp);
Temp[0]:=#0;
r:=1;
t2[2]:=0;
For X:=Length(Strr(Line))+1 To Length(L) Do Begin
If ((L[X]=',') or (L[X]=#32)) And (Temp<>'') Then Begin
Case R Of
1:t1[1]:=Valu(Temp);
2:t1[2]:=Valu(Temp);
3:t2[1]:=Valu(Temp);
4:t2[2]:=Valu(Temp);
End;
Temp[0]:=#0;
Inc(r);
End;
If L[X] in ['0'..'9'] Then Temp:=Temp+L[X];
End;
If t2[2]=0 Then t2[2]:=Valu(temp);
If SysOp Then Begin
C.Ss[Line]:=t1;
C.Sf[Line]:=t2;
Inc(SysTotal);
End Else Begin
C.Us[Line]:=t1;
C.Uf[Line]:=t2;
Inc(UseTotal);
End;
End;
Var K:Char;
Begin
UpdateNode('Chatting with '+RegSysop+'.','');
LoadScreenOk:=True;
FillChar(SysClr,SizeOf(SysClr),0);
FillChar(UseClr,SizeOf(UseClr),0);
C.UserEof:=False;
C.SysEof:=False;
Color:=False;
Col[1]:=0;
Assign(F,Cfg.textfiledir+'CHATNFO.'+Strr(Use));
Reset(F);
If IoResult<>0 Then Begin
Close(F);
WriteLn('');
WriteLn('SysOp: Unable to open CHATNFO.'+Strr(Use)+'.');
WriteLn(' This is required for a Chat Screen!');
LoadScreenOk:=False;
Exit;
End;
SysTotal:=0;
UseTotal:=0;
StatColor:=1;
SysOpColor:=1;
UserColor:=1;
FillChar(C,SizeOf(C),0);
While Not(Eof(F)) Do Begin
Readln(F,L);
L:=UpString(L);
If Pos('TIME=',L)>0 Then FixXy('TIME=',C.Time) Else
If Pos('DATE=',L)>0 Then FixXy('DATE=',C.Date) Else
If Pos('ELAPSED=',L)>0 Then FixXy('ELAPSED=',C.Elapsed) Else
If Pos('SYSOPNAME=',L)>0 Then FixXy('SYSOPNAME=',C.SysName) Else
If Pos('USERNAME=',L)>0 Then FixXy('USERNAME=',C.Uname) Else
If Pos('STATCOLOR=',L)>0 Then GetCol('STATCOLOR=',StatColor) Else
If Pos('SYSOPCOLOR=',L)>0 Then GetCol('SYSOPCOLOR=',SysOpColor) Else
If Pos('USERCOLOR=',L)>0 Then GetCol('USERCOLOR=',UserColor) Else
If Pos('USER_CLEAR_LINE',L)>0 Then C.UserEof:=True Else
If Pos('SYSOP_CLEAR_LINE',L)>0 Then C.SysEof:=True Else
If Pos('SYSOPLINES',L)>0 Then Begin
Repeat
SysOpLine:
Readln(f,l);
If Pos('USERLINES',L)>0 Then Goto UserLine
Else DoXyLocation(True);
Until Eof(F);
End Else If Pos('USERLINES',L)>0 Then Begin
Repeat
UserLine:
Readln(F,L);
If Pos('SYSOPLINES',L)>0 Then Goto SysOpLine Else
DoXyLocation(False);
Until Eof(F);
End;
End;
TextClose(F);
Assign(F,Cfg.TextFileDir+'CHAT.'+Strr(Use));
Reset(F);
If IoResult<>0 Then Begin
TextClose(F);
WriteLn('');
WriteLn('SysOp: You need a screen called CHAT.'+Strr(Use));
LoadScreenOk:=False;
Exit;
End;
ModemInLock:=True;
While Not Eof(F) Do Begin
Read(F,K);
If K='|' Then Begin
Read(F,K);
If Upcase(K)='U' Then SendStr(Urec.Handle) Else
If Upcase(K)='S' Then SendStr(RegSysop) Else
SendFull('|'+K);
End Else SendFull(K);
End;
TextClose(F);
UseTotal:=0;
For V := 1 to 30
Do If C.Us[V][1] > 0 Then Inc(UseTotal);
ShowThing(1,C.SysName);
ShowThing(2,C.UName);
ShowThing(3,C.Time);
ShowThing(4,C.Date);
ShowThing(5,C.Elapsed);
ModemInLock:=False;
End;
Procedure DoSomeChatting;
Label Exit;
Var K:Char;
Done:Boolean;
Procedure AlternateColors;
Var X,Temp:Byte;
Begin
If Col[1]=0 Then
For X:=1 to 8 Do Col[X]:=Cfg.CC[X];
Temp:=Col[1];
For X:=2 to 8 Do Col[X-1]:=Col[X];
Col[8]:=Temp;
AnsiColor(Col[1]);
End;
Procedure ClrSysOpChat;
Var X,Y:Byte;
Begin
ShowThing(3,C.Time);
ShowThing(4,C.Date);
AnsiColor(SysOpColor);
For X:=SysTotal DownTo 2 Do Begin
GoXy(C.Ss[X][1],C.Ss[X][2]);
If C.SysEof Then SendStr(#27+'[K') Else
For Y:=1 to SysClr[X] Do SendStr(#32);
End;
GoXy(C.Ss[1][1],C.Ss[1][2]);
If Length(SysOp1)>0 Then Begin
SendStr(SysOp1);
If C.SysEof Then SendStr(#27+'[K') Else
For Y:=Length(SysOp1) To SysClr[1] Do SendStr(#32);
Sysline:=2;
XSys:=C.Ss[2][1];
YSys:=C.ss[2][2];
FillChar(SysClr,SizeOf(SysClr),0);
SysClr[1]:=Length(SysOp1);
End Else Begin
If C.SysEof Then SendStr(#27+'[K') Else
For Y:=1 to SysClr[1] Do SendStr(#32);
SysLine:=1;
XSys:=C.Ss[1][1];
YSys:=C.Ss[1][2];
FillChar(SysClr,SizeOf(SysClr),0);
End;
End;
Procedure ClrUserChat;
Var X,Y:Byte;
Begin
AnsiColor(UserColor);
For X:=UseTotal DownTo 2 Do Begin
GoXy(C.Us[X][1],C.Us[X][2]);
If C.UserEof Then SendStr(#27+'[K') Else
For Y:=1 to UseClr[X] Do SendStr(#32);
End;
GoXy(C.Us[1][1],C.Us[1][2]);
If Length(User1)>0 Then Begin
SendStr(User1);
If C.UserEof Then SendStr(#27+'[K') Else
For Y:=Length(User1) To UseClr[1] Do SendStr(#32);
Useline:=2;
XUsr:=C.Us[2][1];
YUsr:=C.Us[2][2];
FillChar(UseClr,SizeOf(UseClr),0);
UseClr[1]:=Length(User1);
End Else Begin
If C.UserEof Then SendStr(#27+'[K') Else
For Y:=1 to UseClr[1] Do SendStr(#32);
UseLine:=1;
XUsr:=C.Us[1][1];
YUsr:=C.Us[1][2];
FillChar(UseClr,SizeOf(UseClr),0);
End;
End;
Procedure SysOpWordWrap;
Label Done;
Var Temp,S:Lstr;
Cut,X:Byte;
Begin
Cut:=0;
AnsiColor(SysOpColor);
For X:=Length(SysOp1) DownTo 1 Do Begin
If SysOp1[X] in [#32,'-'] Then Begin
Cut:=X+1;
Goto Done;
End;
End;
Done:
If Sysline >= SysTotal
Then Begin
ClrSysOpChat;
Sysline:=1;
XSys:=C.Ss[1][1]+Cut;
YSys:=C.Ss[1][2];
End;
If Cut>0 Then Begin
S:=Copy(SysOp1,Cut,79);
GoXy(XSys-Length(S)-1,YSys);
For Cut:=WhereX to C.Sf[Sysline][1]
Do SendStr(#32);
SysOp1:=S;
Inc(Sysline);
XSys:=C.Ss[SysLine][1];
YSys:=C.Ss[SysLine][2];
GoXy(Xsys,YSys);
If Color Then
For X:=1 to Length(S) Do Begin
AlternateColors;
SendStr(S[X]);
End
Else
SendStr(S);
XSys:=Xsys+Length(S)+1;
SysClr[Sysline]:=Length(S);
End Else Begin
Inc(SysLine);
XSys:=C.Ss[Sysline][1];
YSys:=C.Ss[Sysline][2];
GoXy(XSys,YSys);
SysOp1[0]:=#0;
End;
End;
Procedure UserWordWrap;
Label UserDone;
Var Temp,S:Lstr;
Cut,X:Byte;
Begin
Cut:=0;
AnsiColor(UserColor);
For X:=Length(User1) DownTo 1 Do Begin
If User1[X] in [#32,'-'] Then Begin
Cut := X+1;
Goto UserDone;
End;
End;
UserDone:
If Useline>=UseTotal Then Begin
ClrUserChat;
Useline:=1;
XUsr:=C.Us[1][1]+Cut;
YUsr:=C.Us[1][2];
End;
If Cut>0 Then Begin
S:=Copy(User1,Cut,79);
GoXy(XUsr-Length(S)-1,YUsr);
For Cut:=WhereX to C.Uf[UseLine][1]
Do SendStr(#32);
User1:=S;
Inc(Useline);
XUsr:=C.Us[UseLine][1];
YUsr:=C.Us[UseLine][2];
GoXy(XUsr,YUsr);
If Color Then
For X:=1 to Length(S) Do Begin
AlternateColors;
SendStr(S[X]);
End
Else
SendStr(S);
XUsr:=XUsr+Length(S)+1;
UseClr[Useline]:=Length(S);
End Else Begin
Inc(UseLine);
XUsr:=C.Us[Useline][1];
YUsr:=C.Us[Useline][2];
GoXy(XUsr,YUsr);
User1[0]:=#0;
End;
End;
Procedure CheckChars;
Begin
If FromKbd Then Begin
If C.Ss[SysLine][1] + Length(SysOp1) > C.Sf[SysLine][1]
Then SysOpWordWrap;
End Else Begin
If C.Us[UseLine][1]+Length(User1) > C.Uf[Useline][1]
Then UserWordWrap;
End;
End;
Procedure TypeChar(K:Char; SysOp:Boolean);
Begin
If FromKbd Then Begin
GoXy(XSys,YSys);
Inc(Xsys);
CheckChars;
Inc(SysClr[SysLine]);
If Color Then AlternateColors Else
AnsiColor(SysOpColor);
SendStr(K);
SysOp1:=SysOp1+K;
End Else Begin
GoXy(XUsr,YUsr);
Inc(XUsr);
CheckChars;
Inc(UseClr[UseLine]);
If Color Then AlternateColors Else
AnsiColor(UserColor);
SendStr(K);
User1:=User1+K;
End;
End;
Var X : Byte;
Begin
Done := False;
If Carrier = False Then Begin
GoXy(C.Us[1][1],C.Us[1][2]);
AnsiColor(UserColor);
SendFull('No Carrier Detected!');
End;
GoXy(C.Ss[1][1],C.Ss[1][2]);
XSys := C.Ss[1][1];
YSys := C.Ss[1][2];
XUsr := C.Us[1][1];
YUsr := C.Us[1][2];
SysLine := 1;
UseLine := 1;
SysOp1[0] := #0;
User1[0] := #0;
AnsiColor(SysOpColor);
Repeat
If HungUpOn Then Begin
GoXy(C.Us[1][1],C.Us[1][2]);
AnsiColor(UserColor);
SendFull(^G^G'Carrier has been lost...');
End;
Repeat Until (KeyHit) or (Carrier and (Numchars));
Fromkbd := KeyHit;
If FromKbd
Then K := BiosKey
Else K := GetChar;
if (ord(k)>127) And (FromKBD)
Then if ((ord(k) - 128) in [59,60,61,62])
Then Done := True;
if (ord(k)>127) then Begin
if ((ord(k)-128)=59) And (FromKbd) then begin
SysOpCommands;
Done := true;
end;
End;
If Done
Then Goto Exit;
If K = #127
Then K := #8;
Case Ord(K) Of
27:If FromKbd
Then Done:=True;
{BackSpace} 8:Begin
If FromKbd Then Begin
If Xsys>C.Ss[SysLine][1]
Then Begin
GoXy(Xsys,YSys);
SendStr(^H+' '+^H);
SysOp1[0]:=Pred(SysOp1[0]);
Dec(Xsys);
Dec(SysClr[Sysline]);
End;
End Else Begin
If XUsr>C.Us[UseLine][1]
Then Begin
GoXy(XUsr,YUsr);
SendStr(^H+' '+^H);
User1[0]:=Pred(User1[0]);
Dec(XUsr);
Dec(UseClr[Useline]);
End
End
End;
{Tab} 9:If FromKbd Then Begin
GoXy(XSys,YSys);
If WhereX+5<C.Sf[Sysline][1]
Then Begin
AnsiColor(SysOpColor);
SysOp1:=SysOp1+' ';
SendStr(' ');
XSys:=XSys+5;
SysClr[Sysline]:=SysClr[Sysline]+5;
End;
End Else Begin
GoXy(XUsr,YUsr);
If WhereX+5<C.Uf[UseLine][1]
Then Begin
AnsiColor(UserColor);
User1:=User1+' ';
SendStr(' ');
XUsr:=XUsr+5;
UseClr[UseLine]:=UseClr[UseLine]+5;
End
End;
{BEEP!} 7:SendFull(^G);
{Colors??} 26 : Color := Not Color;
{Letters} 32..255 : TypeChar(K,FromKbd);
{Ctrl-X} 24:If FromKbd Then Begin
AnsiColor(SysOpColor);
GoXy(XSys,YSys);
For X:=Length(SysOp1) DownTo 1