mysticbbs/mystic/bbs_general.pas

1557 lines
44 KiB
ObjectPascal
Raw Normal View History

2012-02-13 16:50:48 -08:00
Unit bbs_General;
{$I M_OPS.PAS}
Interface
Uses
m_Strings,
m_DateTime,
{$IFNDEF UNIX}
2012-02-21 23:49:20 -08:00
Windows,
2012-02-13 16:50:48 -08:00
bbs_SysopChat,
{$ENDIF}
bbs_Common,
bbs_Edit_Full,
bbs_Edit_Line;
Function Editor (Var Lines: SmallInt; MaxLen, MaxLine: SmallInt; TEdit, Forced : Boolean; Var Subj: String) : Boolean;
Procedure Upgrade_User_Level (Now : Boolean; Var U : RecUser; Sec: Byte);
Procedure View_BBS_List (Long: Boolean; Data: String);
Procedure Add_BBS_List (Name : String);
Procedure AutoSig_Edit;
Procedure AutoSig_View;
2012-02-22 00:41:08 -08:00
Procedure ShowUserList (Data: String);
Procedure ShowLastCallers;
Procedure ShowBBSHistory (LastDays: Word);
Procedure ShowOneLiners (Data: String);
Procedure ShowRandomQuote;
2012-02-13 16:50:48 -08:00
Procedure Add_TimeBank;
Procedure Get_TimeBank;
Procedure Add_Booth;
Procedure Voting_Booth (Forced: Boolean; Num: Integer);
2012-02-22 00:41:08 -08:00
Procedure Voting_Result (Data: Integer);
2012-02-13 16:50:48 -08:00
Procedure Voting_Booth_New;
Procedure View_Directory (Data: String; ViewType: Byte);
2012-02-21 23:49:20 -08:00
{$IFNDEF UNIX}
Procedure PageForSysopChat (Forced: Boolean);
{$ENDIF}
2012-02-13 16:50:48 -08:00
Implementation
Uses
DOS,
m_FileIO,
m_QuickSort,
bbs_Core,
bbs_NodeInfo;
Function Editor (Var Lines: SmallInt; MaxLen, MaxLine: SmallInt; TEdit, Forced : Boolean; Var Subj: String) : Boolean;
Begin
If (Session.io.Graphics > 0) and ((Session.User.ThisUser.EditType = 1) or ((Session.User.ThisUser.EditType = 2) and Session.io.GetYN(Session.GetPrompt(106), True))) Then
Editor := AnsiEditor(Lines, MaxLen, MaxLine, TEdit, Forced, Subj)
Else
Editor := LineEditor(Lines, MaxLen, MaxLine, TEdit, Forced, Subj);
End;
Procedure Upgrade_User_Level (Now: Boolean; Var U: RecUser; Sec: Byte);
Var
2012-07-30 15:21:06 -07:00
Flags : Char;
TempSec : RecSecurity;
2012-02-13 16:50:48 -08:00
Begin
2012-07-30 15:21:06 -07:00
Assign (Session.User.SecurityFile, Config.DataPath + 'security.dat');
Reset (Session.User.SecurityFile);
Seek (Session.User.SecurityFile, Sec - 1);
Read (Session.User.SecurityFile, TempSec);
Close (Session.User.SecurityFile);
2012-02-13 16:50:48 -08:00
U.Security := Sec;
2012-07-30 15:21:06 -07:00
U.StartMenu := TempSec.StartMenu;
U.TimeLeft := TempSec.Time;
2012-02-13 16:50:48 -08:00
U.Expires := '00/00/00';
2012-07-30 15:21:06 -07:00
U.ExpiresTo := TempSec.ExpiresTo;
2012-02-13 16:50:48 -08:00
2012-07-30 15:21:06 -07:00
If TempSec.Expires > 0 Then
U.Expires := DateJulian2Str(CurDateJulian + TempSec.Expires, 1);
2012-02-13 16:50:48 -08:00
2012-07-30 15:21:06 -07:00
For Flags := 'A' to 'Z' Do
If Ord(Flags) - 64 in TempSec.AF1 Then
U.AF1 := U.AF1 + [Ord(Flags) - 64]
2012-02-13 16:50:48 -08:00
Else
2012-07-30 15:21:06 -07:00
If TempSec.Hard Then
U.AF1 := U.AF1 - [Ord(Flags) - 64];
2012-02-13 16:50:48 -08:00
2012-07-30 15:21:06 -07:00
For Flags := 'A' to 'Z' Do
If Ord(Flags) - 64 in TempSec.AF2 Then
U.AF2 := U.AF2 + [Ord(Flags) - 64]
2012-02-13 16:50:48 -08:00
Else
2012-07-30 15:21:06 -07:00
If TempSec.Hard Then
U.AF2 := U.AF2 - [Ord(Flags) - 64];
2012-02-13 16:50:48 -08:00
2012-07-30 15:21:06 -07:00
If Now Then Session.User.Security := TempSec;
2012-02-13 16:50:48 -08:00
End;
Procedure AutoSig_Edit;
Var
DF : File;
Lines : Integer;
Str : String;
Begin
If Config.MaxAutoSig = 0 Then Exit;
Assign (DF, Config.DataPath + 'autosig.dat');
If Session.User.ThisUser.SigLength > 0 Then Begin
Reset (DF, 1);
Seek (DF, Session.User.ThisUser.SigOffset);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
For Lines := 1 to Session.User.ThisUser.SigLength Do Begin
BlockRead (DF, Session.Msgs.MsgText[Lines][0], 1);
BlockRead (DF, Session.Msgs.MsgText[Lines][1], Ord(Session.Msgs.MsgText[Lines][0]));
End;
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Close (DF);
End Else
Lines := 0;
Str := 'Signature Editor'; {++lang}
If Editor (Lines, 78, Config.MaxAutoSig, True, False, Str) Then Begin
{$I-} Reset (DF, 1); {$I+}
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
If IoResult <> 0 Then ReWrite (DF, 1);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Session.User.ThisUser.SigLength := Lines;
Session.User.ThisUser.SigOffset := FileSize(DF);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Seek (DF, Session.User.ThisUser.SigOffset);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
For Lines := 1 to Lines Do
BlockWrite (DF, Session.Msgs.MsgText[Lines][0], Length(Session.Msgs.MsgText[Lines]) + 1);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Close (DF);
End;
End;
Procedure AutoSig_View;
Var
DF : File;
A : Byte;
S : String[79];
Begin
If Session.User.ThisUser.SigLength > 0 Then Begin
Assign (DF, Config.DataPath + 'autosig.dat');
Reset (DF, 1);
Seek (DF, Session.User.ThisUser.SigOffset);
For A := 1 to Session.User.ThisUser.SigLength Do Begin
BlockRead (DF, S[0], 1);
BlockRead (DF, S[1], Ord(S[0]));
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Session.io.OutFullLn (S);
End;
Close (DF);
End Else
Session.io.OutFull (Session.GetPrompt(336));
End;
2012-02-22 00:41:08 -08:00
Procedure ShowRandomQuote;
2012-02-13 16:50:48 -08:00
Var
TF : Text;
2012-02-22 00:41:08 -08:00
TxtBuf : Array[1..2048] of Char;
Total : Integer;
2012-02-13 16:50:48 -08:00
Count : Integer;
Str : String;
Begin
2012-02-22 00:41:08 -08:00
Assign (TF, Config.DataPath + 'quotes.dat');
SetTextBuf (TF, TxtBuf);
2012-02-13 16:50:48 -08:00
{$I-} Reset (TF); {$I+}
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
If IoResult <> 0 Then Exit;
Total := 0;
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
While Not Eof(TF) Do Begin
ReadLn (TF, Str);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
If Str[1] = '*' Then Inc(Total);
End;
If Total = 0 Then Begin
Close (TF);
Exit;
End;
Count := Random(Total) + 1;
Total := 0;
Reset (TF);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
While Total <> Count Do Begin
ReadLn (TF, Str);
If Str[1] = '*' Then Inc(Total);
End;
While Not Eof(TF) Do Begin
ReadLn (TF, Str);
If Str[1] = '*' Then Break Else Session.io.OutFullLn (Str);
End;
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Close (TF);
End;
Function SearchBBS (Str: String; Temp: BBSListRec) : Boolean;
2012-02-13 16:50:48 -08:00
Begin
Str := strUpper(Str);
SearchBBS := Bool_Search(Str, Temp.BBSName) or
Bool_Search(Str, Temp.SysopName) or
Bool_Search(Str, Temp.Software) or
Bool_Search(Str, Temp.Telnet) or
Bool_Search(Str, Temp.Phone) or
Bool_Search(Str, Temp.Location);
End;
Procedure Add_BBS_List (Name : String);
Var
BBSFile : File of BBSListRec;
BBSList : BBSListRec;
Temp : BBSListRec;
Begin
If Name = '' Then Exit;
Session.io.OutFull (Session.GetPrompt(361));
Case Session.io.OneKey ('DTBQ', True) of
'D' : BBSList.cType := 0;
'T' : BBSList.cType := 1;
'B' : BBSList.cType := 2;
'Q' : Exit;
End;
Session.io.OutRawLn('');
If BBSList.cType in [0, 2] Then Begin
Session.io.OutFull (Session.GetPrompt(283));
BBSList.Phone := Session.io.GetInput(15, 15, 12, '');
If BBSList.Phone = '' Then Exit;
End Else
BBSList.Phone := 'None'; //++lang
If BBSList.cType in [1, 2] Then Begin
Session.io.OutFull (Session.GetPrompt(330));
BBSList.Telnet := Session.io.GetInput(40, 40, 11, '');
If BBSList.Telnet = '' Then Exit;
End Else
BBSList.Telnet := 'None'; //++lang
Assign (BBSFile, Config.DataPath + Name + '.bbi');
{$I-} Reset(BBSFile); {$I+}
If IoResult <> 0 Then ReWrite(BBSFile);
While Not Eof(BBSFile) Do Begin
Read (BBSFile, Temp);
If ((strUpper(BBSList.Phone) = strUpper(Temp.Phone)) and (Temp.Phone <> 'None')) or
((strUpper(BBSList.Telnet) = strUpper(Temp.Telnet)) and (Temp.Telnet <> 'None')) Then Begin
Session.io.OutFullLn(Session.GetPrompt(362));
Close (BBSFile);
Exit;
End;
End;
Close (BBSFile);
Session.io.OutFull (Session.GetPrompt(284));
BBSList.BBSName := Session.io.GetInput(30, 30, 11, '');
Session.io.OutFull (Session.GetPrompt(285));
BBSList.Location := Session.io.GetInput(25, 25, 18, '');
Session.io.OutFull (Session.GetPrompt(286));
BBSList.SysopName := Session.io.GetInput(30, 30, 11, '');
Session.io.OutFull (Session.GetPrompt(287));
BBSList.BaudRate := Session.io.GetInput(6, 6, 11, '');
Session.io.OutFull (Session.GetPrompt(288));
BBSList.Software := Session.io.GetInput(10, 10, 11, '');
If Session.io.GetYN(Session.GetPrompt(290), True) Then Begin
BBSList.Deleted := False;
BBSList.AddedBy := Session.User.ThisUser.Handle;
BBSList.Verified := CurDateDos;
Reset (BBSFile);
Seek (BBSFile, FileSize(BBSFile));
Write (BBSFile, BBSList);
Close (BBSFile);
End;
End;
Procedure View_BBS_List (Long : Boolean; Data : String);
Var
BBSFile : File of BBSListRec;
BBSList : BBSListRec;
Name : String[8];
Str : String;
Search : Boolean;
Begin
Search := False;
If Pos(';', Data) > 0 Then Begin
Name := Copy(Data, 1, Pos(';', Data) - 1);
Search := Pos(';SEARCH', strUpper(Data)) > 0;
End Else
Name := Data;
If Name = '' Then Exit;
Assign (BBSFile, Config.DataPath + Name + '.bbi');
{$I-} Reset(BBSFile); {$I+}
If IoResult <> 0 Then Begin
Session.io.OutFullLn (Session.GetPrompt(291));
Exit;
End;
If Search Then Begin
Session.io.OutFull (Session.GetPrompt(292));
Str := Session.io.GetInput(30, 30, 11, '');
End;
Session.io.PausePtr := 1;
Session.io.AllowPause := True;
If Long Then
Session.io.OutFullLn (Session.GetPrompt(264))
Else
Session.io.OutFullLn (Session.GetPrompt(260));
While Not EOF(BBSFile) Do Begin
Read (BBSFile, BBSList);
If BBSList.Deleted Then Continue;
If (Search and SearchBBS(Str, BBSList)) or Not Search Then Begin
Session.io.PromptInfo[1] := BBSList.BBSName;
Case BBSList.cType of
0 : Begin
Session.io.PromptInfo[3] := BBSList.Phone;
Session.io.PromptInfo[2] := 'DIALUP'; //++lang
End;
1 : Begin
Session.io.PromptInfo[3] := BBSList.Telnet;
Session.io.PromptInfo[2] := 'TELNET'; //++lang
End;
2 : Begin
Session.io.PromptInfo[3] := BBSList.Telnet;
Session.io.PromptInfo[2] := 'DU/TEL'; //++lang
End;
End;
If (BBSList.cType = 0) and Long Then Session.io.PromptInfo[3] := BBSList.Telnet;
Session.io.PromptInfo[4] := BBSList.Software;
Session.io.PromptInfo[5] := BBSList.Location;
Session.io.PromptInfo[6] := BBSList.SysopName;
Session.io.PromptInfo[7] := BBSList.BaudRate;
Session.io.PromptInfo[8] := BBSList.AddedBy;
Session.io.PromptInfo[9] := BBSList.Phone;
Session.io.PromptInfo[10] := DateDos2Str(BBSList.Verified, Session.User.ThisUser.DateType);
If Long Then Begin
Session.io.OutFullLn (Session.GetPrompt(265));
Session.io.OutFull (Session.GetPrompt(267));
Case Session.io.OneKey('DQV'#13, True) of
'D' : If Session.User.Access(Config.AcsSysop) or (strUpper(BBSList.AddedBy) = strUpper(Session.User.ThisUser.Handle)) Then Begin
If Session.io.GetYN(Session.GetPrompt(294), False) Then Begin
BBSList.Deleted := True;
Seek (BBSFile, FilePos(BBSFile) - 1);
Write (BBSFile, BBSList);
End;
End Else
Session.io.OutFullLn (Session.GetPrompt(295));
'Q' : Break;
'V' : If Session.io.GetYN(Session.GetPrompt(266), False) Then Begin
BBSList.Verified := CurDateDos;
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Seek (BBSFile, FilePos(BBSFile) - 1);
Write (BBSFile, BBSList);
End;
End;
End Else Begin
Session.io.OutFullLn (Session.GetPrompt(261));
If (Session.io.PausePtr >= Session.User.ThisUser.ScreenSize) and (Session.io.AllowPause) Then
Case Session.io.MorePrompt of
'N' : Break;
'C' : Session.io.AllowPause := False;
End;
End;
End;
End;
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Close (BBSFile);
If Not Long Then
Session.io.OutFullLn (Session.GetPrompt(262));
End;
2012-02-22 00:41:08 -08:00
Procedure ShowUserList (Data: String);
2012-02-13 16:50:48 -08:00
Var
2012-02-22 00:41:08 -08:00
Total : Integer;
TempUser : RecUser;
2012-02-13 16:50:48 -08:00
Begin
If Data = 'SEARCH' Then Begin
Session.io.OutFull (Session.GetPrompt(32));
Data := Session.io.GetInput (30, 30, 12, '');
End;
Reset (Session.User.UserFile);
Session.io.PausePtr := 1;
Session.io.AllowPause := True;
Session.io.OutFullLn (Session.GetPrompt(29));
Total := 0;
While Not Eof(Session.User.UserFile) Do Begin
2012-02-22 00:41:08 -08:00
Read (Session.User.UserFile, TempUser);
If TempUser.Flags AND UserDeleted <> 0 Then Continue;
Session.io.PromptInfo[1] := TempUser.Handle;
Session.io.PromptInfo[2] := TempUser.City;
Session.io.PromptInfo[3] := DateDos2Str(TempUser.LastOn, Session.User.ThisUser.DateType);
Session.io.PromptInfo[4] := TempUser.Gender;
Session.io.PromptInfo[5] := strI2S(TempUser.Security);
Session.io.PromptInfo[6] := TempUser.Address;
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.OptionData[1];
Session.io.PromptInfo[11] := TempUser.OptionData[2];
Session.io.PromptInfo[12] := TempUser.OptionData[3];
2012-02-22 00:41:08 -08:00
If (Data = '') or (Pos(Data, strUpper(TempUser.Handle)) > 0) Then Begin
2012-02-13 16:50:48 -08:00
Session.io.OutFullLn (Session.GetPrompt(30));
Inc (Total);
If (Session.io.PausePtr >= Session.User.ThisUser.ScreenSize) and (Session.io.AllowPause) Then
Case Session.io.MorePrompt of
'N' : Break;
'C' : Session.io.AllowPause := False;
End;
End;
End;
2012-02-21 23:49:20 -08:00
Close (Session.User.UserFile);
2012-02-13 16:50:48 -08:00
2012-02-21 23:49:20 -08:00
Session.io.PromptInfo[1] := strI2S(Total);
2012-02-13 16:50:48 -08:00
2012-02-21 23:49:20 -08:00
Session.io.OutFull (Session.GetPrompt(31));
2012-02-13 16:50:48 -08:00
End;
2012-02-22 00:41:08 -08:00
Procedure ShowLastCallers;
2012-02-13 16:50:48 -08:00
Begin
Session.io.OutFullLn (Session.GetPrompt(141));
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Reset (LastOnFile);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
While Not Eof(LastOnFile) Do Begin
Read (LastOnFile, LastOn);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Session.io.PromptInfo[1] := LastOn.Handle;
Session.io.PromptInfo[2] := strI2S(LastOn.Node);
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[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.OptionData[1];
Session.io.PromptInfo[12] := LastOn.OptionData[2];
Session.io.PromptInfo[13] := LastOn.OptionData[3];
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Session.io.OutFullLn (Session.GetPrompt(142));
End;
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Close (LastOnFile);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Session.io.OutFull (Session.GetPrompt(143));
End;
Procedure Add_TimeBank;
Var
A : Integer;
Begin
Session.io.OutFull (Session.GetPrompt(172));
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
A := strS2I(Session.io.GetInput(4, 4, 11, ''));
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
If A > 0 Then
If (A < Session.TimeLeft - 4) Then Begin
If (Session.User.Security.MaxTB > 0) and (Session.User.ThisUser.TimeBank + A > Session.User.Security.MaxTB) Then Begin
Session.io.OutFullLn (Session.GetPrompt(209));
Exit;
End;
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Inc (Session.User.ThisUser.TimeBank, A);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Session.SetTimeLeft (Session.TimeLeft - A);
End Else
Session.io.OutFullLn (Session.GetPrompt(210));
End;
Procedure Get_TimeBank;
Var
A : Integer;
Begin
Session.io.OutFull (Session.GetPrompt(173));
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
A := strS2I(Session.io.GetInput(4, 4, 11, ''));
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
If (A > 0) and (A <= Session.User.ThisUser.TimeBank) Then Begin
Dec (Session.User.ThisUser.TimeBank, A);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Session.SetTimeLeft (Session.TimeLeft + A);
End;
End;
2012-02-22 00:41:08 -08:00
Procedure ShowOneLiners (Data : String);
2012-02-13 16:50:48 -08:00
Const
MaxLines : Byte = 9;
MaxLen : Byte = 75;
MaxField : Byte = 75;
Var
OneLineFile : File of OneLineRec;
OneLine : OneLineRec;
Str : String;
A : Byte;
Begin
A := Pos(';', Data);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
If A > 0 Then Begin
MaxLines := strS2I(Copy(Data, 1, A - 1)) - 1;
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Delete (Data, 1, A);
A := Pos(';', Data);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
MaxLen := strS2I(Copy(Data, 1, A - 1));
MaxField := strS2I(Copy(Data, A + 1, Length(Data)));
End;
Assign (OneLineFile, Config.DataPath + 'oneliner.dat');
{$I-} Reset (OneLineFile); {$I+}
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
If IoResult <> 0 Then ReWrite (OneLineFile);
Repeat
Reset (OneLineFile);
Session.io.OutFullLn (Session.GetPrompt(188));
While Not Eof(OneLineFile) Do Begin
Read (OneLineFile, OneLine);
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Session.io.PromptInfo[1] := OneLine.Text;
Session.io.PromptInfo[2] := OneLine.From;
Session.io.PromptInfo[3] := OneLine.From[1];
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
If Pos(' ', OneLine.From) > 0 Then
Session.io.PromptInfo[3] := Session.io.PromptInfo[3] + OneLine.From[Pos(' ', OneLine.From) + 1];
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Session.io.OutFullLn (Session.GetPrompt(337));
End;
If Session.io.GetYN(Session.GetPrompt(189), False) Then Begin
Session.io.OutFull (Session.GetPrompt(190));
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
Str := Session.io.GetInput (MaxField, MaxLen, 11, '');
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
If Str <> '' Then Begin
If FileSize(OneLineFile) > MaxLines Then
KillRecord (OneLineFile, 1, SizeOf(OneLineRec));
OneLine.Text := Str;
OneLine.From := Session.User.ThisUser.Handle;
Seek (OneLineFile, FileSize(OneLineFile));
Write (OneLineFile, OneLine);
End;
End Else
Break;
Until False;
Close (OneLineFile);
End;
Procedure Add_Booth;
Var
A : Byte;
Begin
If Not Session.io.GetYN (Session.GetPrompt(275), True) Then Exit;
2012-06-30 17:23:39 -07:00
Reset (Session.VoteFile);
If FileSize (Session.VoteFile) = mysMaxVoteQuestion Then Begin
Close (Session.VoteFile);
2012-02-13 16:50:48 -08:00
Session.io.OutFull (Session.GetPrompt(276));
Exit;
End;
2012-06-30 17:23:39 -07:00
Close (Session.VoteFile);
2012-02-13 16:50:48 -08:00
Session.io.OutFull (Session.GetPrompt(277));
2012-06-30 17:23:39 -07:00
Session.Vote.Question := Session.io.GetInput(78, 78, 11, '');
If Session.Vote.Question = '' Then Exit;
2012-02-13 16:50:48 -08:00
Session.io.OutFullLn (Session.GetPrompt(278));
A := 1;
While A <= 15 Do Begin
Session.io.PromptInfo[1] := strI2S(A);
Session.io.OutFull (Session.GetPrompt(279));
2012-06-30 17:23:39 -07:00
Session.Vote.Answer[A].Text := Session.io.GetInput(40, 40, 11, '');
If Session.Vote.Answer[A].Text = '' Then Begin
2012-02-13 16:50:48 -08:00
Dec (A);
Break;
End;
2012-06-30 17:23:39 -07:00
Session.Vote.Answer[A].Votes := 0;
2012-02-13 16:50:48 -08:00
Inc(A);
End;
If A = 0 Then Exit;
2012-06-30 17:23:39 -07:00
Session.Vote.AnsNum := A;
Session.Vote.Votes := 0;
Session.Vote.ACS := '';
Session.Vote.AddACS := 's999';
Session.Vote.ForceACS := 's999';
2012-02-13 16:50:48 -08:00
2012-06-30 17:23:39 -07:00
If Session.io.GetYN(Session.GetPrompt(280), True) Then Session.Vote.AddACS := '';
2012-02-13 16:50:48 -08:00
If Session.io.GetYN(Session.GetPrompt(281), True) Then Begin
2012-06-30 17:23:39 -07:00
Reset (Session.VoteFile);
Seek (Session.VoteFile, FileSize(Session.VoteFile));
Write (Session.VoteFile, Session.Vote);
Close (Session.VoteFile);
2012-02-13 16:50:48 -08:00
End;
End;
{ VOTING BOOTH SHIT }
Function Voting_List : Byte;
Var
Total : Byte;
Begin
2012-06-30 17:23:39 -07:00
Reset (Session.VoteFile);
2012-02-13 16:50:48 -08:00
Session.io.OutFullLn (Session.GetPrompt(241));
Total := 0;
2012-06-30 17:23:39 -07:00
While Not Eof(Session.VoteFile) Do Begin
Read (Session.VoteFile, Session.Vote);
If Session.User.Access(Session.Vote.ACS) Then Begin
2012-02-13 16:50:48 -08:00
Inc (Total);
Session.io.PromptInfo[1] := strI2S(Total);
2012-06-30 17:23:39 -07:00
Session.io.PromptInfo[2] := Session.Vote.Question;
If Session.User.ThisUser.Vote[FilePos(Session.VoteFile)] = 0 Then
2012-02-13 16:50:48 -08:00
Session.io.PromptInfo[3] := '*' //++lang
Else
Session.io.PromptInfo[3] := ' ';
Session.io.OutFullLn (Session.GetPrompt(242));
End;
End;
2012-06-30 17:23:39 -07:00
Close (Session.VoteFile);
2012-02-13 16:50:48 -08:00
If Total = 0 Then Session.io.OutFullLn (Session.GetPrompt(243));
Voting_List := Total;
End;
Procedure Voting_Result (Data : Integer);
Var
A : SmallInt;
P : SmallInt;
Begin
2012-06-30 17:23:39 -07:00
Reset (Session.VoteFile);
2012-02-13 16:50:48 -08:00
2012-06-30 17:23:39 -07:00
If (Data > 0) and (Data <= FileSize(Session.VoteFile)) Then Begin
Seek (Session.VoteFile, Data - 1);
Read (Session.VoteFile, Session.Vote);
Close (Session.VoteFile);
2012-02-13 16:50:48 -08:00
End Else Begin
A := Voting_List;
If A = 0 Then Exit;
Repeat
Session.io.PromptInfo[1] := strI2S(A);
Session.io.OutFull (Session.GetPrompt(263));
P := strS2I(Session.io.GetInput(2, 2, 12, ''));
If P = 0 Then Exit;
If P <= A Then Break;
Until False;
2012-06-30 17:23:39 -07:00
Reset (Session.VoteFile);
2012-02-13 16:50:48 -08:00
A := 0;
Repeat
2012-06-30 17:23:39 -07:00
Read (Session.VoteFile, Session.Vote);
If Session.User.Access(Session.Vote.ACS) Then Inc(A);
2012-02-13 16:50:48 -08:00
Until A = P;
2012-06-30 17:23:39 -07:00
Close (Session.VoteFile);
2012-02-13 16:50:48 -08:00
End;
2012-06-30 17:23:39 -07:00
Session.io.PromptInfo[1] := Session.Vote.Question;
Session.io.PromptInfo[2] := strI2S(Session.Vote.Votes);
2012-02-13 16:50:48 -08:00
Session.io.OutFullLn (Session.GetPrompt(249));
2012-06-30 17:23:39 -07:00
For A := 1 to Session.Vote.AnsNum Do Begin
2012-02-13 16:50:48 -08:00
Session.io.PromptInfo[1] := strI2S(A);
2012-06-30 17:23:39 -07:00
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
2012-02-13 16:50:48 -08:00
Session.io.PromptInfo[4] := '0';
Session.io.PromptInfo[5] := '';
End Else Begin
2012-06-30 17:23:39 -07:00
Session.io.PromptInfo[5] := Session.io.DrawPercent(Session.Theme.VotingBar, Session.Vote.Answer[A].Votes, Session.Vote.Votes, P);
2012-02-13 16:50:48 -08:00
Session.io.PromptInfo[4] := strI2S(P);
End;
Session.io.OutFullLn (Session.GetPrompt(250));
End;
Session.io.OutFull (Session.GetPrompt(251));
End;
Procedure Voting_Booth_New;
Var
NewQues : Array[1..mysMaxVoteQuestion] of Boolean;
Pos : Byte;
Begin
2012-06-30 17:23:39 -07:00
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)
2012-02-13 16:50:48 -08:00
Else
2012-06-30 17:23:39 -07:00
NewQues[FilePos(Session.VoteFile)] := False;
2012-02-13 16:50:48 -08:00
End;
2012-06-30 17:23:39 -07:00
Close (Session.VoteFile);
2012-02-13 16:50:48 -08:00
For Pos := 1 to mysMaxVoteQuestion Do
If NewQues[Pos] Then Voting_Booth (False, Pos);
End;
Procedure Voting_Booth (Forced: Boolean; Num: Integer);
Var
VPos : Byte;
Temp : Byte;
Total : Byte;
Str : String[40];
Begin
If Not Forced And (Num = 0) Then Begin
Total := Voting_List;
If Total = 0 Then Exit;
Repeat
Session.io.PromptInfo[1] := strI2S(Total);
Session.io.OutFull (Session.GetPrompt(244));
Temp := strS2I(Session.io.GetInput(2, 2, 12, ''));
If Temp = 0 Then Exit;
If Temp <= Total Then Break;
Until False;
Total := 0;
2012-06-30 17:23:39 -07:00
Reset (Session.VoteFile);
2012-02-13 16:50:48 -08:00
Repeat
2012-06-30 17:23:39 -07:00
Read (Session.VoteFile, Session.Vote);
If Session.User.Access(Session.Vote.ACS) Then Inc(Total);
2012-02-13 16:50:48 -08:00
Until Total = Temp;
End Else Begin
2012-06-30 17:23:39 -07:00
Reset (Session.VoteFile);
If Num > FileSize(Session.VoteFile) Then Begin
Close (Session.VoteFile);
2012-02-13 16:50:48 -08:00
Exit;
End;
2012-06-30 17:23:39 -07:00
Seek (Session.VoteFile, Num - 1);
Read (Session.VoteFile, Session.Vote);
2012-02-13 16:50:48 -08:00
End;
2012-06-30 17:23:39 -07:00
VPos := FilePos(Session.VoteFile);
2012-02-13 16:50:48 -08:00
Repeat
2012-06-30 17:23:39 -07:00
Session.io.PromptInfo[1] := Session.Vote.Question;
2012-02-13 16:50:48 -08:00
Session.io.OutFullLn (Session.GetPrompt(245));
2012-06-30 17:23:39 -07:00
For Temp := 1 to Session.Vote.AnsNum Do Begin
2012-02-13 16:50:48 -08:00
Session.io.PromptInfo[1] := strI2S(Temp);
2012-06-30 17:23:39 -07:00
Session.io.PromptInfo[2] := Session.Vote.Answer[Temp].Text;
2012-02-13 16:50:48 -08:00
If Session.User.ThisUser.Vote[VPos] = Temp Then
Session.io.PromptInfo[3] := '*' //++lang
Else
Session.io.PromptInfo[3] := ' ';
Session.io.OutFullLn (Session.GetPrompt(246));
End;
2012-06-30 17:23:39 -07:00
If Session.User.Access(Session.Vote.AddACS) and (Session.Vote.AnsNum < 15) Then Begin
Session.io.PromptInfo[1] := strI2S(Session.Vote.AnsNum + 1);
2012-02-13 16:50:48 -08:00
Session.io.PromptInfo[2] := Session.GetPrompt(252);
Session.io.PromptInfo[3] := ' ';
Session.io.OutFullLn (Session.GetPrompt(246));
End;
Session.io.OutFull (Session.GetPrompt(247));
Temp := strS2I(Session.io.GetInput(2, 2, 12, ''));
2012-06-30 17:23:39 -07:00
If (Session.Vote.AnsNum < 15) and Session.User.Access(Session.Vote.AddACS) and (Temp = Succ(Session.Vote.AnsNum)) Then Begin
2012-02-13 16:50:48 -08:00
Session.io.OutFull (Session.GetPrompt(253));
Str := Session.io.GetInput (40, 40, 11, '');
If Str <> '' Then Begin
2012-06-30 17:23:39 -07:00
Inc (Session.Vote.AnsNum);
Session.Vote.Answer[Session.Vote.AnsNum].Text := Str;
Session.Vote.Answer[Session.Vote.AnsNum].Votes := 0;
2012-02-13 16:50:48 -08:00
End;
End;
2012-06-30 17:23:39 -07:00
If (Temp > 0) and (Temp <= Session.Vote.AnsNum) Then Begin
2012-02-13 16:50:48 -08:00
If Session.User.ThisUser.Vote[VPos] <> 0 Then Begin
2012-06-30 17:23:39 -07:00
Dec (Session.Vote.Answer[Session.User.ThisUser.Vote[VPos]].Votes);
Dec (Session.Vote.Votes);
2012-02-13 16:50:48 -08:00
End;
2012-06-30 17:23:39 -07:00
Inc(Session.Vote.Answer[Temp].Votes);
Inc(Session.Vote.Votes);
2012-02-13 16:50:48 -08:00
Session.User.ThisUser.Vote[VPos] := Temp;
2012-06-30 17:23:39 -07:00
Seek (Session.VoteFile, VPos - 1);
Write (Session.VoteFile, Session.Vote);
2012-02-13 16:50:48 -08:00
Break;
End Else
If Forced Then Session.io.OutFull (Session.GetPrompt(254)) Else Break;
Until False;
2012-06-30 17:23:39 -07:00
Close (Session.VoteFile);
2012-02-13 16:50:48 -08:00
If Session.io.GetYN (Session.GetPrompt(248), True) Then Voting_Result(VPos);
End;
2012-02-22 00:41:08 -08:00
Procedure ShowBBSHistory (LastDays: Word);
2012-02-13 16:50:48 -08:00
Var
Temp : RecHistory;
2012-02-13 16:50:48 -08:00
Days : Word;
Begin
Assign (Session.HistoryFile, Config.DataPath + 'history.dat');
{$I-} Reset(Session.HistoryFile); {$I+}
2012-02-22 00:41:08 -08:00
2012-02-13 16:50:48 -08:00
If IoResult <> 0 Then
Session.io.OutFullLn (Session.GetPrompt(454))
Else Begin
If (LastDays > 0) And (FileSize(Session.HistoryFile) >= LastDays) Then
Seek (Session.HistoryFile, FileSize(Session.HistoryFile) - LastDays);
Session.io.AllowPause := True;
Session.io.PausePtr := 1;
Days := 0;
Session.io.OutFullLn (Session.GetPrompt(455));
While Not Eof(Session.HistoryFile) Do Begin
Read (Session.HistoryFile, Temp);
Session.io.PromptInfo[1] := DateDos2Str(Temp.Date, Session.User.ThisUser.DateType);
Session.io.PromptInfo[2] := strI2S(Temp.Calls);
Session.io.PromptInfo[3] := strI2S(Temp.NewUsers);
Session.io.PromptInfo[4] := strI2S(Temp.Posts);
Session.io.PromptInfo[5] := strI2S(Temp.Emails);
Session.io.PromptInfo[6] := strI2S(Temp.Downloads);
Session.io.PromptInfo[7] := strI2S(Temp.DownloadKB);
Session.io.PromptInfo[8] := strI2S(Temp.Uploads);
Session.io.PromptInfo[9] := strI2S(Temp.UploadKB);
Session.io.OutFullLn (Session.GetPrompt(456));
Inc (Days);
If (Session.io.PausePtr >= Session.User.ThisUser.ScreenSize) and (Session.io.AllowPause) Then
Case Session.io.MorePrompt of
'N' : Break;
'C' : Session.io.AllowPause := False;
End;
End;
Close (Session.HistoryFile);
Session.io.PromptInfo[1] := strI2S(Days);
Session.io.OutFullLn (Session.GetPrompt(457));
End;
End;
Procedure View_Directory (Data: String; ViewType: Byte);
Const
vtMaxList = 1000;
Type
RecSauceInfo = Packed Record
Title : String[35];
Author : String[20];
Group : String[20];
End;
DirRec = Record
Desc : String[160];
Size : LongInt;
Date : LongInt;
IsDir : Boolean;
Title : String[34];
Author : String[19];
Group : String[19];
End;
Var
WinTop : Byte;
WinBot : Byte;
WinSize : Byte;
DirList : Array[1..vtMaxList] of ^DirRec;
DirCount : LongInt = 0;
CurTop : LongInt = 1;
CurBot : LongInt = 1;
CurPos : LongInt = 1;
CurPath : String;
Root : String;
Function ReadSauceInfo (FN: String; Var Sauce: RecSauceInfo) : Boolean;
Var
DF : File;
Str : String;
Res : LongInt;
Begin
Result := False;
Assign (DF, FN);
{$I-} Reset (DF, 1); {$I+}
If IoResult <> 0 Then Exit;
{$I-} Seek (DF, FileSize(DF) - 130); {$I+}
If IoResult <> 0 Then Begin
Close (DF);
Exit;
End;
BlockRead (DF, Str[1], 130);
Str[0] := #130;
Close (DF);
Res := Pos('SAUCE', Copy(Str, 1, 7));
If Res > 0 Then Begin
Result := True;
Sauce.Title := strReplace(Copy(Str, 7 + Res, 35), #0, #32);
Sauce.Author := strReplace(Copy(Str, 42 + Res, 20), #0, #32);
Sauce.Group := strReplace(Copy(Str, 62 + Res, 20), #0, #32);
End;
End;
Procedure BuildDirectory (Path: String);
Var
SR : SearchRec;
Count : Word;
Sauce : RecSauceInfo;
Temp : String;
SortLoop : Word;
SortPos : Word;
Sort : TQuickSort;
Begin
For Count := DirCount Downto 1 Do
Dispose(DirList[Count]);
Sort := TQuickSort.Create;
Temp := Session.GetPrompt(473);
DirCount := 0;
For Count := 1 to 2 Do Begin
FindFirst (Path + '*', AnyFile, SR);
While (DosError = 0) And (DirCount < vtMaxList) Do Begin
If (SR.Name = '.') or ((Path = Root) And (SR.Name = '..')) Then Begin
FindNext (SR);
Continue;
End;
If ((Count = 1) And (SR.Attr And Directory = 0)) or
((Count = 2) And (SR.Attr And Directory <> 0)) Then Begin
FindNext(SR);
Continue;
End;
Inc (DirCount);
New (DirList[DirCount]);
DirList[DirCount]^.Desc := SR.Name;
DirList[DirCount]^.Size := SR.Size;
DirList[DirCount]^.Date := SR.Time;
If (SR.Attr And Directory) = 0 Then Begin
DirList[DirCount]^.IsDir := False;
If ReadSauceInfo(Path + SR.Name, Sauce) Then Begin
DirList[DirCount]^.Title := Sauce.Title;
DirList[DirCount]^.Author := Sauce.Author;
DirList[DirCount]^.Group := Sauce.Group;
End Else Begin
DirList[DirCount]^.Title := strWordGet(1, Temp, ';');
DirList[DirCount]^.Author := strWordGet(2, Temp, ';');
DirList[DirCount]^.Group := strWordGet(3, Temp, ';');
End;
End Else
DirList[DirCount]^.IsDir := True;
FindNext (SR);
End;
FindClose (SR);
Case Count of
1 : Begin
SortPos := DirCount;
For SortLoop := 1 to DirCount Do
Sort.Add(strUpper(DirList[SortLoop]^.Desc), LongInt(@DirList[SortLoop]^));
Sort.Sort(1, DirCount, qAscending);
For SortLoop := 1 to DirCount Do
DirList[SortLoop] := Pointer(Sort.Data[SortLoop]^.Ptr);
End;
2 : If SortPos <> DirCount Then Begin
Sort.Clear;
For SortLoop := Succ(SortPos) to DirCount Do
Sort.Add(strUpper(DirList[SortLoop]^.Desc), LongInt(@DirList[SortLoop]^));
Sort.Sort(1, DirCount - SortPos, qAscending);
For SortLoop := 1 to DirCount - SortPos Do
DirList[SortLoop + SortPos] := Pointer(Sort.Data[SortLoop]^.Ptr);
End;
End;
End;
Sort.Free;
End;
Procedure SetBarInfo (BarPos: Word);
Begin
Session.io.PromptInfo[1] := DirList[BarPos]^.Desc;
Session.io.PromptInfo[2] := strComma(DirList[BarPos]^.Size);
Session.io.PromptInfo[3] := DateDos2Str(DirList[BarPos]^.Date, Session.User.ThisUser.DateType);
Session.io.PromptInfo[7] := TimeDos2Str(DirList[BarPos]^.Date, True);
If DirList[BarPos]^.IsDir Then Begin
Session.io.PromptInfo[4] := '';
Session.io.PromptInfo[5] := '';
Session.io.PromptInfo[6] := '';
End Else Begin
Session.io.PromptInfo[4] := DirList[BarPos].Author;
Session.io.PromptInfo[5] := DirList[BarPos].Title;
Session.io.PromptInfo[6] := DirList[BarPos].Group;
End;
End;
Procedure DrawPage;
Var
Count : SmallInt;
Start : Word;
Begin
Start := CurTop;
For Count := WinTop to WinBot Do Begin
Session.io.AnsiGotoXY(1, Count);
If Start <= DirCount Then Begin
SetBarInfo(Start);
Case DirList[Start]^.IsDir of
False : Session.io.OutFull(Session.GetPrompt(467));
True : Session.io.OutFull(Session.GetPrompt(469));
End;
End Else Begin
Session.io.PromptInfo[1] := '';
Session.io.PromptInfo[2] := '';
Session.io.PromptInfo[3] := '';
Session.io.PromptInfo[4] := '';
Session.io.PromptInfo[5] := '';
Session.io.PromptInfo[6] := '';
Session.io.PromptInfo[7] := '';
Session.io.OutFull(Session.GetPrompt(467));
End;
Inc (Start);
End;
CurBot := Start - 1;
If CurPos > CurBot Then CurPos := CurBot;
2012-06-30 17:23:39 -07:00
Session.io.PromptInfo[1] := Session.io.DrawPercent(Session.Theme.GalleryBar, CurBot, DirCount, Count);
2012-02-13 16:50:48 -08:00
Session.io.PromptInfo[2] := strI2S(Count);
Session.io.OutFull(Session.GetPrompt(472));
End;
Procedure DrawBar (Selected: Boolean);
Begin
SetBarInfo(CurPos);
Session.io.AnsiGotoXY (1, CurPos - CurTop + WinTop);
If Selected Then
Case DirList[CurPos]^.IsDir of
False : Session.io.OutFull(Session.GetPrompt(468));
True : Session.io.OutFull(Session.GetPrompt(470));
End
Else
Case DirList[CurPos]^.IsDir of
False : Session.io.OutFull(Session.GetPrompt(467));
True : Session.io.OutFull(Session.GetPrompt(469));
End;
End;
Procedure UpdatePath;
Var
Temp : String;
Begin
Temp := CurPath;
Delete (Temp, 1, Length(Root) - 1);
If Length(Temp) > 70 Then
Session.io.PromptInfo[1] := '..' + Copy(Temp, (Length(Temp) - 68), 255)
Else
Session.io.PromptInfo[1] := Temp;
Session.io.PromptInfo[2] := strComma(DirCount);
Session.io.OutFull(Session.GetPrompt(471));
End;
Procedure FullReDraw;
Begin
Session.io.OutFile('ansigal', False, 0);
WinTop := Session.io.ScreenInfo[1].Y;
WinBot := Session.io.ScreenInfo[2].Y;
WinSize := WinBot - WinTop + 1;
UpdatePath;
DrawPage;
DrawBar(True);
End;
Function FindCharacter (Ch: Char) : Byte;
Var
Loop : Boolean;
StartPos : Word;
EndPos : Word;
Count : Word;
Begin
Result := 0;
Loop := True;
StartPos := CurPos + 1;
EndPos := DirCount;
If StartPos > DirCount Then StartPos := 1;
Count := StartPos;
While (Count <= EndPos) Do Begin
If UpCase(DirList[Count]^.Desc[1]) = Ch Then Begin
Result := 1;
While Count <> CurPos Do Begin
If CurPos < Count Then Begin
If CurPos < DirCount Then Inc (CurPos);
If CurPos >= CurTop + WinSize Then Begin
Inc (CurTop);
Result := 2;
End;
End Else
If CurPos > Count Then Begin
If CurPos > 1 Then Dec (CurPos);
If CurPos < CurTop Then Begin
Dec (CurTop);
Result := 2;
End;
End;
End;
Break;
End;
If (Count = DirCount) and Loop Then Begin
Count := 0;
StartPos := 1;
EndPos := CurPos - 1;
Loop := False;
End;
Inc (Count);
End;
End;
Var
Ch : Char;
Count : Word;
Speed : Byte;
Begin
If Session.io.Graphics = 0 Then Begin
Session.io.OutFullLn(Session.GetPrompt(466));
Exit;
End;
Session.io.AllowArrow := True;
Root := DirSlash(strWordGet(1, Data, ';'));
Speed := strS2I(strWordGet(2, Data, ';'));
CurPath := Root;
BuildDirectory(CurPath);
FullReDraw;
Repeat
Ch := UpCase(Session.io.GetKey);
If Session.io.IsArrow Then Begin
Case Ch of
#71 : If CurPos > 1 Then Begin
CurPos := 1;
CurTop := 1;
DrawPage;
DrawBar(True);
End;
#72 : If CurPos > 1 Then Begin
If CurPos = CurTop Then Begin
Dec (CurTop);
Dec (CurPos);
DrawPage;
DrawBar(True);
End Else Begin
DrawBar(False);
Dec(CurPos);
DrawBar(True);
End;
End;
#73,
#75 : If CurTop - WinSize >= 1 Then Begin
Dec (CurTop, WinSize);
Dec (CurPos, WinSize);
DrawPage;
DrawBar(True);
End Else
If CurPos > 1 Then Begin
CurPos := 1;
CurTop := 1;
DrawPage;
DrawBar(True);
End;
#79 : If CurPos < DirCount Then Begin
CurPos := DirCount;
CurTop := DirCount - WinSize + 1;
If CurTop < 1 Then CurTop := 1;
DrawPage;
DrawBar(True);
End;
#80 : If CurPos < DirCount Then Begin
If CurPos = CurBot Then Begin
Inc (CurTop);
Inc (CurPos);
DrawPage;
DrawBar(True);
End Else Begin
DrawBar(False);
Inc(CurPos);
DrawBar(True);
End;
End;
#77,
#81 : If CurTop + WinSize <= DirCount - WinSize Then Begin
Inc (CurPos, WinSize);
Inc (CurTop, WinSize);
DrawPage;
DrawBar(True);
End Else
If CurPos < DirCount Then Begin
CurPos := DirCount;
CurTop := DirCount - WinSize + 1;
If CurTop < 1 Then CurTop := 1;
DrawPage;
DrawBar(True);
End;
End;
End Else
Case Ch of
#08 : If CurPath <> Root Then Begin
Delete (CurPath, Length(CurPath), 1);
While CurPath[Length(CurPath)] <> PathChar Do
Delete (CurPath, Length(CurPath), 1);
BuildDirectory(CurPath);
CurPos := 1;
CurTop := 1;
UpdatePath;
DrawPage;
DrawBar(True);
End;
#13 : If DirList[CurPos]^.IsDir Then Begin
If DirList[CurPos]^.Desc = '..' Then Begin
Delete (CurPath, Length(CurPath), 1);
While CurPath[Length(CurPath)] <> PathChar Do
Delete (CurPath, Length(CurPath), 1);
End Else
CurPath := CurPath + DirList[CurPos]^.Desc + PathChar;
BuildDirectory(CurPath);
CurPos := 1;
CurTop := 1;
UpdatePath;
DrawPage;
DrawBar(True);
End Else Begin
Session.io.AllowMCI := True;
Session.io.AnsiColor(7);
Session.io.AnsiClear;
Session.io.OutFile (CurPath + DirList[CurPos]^.Desc, False, Speed);
Session.io.PauseScreen;
FullReDraw;
End;
#27 : Break;
'?' : Begin
Session.io.OutFile('ansigalh', False, 0);
FullRedraw;
End;
'!' : If Not DirList[CurPos]^.IsDir Then Begin
Session.io.AnsiColor(7);
Session.io.AnsiGotoXY(1, Session.User.ThisUser.ScreenSize);
If Session.io.GetYN(Session.GetPrompt(474), False) Then
Session.FileBase.SendFile(CurPath + DirList[CurPos]^.Desc);
FullReDraw;
End;
Else
DrawBar(False);
Case FindCharacter(Ch) of
0,
1 : DrawBar(True);
2 : Begin
DrawPage;
DrawBar(True);
End;
End;
End;
Until Session.ShutDown;
Session.io.AnsiColor(7);
Session.io.AnsiGotoXY(1, 24);
For Count := DirCount DownTo 1 Do
Dispose (DirList[Count]);
End;
2012-02-21 23:49:20 -08:00
{$IFNDEF UNIX}
Procedure PageForSysopChat (Forced: Boolean);
Var
Temp : String;
Count : Integer;
Begin
2012-09-02 18:12:46 -07:00
If Forced or ((TimerMinutes DIV 60 >= Config.ChatStart) and (TimerMinutes DIV 60 <= Config.ChatEnd)) Then Begin
2012-02-21 23:49:20 -08:00
Session.io.OutFull (Session.GetPrompt(23));
Temp := Session.io.GetInput(50, 50, 11, '');
If Temp = '' Then Exit;
Session.SystemLog('Chat Page: ' + Temp);
UpdateStatusLine (0, ' ' + strPadR(Session.User.ThisUser.Handle, 17, ' ') + ' ' + strPadR(Temp, 40, ' ') + ' ALT+(S)plit (C)Line');
2012-02-21 23:49:20 -08:00
Session.io.OutFull(Session.GetPrompt(24));
For Count := 1 to 10 Do Begin
Session.io.OutFull(Session.GetPrompt(25));
Session.io.BufFlush;
MessageBeep(0);
2012-02-22 00:41:08 -08:00
If Input.KeyPressed Then
If Input.ReadKey = #0 Then Begin
Case Input.ReadKey of
#31 : OpenChat(True);
#46 : OpenChat(False);
End;
2012-02-21 23:49:20 -08:00
2012-02-22 00:41:08 -08:00
Exit;
End;
2012-02-21 23:49:20 -08:00
WaitMS(1000);
End;
End;
UpdateStatusLine (StatusPtr, '');
2012-02-21 23:49:20 -08:00
Session.io.OutFull (Session.GetPrompt(28));
If Config.ChatFeedback Then
If Session.io.GetYN(Session.GetPrompt(178), False) Then
Session.Msgs.PostMessage (True, '/TO:' + strReplace(Config.SysopName, ' ', '_') + ' /SUBJ:Chat_Feedback');
End;
{$ENDIF}
2012-02-13 16:50:48 -08:00
(* MYSTIC 2's ANSIVIEWER
- needs to be intergrated with the msgbases. there should NOT be a msgtext AND this
class. there should only be one place where the massive message buffer exists.
Procedure TBBSIO.AnsiViewer (Data: String);
Var
Buf : Array[1..4096] of Char;
BufLen : LongInt;
TopLine : LongInt;
WinSize : LongInt;
Ansi : TMsgBaseAnsi;
AFile : File;
Ch : Char;
FN : String;
Template : String;
Str : String;
Sauce : RecSauceInfo;
Procedure Update;
Begin
// add percentage bar and line number here
Ansi.DrawPage (TBBSCore(Owner).Term.ScreenInfo[1].Y, TBBSCore(Owner).Term.ScreenInfo[2].Y, TopLine);
End;
Begin
Template := strWordGet(1, Data, ';');
FN := strWordGet(2, Data, ';');
If Pos(mysPathSep, FN) = 0 Then
FN := TBBSCore(Owner).Theme.PathText + FN;
If Pos('.', FN) = 0 Then
FN := FN + '.ans';
If Not FileExist(FN) Then Exit;
PromptInfo['A'] := JustFile(FN);
If ReadSauceInfo(FN, Sauce) Then Begin
PromptInfo['B'] := strStripR(strWide2Str(Sauce.Title, 35), ' ');
PromptInfo['C'] := strStripR(strWide2Str(Sauce.Author, 20), ' ');
PromptInfo['D'] := strStripR(strWide2Str(Sauce.Group, 20), ' ');
Str := strWide2Str(Sauce.Date, 8);
PromptInfo['E'] := Copy(Str, 5, 2) + '/' + Copy(Str, 7, 2) + '/' + Copy(Str, 1, 4);
End Else Begin
PromptInfo['B'] := 'Unknown';
PromptInfo['C'] := PromptInfo['B'];
PromptInfo['D'] := PromptInfo['B'];
PromptInfo['E'] := '??/??/????';
End;
Ansi := TMsgBaseAnsi.Create(TBBSCore(Owner), False);
Assign (AFile, FN);
ioReset (AFile, 1, fmReadWrite + fmDenyNone);
While Not Eof(AFile) Do Begin
ioBlockRead (AFile, Buf, SizeOf(Buf), BufLen);
If Ansi.ProcessBuf (Buf, BufLen) Then Break;
End;
Close (AFile);
TBBSCore(Owner).Term.AllowArrow := True;
ShowTemplate(Template);
WinSize := TBBSCore(Owner).Term.ScreenInfo[2].Y - TBBSCore(Owner).Term.ScreenInfo[1].Y + 1;
If strUpper(strWordGet(3, Data, ';')) = 'END' Then Begin
TopLine := Ansi.Lines - WinSize + 1;
If TopLine < 1 Then TopLine := 1;
End Else
TopLine := 1;
Update;
While Not TBBSCore(Owner).ShutDown Do Begin
Ch := UpCase(GetKey(0));
If IsArrow Then Begin
Case Ch of
#71 : If TopLine > 1 Then Begin
TopLine := 1;
Update;
End;
#72 : If TopLine > 1 Then Begin
Dec (TopLine);
Update;
End;
#73,
#75 : If TopLine > 1 Then Begin
Dec (TopLine, WinSize);
If TopLine < 1 Then TopLine := 1;
Update;
End;
#79 : If TopLine + WinSize <= Ansi.Lines Then Begin
TopLine := Ansi.Lines - WinSize + 1;
Update;
End;
#80 : If TopLine + WinSize <= Ansi.Lines Then Begin
Inc (TopLine);
Update;
End;
#77,
#81 : If TopLine < Ansi.Lines - WinSize Then Begin
Inc (TopLine, WinSize);
If TopLine + WinSize > Ansi.Lines Then TopLine := Ansi.Lines - WinSize + 1;
Update;
End;
End;
End Else
If Ch = #27 Then Break;
End;
Ansi.Free;
OutRaw(AnsiGotoXY(1, TBBSCore(Owner).User.ThisUser.ScreenSize));
End;
*)
End.