WAITCALL.PAS

34.5 KB 7d01af84654687e4…
{$I DIRECT.INC}
Unit WaitCall;

Interface

Uses Dos, Crt, Windows, DosMem, GenTypes, StatRet, ConfigRt, Modem,
     GenSubs, Subs1, SubsOvr, Subs2, MailRet, UserRet, OverRet1, FileLock,
     MainR2, FeedBack, Group, Email, MainMenu, MyComman,skashit,little,
     control, config, extense;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
const
 matrixY : array[1..3,1..6] of string[50] = (
 ('|11 f1   local logon        ',
  '|11 f2   shutdown           ',
  '|11 f3   init modem         ',
  '|11 f4   load terminal      ',
  '|11 f5   system shell       ',
  '|11 f6   lock keyboard      '),
 {------------------------------------}
 ('|11 f1   configuration      ',
  '|11 f2   menu editor        ',
  '|11 f3   themes editor      ',
  '|11 f4   protocol editor    ',
  '|11 f5   user editor        ',
  '|11 f6   file conferences   '),
 {------------------------------------}
 ('|11 f1   message conferences',
  '|11 f2   cycle stat screen  ',
  '|11 f3   make user          ',
  '|11 f4   sysop email        ',
  '|11 f5   sysop feedback     ',
  '|11 f6   infusion nfo       '));
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
 matrixX : array[1..3,1..6] of string[50] = (
 ('|03 f1 |08- |07local logon        ',
  '|03 f2 |08- |07shutdown           ',
  '|03 f3 |08- |07init modem         ',
  '|03 f4 |08- |07load terminal      ',
  '|03 f5 |08- |07system shell       ',
  '|03 f6 |08- |07lock keyboard      '),
 {------------------------------------}
 ('|03 f1 |08- |07configuration      ',
  '|03 f2 |08- |07menu editor        ',
  '|03 f3 |08- |07themes editor      ',
  '|03 f4 |08- |07protocol editor    ',
  '|03 f5 |08- |07user editor        ',
  '|03 f6 |08- |07file conferences   '),
 {------------------------------------}
 ('|03 f1 |08- |07message conferences',
  '|03 f2 |08- |07cycle stat screen  ',
  '|03 f3 |08- |07make user          ',
  '|03 f4 |08- |07sysop email        ',
  '|03 f5 |08- |07sysop feedback     ',
  '|03 f6 |08- |07infusion nfo       '));
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Var
 current_menu,current_bar,last : integer;donethat : boolean;
 nul1,nul2,nul3,nul4 : integer;cputype : string;
 kbLocked : boolean;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Function WaitForACall : Boolean;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
 Implementation
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Function WaitForACall : Boolean;
 type
  chars79=string[79];
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
 Var
  CC           : integer;
  OverRide     : Mstr;
  XSet         : Boolean;
  SaveScreen   : Boolean;
  GlobalTest   : Byte;
  current_wfc  : integer;
  beendone     : integer;
  scrollcount  : byte;
  scrolllength : byte;
  total_menus  : byte;
           ch  : byte;
  doStats      : boolean;
  currentStat  : byte;
  doneMatrix   : boolean;
  statCount    : byte;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure Color (F, B : BYTE); Assembler;
ASM
  MOV    AL, B
  SHL    AL, 4
  OR     AL, F
  MOV    TextAttr, AL
