BBS History and Last Callers revamp. Prep for A11 release

This commit is contained in:
mysticbbs 2012-03-02 21:25:37 -05:00
parent 5d38954fe6
commit 55301cd6ea
13 changed files with 232 additions and 91 deletions

View File

@ -13,6 +13,33 @@ Uses
{$I RECORDS.PAS}
Type
OldLastOnRec = Record { CALLERS.DAT }
Handle : String[30]; { User's Name }
City : String[25]; { City/State }
Address : String[30]; { user's address }
Baud : String[6]; { Baud Rate }
DateTime : LongInt; { Date & Time (UNIX) }
Node : Byte; { Node number of login }
CallNum : LongInt; { Caller Number }
EmailAddr : String[35]; { email address }
UserInfo : String[30]; { user info field }
Option1 : String[35]; { optional data 1 }
Option2 : String[35]; { " " 2 }
Option3 : String[35]; { " " 3 }
End;
OldHistoryRec = Record
Date : LongInt;
Emails : Word;
Posts : Word;
Downloads : Word;
Uploads : Word;
DownloadKB : LongInt;
UploadKB : LongInt;
Calls : LongInt;
NewUsers : Word;
End;
OldPercentRec = Record // percentage bar record
BarLen : Byte;
LoChar : Char;
@ -708,11 +735,11 @@ Begin
User.Gender := Gender;
User.Email := EmailAddr;
FillChar (User.Optional, SizeOf(User.Optional), #0);
FillChar (User.OptionData, SizeOf(User.OptionData), #0);
User.Optional[1] := Option1;
User.Optional[2] := Option2;
User.Optional[3] := Option3;
User.OptionData[1] := Option1;
User.OptionData[2] := Option2;
User.OptionData[3] := Option3;
User.UserInfo := UserInfo;
User.Theme := Language;
@ -729,7 +756,7 @@ Begin
User.ScreenSize := ScrnPause;
User.ScreenCols := 80;
User.PeerIP := '';
User.PeerName := '';
User.PeerHost := '';
User.FirstOn := FirstOn;
User.LastOn := LastOn;
User.Calls := Calls;
@ -1120,6 +1147,100 @@ Begin
DeleteFile (Config.DataPath + 'fbases.old');
End;
Procedure ConvertHistory;
Var
Hist : RecHistory;
HistFile : File of RecHistory;
OldHist : OldHistoryRec;
OldHistFile : File of OldHistoryRec;
Begin
WriteLn ('[-] Updating BBS history...');
If Not ReNameFile(Config.DataPath + 'history.dat', Config.DataPath + 'history.old') Then Begin
WriteLn('[!] UNABLE TO FIND: ' + Config.DataPath + 'history.dat');
Exit;
End;
Assign (OldHistFile, Config.DataPath + 'history.old');
Reset (OldHistFile);
Assign (HistFile, Config.DataPath + 'history.dat');
ReWrite (HistFile);
While Not Eof(OldHistFile) Do Begin
Read (OldHistFile, OldHist);
FillChar(Hist, SizeOf(Hist), 0);
Hist.Date := OldHist.Date;
Hist.Emails := OldHist.Emails;
Hist.Posts := OldHist.Posts;
Hist.Downloads := OldHist.Downloads;
Hist.Uploads := OldHist.Uploads;
Hist.DownloadKB := OldHIst.DownloadKB;
Hist.UploadKB := OldHIst.UploadKB;
Hist.Calls := OldHist.Calls;
Hist.NewUsers := OldHist.NewUsers;
Write (HistFile, Hist);
End;
Close (HIstFile);
Close (OldHistFile);
DeleteFile (Config.DataPath + 'history.old');
End;
Procedure ConvertLastOn;
Var
Last : RecLastOn;
LastFile : File of RecLastOn;
OldLast : OldLastOnRec;
OldLastFile : File of OldLastOnRec;
Begin
WriteLn ('[-] Updating last callers...');
If Not ReNameFile(Config.DataPath + 'callers.dat', Config.DataPath + 'callers.old') Then Begin
WriteLn('[!] UNABLE TO FIND: ' + Config.DataPath + 'callers.dat');
Exit;
End;
Assign (OldLastFile, Config.DataPath + 'callers.old');
Reset (OldLastFile);
Assign (LastFile, Config.DataPath + 'callers.dat');
ReWrite (LastFile);
While Not Eof(OldLastFile) Do Begin
Read (OldLastFile, OldLast);
FillChar(Last, SizeOf(Last), 0);
With OldLast Do Begin
Last.DateTime := DateTime;
Last.Node := Node;
Last.CallNum := CallNum;
Last.Handle := Handle;
Last.City := City;
Last.Address := Address;
Last.Gender := '?';
Last.EmailAddr := EmailAddr;
Last.UserInfo := UserInfo;
Last.OptionData[1] := Option1;
Last.OptionData[2] := Option2;
Last.OptionData[3] := Option3;
End;
Write (LastFile, Last);
End;
Close (LastFile);
Close (OldLastFile);
DeleteFile (Config.DataPath + 'callers.old');
End;
Procedure ConvertMessageBases;
Var
MBase : RecMessageBase;
@ -1191,23 +1312,26 @@ Begin
WarningDisplay;
//COMMENT this out if mystic.dat is being converted:
Assign (ConfigFile, 'mystic.dat');
Reset (ConfigFile);
Read (ConfigFile, Config);
Close (ConfigFile);
// Assign (ConfigFile, 'mystic.dat');
// Reset (ConfigFile);
// Read (ConfigFile, Config);
// Close (ConfigFile);
// ConvertConfig; //1.10a11
// ConvertUsers; //1.10a11
//ConvertSecurity; //1.10a11
//ConvertFileLists; //1.10a11
//ConvertFileBases; //1.10a11
//ConvertMessageBases; //1.10a11
//ConvertThemes; //1.10a11
ConvertConfig; //1.10a11
ConvertUsers; //1.10a11
ConvertSecurity; //1.10a11
ConvertFileLists; //1.10a11
ConvertFileBases; //1.10a11
ConvertMessageBases; //1.10a11
ConvertThemes; //1.10a11
ConvertHistory; //1.10a11
ConvertLastOn; //1.10a11
// ConvertArchives; //1.10a1
// ConvertGroups; //1.10a1
PurgeDataWildcard('*.lng');
PurgeDataWildcard('node*.dat');
TextAttr := 12;
WriteLn;

View File

@ -3974,3 +3974,10 @@
3) Prompts within a prompt file no longer has to be in numerical order.
More to come on why this change is being made, but generally this
allows you to categorize prompts.
+ Mystic now saves the last known IP and hostname from each user.
+ Revamped last caller information. It now saves the IP, Hostname,
Gender, and if the user was a new user or not. In addition, it will now
save all 10 custom user questions (not implemented yet).

View File

@ -169,13 +169,13 @@ Begin
Session.io.OutRawLn ('J. E-mail ' + strPadR(Session.User.TempUser.Email, 32, ' ') +
'5. Mail Index ' + Session.io.OutYN(Session.User.TempUser.UseLBMIdx));
Session.io.OutRawLn ('K. ' + strPadL(Config.OptionalField[1].Desc, 10, ' ') + ' ' + strPadR(Session.User.TempUser.Optional[1], 32, ' ') +
Session.io.OutRawLn ('K. ' + strPadL(Config.OptionalField[1].Desc, 10, ' ') + ' ' + strPadR(Session.User.TempUser.OptionData[1], 32, ' ') +
'6. Time Left ' + strI2S(Session.User.TempUser.TimeLeft));
Session.io.OutRawLn ('L. ' + strPadL(Config.OptionalField[2].Desc, 10, ' ') + ' ' + strPadR(Session.User.TempUser.Optional[2], 32, ' ') +
Session.io.OutRawLn ('L. ' + strPadL(Config.OptionalField[2].Desc, 10, ' ') + ' ' + strPadR(Session.User.TempUser.OptionData[2], 32, ' ') +
'7. Time Bank ' + strI2S(Session.User.TempUser.TimeBank));
Session.io.OutRawLn ('N. ' + strPadL(Config.OptionalField[3].Desc, 10, ' ') + ' ' + strPadR(Session.User.TempUser.Optional[3], 32, ' ') +
Session.io.OutRawLn ('N. ' + strPadL(Config.OptionalField[3].Desc, 10, ' ') + ' ' + strPadR(Session.User.TempUser.OptionData[3], 32, ' ') +
'8. Screen Size ' + strI2S(Session.User.TempUser.ScreenSize));
Session.io.OutRawLn ('O. User Note ' + strPadR(Session.User.TempUser.UserInfo, 32, ' ') +
@ -212,9 +212,9 @@ Begin
'H' : Session.User.TempUser.HomePhone := Session.io.InXY (16, 10, 15, 15, 12, Session.User.TempUser.HomePhone);
'I' : Session.User.TempUser.DataPhone := Session.io.InXY (16, 11, 15, 15, 12, Session.User.TempUser.DataPhone);
'J' : Session.User.TempUser.Email := Session.io.InXY (16, 12, 30, 35, 11, Session.User.TempUser.Email);
'K' : Session.User.TempUser.Optional[1] := Session.io.InXY (16, 13, 30, 35, 11, Session.User.TempUser.Optional[1]);
'L' : Session.User.TempUser.Optional[2] := Session.io.InXY (16, 14, 30, 35, 11, Session.User.TempUser.Optional[2]);
'N' : Session.User.TempUser.Optional[3] := Session.io.InXY (16, 15, 30, 35, 11, Session.User.TempUser.Optional[3]);
'K' : Session.User.TempUser.OptionData[1] := Session.io.InXY (16, 13, 30, 35, 11, Session.User.TempUser.OptionData[1]);
'L' : Session.User.TempUser.OptionData[2] := Session.io.InXY (16, 14, 30, 35, 11, Session.User.TempUser.OptionData[2]);
'N' : Session.User.TempUser.OptionData[3] := Session.io.InXY (16, 15, 30, 35, 11, Session.User.TempUser.OptionData[3]);
'O' : Session.User.TempUser.UserInfo := Session.io.InXY (16, 16, 30, 30, 11, Session.User.TempUser.UserInfo);
'P' : Begin
Session.User.TempUser.Security := strS2I(Session.io.InXY(16, 17, 3, 3, 12, strI2S(Session.User.TempUser.Security)));

View File

@ -41,8 +41,8 @@ Var
Vote : VoteRec;
Chat : ChatRec;
Room : RoomRec;
LastOnFile : File of LastOnRec;
LastOn : LastOnRec;
LastOnFile : File of RecLastOn;
LastOn : RecLastOn;
Config : RecConfig;
StatusPtr : Byte = 1;

View File

@ -53,7 +53,7 @@ Type
TimeChecked : Boolean;
ConfigMode : Boolean;
InUserEdit : Boolean;
HistoryFile : File of HistoryRec;
HistoryFile : File of RecHistory;
HistoryEmails : Word;
HistoryPosts : Word;
HistoryDLs : Word;
@ -142,12 +142,12 @@ End;
Procedure TBBSCore.UpdateHistory;
Var
History : HistoryRec;
History : RecHistory;
Begin
Assign (HistoryFile, Config.DataPath + 'history.dat');
ioReset (HistoryFile, SizeOf(HistoryRec), fmRWDW);
ioReset (HistoryFile, SizeOf(RecHistory), fmRWDW);
If IoResult <> 0 Then ioReWrite(HistoryFile, SizeOf(HistoryRec), fmRWDW);
If IoResult <> 0 Then ioReWrite(HistoryFile, SizeOf(RecHistory), fmRWDW);
History.Date := CurDateDos;

View File

@ -434,9 +434,9 @@ Begin
Session.io.PromptInfo[7] := strI2S(DaysAgo(TempUser.Birthday) DIV 365);
Session.io.PromptInfo[8] := TempUser.Email;
Session.io.PromptInfo[9] := TempUser.UserInfo;
Session.io.PromptInfo[10] := TempUser.Optional[1];
Session.io.PromptInfo[11] := TempUser.Optional[2];
Session.io.PromptInfo[12] := TempUser.Optional[3];
Session.io.PromptInfo[10] := TempUser.OptionData[1];
Session.io.PromptInfo[11] := TempUser.OptionData[2];
Session.io.PromptInfo[12] := TempUser.OptionData[3];
If (Data = '') or (Pos(Data, strUpper(TempUser.Handle)) > 0) Then Begin
Session.io.OutFullLn (Session.GetPrompt(30));
@ -471,14 +471,13 @@ Begin
Session.io.PromptInfo[3] := LastOn.City;
Session.io.PromptInfo[4] := DateDos2Str(LastOn.DateTime, Session.User.ThisUser.DateType);
Session.io.PromptInfo[5] := TimeDos2Str(LastOn.DateTime, True);
Session.io.PromptInfo[6] := LastOn.Baud;
Session.io.PromptInfo[7] := strI2S(LastOn.CallNum);
Session.io.PromptInfo[8] := LastOn.Address;
Session.io.PromptInfo[9] := LastOn.UserInfo;
Session.io.PromptInfo[10] := LastOn.EmailAddr;
Session.io.PromptInfo[11] := LastOn.Option1;
Session.io.PromptInfo[12] := LastOn.Option2;
Session.io.PromptInfo[13] := LastOn.Option3;
Session.io.PromptInfo[11] := LastOn.OptionData[1];
Session.io.PromptInfo[12] := LastOn.OptionData[2];
Session.io.PromptInfo[13] := LastOn.OptionData[3];
Session.io.OutFullLn (Session.GetPrompt(142));
End;
@ -837,7 +836,7 @@ End;
Procedure ShowBBSHistory (LastDays: Word);
Var
Temp : HistoryRec;
Temp : RecHistory;
Days : Word;
Begin
Assign (Session.HistoryFile, Config.DataPath + 'history.dat');

View File

@ -583,9 +583,9 @@ Begin
End;
'U' : Case Code[2] of
'#' : LastMCIValue := strI2S(TBBSCore(Core).User.ThisUser.PermIdx);
'1' : LastMCIValue := TBBSCore(Core).User.ThisUser.Optional[1];
'2' : LastMCIValue := TBBSCore(Core).User.ThisUser.Optional[2];
'3' : LastMCIValue := TBBSCore(Core).User.ThisUser.Optional[3];
'1' : LastMCIValue := TBBSCore(Core).User.ThisUser.OptionData[1];
'2' : LastMCIValue := TBBSCore(Core).User.ThisUser.OptionData[2];
'3' : LastMCIValue := TBBSCore(Core).User.ThisUser.OptionData[3];
'A' : LastMCIValue := TBBSCore(Core).User.ThisUser.Address;
'B' : Case TBBSCore(Core).User.ThisUser.FileList of
0 : LastMCIValue := 'Normal';

View File

@ -460,7 +460,7 @@ Begin
Else
Session.io.OutFull (Session.GetPrompt(443));
ThisUser.Optional[1] := Session.io.GetInput(35, 35, 11, ThisUser.Optional[1]);
ThisUser.OptionData[1] := Session.io.GetInput(35, 35, 11, ThisUser.OptionData[1]);
End;
Procedure TBBSUser.GetOption2 (Edit : Boolean);
@ -470,7 +470,7 @@ Begin
Else
Session.io.OutFull (Session.GetPrompt(445));
ThisUser.Optional[2] := Session.io.GetInput(35, 35, 11, ThisUser.Optional[2]);
ThisUser.OptionData[2] := Session.io.GetInput(35, 35, 11, ThisUser.OptionData[2]);
End;
Procedure TBBSUser.GetOption3 (Edit : Boolean);
@ -480,7 +480,7 @@ Begin
Else
Session.io.OutFull (Session.GetPrompt(447));
ThisUser.Optional[3] := Session.io.GetInput(35, 35, 11, ThisUser.Optional[3]);
ThisUser.OptionData[3] := Session.io.GetInput(35, 35, 11, ThisUser.OptionData[3]);
End;
Procedure TBBSUser.GetEditor (Edit : Boolean);
@ -971,7 +971,7 @@ End;
Procedure TBBSUser.User_Logon3;
Var
A : Byte;
Count : Byte;
Ch : Char;
Begin
{$IFDEF LOGGING} Session.SystemLog('Logon3'); {$ENDIF}
@ -987,7 +987,7 @@ Begin
Reset (LastOnFile);
If FileSize(LastOnFile) >= 10 Then
KillRecord (LastOnFile, 1, SizeOf(LastOnRec));
KillRecord (LastOnFile, 1, SizeOf(RecLastOn));
LastOn.Handle := ThisUser.Handle;
LastOn.City := ThisUser.City;
@ -997,14 +997,13 @@ Begin
LastOn.Address := ThisUser.Address;
LastOn.EmailAddr := ThisUser.Email;
LastOn.UserInfo := ThisUser.UserInfo;
LastOn.Option1 := ThisUser.Optional[1];
LastOn.Option2 := ThisUser.Optional[2];
LastOn.Option3 := ThisUser.Optional[3];
LastOn.Gender := ThisUser.Gender;
LastOn.PeerIP := Session.UserIPInfo;
LastOn.PeerHost := Session.UserHostInfo;
LastOn.NewUser := ThisUser.Calls = 0;
If Session.LocalMode Then
LastOn.Baud := 'LOCAL'
Else
LastOn.Baud := 'TELNET';
For Count := 1 to 10 Do
LastOn.OptionData[Count] := ThisUser.OptionData[Count];
Seek (LastOnFile, FileSize(LastOnFile));
Write (LastOnFile, LastOn);
@ -1017,8 +1016,8 @@ Begin
{ this (below) causes runtime 201 when range checking is ON }
For A := 1 to 9 Do
Session.io.OutFile ('logon' + strI2S(A), True, 0);
For Count := 1 to 9 Do
Session.io.OutFile ('logon' + strI2S(Count), True, 0);
Session.io.OutFile ('sl' + strI2S(ThisUser.Security), True, 0);
@ -1036,11 +1035,11 @@ Begin
While Not Eof(VoteFile) Do Begin
Read (VoteFile, Vote);
If Access(Vote.ACS) and Access(Vote.ForceACS) and (ThisUser.Vote[FilePos(VoteFile)] = 0) Then Begin
A := FilePos(VoteFile);
Count := FilePos(VoteFile);
Close (VoteFile);
Voting_Booth (True, A);
Voting_Booth (True, Count);
Reset (VoteFile);
Seek (VoteFile, A);
Seek (VoteFile, Count);
End;
End;
Close (VoteFile);

View File

@ -58,7 +58,7 @@ Begin
Reset (TF);
If IoResult <> 0 Then Begin
WriteLn ('ERROR: Theme file (' + FName + FExt + ') not found.');
WriteLn ('ERROR: Theme file (' + FName + FExt + ') not found');
Halt (1);
End;
@ -70,7 +70,7 @@ Begin
If IoResult <> 0 Then Begin
WriteLn;
WriteLn;
WriteLn ('ERROR: Cannot run while Mystic is loaded.');
WriteLn ('ERROR: Cannot run while Mystic is loaded');
Halt(1);
End;
@ -98,7 +98,7 @@ Begin
If Count > mysMaxThemeText Then Begin
WriteLn;
WriteLn;
WriteLn ('ERROR: Prompt #', Count, ' was not expected. Theme file not created.');
WriteLn ('ERROR: Prompt #', Count, ' was not expected. Theme file not created');
Close (ThemeFile);
Erase (ThemeFile);
Halt(1);
@ -107,7 +107,7 @@ Begin
If Found[Count] Then Begin
WriteLn;
WriteLn;
WriteLn ('ERROR: Prompt #', Count, ' was found twice. Theme file not created.');
WriteLn ('ERROR: Prompt #', Count, ' was found twice. Theme file not created');
Close (ThemeFile);
Erase (ThemeFile);
Halt (1);
@ -128,7 +128,7 @@ Begin
For Count := 0 to mysMaxThemeText Do Begin
If Not Found[Count] Then Begin
WriteLn;
WriteLn (^G'ERROR: Prompt #', Count, ' was not found. Theme file not created.');
WriteLn (^G'ERROR: Prompt #', Count, ' was not found. Theme file not created');
Erase (ThemeFile);
Halt (1);
End;
@ -153,7 +153,7 @@ Begin
ReWrite(TF);
If IoResult <> 0 Then Begin
WriteLn ('ERROR: Unable to create output file.');
WriteLn ('ERROR: Unable to create output file');
Halt(1);
End;

View File

@ -131,8 +131,8 @@ End;
Procedure TFTPServer.UpdateUserStats (TFBase: RecFileBase; FDir: RecFileList; DirPos: LongInt);
Var
HistFile: File of HistoryRec;
History : HistoryRec;
HistFile: File of RecHistory;
History : RecHistory;
FDirFile: File of RecFileList;
UserFile: File of RecUser;
Begin
@ -168,7 +168,7 @@ Begin
Close (FDirFile);
Assign (HistFile, bbsConfig.DataPath + 'history.dat');
ioReset (HistFile, SizeOf(HistoryRec), fmReadWrite + fmDenyWrite);
ioReset (HistFile, SizeOf(RecHistory), fmReadWrite + fmDenyWrite);
If IoResult <> 0 Then ReWrite(HistFile);

View File

@ -85,6 +85,8 @@ Begin
If Session.User.UserNum <> -1 Then Begin
Session.User.ThisUser.LastOn := CurDateDos;
Session.User.ThisUser.PeerIP := Session.UserIPInfo;
Session.User.ThisUser.PeerHost := Session.UserHostInfo;
If Session.TimerOn Then
If (Session.TimeOffset > 0) and (Session.TimeSaved > Session.TimeOffset) Then

View File

@ -278,7 +278,7 @@ Type
Birthday : LongInt;
Gender : Char; { M> Male F> Female }
Email : String[60]; { email address }
Optional : Array[1..10] of String[60];
OptionData : Array[1..10] of String[60];
UserInfo : String[30]; { user comment field }
Theme : String[20]; // user's theme file
AF1 : AccessFlagType;
@ -294,7 +294,7 @@ Type
ScreenSize : Byte; { user's screen length }
ScreenCols : Byte;
PeerIP : String[20];
PeerName : String[50];
PeerHost : String[50];
FirstOn : LongInt; { Date/Time of First Call }
LastOn : LongInt; { Date/Time of Last Call }
Calls : LongInt; { Number of calls to BBS }
@ -671,22 +671,24 @@ Type
(* file is always 10 records long with the most recent caller being the *)
(* 10th record. *)
LastOnRec = Record { CALLERS.DAT }
Handle : String[30]; { User's Name }
City : String[25]; { City/State }
Address : String[30]; { user's address }
Baud : String[6]; { Baud Rate }
DateTime : LongInt; { Date & Time (UNIX) }
Node : Byte; { Node number of login }
CallNum : LongInt; { Caller Number }
EmailAddr : String[35]; { email address }
UserInfo : String[30]; { user info field }
Option1 : String[35]; { optional data 1 }
Option2 : String[35]; { " " 2 }
Option3 : String[35]; { " " 3 }
RecLastOn = Record // CALLERS.DAT
DateTime : LongInt;
NewUser : Boolean;
PeerIP : String[15];
PeerHost : String[50];
Node : Byte;
CallNum : LongInt;
Handle : String[30];
City : String[25];
Address : String[30];
Gender : Char;
EmailAddr : String[35];
UserInfo : String[30];
OptionData : Array[1..10] of String[60];
Reserved : Array[1..53] of Byte;
End;
HistoryRec = Record
RecHistory = Record
Date : LongInt;
Emails : Word;
Posts : Word;
@ -696,6 +698,13 @@ Type
UploadKB : LongInt;
Calls : LongInt;
NewUsers : Word;
Telnet : Word;
FTP : Word;
POP3 : Word;
SMTP : Word;
NNTP : Word;
HTTP : Word;
Reserved : Array[1..26] of Byte;
End;
RecProtocol = Record

View File

@ -98,6 +98,7 @@ FUTURE / IDEAS / WORK IN PROGRESS / NOTES
rename them automatically.
- ANSI listbox is terribly inefficient with its output.
- So much cool stuff to do with the new themes
- LastOn revamp make sure its not global and new stuff is populated
RANDOM DRUNKEN BRAINDUMP AKA DESIGN DETAILS
===========================================