Some code reorg

This commit is contained in:
mysticbbs 2012-06-30 20:23:39 -04:00
parent 9750310b9b
commit 3e5b558071
21 changed files with 356 additions and 405 deletions

View File

@ -284,7 +284,7 @@ Begin
Template := strWordGet(2, Str, ';');
Keyword := strWordGet(3, Str, ';');
If Pos(PathChar, FN) = 0 Then FN := Session.Lang.TextPath + FN;
If Pos(PathChar, FN) = 0 Then FN := Session.Theme.TextPath + FN;
Assign (HelpFile, FN + '.hlp');
{$I-} Reset (HelpFile); {$I+}

View File

@ -124,7 +124,7 @@ Begin
'T' : Begin
Inc (Count, 2);
Session.io.BufAddStr(Session.io.Attr2Ansi(Session.Lang.Colors[strS2I(Code[2])]));
Session.io.BufAddStr(Session.io.Attr2Ansi(Session.Theme.Colors[strS2I(Code[2])]));
End;
Else
Session.io.BufAddChar(S[Count]);

View File

@ -192,7 +192,7 @@ Begin
Until false;
Session.io.OutFullLn ('|14Saving...');
assign (menufile, Session.lang.menupath + Session.Menu.menuname + '.mnu');
assign (menufile, Session.Theme.menupath + Session.Menu.menuname + '.mnu');
rewrite (menufile);
writeln (menufile, Session.Menu.Menu.header);
writeln (menufile, Session.Menu.Menu.prompt);
@ -231,21 +231,21 @@ Var
DirInfo: SearchRec;
A : Byte; {format dir output}
Begin
If session.lang.filename = '' then exit;
If session.Theme.filename = '' then exit;
Old := Session.Menu.MenuName;
OldLang := Session.Lang;
OldLang := Session.Theme;
Session.SystemLog ('*MENU EDITOR*');
Session.io.OutFull ('|CL');
Session.User.GetLanguage;
Repeat
Session.io.OutFullLn ('|CL|14Menu Editor (Language: ' + Session.Lang.Desc + ')|CR');
Session.io.OutFullLn ('|08Directory of ' + Session.lang.MenuPath + '*.MNU|CR|03');
Session.io.OutFullLn ('|CL|14Menu Editor (Language: ' + Session.Theme.Desc + ')|CR');
Session.io.OutFullLn ('|08Directory of ' + Session.Theme.MenuPath + '*.MNU|CR|03');
a := 0;
FindFirst (Session.lang.MenuPath + '*.mnu', Archive, DirInfo);
FindFirst (Session.Theme.MenuPath + '*.mnu', Archive, DirInfo);
While DosError = 0 Do Begin
inc (a);
Session.io.OutRaw (strPadR(DirInfo.Name, 25, ' '));
@ -264,7 +264,7 @@ Begin
Session.io.OutRaw ('Menu Name: ');
Session.menu.MenuName := Session.io.GetInput(mysMaxMenuNameLen, mysMaxMenuNameLen, 11, '');
If Session.Menu.MenuName <> '' Then Begin
Assign (MenuFile, Session.Lang.MenuPath + Session.Menu.MenuName + '.mnu');
Assign (MenuFile, Session.Theme.MenuPath + Session.Menu.MenuName + '.mnu');
{$I-} Reset(MenuFile); {$I+}
If IoResult = 0 Then
Session.io.OutRawLn ('Menu already exists')
@ -289,15 +289,15 @@ Begin
'D' : Begin
Session.io.OutRaw ('Menu to delete: ');
Session.Menu.MenuName := Session.io.GetInput(mysMaxMenuNameLen, mysMaxMenuNameLen, 11, '');
FileErase(Session.Lang.MenuPath + Session.Menu.MenuName + '.mnu');
FileErase(Session.Theme.MenuPath + Session.Menu.MenuName + '.mnu');
End;
'Q' : Break;
End;
Until False;
Session.Menu.MenuName := Old;
Session.Lang := OldLang;
Session.Theme := OldLang;
Close (Session.PromptFile);
Assign (Session.PromptFile, Config.DataPath + Session.Lang.FileName + '.thm');
Assign (Session.PromptFile, Config.DataPath + Session.Theme.FileName + '.thm');
Reset (Session.PromptFile);
End;

View File

@ -415,9 +415,9 @@ Begin
Session.io.AnsiColor(7);
Session.io.AnsiClear;
SavedTheme := Session.Lang;
SavedTheme := Session.Theme;
Move (Theme.Colors, Session.Lang.Colors, SizeOf(Theme.Colors));
Move (Theme.Colors, Session.Theme.Colors, SizeOf(Theme.Colors));
Box := TAnsiMenuBox.Create;
Input := TAnsiMenuInput.Create;
@ -553,7 +553,7 @@ Begin
Session.io.RemoteRestore(Image);
Session.Lang := SavedTheme;
Session.Theme := SavedTheme;
End;
Procedure EditBars (Var Theme: RecTheme);

View File