END;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure place(x,y:byte;str : string);
 begin
 gotoxy(x,y);
 skaWrite(str);
 end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure wShowStatz;

          Procedure wClrShit;
           begin
           window(31,10,80,15);
           textAttr := 7; clrScr;
           window(1,1,80,25);
           end;

 begin
 wClrShit;
 if not currentStat in [1..4] then currentStat := 1;
 if (currentStat=1) then
  begin
  gotoXY(31,10); skaWrite('|07total callers    |08- |03'+strr(status.totalCallers));
  gotoXY(31,11); skaWrite('|07total days up    |08- |03'+strr(status.numDaysUp));
  gotoXY(31,12); skaWrite('|07total uploads    |08- |03'+strr(status.totalFiles));
  gotoXY(31,13); skaWrite('|07total posts      |08- |03'+strr(status.totalMsgs));
  gotoXY(31,14); skaWrite('|07total feedback   |08- |03'+strr(getNumMail(1)));
  gotoXY(31,15); skaWrite('|07minutes idle     |08- |03'+strr(elapsedTime(status.MinutesIdle)));
  end else
 if (currentStat=2) then
  begin
  gotoXY(31,10); skaWrite('|07todays callers   |08- |03'+strr(status.callsToday));
  gotoXY(31,11); skaWrite('|07todays feedback  |08- |03'+strr(status.newFeedback));
  gotoXY(31,12); skaWrite('|07todays downloads |08- |03'+strr(status.newDownloads));
  gotoXY(31,13); skaWrite('|07todays uploads   |08- |03'+strr(status.newUploads));
  gotoXY(31,14); skaWrite('|07todays posts     |08- |03'+strr(status.newPosts));
  gotoXY(31,15); skaWrite('|07sysop avail.lvl  |08- |03'+strr(status.sysopAvail));
  end else
 if (currentStat=3) then
  begin
  gotoXY(31,10); skaWrite('|07special |03thanks|07 and |03greetz|07 goto the following |08-');
  gotoXY(31,12); skaWrite('|07jack phlash, raekwon, mrplastik, minister of light');
  gotoXY(31,13); skaWrite('|07creator, zuess II, plazz, _rzicus, judge dredd, nd');
  gotoXY(31,14); skaWrite('|07sudden death, horrid nature, burning chrome, spot');
  gotoXY(31,15); skaWrite('|07kidfrost, smoke, nivenh, comatose, mag-, and |11Y|03OU!');
  end else
 if (currentStat=4) then
  begin
  gotoXY(31,10); skaWrite('|07infusion bulletin board software |08-|03 v'+versionNum);
  gotoXY(31,11); skaWrite('|07(c)Copyright |03Grant Passmore (iTECH) |08/|07 Avenge 1998');
  gotoXY(31,13); skaWrite('|07"..can this be |11r|03eal|07???"');
  gotoXY(31,15); skaWrite('|07Author support |08- |03skaboy101@mindless.com');
  end;
 end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure wToggleLock;
var t : string;
 begin
  textAttr := 8;
  little.growBox(20,10,60,12);
  gotoXY(21,11);skaWrite('|B0 |11K|03eyboard |11P|03assword: ');
  t := control.inputStr(41,11,7,15,'');
  if (upString(t)=upString(cfg.kbUnlockPassword)) then
      kbLocked := not kbLocked;
  doneThat := false;
 end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
procedure drawmatrix;
 begin
 if (not doneMatrix) then begin
                       window(2,10,25,15);
                       textbackground(0);clrscr;window(1,1,80,25);
                       for nul1 := 1 to 6 do begin
                       gotoxy(2,nul1+9);skawrite('|B0'+matrixx[current_menu,nul1]);
                       end;
                       doneMatrix := true;
                       end;
 gotoxy(2,last+9);
 skawrite('|B0'+matrixx[current_menu,last]);
 gotoxy(2,9+current_bar);skawrite('|B3|00'+matrixY[current_menu,current_bar]);
 end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure PhoneIsRinging;
 Begin
  If (cfg.AutoAnswerStr<>'') then
    SendModemStr(cfg.AutoAnswerStr,False) else
    SendModemStr ('ATA|', FALSE);
 End;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
function getcpu:integer;
 begin
  if (Test8086 = 2) then         { RTL check stops at 2 = 386}
  asm
             inc    Test8086     { 3 = 386, for consistency }
    { Do we have a 386 or a 486? }
    { Does pushf/popf preserve the Alignment Check bit? (386=no, 486=yes) }
             mov    bx, sp       { save current stack pointer }
             and    sp, not 3    { align stack to avoid AC fault }
    db $66;  pushf
    db $66;  pop    ax
    db $66;  mov    cx, ax
    db $66, $35; dd $40000       { xor AC bit in EFLAGS }
    db $66;  push   ax
    db $66;  popf
    db $66;  pushf
    db $66;  pop    ax
    db $66;  xor    ax, cx       { Is AC bit toggled? }
             je @@1              { if not, we have a 386 }
             and    sp, not 3    { align stack to avoid AC fault }
    db $66;  push   cx
    db $66;  popf                { restore original AC bit }
             mov    sp, bx       { restore original stack pointer }
             mov  Test8086, 4    { we know we have at least a 486 }

    { Do we have a 486 or a Pentium? }
    { Does pushf/popf preserve the CPUID bit? (486=no, P5=yes) }
    db $66;  mov    ax, cx       { get original EFLAGS}
    db $66, $35; dd $200000      { XOR id bit in flags}
    db $66;  push   ax
    db $66;  popf
    db $66;  pushf
    db $66;  pop    ax
    db $66;  xor    ax, cx      { Is CPUID bit toggled? }
             je @@1             { if not, we have a 486 }
    db $66;  xor    ax, ax
    db $f,$a2                   { CPUID, AX = 0 (get CPUID caps) }
    db $66;  cmp    ax, 1
             jl @@1             { if < 1, then exit }
    db $66;  xor    ax, ax
    db $66;  inc    ax
    db $f,$a2                   { CPUID, AX = 1 (get CPU info)   }
             and    ax, $f00    { mask out all but family id }
             shr    ax, 8
             mov    Test8086, al      { Pentium family = 5 }
   @@1:
  end;
  getcpu := test8086;
  end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Function FindTasker : Byte; Assembler;
