Unit UserData;



interface

{***************************************************************************}

{***************************************************************************}



Procedure ChangePhone(Phone: string);

Function  GetPhone(var Phone: string): boolean;

Procedure Show(TempUserID: integer);

Procedure Update;

Function  UserFile(UserID: integer): string;



implementation

{***************************************************************************}

{***************************************************************************}

uses

  BBSFuncs,

  BBSGlbls,

  Bull,

  Disk,

  Glob,

  IOPorts,

  Misc,

  Data,

  Time;



Procedure ChangePhone(Phone: string);

{***************************************************************************}

begin

  DumBool := Disk.LineWrite(UserFile(UserID[Port]), 8, Phone);

end;



Function  GetPhone(var Phone: string): boolean;

{***************************************************************************}

var

  Temp: boolean;

begin

  Temp := FileLine('R', UserFile(UserID[Port]), 8, Phone);

  GetPhone := Temp;

end;



Procedure Show(TempUserID: integer);

{***************************************************************************}

const

  DescripU: array[1..14] of string = (

    'Password:  ',

    'Number of seconds per call:  ',

    'Privileges Code Number:  ',

    'Automatic Menu Display:  ',

    'Date and Time when last logged out:  ',

    'Number of bulletins posted when last logged out:  ',

    'Number of files uploaded when last logged out:  ',

    'Phone number:  ',



    'Minimum time between calls in seconds:  ',

    'Total time allowable per day in seconds:  ',

    'Total time used today in seconds:  ',

    'Credit:  $',

    'Acquired kudos:  ',

    'Second password:  ');

var

  SF: text;

  alpha: integer;

  LineStr: string;

begin

  alpha := 0;

  if FileOpen('R', UserFile(TempUserID), SF) = 0 then

    begin

      while not(EOF(SF)) do

        begin

          Inc(alpha);

          Say(DescripU[alpha]);

          readln(SF, LineStr);

          if alpha <> 1 then

            SayL(LineStr)

          else

            SayL('not shown');

        end;

      close(SF);

    end;

  SayL('');

end;



Procedure Update;

{***************************************************************************}

var

  LastLogOut,

  LastBull,

  LastFile: string;

begin

  LastLogout := DateTimeStrNow;

  DumBool := FileLine('O', UserFile(UserID[Port]), 5, LastLogout);

  LastBull := StrInt(Bull.BullsPosted);

  DumBool := FileLine('O', UserFile(UserID[Port]), 6, LastBull);

  LastFile := StrInt(FilesLoaded);

  DumBool := FileLine('O', UserFile(UserID[Port]), 7, LastFile);

end;



Function UserFile(UserID: integer): string;

{***************************************************************************}

begin

  UserFile := UserDir(UserID) + '\UserData.BBS';

end;



{***************************************************************************}

{***************************************************************************}

{***************************************************************************}

begin

end.