Support for newuserapp.mpx new user application replacement via MPL program

This commit is contained in:
mysticbbs 2012-06-30 16:08:14 -04:00
parent 3f127a8625
commit db3546092c
1 changed files with 29 additions and 22 deletions

View File

@ -32,6 +32,7 @@ Type
Constructor Create (Var Owner: Pointer); Constructor Create (Var Owner: Pointer);
Destructor Destroy; Override; Destructor Destroy; Override;
Procedure InitializeUserData;
Function IsThisUser (Str: String) : Boolean; Function IsThisUser (Str: String) : Boolean;
Function Access (Str: String) : Boolean; Function Access (Str: String) : Boolean;
Function SearchUser (Var Str : String; Real : Boolean) : Boolean; Function SearchUser (Var Str : String; Real : Boolean) : Boolean;
@ -75,20 +76,32 @@ Uses
bbs_Core; bbs_Core;
Constructor TBBSUser.Create (Var Owner: Pointer); Constructor TBBSUser.Create (Var Owner: Pointer);
Begin
InitializeUserData;
End;
Destructor TBBSUser.Destroy;
Begin
Inherited Destroy;
End;
Procedure TBBSUser.InitializeUserData;
Begin Begin
FillChar (ThisUser, SizeOf(ThisUser), #0); FillChar (ThisUser, SizeOf(ThisUser), #0);
FillChar (Security, SizeOf(Security), #0);
UserNum := -1; UserNum := -1;
ThisUser.ScreenSize := Config.DefScreenSize; ThisUser.ScreenSize := Config.DefScreenSize;
ThisUser.Theme := Config.DefThemeFile;
ThisUser.DateType := 1; ThisUser.DateType := 1;
ThisUser.Security := 255;
ThisUser.HotKeys := True; ThisUser.HotKeys := True;
ThisUser.RealName := 'Unknown'; ThisUser.RealName := 'Unknown';
ThisUser.Handle := 'Unknown'; ThisUser.Handle := ThisUser.RealName;
ThisUser.EditType := 1; ThisUser.EditType := 1;
ThisUser.Birthday := CurDateJulian; ThisUser.Birthday := CurDateJulian;
ThisUser.Gender := 'U'; ThisUser.Gender := 'U';
ThisUser.FirstOn := CurDateDos; ThisUser.FirstOn := CurDateDos;
ThisUser.TimeLeft := Config.LoginTime;
ThisUser.Archive := Config.qwkArchive; ThisUser.Archive := Config.qwkArchive;
ThisUser.LastFGroup := Config.StartFGroup; ThisUser.LastFGroup := Config.StartFGroup;
ThisUser.LastMGroup := Config.StartMGroup; ThisUser.LastMGroup := Config.StartMGroup;
@ -99,11 +112,6 @@ Begin
MatrixOK := False; MatrixOK := False;
End; End;
Destructor TBBSUser.Destroy;
Begin
Inherited Destroy;
End;
Function TBBSUser.IsThisUser (Str: String) : Boolean; Function TBBSUser.IsThisUser (Str: String) : Boolean;
Begin Begin
Str := strUpper(Str); Str := strUpper(Str);
@ -846,27 +854,26 @@ Begin
Session.SystemLog ('NEW USER'); Session.SystemLog ('NEW USER');
{ make user intialize data function } InitializeUserData;
If ExecMPE Then Begin { replace this with apple.mpx once the above is done }
(*
If User.ThisUser.RealName = '' Then User.ThisUser.RealName := User.ThisUser.Handle;
If User.ThisUser.Handle = '' Then User.ThisUser.Handle := User.ThisUser.RealName;
If { Test validity of user data }
IsUser(User.ThisUser.RealName) or
IsUser(User.ThisUser.Handle) or
(User.ThisUser.Password = '') or
(User.ThisUser.RealName = '') or
(User.ThisUser.Handle = '')
Then Begin
Sysop_Log('"apply.mpx" does not set minimum data elements');
Halt(1);
End;
*)
End Else Begin
Session.io.OutFile ('newuser1', True, 0); Session.io.OutFile ('newuser1', True, 0);
If ExecuteMPL (NIL, 'newuserapp') > 0 Then Begin
If ThisUser.RealName = '' Then ThisUser.RealName := ThisUser.Handle;
If ThisUser.Handle = '' Then ThisUser.Handle := ThisUser.RealName;
If { Test validity of user data }
FindUser(ThisUser.RealName, False) or
FindUser(ThisUser.Handle, False) or
(ThisUser.Password = '') or
(ThisUser.RealName = '') or
(ThisUser.Handle = '')
Then Begin
Session.SystemLog('newuserapp.mpx does not set minimum data elements');
Halt(1);
End;
End Else Begin
If strUpper(DefName) = 'NEW' Then DefName := ''; If strUpper(DefName) = 'NEW' Then DefName := '';
With Config Do Begin With Config Do Begin