Asm
    MOV   AX, $3001
    INT   $21
    CMP   AL, $14
    JE    @SETOS2
    MOV   AX, $160A
    INT   $2F
    CMP   AX, $00
    JE    @SETWIN
    MOV   AX, $2B01
    MOV   CX, $4445
    MOV   DX, $5351
    INT   $21
    CMP   AL, $FF
    JNE   @SETDVX
    MOV   AX, $7A00
    INT   $2F
    CMP   AL, $FF
    JE    @SETNOV
    MOV   TASKER, 0
    JMP   @EXIT
@SETOS2:
    MOV   TASKER, 2
    JMP   @EXIT
@SETWIN:
    MOV   TASKER, 3
    JMP   @EXIT
@SETDVX:
    MOV   TASKER, 1
    JMP   @EXIT
@SETNOV:
    MOV   TASKER, 4
@EXIT:
    MOV   AL, TASKER
End;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure CheckTasking;
Begin
  CASE FindTasker OF
           0: Multitaskername := 'dOs [yeah!]';
           1: Multitaskername := 'deskview';
           2: Multitaskername := 'os.too';
           3: Multitaskername := 'windoze';
           4: Multitaskername := 'novell';
  End;
END;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
FUNCTION BaudSupported : BOOLEAN;
VAR brated : baudratetype;
    cnt : BYTE;
BEGIN
  CASE connectbaud DIV 100 OF
        3 : brated := b300;
       12 : brated := b1200;
       24 : brated := b2400;
       48 : brated := b4800;
       72 : brated := b7200;
       96 : brated := b9600;
      120 : brated := b12000;
      144 : brated := b14400;
      168 : brated := b16800;
      192 : brated := b19200;
      216 : brated := b21600;
      240 : brated := b24000;
      264 : brated := b26400;
      288 : brated := b28800;
      312 : brated := b31200;
      336 : brated := b33600;
      384 : brated := b38400;
      576 : brated := b57600;
     1152 : brated := b115200;
  END;
  Cnt:=0;
  IF brated IN cfg.supportedrates THEN BaudSupported:=True ELSE
    IF cfg.LowBaudPassword<>'' THEN BEGIN
      SendCr('Your Connect Speed is not within the allowed baud rates!'^M);
      REPEAT
        WriteStr ('Turtle Password: *');
        BaudSupported:=Match (inpt, cfg.LowBaudPassword);
        INC (cnt);
      UNTIL (cnt > 2) OR BaudSupported;
    END;
END;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
FUNCTION seconds : BYTE;
Inline(
  $B4/$2C/               {  MOV AH, $2C}
  $CD/$21/               {  INT 21h}
  $88/$F0);              {  MOV AL, DH}

PROCEDURE CheckDSZLog;
BEGIN
  skaWrite('|08:|07:|15: |07Examining |15DSZLOG|07 environment variable..|CR');
  IF (Match(cfg.DszLog, getenv ('DSZLOG'))=false) then
   begin
   showLine;
   skaWrite('|07  Infusion requires the DSZLOG environment variable to be set at all times.|CR');
   skaWrite('|07  Please add |15SET DSZLOG='+cfg.dszLog+'|07 to your system batch file.|CR');
   showLine;
   halt(5);
   end else skaWrite('|08:|07:15: |07Environment variable locked and located..|CR');