@ -22,36 +22,42 @@ var
Temp : String[2];
Begin
Session.SystemLog ('*VOTE EDITOR*');
Repeat
Session.io.OutFullLn ('|CL|14Voting Booth Editor|CR|CR|15## Question|CR|09-- ---------------------------------------');
Reset (VoteFile);
While Not Eof(VoteFile) do begin
Read (VoteFile, Vote);
Session.io.OutFullLn ('|15' + strPadR(strI2S(filepos(VoteFile)), 4, ' ') + '|14' + Vote.Question);
Reset (Session.VoteFile);
While Not Eof(Session.VoteFile) Do Begin
Read (Session.VoteFile, Session.Vote);
Session.io.OutFullLn ('|15' + strPadR(strI2S(FilePos(Session.VoteFile)), 4, ' ') + '|14' + Session.Vote.Question);
End;
Session.io.OutFull ('|CR|09(A)dd, (D)elete, (E)dit, (Q)uit? ');
case Session.io.OneKey ('ADEQ', True) of
'A' : If FileSize(VoteFile) = mysMaxVoteQuestion Then
Case Session.io.OneKey ('ADEQ', True) of
'A' : If FileSize(Session.VoteFile) = mysMaxVoteQuestion Then
Session.io.OutFullLn ('|CR|14Max # of questions is ' + strI2S(mysMaxVoteQuestion))
Else Begin
Vote.Votes := 0;
Vote.AnsNum := 1;
Vote.ACS := 's999';
Vote.AddACS := 's999';
Vote.ForceACS := 's999';
Vote.Question := 'New Question';
Vote.Answer[1].Text := 'New voting answer';
Vote.Answer[1].Votes := 0;
Seek (VoteFile, FileSize(VoteFile));
Write (VoteFile, Vote);
Session.Vote.Votes := 0;
Session.Vote.AnsNum := 1;
Session.Vote.ACS := 's999';
Session.Vote.AddACS := 's999';
Session.Vote.ForceACS := 's999';
Session.Vote.Question := 'New Question';
Session.Vote.Answer[1].Text := 'New voting answer';
Session.Vote.Answer[1].Votes := 0;
Seek (Session.VoteFile, FileSize(Session.VoteFile));
Write (Session.VoteFile, Session.Vote);
End;
'D' : begin
Session.io.OutRaw ('Delete which? ');
a := strS2I(Session.io.GetInput(3, 3, 11, ''));
If (A > 0) And (A <= FileSize(VoteFile)) Then Begin
If (A > 0) And (A <= FileSize(Session.VoteFile)) Then Begin
Session.io.OutFullLn ('|CRDeleting...');
KillRecord (VoteFile, A, SizeOf(VoteRec));
KillRecord (Session.VoteFile, A, SizeOf(VoteRec));
Reset (Session.User.UserFile);
While Not Eof(Session.User.UserFile) Do Begin
@ -70,76 +76,78 @@ Begin
end;
'E' : begin
Session.io.OutRaw ('Edit which? ');
a := strS2I(Session.io.GetInput(3, 3, 11, ''));
if (a > 0) and (a <= filesize(VoteFile)) then begin
seek (VoteFile, a-1);
read (VoteFile, Vote);
A := strS2I(Session.io.GetInput(3, 3, 11, ''));
If (A > 0) And (A <= FileSize(Session.VoteFile)) then begin
Seek (Session.VoteFile, A - 1);
Read (Session.VoteFile, Session.Vote);
repeat
Session.io.OutFullLn ('|CL|14Question ' + strI2S(FilePos(VoteFile)) + ' of ' + strI2S(FileSize(VoteFile)) + '|CR|03');
Session.io.OutRawln ('A. Question : ' + strPadR(Vote.Question, 60, ' '));
Session.io.OutRawLn ('B. Votes : ' + strI2S(Vote.Votes));
Session.io.OutRawLn ('C. Vote ACS : ' + Vote.ACS);
Session.io.OutRawLn ('E. Add ACS : ' + Vote.AddACS);
Session.io.OutRawLn ('F. Forced ACS : ' + Vote.ForceACS);
Session.io.OutFullLn ('|CL|14Question ' + strI2S(FilePos(Session.VoteFile)) + ' of ' + strI2S(FileSize(Session.VoteFile)) + '|CR|03');
Session.io.OutRawln ('A. Question : ' + strPadR(Session.Vote.Question, 60, ' '));
Session.io.OutRawLn ('B. Votes : ' + strI2S(Session.Vote.Votes));
Session.io.OutRawLn ('C. Vote ACS : ' + Session.Vote.ACS);
Session.io.OutRawLn ('E. Add ACS : ' + Session.Vote.AddACS);
Session.io.OutRawLn ('F. Forced ACS : ' + Session.Vote.ForceACS);
Session.io.OutFullLn ('|CR|15## Answer ## Answer');
Session.io.OutFullLn ('|09-- ----------------------------------- -- ------------------------------------');
For B := 1 to Vote.AnsNum Do Begin
Session.io.OutFull ('|11' + strZero(B) + ' |14' + strPadR(Vote.Answer[B].Text, 35, ' ') + ' ');
If (B Mod 2 = 0) or (B = Vote.AnsNum) Then Session.io.OutRawLn ('');
For B := 1 to Session.Vote.AnsNum Do Begin
Session.io.OutFull ('|11' + strZero(B) + ' |14' + strPadR(Session.Vote.Answer[B].Text, 35, ' ') + ' ');
If (B Mod 2 = 0) or (B = Session.Vote.AnsNum) Then Session.io.OutRawLn ('');
End;
Session.io.OutFull ('|CR|09(D)elete, (I)nsert, (Q)uit: ');
Temp := Session.io.GetInput(2, 2, 12, '');
If Temp = 'A' Then Vote.Question := Session.io.InXY(17, 3, 60, 70, 11, Vote.Question) Else
If Temp = 'B' Then Vote.Votes := strS2I(Session.io.InXY(17, 4, 5, 5, 12, strI2S(Vote.Votes))) Else
If Temp = 'C' Then Vote.ACS := Session.io.InXY(17, 5, 20, 20, 11, Vote.ACS) Else
If Temp = 'A' Then Session.Vote.Question := Session.io.InXY(17, 3, 60, 70, 11, Session.Vote.Question) Else
If Temp = 'B' Then Session.Vote.Votes := strS2I(Session.io.InXY(17, 4, 5, 5, 12, strI2S(Session.Vote.Votes))) Else
If Temp = 'C' Then Session.Vote.ACS := Session.io.InXY(17, 5, 20, 20, 11, Session.Vote.ACS) Else
If Temp = 'D' Then Begin
Session.io.OutFull ('Delete which answer? ');
A := strS2I(Session.io.GetInput(2, 2, 12, ''));
If (A > 0) and (A <= Vote.AnsNum) Then Begin
For C := A to Vote.AnsNum-1 Do
Vote.Answer[C] := Vote.Answer[C+1];
Dec (Vote.AnsNum);
If (A > 0) and (A <= Session.Vote.AnsNum) Then Begin
For C := A to Session.Vote.AnsNum-1 Do
Session.Vote.Answer[C] := Session.Vote.Answer[C+1];
Dec (Session.Vote.AnsNum);
Reset (Session.User.UserFile);
While Not Eof(Session.User.UserFile) Do Begin
Read (Session.User.UserFile, Session.User.TempUser);
If Session.User.TempUser.Vote[FilePos(VoteFile)] = A Then Begin
Session.User.TempUser.Vote[FilePos(VoteFile)] := 0;
If Session.User.TempUser.Vote[FilePos(Session.VoteFile)] = A Then Begin
Session.User.TempUser.Vote[FilePos(Session.VoteFile)] := 0;
Seek (Session.User.UserFile, FilePos(Session.User.UserFile) - 1);
Write (Session.User.UserFile, Session.User.TempUser);
End;
End;
Close (Session.User.UserFile);
If Session.User.ThisUser.Vote[FilePos(VoteFile)] = A Then
Session.User.ThisUser.Vote[FilePos(VoteFile)] := 0;
If Session.User.ThisUser.Vote[FilePos(Session.VoteFile)] = A Then
Session.User.ThisUser.Vote[FilePos(Session.VoteFile)] := 0;
End;
End Else
If Temp = 'E' Then Vote.AddACS := Session.io.InXY(17, 6, 20, 20, 11, Vote.AddACS) Else
If Temp = 'F' Then Vote.ForceACS := Session.io.InXY(17, 7, 20, 20, 11, Vote.ForceACS) Else
If (Temp = 'I') and (Vote.AnsNum < 15) Then Begin
Inc (Vote.AnsNum);
Vote.Answer[Vote.AnsNum].Text := '';
Vote.Answer[Vote.AnsNum].Votes := 0;
If Temp = 'E' Then Session.Vote.AddACS := Session.io.InXY(17, 6, 20, 20, 11, Session.Vote.AddACS) Else
If Temp = 'F' Then Session.Vote.ForceACS := Session.io.InXY(17, 7, 20, 20, 11, Session.Vote.ForceACS) Else
If (Temp = 'I') and (Session.Vote.AnsNum < 15) Then Begin
Inc (Session.Vote.AnsNum);
Session.Vote.Answer[Session.Vote.AnsNum].Text := '';
Session.Vote.Answer[Session.Vote.AnsNum].Votes := 0;
End Else
If Temp = 'Q' Then Break Else Begin
A := strS2I(Temp);
If (A > 0) and (A < 21) Then Begin
Session.io.OutRaw ('Answer: ');
Vote.Answer[A].Text := Session.io.GetInput (40, 40, 11, Vote.Answer[A].Text);
Session.Vote.Answer[A].Text := Session.io.GetInput (40, 40, 11, Session.Vote.Answer[A].Text);
Session.io.OutRaw ('Votes : ');
Vote.Answer[A].Votes := strS2I(Session.io.GetInput(5, 5, 12, strI2S(Vote.Answer[A].Votes)));
Session.Vote.Answer[A].Votes := strS2I(Session.io.GetInput(5, 5, 12, strI2S(Session.Vote.Answer[A].Votes)));
End;
End;
until false;
seek (VoteFile, filepos(VoteFile)-1);
write (VoteFile, Vote);
seek (Session.VoteFile, filepos(Session.VoteFile)-1);
write (Session.VoteFile, Session.Vote);
end;
end;
'Q' : break;
end;
until False;
close (VoteFile);
Until False;
Close (Session.VoteFile);
End;
End.
End.

View File