END;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure Exitinfusion;
var x : byte;
begin
  Window(1,1,80,25);
  randomize;
  x := random(12);
  if (x>12) then x := 12;
  case x of
   1 : woop_dat_screen;
   2 : pulltheBars;
   3 : rollUp;
   4 : column_Clear;
   5 : row_Clear;
   6 : close_Horizontal;
   7 : close_Vertical;
   8 : slideUp;
   9 : slideDown;
  10 : slideLeft;
  11 : slideRight;
  12 : squish_Screen;
  end;
 if not exist(cfg.screensdir+'DONE.BIN') then
 skawrite('|01%%% |09i|01nfusion |09b|01bs |09s|01oftware |09v|01ersion |09'+coolvernum+
 ' |08[|01c|08] |09g|01rant |09p|01assmore |08[|01skaboy101|08] |091|01998 |01%%%') else
 lOadTextScreen(cfg.screensdir+'DONE.BIN');
 gotoxy(1,25);
 ShutDownSystem;
 textAttr := 7;
 halt(4)
End;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure wShowCallers;
var wCallers : array[1..7] of lastRec;
       wFile : file;
           x : byte;
 begin
 for x := 1 to 7 do
  begin
  wCallers[x].name   := 'nobody';
  wCallers[x].minsOn := 0;
  wCallers[x].ac     := '555';
  wCallers[x].baud   := '000000';
  wCallers[x].when   := 0;
  end;
 if exist(cfg.dataDir+'CALLERS') then
  begin
  assign(wFile,cfg.dataDir+'CALLERS');
  reset(wFile,1);
  if (fileSize(wFile) div sizeOf(lastRec)>=7) then
   begin
   seek(wFile,fileSize(wFile)-(sizeOf(lastRec)*7));
   for x := 7 downto 1 do blockRead(wFile,wCallers[x],sizeOf(lastRec));
   end else
    begin
    seek(wFile,0);
    for x := (fileSize(wFile) div sizeOf(lastRec)) downto 1 do blockRead(wFile,wCallers[x],sizeOf(lastRec));
    end;
  close(wFile);
  end;
 for x := 1 to 7 do
  begin
  gotoXY(42,16+x);
  skaWrite('|11'+tab(copy(wCallers[x].name,1,10),10)+' |08/|07 '+tab(copy(wCallers[x].baud,1,10),10)+' |08/|07 '+
           'from '+wCallers[x].ac+' ac');
  end;
 end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure wShowSite;
var nodeMode : string[20];
 begin
 if (local=true) or (cfg.useCom=0) then nodeMode := 'local' else
     nodeMode := 'dial-up/telnet';
 textAttr := 3;
 gotoXY(14,17); if (kbLocked=true) then skaWrite('locked - press |11F10|03') else write('active');
 gotoXY(14,18); write(cfg.longName);
 gotoXY(14,19); write(cfg.sysopName);
 gotoXY(14,20); write(cfg.nodeNum,' of ',cfg.totalNodes);
 gotoXY(14,21); write(nodeMode);
 gotoXY(14,22); write(multiTaskerName);
 gotoXY(14,23); write(cfg.eventBatch);
 end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
procedure drawwfc;
 begin
 if (not donethat) then
   begin
   clrscr;
   if not exist(cfg.screensdir+'wfc.bin') then writeln('YO KiD, WFC.BiN DOESNT EXiST') else
    begin
    loadTextScreen(cfg.screensdir+'WFC.BIN');
    wShowSite;
    wShowStatz;
    wShowCallers;
    doneMatrix := false;
    drawMatrix;
    donethat := true;
    end;
   end else
drawmatrix;
end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
PROCEDURE ReceiveCall (AlreadyConnected : BOOLEAN);
Var TempStr : String;
BEGIN
  Local := False;
  Online := False;
  ConnectStr [0] := #0;
  BaudStr [0] := #0;
  IF (AlreadyConnected) AND (OverRide <> '') THEN ConnectStr := OverRide
  Else ConnectStr := Strr(cfg.DefBaudRate * 100);
  If Not Carrier Then Exit;
  TempStr := Copy(ConnectStr, 1, 6);
  While (TempStr[Length(TempStr)] <> '0') Do Dec(TempStr[0]);
  SToUpper(ConnectStr);
  BaudRate := WORD(LongValu(TempStr) Div 100);
  connectbaud := baudrate*100;
  BaudStr := TempStr;
  Online := True;
  Urec.Config := [Lowercase, Linefeeds, Eightycols, Ansigraphics];
  IF NOT BaudSupported THEN Hangup
  ELSE
  BEGIN
    IF POS ('ARQ', ConnectStr) > 0 THEN BaudStr := BaudStr + '/ARQ';
    IF POS ('HST', ConnectStr) > 0 THEN BaudStr := BaudStr + '/HST';
    IF POS ('V32', ConnectStr) > 0 THEN BaudStr := BaudStr + '/V32';
    IF POS ('V42', ConnectStr) > 0 THEN BaudStr := BaudStr + '/V42';
    IF POS ('VFC', ConnectStr) > 0 THEN BaudStr := BaudStr + '/VFC';
    IF POS ('V34', ConnectStr) > 0 THEN BaudStr := BaudStr + '/V34';
    IF POS ('MNP', ConnectStr) > 0 THEN BaudStr := BaudStr + '/MNP';
    IF POS ('LAPM', ConnectStr) > 0 THEN BaudStr := BaudStr + '/LAPM';
    ConnectStr := BaudStr;
    AnsiColor (1);
    AnsiCls;
    multicolor('|CR|08┌───────────────────────────────────────────────────────────────────────┐|CR');
    multicolor('|08│|07    This System is running an alpha test version of the Infusion BBS |08  │|CR');
    multicolor('|08│|07 Infusion is (c)Copyright Grant Passmore (skaboy101) / Avenge 1997-99.|08 │|CR');
    multicolor('|08│                                                                      |08 │|CR');
    multicolor('|08│|07   If you would like to test infusion, contact skaboy101@mindless.com |08 │|CR');
    multicolor('|08└───────────────────────────────────────────────────────────────────────┘|CR|CR');
    Sr.C [1] := 'BR';
    Sr.S [1] := BaudStr;
    MultiColor (Strng^.ConnectionStr);
    SendCr('');
    Sr.C [1] := 'BR';
    Sr.S [1] := Strr(cfg.DefBaudRate*100);
    MultiColor (Strng^.LockedBaudStr);
    SendCr('');
    Sr.C [1] := 'NN';
    Sr.S [1] := Strr(cfg.NodeNum);
    MultiColor (Strng^.LoggedOnNodeNum);
    SendCr('')
  End;
  Delay(1000);
  If cfg.TotalNodes > 1 Then
  Begin
    Open_Message_File(cfg.NodeNum);
    Close_Message_File;
  End;
  Inc(Status.NewCalls);
END;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
PROCEDURE DoTimedEvent;
BEGIN
  CLRSCR;
  TextAttr := 7;
  WriteLn( 'Executing timed event: ', cfg.eventbatch);
  Status.EventDone := DateStr (now);
  ShutDownSystem;
  HALT (3)
END;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure wUpdateScroller;                                                       {   31   2/4}
 var dCount : byte;
 const wScrollText = 'combining speed, configurability, support, while still keeping '+
                     'it all at a professional level, infusion bulletin board software i'+
                     's the educated choice for serious sysops.  author support is a'+
                     'vailable through netmail - skaboy101@mindless.com   ';
 begin
 textAttr := 3*16+11;
 scrollLength := length(wScrollText);
 gotoxy(10,25);
 if (scrollCount>scrollLength) then scrollCount := 0;
 if (scrollCount<scrollLength-62) then
  begin
  inc(scrollCount);
  write(copy(wScrollText,scrollCount,62));
  end else
   begin
   inc(scrollCount);
   write(tab(copy(wScrollText,scrollCount,length(wScrollText)-scrollCount),62));
   end;
 end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Procedure newWFC;
VAR TotalMins,
    TotalUp,
    TotalIdle : LongInt;
    X         : SStr;

  FUNCTION Percent (R1, R2 : Real) : SStr;
  BEGIN                                       {commented out}
    IF (R2 < 1) THEN EXIT;                    {shows perecentage of usage}
    Percent := StReal ((R1 / R2) * 100) + '%' {do search for 'percent' }
  END;                                       {to find all lines that use }
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
PROCEDURE Place (X, Y : BYTE; S : LStr);
  BEGIN
    GOTOXY (X, Y);
    skawrite(+S);
  END;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
var blah : integer;
begin
 drawWfc;
 if not doneMatrix then drawMatrix;
  {--------(check for event shiznits)--------}
  if (timeTillEvent < 6) then
   begin
    dontAnswer;
    IF (timeTillEvent < 2) then doTimedEvent;
   end;
  {-------(done with that)-------------------}
end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
FUNCTION StatusScreen : CHAR;
const  colorz : array [1..2,1..4] of string = (
  ('|07.|08..','|08.|07.|08.','|08..|07.|08','|08.|07.|08.'),
  ('|08..|07.|08','|08.|07.|08.','|07.|08..','|08.|07.|08.'));