@ -26,7 +26,6 @@ Const
WinConsoleTitle = 'Mystic Node ';
CopyID = 'Copyright (C) ' + mysCopyYear + ' By James Coyle. All Rights Reserved.';
DateTypeStr : Array[1..4] of String[8] = ('MM/DD/YY', 'DD/MM/YY', 'YY/DD/MM', 'Ask ');
GetKeyFunc : Function (Forced : Boolean) : Boolean = NIL;
Var
Screen : TOutput;
@ -35,8 +34,6 @@ Var
ConfigFile : File of RecConfig;
ChatFile : File of ChatRec;
RoomFile : File of RoomRec;
VoteFile : File of VoteRec;
Vote : VoteRec;
Chat : ChatRec;
Room : RoomRec;
LastOnFile : File of RecLastOn;
@ -44,9 +41,6 @@ Var
Config : RecConfig;
StatusPtr : Byte = 1;
Procedure EditAccessFlags (Var Flags : AccessFlagType);
Function DrawAccessFlags (Var Flags : AccessFlagType) : String;
Function NoGetKeyFunc (Forced : Boolean) : Boolean;
Procedure KillRecord (Var dFile; RecNum: LongInt; RecSize: Word);
Procedure AddRecord (var dFile; RecNum: LongInt; RecSize: Word);
Function Bool_Search (Mask: String; Str: String) : Boolean;
@ -71,37 +65,6 @@ Uses
bbs_General,
MPL_Execute;
Function DrawAccessFlags (Var Flags : AccessFlagType) : String;
Var
S : String;
Ch : Char;
Begin
S := '';
For Ch := 'A' to 'Z' Do
If Ord(Ch) - 64 in Flags Then S := S + Ch Else S := S + '-';
DrawAccessFlags := S;
End;
Procedure EditAccessFlags (Var Flags : AccessFlagType);
Var
Ch : Char;
Begin
Repeat
Session.io.OutFull ('Toggle: [' + DrawAccessFlags(Flags) + '] (Enter/Done): ');
Ch := Session.io.OneKey('ABCDEFGHIJKLMNOPQRSTUVWXYZ'#13, True);
If Ch = #13 Then Break;
If Ord(Ch) - 64 in Flags Then
Flags := Flags - [Ord(Ch) - 64]
Else
Flags := Flags + [Ord(Ch) - 64];
Until False;
End;
Procedure AddRecord (var dFile; RecNum: LongInt; RecSize: Word);
Var
F : File Absolute dFile;
@ -155,7 +118,9 @@ Function Bool_Search (Mask: String; Str: String) : Boolean;
{ to search }
Begin
Bool_Search := True;
If Mask = '' Then Exit;
Bool_Search := Pos(strUpper(Mask), strUpper(Str)) > 0;
End;
@ -203,19 +168,14 @@ Begin
Result := Temp;
End;
Function NoGetKeyFunc (Forced : Boolean): Boolean;
Begin
Result := False;
End;
Function ShellDOS (ExecPath: String; Command: String) : LongInt;
{$IFNDEF UNIX}
Var
Image : TConsoleImageRec;
{$ENDIF}
{$IFNDEF UNIX}
Var
Image : TConsoleImageRec;
{$ENDIF}
Begin
{$IFDEF WINDOWS}
ExecInheritsHandles := True;
ExecInheritsHandles := True;
{$ENDIF}
If Session.User.UserNum <> -1 Then Begin
@ -226,10 +186,10 @@ Begin
End;
{$IFNDEF UNIX}
Screen.GetScreenImage(1, 1, 80, 25, Image);
Screen.SetWindow (1, 1, 80, 25, False);
Screen.TextAttr := 7;
Screen.ClearScreen;
Screen.GetScreenImage(1, 1, 80, 25, Image);
Screen.SetWindow (1, 1, 80, 25, False);
Screen.TextAttr := 7;
Screen.ClearScreen;
{$ENDIF}
{$IFDEF UNIX}
@ -268,15 +228,29 @@ Begin
Reset (Session.PromptFile);
{$IFNDEF UNIX}
Screen.PutScreenImage(Image);
UpdateStatusLine(StatusPtr, '');
Screen.PutScreenImage(Image);
UpdateStatusLine(StatusPtr, '');
{$ENDIF}
Session.TimeOut := TimerSeconds;
Session.TimeOut := TimerSeconds;
End;
{$IFNDEF UNIX}
Procedure UpdateStatusLine (Mode: Byte; Str: String);
Function DrawAccessFlags (Var Flags : AccessFlagType) : String;
Var
S : String;
Ch : Char;
Begin
S := '';
For Ch := 'A' to 'Z' Do
If Ord(Ch) - 64 in Flags Then S := S + Ch Else S := S + '-';
Result := S;
End;
Begin
If Not Config.UseStatusBar Then Exit;
@ -377,6 +351,4 @@ Begin
End;
{$ENDIF}
Begin
GetKeyFunc := NoGetKeyFunc;
End.

View File

@ -29,13 +29,15 @@ Type
IO : TBBSIO;
Client : TSocketClass;
EventFile : File of EventRec;
LangFile : File of RecTheme;
ThemeFile : File of RecTheme;
VoteFile : File of VoteRec;
Vote : VoteRec;
CommHandle : LongInt;
ShutDown : Boolean;
TempPath : String;
Event : EventRec;
NextEvent : EventRec;
Lang : RecTheme;
Theme : RecTheme;
LocalMode : Boolean;
Baud : LongInt;
ExitLevel : Byte;
@ -336,23 +338,23 @@ Function TBBSCore.LoadThemeData (Str: String) : Boolean;
Begin
Result := False;
Reset (LangFile);
Reset (ThemeFile);
While Not Eof(LangFile) Do Begin
Read (LangFile, Lang);
While Not Eof(ThemeFile) Do Begin
Read (ThemeFile, Theme);
{$IFDEF FS_SENSITIVE}
If Lang.FileName = Str Then Begin
{$ELSE}
If strUpper(Lang.FileName) = strUpper(Str) Then Begin
If strUpper(Theme.FileName) = strUpper(Str) Then Begin
{$ENDIF}
If Not FileExist(Config.DataPath + Lang.FileName + '.thm') Then Break;
If Not FileExist(Config.DataPath + Theme.FileName + '.thm') Then Break;
{$I-} Close (PromptFile); {$I+}
If IoResult <> 0 Then;
Assign (PromptFile, Config.DataPath + Lang.FileName + '.thm');
Assign (PromptFile, Config.DataPath + Theme.FileName + '.thm');
Result := ioReset(PromptFile, SizeOf(RecPrompt), fmRWDN);
@ -360,7 +362,7 @@ Begin
End;
End;
Close (LangFile);
Close (ThemeFile);
End;
End.

View File

@ -121,7 +121,7 @@ Begin
Write (tFile, Session.io.Graphics, Ending);
Write (tFile, Ord(Not Session.LocalMode), Ending);
Write (tFile, (Session.TimeLeft * 60), Ending);
Write (tFile, Session.Lang.TextPath + Ending);
Write (tFile, Session.Theme.TextPath + Ending);
Write (tFile, Config.DataPath + Ending);
Write (tFile, 'SYSOP.', Session.NodeNum, Ending);
If Session.LocalMode Then

View File

@ -514,7 +514,7 @@ Var
Begin
Session.io.AnsiGotoXY (1, QuoteCurLine + Session.io.ScreenInfo[2].Y);
If On Then
Session.io.AnsiColor (Session.Lang.QuoteColor)
Session.io.AnsiColor (Session.Theme.QuoteColor)
Else
Session.io.AnsiColor (Session.io.ScreenInfo[2].A);

View File

@ -1642,7 +1642,7 @@ Var
Screen.TextAttr := 255;
Insert (
Session.io.Attr2Ansi(Session.Lang.FileDescLo),
Session.io.Attr2Ansi(Session.Theme.FileDescLo),
Temp,
Pos(Data, strUpper(Temp)) + Length(Data)
);
@ -1650,7 +1650,7 @@ Var
Screen.TextAttr := 255;
Insert (
Session.io.Attr2Ansi(Session.Lang.FileDescHi),
Session.io.Attr2Ansi(Session.Theme.FileDescHi),
Temp,
Pos(Data, strUpper(Temp)));
@ -1855,7 +1855,7 @@ Var
For A := 1 to BatchNum Do
If Batch[A].FileName = FDir.FileName Then Begin
List[ListSize + 1].Batch := True;
Session.io.PromptInfo[3] := Session.Lang.TagChar;
Session.io.PromptInfo[3] := Session.Theme.TagChar;
Break;
End;
@ -1920,7 +1920,7 @@ Var
BotPage := FilePos(FDirFile) - 1;
LastPage := Eof(FDirFile) And (BotDesc = 0) And Not IsNotLast;
IsNotLast := False;
Str := Session.io.DrawPercent(Session.Lang.FileBar, BotPage, FileSize(FDirFile), A);
Str := Session.io.DrawPercent(Session.Theme.FileBar, BotPage, FileSize(FDirFile), A);
If Found Then Begin
If (ListType = 1) and (Session.io.ScreenInfo[5].Y <> 0) Then Begin
@ -1944,7 +1944,7 @@ Var
Session.io.PromptInfo[2] := List[CurPos].FileName;
If List[CurPos].Batch Then
Session.io.PromptInfo[3] := Session.Lang.TagChar
Session.io.PromptInfo[3] := Session.Theme.TagChar
Else
Session.io.PromptInfo[3] := ' ';
@ -1979,7 +1979,7 @@ Var
Session.io.PromptInfo[2] := List[CurPos].FileName;
If List[CurPos].Batch Then
Session.io.PromptInfo[3] := Session.Lang.TagChar
Session.io.PromptInfo[3] := Session.Theme.TagChar
Else
Session.io.PromptInfo[3] := ' ';

View File

@ -597,17 +597,18 @@ Var
Begin
If Not Session.io.GetYN (Session.GetPrompt(275), True) Then Exit;
Reset (VoteFile);
If FileSize (VoteFile) = mysMaxVoteQuestion Then Begin
Close (VoteFile);
Reset (Session.VoteFile);
If FileSize (Session.VoteFile) = mysMaxVoteQuestion Then Begin
Close (Session.VoteFile);
Session.io.OutFull (Session.GetPrompt(276));
Exit;
End;
Close (VoteFile);
Close (Session.VoteFile);
Session.io.OutFull (Session.GetPrompt(277));
Vote.Question := Session.io.GetInput(78, 78, 11, '');
If Vote.Question = '' Then Exit;
Session.Vote.Question := Session.io.GetInput(78, 78, 11, '');
If Session.Vote.Question = '' Then Exit;
Session.io.OutFullLn (Session.GetPrompt(278));
@ -616,30 +617,30 @@ Begin
While A <= 15 Do Begin
Session.io.PromptInfo[1] := strI2S(A);
Session.io.OutFull (Session.GetPrompt(279));
Vote.Answer[A].Text := Session.io.GetInput(40, 40, 11, '');
If Vote.Answer[A].Text = '' Then Begin
Session.Vote.Answer[A].Text := Session.io.GetInput(40, 40, 11, '');
If Session.Vote.Answer[A].Text = '' Then Begin
Dec (A);
Break;
End;
Vote.Answer[A].Votes := 0;
Session.Vote.Answer[A].Votes := 0;
Inc(A);
End;
If A = 0 Then Exit;
Vote.AnsNum := A;
Vote.Votes := 0;
Vote.ACS := '';
Vote.AddACS := 's999';
Vote.ForceACS := 's999';
Session.Vote.AnsNum := A;
Session.Vote.Votes := 0;
Session.Vote.ACS := '';
Session.Vote.AddACS := 's999';
Session.Vote.ForceACS := 's999';
If Session.io.GetYN(Session.GetPrompt(280), True) Then Vote.AddACS := '';
If Session.io.GetYN(Session.GetPrompt(280), True) Then Session.Vote.AddACS := '';
If Session.io.GetYN(Session.GetPrompt(281), True) Then Begin
Reset (VoteFile);
Seek (VoteFile, FileSize(VoteFile));
Write (VoteFile, Vote);
Close (VoteFile);
Reset (Session.VoteFile);
Seek (Session.VoteFile, FileSize(Session.VoteFile));
Write (Session.VoteFile, Session.Vote);
Close (Session.VoteFile);
End;
End;
@ -649,25 +650,26 @@ Function Voting_List : Byte;
Var
Total : Byte;
Begin
Reset (VoteFile);
Reset (Session.VoteFile);
Session.io.OutFullLn (Session.GetPrompt(241));
Total := 0;
While Not Eof(VoteFile) Do Begin
Read (VoteFile, Vote);
If Session.User.Access(Vote.ACS) Then Begin
While Not Eof(Session.VoteFile) Do Begin
Read (Session.VoteFile, Session.Vote);
If Session.User.Access(Session.Vote.ACS) Then Begin
Inc (Total);
Session.io.PromptInfo[1] := strI2S(Total);
Session.io.PromptInfo[2] := Vote.Question;
If Session.User.ThisUser.Vote[FilePos(VoteFile)] = 0 Then
Session.io.PromptInfo[2] := Session.Vote.Question;
If Session.User.ThisUser.Vote[FilePos(Session.VoteFile)] = 0 Then
Session.io.PromptInfo[3] := '*' //++lang
Else
Session.io.PromptInfo[3] := ' ';
Session.io.OutFullLn (Session.GetPrompt(242));
End;
End;
Close (VoteFile);
Close (Session.VoteFile);
If Total = 0 Then Session.io.OutFullLn (Session.GetPrompt(243));
Voting_List := Total;
@ -678,12 +680,12 @@ Var
A : SmallInt;
P : SmallInt;
Begin
Reset (VoteFile);
Reset (Session.VoteFile);
If (Data > 0) and (Data <= FileSize(VoteFile)) Then Begin
Seek (VoteFile, Data - 1);
Read (VoteFile, Vote);
Close (VoteFile);
If (Data > 0) and (Data <= FileSize(Session.VoteFile)) Then Begin
Seek (Session.VoteFile, Data - 1);
Read (Session.VoteFile, Session.Vote);
Close (Session.VoteFile);
End Else Begin
A := Voting_List;
If A = 0 Then Exit;
@ -696,27 +698,27 @@ Begin
If P <= A Then Break;
Until False;
Reset (VoteFile);
Reset (Session.VoteFile);
A := 0;
Repeat
Read (VoteFile, Vote);
If Session.User.Access(Vote.ACS) Then Inc(A);
Read (Session.VoteFile, Session.Vote);
If Session.User.Access(Session.Vote.ACS) Then Inc(A);
Until A = P;
Close (VoteFile);
Close (Session.VoteFile);
End;
Session.io.PromptInfo[1] := Vote.Question;
Session.io.PromptInfo[2] := strI2S(Vote.Votes);
Session.io.PromptInfo[1] := Session.Vote.Question;
Session.io.PromptInfo[2] := strI2S(Session.Vote.Votes);
Session.io.OutFullLn (Session.GetPrompt(249));
For A := 1 to Vote.AnsNum Do Begin
For A := 1 to Session.Vote.AnsNum Do Begin
Session.io.PromptInfo[1] := strI2S(A);
Session.io.PromptInfo[2] := Vote.Answer[A].Text;
Session.io.PromptInfo[3] := strI2S(Vote.Answer[A].Votes);
If Vote.Votes = 0 Then Begin
Session.io.PromptInfo[2] := Session.Vote.Answer[A].Text;
Session.io.PromptInfo[3] := strI2S(Session.Vote.Answer[A].Votes);
If Session.Vote.Votes = 0 Then Begin
Session.io.PromptInfo[4] := '0';
Session.io.PromptInfo[5] := '';
End Else Begin
Session.io.PromptInfo[5] := Session.io.DrawPercent(Session.Lang.VotingBar, Vote.Answer[A].Votes, Vote.Votes, P);
Session.io.PromptInfo[5] := Session.io.DrawPercent(Session.Theme.VotingBar, Session.Vote.Answer[A].Votes, Session.Vote.Votes, P);
Session.io.PromptInfo[4] := strI2S(P);
End;
Session.io.OutFullLn (Session.GetPrompt(250));
@ -729,15 +731,15 @@ Var
NewQues : Array[1..mysMaxVoteQuestion] of Boolean;
Pos : Byte;
Begin
Reset (VoteFile);
While Not Eof(VoteFile) Do Begin
Read (VoteFile, Vote);
If Session.User.Access(Vote.ACS) Then
NewQues[FilePos(VoteFile)] := (Session.User.ThisUser.Vote[FilePos(VoteFile)] = 0)
Reset (Session.VoteFile);
While Not Eof(Session.VoteFile) Do Begin
Read (Session.VoteFile, Session.Vote);
If Session.User.Access(Session.Vote.ACS) Then
NewQues[FilePos(Session.VoteFile)] := (Session.User.ThisUser.Vote[FilePos(Session.VoteFile)] = 0)
Else
NewQues[FilePos(VoteFile)] := False;
NewQues[FilePos(Session.VoteFile)] := False;
End;
Close (VoteFile);
Close (Session.VoteFile);
For Pos := 1 to mysMaxVoteQuestion Do
If NewQues[Pos] Then Voting_Booth (False, Pos);
@ -764,29 +766,29 @@ Begin
Until False;
Total := 0;
Reset (VoteFile);
Reset (Session.VoteFile);
Repeat
Read (VoteFile, Vote);
If Session.User.Access(Vote.ACS) Then Inc(Total);
Read (Session.VoteFile, Session.Vote);
If Session.User.Access(Session.Vote.ACS) Then Inc(Total);
Until Total = Temp;
End Else Begin
Reset (VoteFile);
If Num > FileSize(VoteFile) Then Begin
Close (VoteFile);
Reset (Session.VoteFile);
If Num > FileSize(Session.VoteFile) Then Begin
Close (Session.VoteFile);
Exit;
End;
Seek (VoteFile, Num - 1);
Read (VoteFile, Vote);
Seek (Session.VoteFile, Num - 1);
Read (Session.VoteFile, Session.Vote);
End;
VPos := FilePos(VoteFile);
VPos := FilePos(Session.VoteFile);
Repeat
Session.io.PromptInfo[1] := Vote.Question;
Session.io.PromptInfo[1] := Session.Vote.Question;
Session.io.OutFullLn (Session.GetPrompt(245));
For Temp := 1 to Vote.AnsNum Do Begin
For Temp := 1 to Session.Vote.AnsNum Do Begin
Session.io.PromptInfo[1] := strI2S(Temp);
Session.io.PromptInfo[2] := Vote.Answer[Temp].Text;
Session.io.PromptInfo[2] := Session.Vote.Answer[Temp].Text;
If Session.User.ThisUser.Vote[VPos] = Temp Then
Session.io.PromptInfo[3] := '*' //++lang
Else
@ -794,8 +796,8 @@ Begin
Session.io.OutFullLn (Session.GetPrompt(246));
End;
If Session.User.Access(Vote.AddACS) and (Vote.AnsNum < 15) Then Begin
Session.io.PromptInfo[1] := strI2S(Vote.AnsNum + 1);
If Session.User.Access(Session.Vote.AddACS) and (Session.Vote.AnsNum < 15) Then Begin
Session.io.PromptInfo[1] := strI2S(Session.Vote.AnsNum + 1);
Session.io.PromptInfo[2] := Session.GetPrompt(252);
Session.io.PromptInfo[3] := ' ';
Session.io.OutFullLn (Session.GetPrompt(246));
@ -804,33 +806,33 @@ Begin
Session.io.OutFull (Session.GetPrompt(247));
Temp := strS2I(Session.io.GetInput(2, 2, 12, ''));
If (Vote.AnsNum < 15) and Session.User.Access(Vote.AddACS) and (Temp = Succ(Vote.AnsNum)) Then Begin
If (Session.Vote.AnsNum < 15) and Session.User.Access(Session.Vote.AddACS) and (Temp = Succ(Session.Vote.AnsNum)) Then Begin
Session.io.OutFull (Session.GetPrompt(253));
Str := Session.io.GetInput (40, 40, 11, '');
If Str <> '' Then Begin
Inc (Vote.AnsNum);
Vote.Answer[Vote.AnsNum].Text := Str;
Vote.Answer[Vote.AnsNum].Votes := 0;
Inc (Session.Vote.AnsNum);
Session.Vote.Answer[Session.Vote.AnsNum].Text := Str;
Session.Vote.Answer[Session.Vote.AnsNum].Votes := 0;
End;
End;
If (Temp > 0) and (Temp <= Vote.AnsNum) Then Begin
If (Temp > 0) and (Temp <= Session.Vote.AnsNum) Then Begin
If Session.User.ThisUser.Vote[VPos] <> 0 Then Begin
Dec (Vote.Answer[Session.User.ThisUser.Vote[VPos]].Votes);
Dec (Vote.Votes);
Dec (Session.Vote.Answer[Session.User.ThisUser.Vote[VPos]].Votes);
Dec (Session.Vote.Votes);
End;
Inc(Vote.Answer[Temp].Votes);
Inc(Vote.Votes);
Inc(Session.Vote.Answer[Temp].Votes);
Inc(Session.Vote.Votes);
Session.User.ThisUser.Vote[VPos] := Temp;
Seek (VoteFile, VPos - 1);
Write (VoteFile, Vote);
Seek (Session.VoteFile, VPos - 1);
Write (Session.VoteFile, Session.Vote);
Break;
End Else
If Forced Then Session.io.OutFull (Session.GetPrompt(254)) Else Break;
Until False;
Close (VoteFile);
Close (Session.VoteFile);
If Session.io.GetYN (Session.GetPrompt(248), True) Then Voting_Result(VPos);
End;
@ -1099,7 +1101,7 @@ Var
If CurPos > CurBot Then CurPos := CurBot;
Session.io.PromptInfo[1] := Session.io.DrawPercent(Session.Lang.GalleryBar, CurBot, DirCount, Count);
Session.io.PromptInfo[1] := Session.io.DrawPercent(Session.Theme.GalleryBar, CurBot, DirCount, Count);
Session.io.PromptInfo[2] := strI2S(Count);
Session.io.OutFull(Session.GetPrompt(472));

View File

@ -21,36 +21,39 @@ Const
MaxPromptInfo = 15;
Type
TGetKeyCallBack = Function (Forced: Boolean) : Boolean Is Nested;
TBBSIO = Class
Core : Pointer;
Term : TTermAnsi;
ScreenInfo : Array[0..9] of Record X, Y, A : Byte; End;
PromptInfo : Array[1..MaxPromptInfo] of String[89];
FmtString : Boolean;
FmtLen : Byte;
FmtType : Byte;
InMacro : Boolean;
InMacroPos : Byte;
InMacroStr : String;
BaudEmulator : Byte;
AllowPause : Boolean;
AllowMCI : Boolean;
LocalInput : Boolean;
AllowArrow : Boolean;
IsArrow : Boolean;
UseInField : Boolean;
UseInLimit : Boolean;
UseInSize : Boolean;
InLimit : Byte;
InSize : Byte;
AllowAbort : Boolean;
Aborted : Boolean;
NoFile : Boolean;
Graphics : Byte;
PausePtr : Byte;
InputData : Array[1..mysMaxInputHistory] of String[255];
LastMCIValue : String;
InputPos : Byte;
Core : Pointer;
Term : TTermAnsi;
ScreenInfo : Array[0..9] of Record X, Y, A : Byte; End;
PromptInfo : Array[1..MaxPromptInfo] of String[89];
FmtString : Boolean;
FmtLen : Byte;
FmtType : Byte;
InMacro : Boolean;
InMacroPos : Byte;
InMacroStr : String;
BaudEmulator : Byte;
AllowPause : Boolean;
AllowMCI : Boolean;
LocalInput : Boolean;
AllowArrow : Boolean;
IsArrow : Boolean;
UseInField : Boolean;
UseInLimit : Boolean;
UseInSize : Boolean;
InLimit : Byte;
InSize : Byte;
AllowAbort : Boolean;
Aborted : Boolean;
NoFile : Boolean;
Graphics : Byte;
PausePtr : Byte;
InputData : Array[1..mysMaxInputHistory] of String[255];
LastMCIValue : String;
InputPos : Byte;
GetKeyCallBack : TGetKeyCallBack;
{$IFDEF WINDOWS}
OutBuffer : Array[0..TBBSIOBufferSize] of Char;
@ -585,7 +588,7 @@ Begin
End;
'T' : Case Code[2] of
'0'..
'9' : LastMCIValue := Attr2Ansi(Session.Lang.Colors[strS2I(Code[2])]);
'9' : LastMCIValue := Attr2Ansi(Session.Theme.Colors[strS2I(Code[2])]);
'B' : LastMCIValue := strI2S(TBBSCore(Core).User.ThisUser.TimeBank);
'C' : LastMCIValue := strI2S(Config.SystemCalls);
'E' : If Graphics = 1 Then LastMCIValue := 'Ansi' Else LastMCIValue := 'Ascii'; //++lang
@ -622,7 +625,7 @@ Begin
1 : LastMCIValue := 'Lightbar'; {++lang}
End;
'K' : LastMCIValue := TBBSCore(Core).User.ThisUser.Email;
'L' : LastMCIValue := TBBSCore(Core).Lang.Desc;
'L' : LastMCIValue := TBBSCore(Core).Theme.Desc;
'M' : LastMCIValue := OutON(TBBSCore(Core).User.ThisUser.UseLBMIdx);
'N' : LastMCIValue := TBBSCore(Core).User.ThisUser.RealName;
'P' : LastMCIValue := TBBSCore(Core).User.ThisUser.HomePhone;
@ -716,7 +719,7 @@ Begin
Inc (B);
FSplit (strStripLOW(Copy(Str, A + 1, B - A - 1)), D, N, E);
OutFile (TBBSCore(Core).Lang.TextPath + N + E, True, 0);
OutFile (TBBSCore(Core).Theme.TextPath + N + E, True, 0);
A := B;
@ -947,7 +950,7 @@ Var
Begin
If Pos(PathChar, FName) = 0 Then
FName := TBBSCore(Core).Lang.TextPath + FName;
FName := TBBSCore(Core).Theme.TextPath + FName;
If Pos('.', FName) > 0 Then
Ext := ''
@ -1027,7 +1030,7 @@ Begin
Str := Str + GetChar;
End;
OutFile (TBBSCore(Core).Lang.TextPath + strStripLOW(Str), True, 0);
OutFile (TBBSCore(Core).Theme.TextPath + strStripLOW(Str), True, 0);
Continue;
End;
@ -1249,10 +1252,11 @@ Begin
Repeat
If LastSec <> TimerSeconds Then Begin
If GetKeyFunc(False) Then Begin
Result := #02;
Exit;
End;
If Assigned(GetKeyCallBack) Then
If GetKeyCallBack(False) Then Begin
Result := #02;
Exit;
End;
LastSec := TimerSeconds;
@ -1377,7 +1381,7 @@ End;
Function TBBSIO.GetYN (Str: String; Yes: Boolean) : Boolean;
Begin
If (TBBSCore(Core).Lang.Flags AND ThmLightbarYN <> 0) and (Graphics = 1) Then Begin
If (TBBSCore(Core).Theme.Flags AND ThmLightbarYN <> 0) and (Graphics = 1) Then Begin
GetYN := GetYNL(Str, Yes);
Exit;
End;
@ -1407,7 +1411,9 @@ Begin
Repeat
OutFull (Str);
Temp := GetInput(15, 15, 16, '');
If Temp = PW Then
Exit
Else Begin
@ -1467,7 +1473,7 @@ Var
Procedure pWrite (Str : String);
Begin
If (Mode = 6) and (Str <> '') Then
BufAddStr (strRep(TBBSCore(Core).Lang.EchoChar, Length(Str)))
BufAddStr (strRep(TBBSCore(Core).Theme.EchoChar, Length(Str)))
Else
BufAddStr (Str);
End;
@ -1477,9 +1483,9 @@ Var
AnsiMoveX (xPos);
pWrite (Copy(Str, Junk, Field));
If UseInField Then AnsiColor(TBBSCore(Core).Lang.FieldColor2);
If UseInField Then AnsiColor(TBBSCore(Core).Theme.FieldColor2);
pWrite (strRep(FieldCh, Field - Length(Copy(Str, Junk, Field))));
If UseInField Then AnsiColor(TBBSCore(Core).Lang.FieldColor1);
If UseInField Then AnsiColor(TBBSCore(Core).Theme.FieldColor1);
AnsiMoveX (xPos + CurPos - 1);
End;
@ -1487,9 +1493,9 @@ Var
Procedure ReDrawPart;
Begin
pWrite (Copy(Str, StrPos, Field - CurPos + 1));
If UseInField Then AnsiColor(TBBSCore(Core).Lang.FieldColor2);
If UseInField Then AnsiColor(TBBSCore(Core).Theme.FieldColor2);
pWrite (strRep(FieldCh, (Field - CurPos + 1) - Length(Copy(Str, StrPos, Field - CurPos + 1))));
If UseInField Then AnsiColor(TBBSCore(Core).Lang.FieldColor1);
If UseInField Then AnsiColor(TBBSCore(Core).Theme.FieldColor1);
AnsiMoveX (xPos + CurPos - 1);
End;
@ -1546,11 +1552,11 @@ Begin
Dec (Mode, 10);
If UseInField and (Graphics = 1) Then Begin
FieldCh := TBBSCore(Core).Lang.FieldChar;
FieldCh := TBBSCore(Core).Theme.FieldChar;
AnsiColor (TBBSCore(Core).Lang.FieldColor2);
AnsiColor (TBBSCore(Core).Theme.FieldColor2);
BufAddStr (strRep(FieldCh, Field));
AnsiColor (TBBSCore(Core).Lang.FieldColor1);
AnsiColor (TBBSCore(Core).Theme.FieldColor1);
AnsiMoveX (xPos);
End Else
UseInField := False;
@ -1654,9 +1660,9 @@ Begin
ScrollLeft
Else
If StrPos = Length(Str) + 1 Then Begin
If UseInField Then AnsiColor(TBBSCore(Core).Lang.FieldColor2);
If UseInField Then AnsiColor(TBBSCore(Core).Theme.FieldColor2);
BufAddStr (#8 + FieldCh + #8);
If UseInField Then AnsiColor(TBBSCore(Core).Lang.FieldColor1);
If UseInField Then AnsiColor(TBBSCore(Core).Theme.FieldColor1);
Dec (CurPos);
End Else Begin
BufAddChar (#8);

View File

@ -232,7 +232,7 @@ Begin
'?' : Begin
// online ANSI help system (BBSHTML) prototype
Help := TAnsiMenuHelp.Create;
Help.OpenHelp (Session.Lang.TextPath + Data + ';ansihelp;INDEX');
Help.OpenHelp (Session.Theme.TextPath + Data + ';ansihelp;INDEX');
Help.Free;
End;
End;
@ -345,7 +345,7 @@ Begin
{$IFDEF LOGGING} Session.SystemLog('Load menu: ' + MenuName); {$ENDIF}
Assign (MenuFile, Session.Lang.MenuPath + MenuName + '.mnu');
Assign (MenuFile, Session.Theme.MenuPath + MenuName + '.mnu');
{$I-} Reset (MenuFile); {$I+}
If IoResult <> 0 Then Begin
@ -648,7 +648,7 @@ Var
Session.io.PurgeInputBuffer;
Listed := 0;
Listed := 0;
Session.io.AllowArrow := True;
If HotKeys Then Begin
@ -663,6 +663,7 @@ Var
Session.io.BufAddChar (Temp[1]);
Repeat
Ch := UpCase(Session.io.GetKey);
Case Ch of
#08 : If Length(Temp) > 0 Then Begin
Dec (Temp[0]);

View File

@ -158,8 +158,8 @@ Var
Count : Integer;
Temp : MScanRec;
Begin
Temp.NewScan := MBase.DefNScan;
Temp.QwkScan := MBase.DefQScan;
Temp.NewScan := MBase.DefNScan;
Temp.QwkScan := MBase.DefQScan;
Assign (MScanFile, MBase.Path + MBase.FileName + '.scn');
{$I-} Reset (MScanFile); {$I+}
@ -1083,7 +1083,7 @@ Begin
If Not Session.LocalMode Then FileErase(FN);
DirClean(Session.TempPath, 'msgtmp');
DirClean (Session.TempPath, 'msgtmp');
Session.io.PromptInfo[1] := T1;
Session.io.PromptInfo[2] := T2;
@ -1408,7 +1408,7 @@ Var
Session.io.OutRawLn ('');
End;
Temp := Session.io.DrawPercent(Session.Lang.MsgBar, PageEnd - 1, Lines, A);
Temp := Session.io.DrawPercent(Session.Theme.MsgBar, PageEnd - 1, Lines, A);
If Session.io.ScreenInfo[4].Y <> 0 Then Begin
Session.io.AnsiGotoXY (Session.io.ScreenInfo[4].X, Session.io.ScreenInfo[4].Y);
@ -1716,7 +1716,7 @@ Var
Session.io.PromptInfo[4] := MsgTo;
If NewMsgs Then
Session.io.PromptInfo[5] := Session.Lang.NewMsgChar
Session.io.PromptInfo[5] := Session.Theme.NewMsgChar
Else
Session.io.PromptInfo[5] := ' ';
End;
@ -1824,7 +1824,7 @@ Var
Session.io.PromptInfo[4] := MsgInfo[PagePos].MsgTo;
If MsgInfo[PagePos].NewMsgs Then
Session.io.PromptInfo[5] := Session.Lang.NewMsgChar
Session.io.PromptInfo[5] := Session.Theme.NewMsgChar
Else
Session.io.PromptInfo[5] := ' ';
@ -2689,7 +2689,7 @@ Begin
End;
Session.User.IgnoreGroup := Pos('/G', Data) > 0;
WereMsgs := False;
WereMsgs := False;
Session.io.OutRawLn ('');
@ -2768,12 +2768,12 @@ Begin
End;
End;
Session.io.OutFull (Session.GetPrompt(311));
Session.io.OutFull (Session.GetPrompt(311));
Close (MBaseFile);
End;
Session.User.IgnoreGroup := False;
MBase := OLD;
MBase := OLD;
End;
Procedure TMsgBase.SendMassEmail;
@ -3416,10 +3416,9 @@ Begin
End;
Procedure TMsgBase.MessageQuickScan (Data: String);
// defaults to ALL mode
// defaults to ALL groups/bases
// /CURRENT = scan only current message base
// /GROUP = scan only current group bases
// /ALL = scan all bases in all groups
// options:
// /NOSCAN = do not show "scanning" prompt
// /NOFOOT = do not show "end of scan" prompt
@ -3538,6 +3537,7 @@ Begin
If Session.User.Access(MBase.ReadACS) Then Begin
GetMessageScan;
If MScan.NewScan > 0 Then ScanBase;
End;
End;

View File

@ -390,7 +390,7 @@ Begin
Session.AllowMessages := False;
GetKeyFunc := GetKeyNodeChatFunc;
Session.io.GetKeyCallBack := GetKeyNodeChatFunc;
Repeat
Session.io.PromptInfo[1] := Session.User.ThisUser.Handle;
@ -405,7 +405,7 @@ Begin
Str := Session.io.GetInput (79 - Screen.CursorX + 1, 250, 11, '');
If Str[1] = '/' Then Begin
GetKeyFunc := NoGetKeyFunc;
Session.io.GetKeyCallBack := NIL;
Str2 := strUpper(strWordGet(1, Str, ' '));
@ -465,7 +465,7 @@ Begin
Send_Node_Message (7, '0;Topic changed to "' + Room.Name + '"', CurRoom); // ++lang
End;
GetKeyFunc := GetKeyNodeChatFunc;
Session.io.GetKeyCallBack := GetKeyNodeChatFunc;
End Else
If Str <> '' Then Begin
Send_Node_Message (1, '0;' + Str, CurRoom);
@ -474,7 +474,8 @@ Begin
End;
Until False;
GetKeyFunc := NoGetKeyFunc;
Session.io.GetKeyCallBack := NIL;
Chat.InChat := False;
Chat.Available := Avail;

View File

@ -413,7 +413,7 @@ Procedure TBBSUser.DetectGraphics;
Var
Loop : Byte;
Begin
If Session.Lang.Flags AND ThmAllowANSI = 0 Then Begin
If Session.Theme.Flags AND ThmAllowANSI = 0 Then Begin
Session.io.Graphics := 0;
Exit;
End;
@ -803,20 +803,20 @@ Var
A : Byte;
Begin
T := 0;
Old := Session.Lang;
Old := Session.Theme;
Session.io.OutFullLn (Session.GetPrompt(182));
Reset (Session.LangFile);
Reset (Session.ThemeFile);
Repeat
Read (Session.LangFile, Session.Lang);
If ((Session.Lang.Flags AND ThmAllowASCII = 0) and (Session.io.Graphics = 0)) or
((Session.Lang.Flags AND ThmAllowANSI = 0) and (Session.io.Graphics = 1)) Then Continue;
Read (Session.ThemeFile, Session.Theme);
If ((Session.Theme.Flags AND ThmAllowASCII = 0) and (Session.io.Graphics = 0)) or
((Session.Theme.Flags AND ThmAllowANSI = 0) and (Session.io.Graphics = 1)) Then Continue;
Inc (T);
Session.io.PromptInfo[1] := strI2S(T);
Session.io.PromptInfo[2] := Session.Lang.Desc;
Session.io.PromptInfo[2] := Session.Theme.Desc;
Session.io.OutFullLn (Session.GetPrompt(183));
Until Eof(Session.LangFile);
Until Eof(Session.ThemeFile);
{ Lang := Old; }
@ -827,25 +827,23 @@ Begin
If (A < 1) or (A > T) Then A := 1;
T := 0;
Reset (Session.LangFile);
Reset (Session.ThemeFile);
Repeat
Read (Session.LangFile, Session.Lang);
If ((Session.Lang.Flags AND ThmAllowASCII = 0) and (Session.io.Graphics = 0)) or
((Session.Lang.Flags AND ThmAllowANSI = 0) and (Session.io.Graphics = 1)) Then Continue;
Read (Session.ThemeFile, Session.Theme);
If ((Session.Theme.Flags AND ThmAllowASCII = 0) and (Session.io.Graphics = 0)) or
((Session.Theme.Flags AND ThmAllowANSI = 0) and (Session.io.Graphics = 1)) Then Continue;
Inc (T);
Until T = A;
{ Close (Session.LangFile);}
If Not Session.LoadThemeData(Session.Lang.FileName) Then Begin
If Not Session.LoadThemeData(Session.Theme.FileName) Then Begin
Session.io.OutFullLn (Session.GetPrompt(185));
Session.Lang := Old;
Session.Theme := Old;
End Else
ThisUser.Theme := Session.Lang.FileName;
ThisUser.Theme := Session.Theme.FileName;
End;
Procedure TBBSUser.CreateNewUser (DefName: String);
Const
ExecMPE : Boolean = False; {placeholder for apply.mpx dev}
Begin
If Not Config.AllowNewUsers Then Begin
Session.io.OutFile ('nonewusr', True, 0);
@ -1045,18 +1043,18 @@ Begin
{ Check for forced voting questions }
Reset (VoteFile);
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
Count := FilePos(VoteFile);
Close (VoteFile);
Reset (Session.VoteFile);
While Not Eof(Session.VoteFile) Do Begin
Read (Session.VoteFile, Session.Vote);
If Access(Session.Vote.ACS) and Access(Session.Vote.ForceACS) and (ThisUser.Vote[FilePos(Session.VoteFile)] = 0) Then Begin
Count := FilePos(Session.VoteFile);
Close (Session.VoteFile);
Voting_Booth (True, Count);
Reset (VoteFile);
Seek (VoteFile, Count);
Reset (Session.VoteFile);
Seek (Session.VoteFile, Count);
End;
End;
Close (VoteFile);
Close (Session.VoteFile);
{ END forced voting check }
End;
@ -1201,12 +1199,12 @@ Begin
If FileExist(Config.ScriptPath + 'startup.mpx') Then
ExecuteMPL(NIL, 'startup');
If (Session.Lang.Flags AND ThmAllowASCII = 0) and (Session.io.Graphics = 0) Then Begin
If (Session.Theme.Flags AND ThmAllowASCII = 0) and (Session.io.Graphics = 0) Then Begin
Session.io.OutFullLn (Session.GetPrompt(321));
Session.SystemLog ('ASCII login disabled');
Halt(0);
End Else
If (Session.Lang.Flags AND ThmAllowANSI = 0) and (Session.io.Graphics = 1) Then Begin
If (Session.Theme.Flags AND ThmAllowANSI = 0) and (Session.io.Graphics = 1) Then Begin
Session.io.OutFullLn (Session.GetPrompt(322));
Session.SystemLog ('ANSI login disabled');
Halt(0);
@ -1305,7 +1303,7 @@ Begin
8 : GetDateFormat(True);
9 : Repeat
GetGraphics;
If ((Session.Lang.Flags AND ThmAllowASCII = 0) and (Session.io.Graphics = 0)) or ((Session.Lang.Flags AND ThmAllowANSI = 0) and (Session.io.Graphics = 1)) Then
If ((Session.Theme.Flags AND ThmAllowASCII = 0) and (Session.io.Graphics = 0)) or ((Session.Theme.Flags AND ThmAllowANSI = 0) and (Session.io.Graphics = 1)) Then
Session.io.OutFullLn (Session.GetPrompt(325))
Else
Break;

View File

@ -81,13 +81,13 @@ Var
InRemote := 1;
Session.io.AnsiColor (Session.Lang.LineChat1);
Session.io.AnsiColor (Session.Theme.LineChat1);
End Else Begin
Ch := Session.io.InKey(200);
If Ch = #255 Then Continue;
Session.io.AnsiColor (Session.Lang.LineChat2);
Session.io.AnsiColor (Session.Theme.LineChat2);
BlockWrite (fOut, Ch, 1);
@ -154,4 +154,4 @@ Begin
Session.io.OutFullLn(Session.GetPrompt(484));
End;
End.
End.

View File

@ -1,13 +1,12 @@
{$I M_OPS.PAS}
Unit MIS_Client_HTTP;
// placeholder for HTTP server if Mystic needs one?
// based off off initial POP3 server footprint
{$I M_OPS.PAS}
Interface
Uses
MD5,
Classes,
SysUtils,
m_Strings,
m_FileIO,
@ -15,112 +14,66 @@ Uses
m_DateTime,
MIS_Server,
MIS_NodeData,
MIS_Common;
MIS_Common,
BBS_MsgBase_ABS,
BBS_MsgBase_JAM,
BBS_MsgBase_Squish;
Function CreatePOP3 (Owner: TServerManager; ND: TNodeData; CliSock: TSocketClass) : TServerClient;
Function CreateHTTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient;
Type
TPOP3Server = Class(TServerClient)
Server : TServerManager;
UserName : String[40];
Password : String[20];
LoggedIn : Boolean;
Cmd : String;
Data : String;
User : UserRec;
UserPos : LongInt;
THTTPServer = Class(TServerClient)
Server : TServerManager;
UserName : String[30];
LoggedIn : Boolean;
GotQuit : Boolean;
Cmd : String;
Data : String;
Constructor Create (Owner: TServerManager; CliSock: TSocketClass);
Procedure Execute; Override;
Destructor Destroy; Override;
Procedure ResetSession;
Procedure cmdUSER;
Procedure cmdPASS;
End;
Implementation
Const
POP3TimeOut = 120;
FileBufSize = 8 * 1024;
re_OK = '+OK ';
re_Error = '-ERR ';
re_UnknownCommand = re_Error + 'Unknown command';
re_UnknownUser = re_Error + 'Unknown user';
re_BadLogin = re_Error + 'Bad credentials';
re_Greeting = 'Mystic POP3 Server';
re_Goodbye = re_OK + 'Goodbye';
re_SendUserPass = re_OK + 'Send user password';
re_LoggedIn = re_OK + 'Welcome';
Function CreatePOP3 (Owner: TServerManager; ND: TNodeData; CliSock: TSocketClass) : TServerClient;
Function CreateHTTP (Owner: TServerManager; Config: RecConfig; ND: TNodeData; CliSock: TSocketClass) : TServerClient;
Begin
Result := TPOP3Server.Create(Owner, CliSock);
Result := THTTPServer.Create(Owner, CliSock);
End;
Constructor TPOP3Server.Create (Owner: TServerManager; CliSock: TSocketClass);
Constructor THTTPServer.Create (Owner: TServerManager; CliSock: TSocketClass);
Begin
Inherited Create(Owner, CliSock);
Server := Owner;
End;
Procedure TPOP3Server.ResetSession;
Procedure THTTPServer.ResetSession;
Var
Count : LongInt;
Begin
LoggedIn := False;
UserName := '';
Password := '';
UserPos := -1;
LoggedIn := False;
GotQuit := False;
End;
Procedure TPOP3Server.cmdUSER;
Begin
ResetSession;
If SearchForUser(Data, User, UserPos) Then Begin
Client.WriteLine(re_SendUserPass);
UserName := Data;
End Else
Client.WriteLine(re_UnknownUser);
End;
Procedure TPOP3Server.cmdPASS;
Begin
If (UserName = '') or (UserPos = -1) Then Begin
Client.WriteLine(re_UnknownUser);
Exit;
End;
If strUpper(Data) = User.Password Then Begin
LoggedIn := True;
Client.WriteLine(re_LoggedIn);
End Else
Client.WriteLine(re_BadLogin);
End;
Procedure TPOP3Server.Execute;
Procedure THTTPServer.Execute;
Var
Str : String;
Begin
ResetSession;
Client.WriteLine(re_Greeting);
// Client.WriteLine(re_Greeting);
Repeat
If Client.WaitForData(POP3TimeOut * 1000) = 0 Then Break;
If Client.WaitForData(60 * 1000) = 0 Then Break;
If Terminated Then Exit;
If Client.ReadLine(Str) = -1 Then Exit;
server.server.status(str);
Cmd := strUpper(strWordGet(1, Str, ' '));
If Pos(' ', Str) > 0 Then
@ -128,17 +81,24 @@ server.server.status(str);
Else
Data := '';
If Cmd = 'PASS' Then cmdPASS Else
If Cmd = 'QUIT' Then Break Else
If Cmd = 'USER' Then cmdUSER Else
If Cmd = 'QUIT' Then Begin
GotQuit := True;
Break;
End Else
Client.WriteLine(re_UnknownCommand);
Until Terminated;
If Not Terminated Then Client.WriteLine(re_Goodbye);
If GotQuit Then Begin
Client.WriteLine(re_Goodbye);
Server.Server.Status (User.Handle + ' logged out');
End;
End;
Destructor TPOP3Server.Destroy;
Destructor THTTPServer.Destroy;
Begin
ResetSession;
Inherited Destroy;
End;

View File

@ -335,8 +335,8 @@ Begin
AddPointer ({$IFDEF MPLPARSER} 'cfgmsgspath', {$ENDIF} iString, mysMaxPathSize, {$IFNDEF MPLPARSER} @Config.MsgsPath {$ELSE} NIL {$ENDIF});
AddPointer ({$IFDEF MPLPARSER} 'cfgattpath', {$ENDIF} iString, mysMaxPathSize, {$IFNDEF MPLPARSER} @Config.AttachPath {$ELSE} NIL {$ENDIF});
AddPointer ({$IFDEF MPLPARSER} 'cfgqwkpath', {$ENDIF} iString, mysMaxPathSize, {$IFNDEF MPLPARSER} @Config.QwkPath {$ELSE} NIL {$ENDIF});
AddPointer ({$IFDEF MPLPARSER} 'cfgmenupath', {$ENDIF} iString, mysMaxPathSize, {$IFNDEF MPLPARSER} @Session.Lang.MenuPath {$ELSE} NIL {$ENDIF});
AddPointer ({$IFDEF MPLPARSER} 'cfgtextpath', {$ENDIF} iString, mysMaxPathSize, {$IFNDEF MPLPARSER} @Session.Lang.TextPath {$ELSE} NIL {$ENDIF});
AddPointer ({$IFDEF MPLPARSER} 'cfgmenupath', {$ENDIF} iString, mysMaxPathSize, {$IFNDEF MPLPARSER} @Session.Theme.MenuPath {$ELSE} NIL {$ENDIF});
AddPointer ({$IFDEF MPLPARSER} 'cfgtextpath', {$ENDIF} iString, mysMaxPathSize, {$IFNDEF MPLPARSER} @Session.Theme.TextPath {$ELSE} NIL {$ENDIF});
AddPointer ({$IFDEF MPLPARSER} 'cfgmpepath', {$ENDIF} iString, mysMaxPathSize, {$IFNDEF MPLPARSER} @Config.ScriptPath {$ELSE} NIL {$ENDIF});
AddPointer ({$IFDEF MPLPARSER} 'cfgtemppath', {$ENDIF} iString, mysMaxPathSize, {$IFNDEF MPLPARSER} @Session.TempPath {$ELSE} NIL {$ENDIF});
AddPointer ({$IFDEF MPLPARSER} 'cfgtimeout', {$ENDIF} iWord, 4, {$IFNDEF MPLPARSER} @Config.Inactivity {$ELSE} NIL {$ENDIF});

View File

@ -223,3 +223,4 @@
top_pcr_desc = Posts Per Call
top_pcr_namelen = 30
top_pcr_datalen = 10

View File

@ -244,19 +244,19 @@ Begin
End;
Close (Session.User.UserFile);
Assign (VoteFile, Config.DataPath + 'votes.dat');
{$I-} Reset (VoteFile); {$I+}
If IoResult <> 0 Then ReWrite (VoteFile);
Close (VoteFile);
Assign (Session.VoteFile, Config.DataPath + 'votes.dat');
{$I-} Reset (Session.VoteFile); {$I+}
If IoResult <> 0 Then ReWrite (Session.VoteFile);
Close (Session.VoteFile);
Assign (Session.LangFile, Config.DataPath + 'theme.dat');
{$I-} Reset (Session.LangFile); {$I+}
Assign (Session.ThemeFile, Config.DataPath + 'theme.dat');
{$I-} Reset (Session.ThemeFile); {$I+}
If IoResult <> 0 Then Begin
Screen.WriteLine ('ERROR: No theme configuration.');
DisposeClasses;
Halt(1);
End;
Close (Session.LangFile);
Close (Session.ThemeFile);
If Not Session.LoadThemeData(Config.DefThemeFile) Then Begin
If Not Session.ConfigMode Then Begin