VAR  S  : Byte;
    Return : STRING;
    Waiting : Minutes;


    FUNCTION Interrupted : BOOLEAN;
  Var b : char;
      K : Char;
  BEGIN
     IF Keyhit THEN
    BEGIN
      dec(ch);         {unaffects their asses }
      dec(statCount);
      dec(scrollCount);
      K := upCase(BiosKey);
      SaveScreen := FALSE;
      NewWFC;
      b := upCase(K);
      CASE K OF
      #158           : ToggleAvail;
      #196           : if (kbLocked=true) then wToggleLock;
      #205           : if not kbLocked then begin
                       if (current_menu<>total_menus) then begin
                       inc(current_menu);
                       doneMatrix := false;
                       end;
                       end;
      #203           : if not kbLocked then begin
                       if (current_menu<>1) then begin
                       dec(current_menu);
                       doneMatrix := false;
                       end;
                       end;
      #200           : if not kbLocked then begin
                      last := current_bar;
                      dec(current_bar);
                      if (current_bar < 1) then if
                          (current_menu > 1) then begin
                                             current_bar := 6;
                                             dec(current_Menu);
                                             doneMatrix := false;
                                             end else
                      current_bar := 1;
                      drawmatrix;
                      end;
      #208           : if not kbLocked then begin
                      last := current_bar;
                      inc(current_bar);
                      if (current_bar > 6) then if
                          (current_menu < 3) then
                             begin
                             current_bar := 1;
                             inc(current_menu);
                             doneMatrix := false;
                             end else
                      current_bar := 6;
                      drawmatrix;
                      end;
      #187..#192       : if not kbLocked then begin
                       interrupted := true;
                       if (k=#187) then
                        case current_menu of
                        1 : statusScreen := ' ';
                        2 : statusScreen := 'S';
                        3 : statusScreen := '@';
                        end else
                       if (k=#188) then
                        case current_menu of
                        1 : statusScreen := 'Q';
                        2 : statusScreen := '#';
                        3 : statusScreen := #9;
                        end else
                       if (k=#189) then
                        case current_menu of
                        1 : statusScreen := 'I';
                        2 : statusScreen := '$';
                        3 : statusScreen := 'M';
                        end else
                       if (k=#190) then
                        case current_menu of
                        1 : statusScreen := 'T';
                        2 : statusScreen := '*';
                        3 : statusScreen := 'E';
                        end else
                       if (k=#191) then
                        case current_menu of
                        1 : statusScreen := 'J';
                        2 : statusScreen := 'U';
                        3 : statusScreen := 'F';
                        end else
                       if (k=#192) then
                        case current_menu of
                        1 : statusScreen := '%';
                        2 : statusScreen := '(';
                        3 : statusScreen := '&';
                        end
                       end;
      #13            : if not kbLocked then begin
                       interrupted := true;
                        if (current_menu=1) then
                         begin
                         case current_bar of
                         1 : statusscreen := ' ';
                         2 : statusscreen := 'Q';
                         3 : statusscreen := 'I';
                         4 : statusscreen := 'T';
                         5 : statusscreen := 'J';
                         6 : statusscreen := '%';
                         end;
                        end else
                       if (current_menu=2) then
                         begin
                          case current_bar of
                          1 : statusscreen := 'S';
                          2 : statusscreen := '#';
                          3 : statusscreen := '$';
                          4 : statusscreen := '*';{prot}
                          5 : statusscreen := 'U';
                          6 : statusscreen := '(';
                          end;
                         end else
                       if (current_menu=3) then
                         begin
                          case current_bar of
                          1 : statusscreen := '@';
                          2 : statusscreen := #9;
                          3 : statusscreen := 'M';
                          4 : statusscreen := 'E';
                          5 : statusscreen := 'F';
                          6 : statusscreen := '&';
                          end;
                         end;
                       end;
                      end;
      end;
end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
var f : file;
   ld : boolean;
BEGIN
  Waiting.Started := FALSE;
  Waiting.Total := 0;
  StartTimer (Waiting);
  Cursor_ (FALSE);
  StatusScreen := #0;
  FillChar(Return, SizeOf(Return), 0);
  If Not SaveScreen Then begin
   NewWFC;
   end;
  Repeat
    If NumChars Then
    Begin
      While (NumChars) And (Return[0] < #75) Do
        Return := Return + GetChar;
      SToUpper(Return);
      If Pos('CONNECT',Return) > 0 Then
      Begin
        OverRide := Copy(Return,Pos('CONNECT',Return) + 8, Length(Return));
        Exit;
      End
      Else
      If Pos('CARRIER',Return) > 0 Then
      Begin
        OverRide := Copy(Return,Pos('CARRIER',Return) + 8, Length(Return));
        Exit;
      End
      Else
      If Pos('RING',Return) > 0 Then
      Begin
        Return[0] := #0;
        TextAttr := 15;
        If SaveScreen Then
        Begin
          NewWFC;
          SaveScreen := False;
        End;
        PhoneIsRinging;
        S := Seconds;
        While S = Seconds Do TimeSlice;
      End;
    End;
    If KeyHit Then If Interrupted Then Exit;
    IF NOT SaveScreen THEN
     Begin
      inc(statCount);
      if (statCount>=3) then
       begin
       if currentStat<>4 then inc(currentStat) else
          currentStat := 1;
       wShowStatz;
       statCount := 0;
       end;
      wUpdateScroller;
      Cursor_(false);
      INC (CH);
      IF CH > 4 THEN CH := 1;
      S := Seconds;
      While (Seconds = S) And (Not KeyHit) Do TimeSlice;
      If (cfg.ScreenSave > 0) And (ElapsedTime(Waiting) >= cfg.ScreenSave) Then
       Begin

       End;
    End;
  UNTIL (Seconds = 1) AND (Not NumChars) AND (Not KeyHit);
  donethat := false;
  ld := false;
  IF Status.Lastdayup <> DateStr (now) THEN
  Begin
    Status.Lastdayup := DateStr (now);
    Inc(Status.NumDaysUp);
    Status.CallsToday := 0;
  End;
  WriteStatus;
 end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
PROCEDURE Execute (D0S : BOOLEAN);
VAR S   : Sstr;
  St  : WORD;
  STR : Lstr;
BEGIN
  TEXTMODE (co80);
  WINDOW (1, 1, 80, 25);
  CLRSCR;
  IF D0S THEN
     BEGIN
     TEXTMODE (co80);
     TextAttr := 7;
     writeLn('       __        _____                         __              _________ _ __');
     writeLn('      (__)______|   _/__/\_____  __________   (__)  __________|  _______ _ _');
     writeLn('   _______\__   \   \     ____/_|   __   (_________/_     \    \  \');
     writeLn('   \        /  \____/     __/   |   /_\    \        /_____/  \____/');
     writeLn('    \______/______/|______| \______/\______/\______/nfm!\______/');
     writeLn('                      ...type "EXIT" to return...'#13#10);
     ExecuteWithSwap ('', '', FALSE);
     STR := cfg.infusionDir;
     Dec(Byte(Str[0]));
     CHDIR (STR);
     END ELSE
     executeWithSwap('TERMINAL.BAT','',false);
END;

PROCEDURE MakeAccount;
BEGIN
  unum := 1;
  readurec;
  Urec.timetoday := 9999;
  Urec.handle := '';
  if (No_Modem=false) then Null_Modem;
  local := TRUE;
  logontime := timer;
  UseBottom := cfg.DefBottomLine;
  InitWinds;
  Bottomline;
END;

PROCEDURE UnDoAccount;
BEGIN
  unum := - 1;
  ulvl := - 1;
  unam [0] := #0;
  FILLCHAR (Urec, SIZEOF (Urec), 0);
  local := FALSE;
  logontime := timer;
  logofftime := timer + 999;
  If (No_Modem=false) then Real_Modem;
END;

Var  K    : CHAR;
     A    : BYTE;
     T,
     Temp : INTEGER;
     O    : MStr;

BEGIN
  checkDSZLog;
  currentStat := 0;
  total_menus := 3;
  randomize;
  last := 1;
  donethat := false;
  cursor_(false);
  scrollCount := 0;
  NumUsers := FileSize(UFile) - 1;
  SaveScreen := False;
  Check_Is_Okay:=False;
  CheckTasking;
  FileConf := 1;
  MsgConf := 1;
  current_menu := 1;current_bar := 1;
  WaitForACall := FALSE;
  SetParam;
  WriteLn;
  OverRide [0] := #0;
  XSet := False;
   For A:=1 To ParamCount Do If Upstring(ParamStr(A))='/X' Then XSet := True;
  IF Carrier THEN
    IF PARAMCOUNT > 0 THEN
    BEGIN
      OverRide := ParamStr(1);
      If OverRide[1] = '/' Then Delete(OverRide,1,1)
      Else OverRide[0] := #0;
      Cursor_ (TRUE);
      ReceiveCall (TRUE);
      IF Carrier THEN
      Begin
        ClrScr;
        Exit;
      End;
    End;
  StartTimer (Status.MinutesIdle);
  Local := False;
  SetupModem;
  REPEAT
    Window(1,1,80,25);
    If XSet And Not Carrier Then
    BEGIN
      TextAttr := 7;
      clrscr;
      showMainLogo;
      showElite('|15error, the /x parameter is active, but no user is currently online|CR');
      showElite('|15troubleshooting tip, make sure that you are loading the node with the');
      skaWrite('|15           connected port|CR|CR');
      skawrite('|07  this command is used to tell infusion not to init the modem, but just log|CR');
      skaWrite('|07  the user on.  only use this command when someone is |15ALREADY|07 connected, like|CR');
      skaWrite('|07  with a front door.|CR|CR');
      cursor_on;
      ShutDownSystem;
      HALT (5);
    END;
    K := StatusScreen;
    If Carrier THEN
    BEGIN
      Cursor_ (TRUE);
      ReceiveCall (OverRide > '');
      IF Carrier THEN
      Begin
        ClrScr;
        Exit;
      End;
    END;
        CASE k of
       'S' : begin
             local  := true;
             textmode(co80);
             makeAccount;
             cConfig0;
             doneThat := false;
             unDoAccount;
             end;
       'I' : begin
             if not local then
              begin
              setupModem;
              doneThat := false;
              end;
             end;
       ' ' : Begin {local login}
             TEXTMODE (co80);
             Cursor_ (TRUE);
             makeAccount;
             Color (15, 0);
             local := TRUE;
             online := FALSE;
             Status.newfeedback := 0;
             Status.NewUploads := 0;
             Status.NewDownloads := 0;
             Status.Newcalls := 0;
             Status.NewPosts := 0;
             Status.NewMail := 0;
             Writestatus;
             ConnectStr := 'Local Logon';
             connectbaud := 115200;
             Null_Modem;
             ClrScr;
             donethat := false;
             Exit;
             End;
      '%'  : begin
             wToggleLock;
             doneThat := false;
             end;
      'Q'  : BEGIN {quit do dos}
             Cursor_ (TRUE);
             TextAttr := 8;
             Exitinfusion;
            END;
      'J'  : BEGIN {jump to dos/dosshell}
             Cursor_ (TRUE);
             Color (15, 0);
             DontAnswer;
             Execute (TRUE);
             ReadCfg(False);
             DoAnswer;
            donethat := false;
           END;
      'U' : begin
            local := true;
            textmode(co80);
            makeAccount;
            cUserEdit;
            doneThat := false;
            unDoAccount;
            end;
      'M' : begin
            local := true;
            textMode(co80);
            makeAccount;
            MakeUser;
            doneThat := false;
            unDoAccount;
            end;
      '#' : begin
            local := true;
            textMode(co80);
            makeAccount;
            cMenuEdit;
            unDoAccount;
            doneThat := false;
            end;
      'D' : begin
            local := true;
            textMode(co80);
            makeAccount;
            unDoAccount;
            doneThat := false;
            end;
     '@'  : begin
            local := true;
            textMode(co80);
            makeAccount;
            cConferenceEdit(2);
            unDoAccount;
            doneThat := false;
            end;
     'T'  : begin
            execute(false);
            doneThat := false;
            end;
     '$'  : begin
            makeAccount;
            textMode(co80);
            cThemeEdit;
            doneThat := false;
            undoAccount;
            end;
     'F'  : begin
            makeAccount;
            textMode(co80);
            QuickFeedBackRead (FALSE);
            doneThat := false;
            undoAccount;
            end;
     '('  : begin
            makeAccount;
            textMode(co80);
            cConferenceEdit(1);
            doneThat := false;
            undoAccount;
            end;
     'E'  : begin
            makeAccount;
            textMode(co80);
            IF init_email THEN mailread (FALSE);
            doneThat := false;
            undoAccount;
            end;
     #9   : begin
            if (currentStat<>4) then inc(currentStat)
            else currentStat := 1;
            wShowStatz;
            end;
    '%'   : begin
            makeAccount;
            textMode(co80);
            doneThat := false;
            undoAccount;
            end;
    '*'   : begin
            makeAccount;
            textMode(co80);
            cProtocolEdit;
            doneThat := false;
            unDoAccount;
            end;
    '&'   : begin
            makeAccount;
            textMode(co80);
{            dDataTest;}
            doneThat := false;
            unDoAccount;
            end;
    end;
  until (2=1);
 end;
end.