Code cleanup

This commit is contained in:
mysticbbs 2012-09-24 02:38:25 -04:00
parent b788a94a0e
commit 0087df705f
4 changed files with 129 additions and 177 deletions

View File

@ -1464,10 +1464,7 @@ Var
End; End;
Procedure Send_Msg_Text (Str : String); Procedure Send_Msg_Text (Str : String);
Var
B : Byte;
Begin Begin
If IsQuotedText(Str) Then Begin If IsQuotedText(Str) Then Begin
Session.io.AnsiColor(MBase.ColQuote); Session.io.AnsiColor(MBase.ColQuote);
Session.io.OutPipe (Str); Session.io.OutPipe (Str);

View File

@ -62,7 +62,7 @@ Type
Function GetFrom: String; Virtual; {Get from name on current msg} Function GetFrom: String; Virtual; {Get from name on current msg}
Function GetTo: String; Virtual; {Get to name on current msg} Function GetTo: String; Virtual; {Get to name on current msg}
Function GetSubj: String; Virtual; {Get subject on current msg} Function GetSubj: String; Virtual; {Get subject on current msg}
Function GetCost: Word; Virtual; {Get cost of current msg} // Function GetCost: Word; Virtual; {Get cost of current msg}
Function GetDate: String; Virtual; {Get date of current msg} Function GetDate: String; Virtual; {Get date of current msg}
Function GetTime: String; Virtual; {Get time of current msg} Function GetTime: String; Virtual; {Get time of current msg}
Function GetRefer: LongInt; Virtual; {Get reply to of current msg} Function GetRefer: LongInt; Virtual; {Get reply to of current msg}
@ -381,9 +381,9 @@ Function TMsgBaseABS.GetSubj: String;
Begin Begin
End; End;
Function TMsgBaseABS.GetCost: Word; //Function TMsgBaseABS.GetCost: Word;
Begin //Begin
End; //End;
Function TMsgBaseABS.GetDate: String; Function TMsgBaseABS.GetDate: String;
Begin Begin

View File

@ -191,7 +191,7 @@ Type
Function GetFrom : String; Virtual; {Get from name on current msg} Function GetFrom : String; Virtual; {Get from name on current msg}
Function GetTo : String; Virtual; {Get to name on current msg} Function GetTo : String; Virtual; {Get to name on current msg}
Function GetSubj : String; Virtual; {Get subject on current msg} Function GetSubj : String; Virtual; {Get subject on current msg}
Function GetCost : Word; Virtual; {Get cost of current msg} // Function GetCost : Word; Virtual; {Get cost of current msg}
Function GetDate : String; Virtual; {Get date of current msg} Function GetDate : String; Virtual; {Get date of current msg}
Function GetTime : String; Virtual; {Get time of current msg} Function GetTime : String; Virtual; {Get time of current msg}
Function GetRefer : LongInt; Virtual; {Get reply to of current msg} Function GetRefer : LongInt; Virtual; {Get reply to of current msg}
@ -307,78 +307,65 @@ Begin
JamStrCrc := Crc; JamStrCrc := Crc;
End; End;
Procedure TMsgBaseJAM.SetMsgPath(St: String); Procedure TMsgBaseJAM.SetMsgPath(St: String);
Begin Begin
JM^.MsgPath := Copy(St, 1, 124); JM^.MsgPath := Copy(St, 1, 124);
End; End;
Function TMsgBaseJAM.GetHighMsgNum: LongInt; Function TMsgBaseJAM.GetHighMsgNum: LongInt;
Begin Begin
GetHighMsgNum := JM^.BaseHdr.BaseMsgNum + FileSize(JM^.IdxFile) - 1; GetHighMsgNum := JM^.BaseHdr.BaseMsgNum + FileSize(JM^.IdxFile) - 1;
End; End;
Procedure TMsgBaseJAM.SetDest(Var Addr: RecEchoMailAddr); Procedure TMsgBaseJAM.SetDest(Var Addr: RecEchoMailAddr);
Begin Begin
JM^.Dest := Addr; JM^.Dest := Addr;
End; End;
Procedure TMsgBaseJAM.SetOrig(Var Addr: RecEchoMailAddr); Procedure TMsgBaseJAM.SetOrig(Var Addr: RecEchoMailAddr);
Begin Begin
JM^.Orig := Addr; JM^.Orig := Addr;
End; End;
Procedure TMsgBaseJAM.SetFrom(Name: String); Procedure TMsgBaseJAM.SetFrom(Name: String);
Begin Begin
JM^.MsgFrom := Name; JM^.MsgFrom := Name;
End; End;
Procedure TMsgBaseJAM.SetTo(Name: String); Procedure TMsgBaseJAM.SetTo(Name: String);
Begin Begin
JM^.MsgTo := Name; JM^.MsgTo := Name;
End; End;
Procedure TMsgBaseJAM.SetSubj(Str: String); Procedure TMsgBaseJAM.SetSubj(Str: String);
Begin Begin
JM^.MsgSubj := Str; JM^.MsgSubj := Str;
End; End;
Procedure TMsgBaseJAM.SetCost(SCost: Word); Procedure TMsgBaseJAM.SetCost(SCost: Word);
Begin Begin
MsgHdr^.JamHdr.Cost := SCost; MsgHdr^.JamHdr.Cost := SCost;
End; End;
Procedure TMsgBaseJAM.SetRefer(SRefer: LongInt); Procedure TMsgBaseJAM.SetRefer(SRefer: LongInt);
Begin Begin
MsgHdr^.JamHdr.ReplyTo := SRefer; MsgHdr^.JamHdr.ReplyTo := SRefer;
End; End;
Procedure TMsgBaseJAM.SetSeeAlso(SAlso: LongInt); Procedure TMsgBaseJAM.SetSeeAlso(SAlso: LongInt);
Begin Begin
MsgHdr^.JamHdr.ReplyFirst := SAlso; MsgHdr^.JamHdr.ReplyFirst := SAlso;
End; End;
Procedure TMsgBaseJAM.SetDate(SDate: String); Procedure TMsgBaseJAM.SetDate(SDate: String);
Begin Begin
JM^.MsgDate := SDate; JM^.MsgDate := SDate;
End; End;
Procedure TMsgBaseJAM.SetTime(STime: String); Procedure TMsgBaseJAM.SetTime(STime: String);
Begin Begin
JM^.MsgTime := STime; JM^.MsgTime := STime;
End; End;
Procedure TMsgBaseJAM.SetAttr1(Mask: LongInt; St: Boolean); Procedure TMsgBaseJAM.SetAttr1(Mask: LongInt; St: Boolean);
Begin Begin
@ -543,20 +530,21 @@ Type
Data : Array[1..256] of Char; Data : Array[1..256] of Char;
End; End;
Var Var
SubField: SubFieldPTR; SubField: SubFieldPTR;
Begin Begin
SubField := SubFieldPTR(@MsgHdr^.SubBuf[MsgHdr^.JamHdr.SubFieldLen + 1]); SubField := SubFieldPTR(@MsgHdr^.SubBuf[MsgHdr^.JamHdr.SubFieldLen + 1]);
If (MsgHdr^.JamHdr.SubFieldLen + 8 + Length(Data) < JamSubBufSize) Then
Begin If (MsgHdr^.JamHdr.SubFieldLen + 8 + Length(Data) < JamSubBufSize) Then Begin
Inc(MsgHdr^.JamHdr.SubFieldLen, 8 + Length(Data)); Inc(MsgHdr^.JamHdr.SubFieldLen, 8 + Length(Data));
SubField^.LoId := Id; SubField^.LoId := Id;
SubField^.HiId := 0; SubField^.HiId := 0;
SubField^.DataLen := Length(Data); SubField^.DataLen := Length(Data);
Move(Data[1], SubField^.Data[1], Length(Data)); Move(Data[1], SubField^.Data[1], Length(Data));
End;
End; End;
End;
Procedure TMsgBaseJAM.EditMsgInit; Procedure TMsgBaseJAM.EditMsgInit;
Begin Begin
@ -735,13 +723,12 @@ Begin
UnLockMsgBase; UnLockMsgBase;
End; End;
Function TMsgBaseJAM.WriteMsg: Word; Function TMsgBaseJAM.WriteMsg: Word;
Var Var
DT: DateTime; DT: DateTime;
WriteError: Word; WriteError: Word;
i: longint; i: longint;
TmpIdx: JamIdxType; TmpIdx: JamIdxType;
Begin Begin
WriteError := 0; WriteError := 0;
@ -952,8 +939,7 @@ Procedure TMsgBaseJAM.MsgStartUp;
JM^.MsgTime := strZero(DT.Hour) + ':' + strZero(DT.Min); JM^.MsgTime := strZero(DT.Hour) + ':' + strZero(DT.Min);
SubCtr := 1; SubCtr := 1;
While ((SubCtr <= MsgHdr^.JamHdr.SubFieldLen) and While ((SubCtr <= MsgHdr^.JamHdr.SubFieldLen) and (SubCtr < JamSubBufSize)) Do
(SubCtr < JamSubBufSize)) Do
Begin Begin
SubPtr := SubFieldPTR(@MsgHdr^.SubBuf[SubCtr]); SubPtr := SubFieldPTR(@MsgHdr^.SubBuf[SubCtr]);
Inc(SubCtr, SubPtr^.DataLen + 8); Inc(SubCtr, SubPtr^.DataLen + 8);
@ -1096,85 +1082,71 @@ Begin
JM^.TxtPos := MsgHdr^.JamHdr.TextOfs; JM^.TxtPos := MsgHdr^.JamHdr.TextOfs;
End; End;
Function TMsgBaseJAM.GetString(MaxLen: Word): String; Function TMsgBaseJAM.GetString (MaxLen: Word) : String;
Var Var
WPos: LongInt; WPos : LongInt;
WLen: Byte; WLen : Byte;
StrDone: Boolean; StrDone : Boolean;
// TxtOver: Boolean; StartSoft : Boolean;
StartSoft: Boolean; CurrLen : Word;
CurrLen: Word; TmpCh : Char;
// PPos: LongInt; Begin
TmpCh: Char; StrDone := False;
CurrLen := 0;
Begin WPos := 0;
StrDone := False; WLen := 0;
CurrLen := 0;
// PPos := JM^.TxtPos;
WPos := 0;
WLen := 0;
StartSoft := LastSoft; StartSoft := LastSoft;
LastSoft := True; LastSoft := True;
TmpCh := GetChar; TmpCh := GetChar;
While ((Not StrDone) And (CurrLen <= MaxLen) And (Not EOM)) Do Begin While ((Not StrDone) And (CurrLen <= MaxLen) And (Not EOM)) Do Begin
Case TmpCh of Case TmpCh of
#$00:; #$00: ;
#$0d: Begin #$0d: Begin
StrDone := True; StrDone := True;
LastSoft := False; LastSoft := False;
End; End;
#$8d:; #$8d: ;
#$0a:; #$0a: ;
#$20: Begin #$20: Begin
If ((CurrLen <> 0) or (Not StartSoft)) Then If ((CurrLen <> 0) or (Not StartSoft)) Then Begin
Begin Inc(CurrLen);
Inc(CurrLen); WLen := CurrLen;
WLen := CurrLen; GetString[CurrLen] := TmpCh;
GetString[CurrLen] := TmpCh; WPos := JM^.TxtPos;
WPos := JM^.TxtPos; End Else
End StartSoft := False;
Else
StartSoft := False;
End; End;
Else Else
Begin Inc(CurrLen);
Inc(CurrLen); GetString[CurrLen] := TmpCh;
GetString[CurrLen] := TmpCh; End;
End;
End;
If Not StrDone Then If Not StrDone Then
TmpCh := GetChar; TmpCh := GetChar;
End;
If StrDone Then
Begin
GetString[0] := Chr(CurrLen);
End
Else
If EOM Then
Begin
GetString[0] := Chr(CurrLen);
End
Else
Begin
If WLen = 0 Then
Begin
GetString[0] := Chr(CurrLen);
Dec(JM^.TxtPos);
End
Else
Begin
GetString[0] := Chr(WLen);
JM^.TxtPos := WPos;
End;
End;
End; End;
If StrDone Then Begin
GetString[0] := Chr(CurrLen);
End Else
If EOM Then Begin
GetString[0] := Chr(CurrLen);
End Else Begin
If WLen = 0 Then Begin
GetString[0] := Chr(CurrLen);
Dec(JM^.TxtPos);
End Else Begin
GetString[0] := Chr(WLen);
JM^.TxtPos := WPos;
End;
End;
End;
Function TMsgBaseJAM.EOM: Boolean; Function TMsgBaseJAM.EOM: Boolean;
Begin Begin
EOM := (((JM^.TxtPos < MsgHdr^.JamHdr.TextOfs) Or EOM := (((JM^.TxtPos < MsgHdr^.JamHdr.TextOfs) Or
(JM^.TxtPos > JM^.TxtEnd)) And (JM^.TxtPos >= 0)); (JM^.TxtPos > JM^.TxtEnd)) And (JM^.TxtPos >= 0));
End; End;
(* (*
Function TMsgBaseJAM.WasWrap: Boolean; Function TMsgBaseJAM.WasWrap: Boolean;
@ -1184,69 +1156,59 @@ Function TMsgBaseJAM.WasWrap: Boolean;
*) *)
Function TMsgBaseJAM.GetFrom: String; {Get from name on current msg} Function TMsgBaseJAM.GetFrom: String; {Get from name on current msg}
Begin Begin
GetFrom := JM^.MsgFrom; GetFrom := JM^.MsgFrom;
End; End;
Function TMsgBaseJAM.GetTo: String; {Get to name on current msg} Function TMsgBaseJAM.GetTo: String; {Get to name on current msg}
Begin Begin
GetTo := JM^.MsgTo; GetTo := JM^.MsgTo;
End; End;
Function TMsgBaseJAM.GetSubj: String; {Get subject on current msg} Function TMsgBaseJAM.GetSubj: String; {Get subject on current msg}
Begin Begin
GetSubj := JM^.MsgSubj; GetSubj := JM^.MsgSubj;
End; End;
Function TMsgBaseJAM.GetCost: Word; {Get cost of current msg}
Begin
GetCost := MsgHdr^.JamHdr.Cost;
End;
//Function TMsgBaseJAM.GetCost: Word; {Get cost of current msg}
//Begin
// GetCost := MsgHdr^.JamHdr.Cost;
//End;
Function TMsgBaseJAM.GetDate: String; {Get date of current msg} Function TMsgBaseJAM.GetDate: String; {Get date of current msg}
Begin Begin
GetDate := JM^.MsgDate; GetDate := JM^.MsgDate;
End; End;
Function TMsgBaseJAM.GetTime: String; {Get time of current msg} Function TMsgBaseJAM.GetTime: String; {Get time of current msg}
Begin Begin
GetTime := JM^.MsgTime; GetTime := JM^.MsgTime;
End; End;
Function TMsgBaseJAM.GetRefer: LongInt; {Get reply to of current msg} Function TMsgBaseJAM.GetRefer: LongInt; {Get reply to of current msg}
Begin Begin
GetRefer := MsgHdr^.JamHdr.ReplyTo; GetRefer := MsgHdr^.JamHdr.ReplyTo;
End; End;
Function TMsgBaseJAM.GetSeeAlso: LongInt; {Get see also of current msg} Function TMsgBaseJAM.GetSeeAlso: LongInt; {Get see also of current msg}
Begin Begin
GetSeeAlso := MsgHdr^.JamHdr.ReplyFirst; GetSeeAlso := MsgHdr^.JamHdr.ReplyFirst;
End; End;
Function TMsgBaseJAM.GetMsgNum: LongInt; {Get message number} Function TMsgBaseJAM.GetMsgNum: LongInt; {Get message number}
Begin Begin
GetMsgNum := MsgHdr^.JamHdr.MsgNum; GetMsgNum := MsgHdr^.JamHdr.MsgNum;
End; End;
Procedure TMsgBaseJAM.GetOrig(Var Addr: RecEchoMailAddr); {Get origin address} Procedure TMsgBaseJAM.GetOrig(Var Addr: RecEchoMailAddr); {Get origin address}
Begin Begin
Addr := JM^.Orig; Addr := JM^.Orig;
End; End;
Procedure TMsgBaseJAM.GetDest(Var Addr: RecEchoMailAddr); {Get destination address} Procedure TMsgBaseJAM.GetDest(Var Addr: RecEchoMailAddr); {Get destination address}
Begin Begin
Addr := JM^.Dest; Addr := JM^.Dest;
End; End;
Function TMsgBaseJAM.GetTextLen : LongInt; {returns length of text in msg} Function TMsgBaseJAM.GetTextLen : LongInt; {returns length of text in msg}
Begin Begin
@ -1254,33 +1216,29 @@ Begin
End; End;
Function TMsgBaseJAM.IsLocal: Boolean; {Is current msg local} Function TMsgBaseJAM.IsLocal: Boolean; {Is current msg local}
Begin Begin
IsLocal := (MsgHdr^.JamHdr.Attr1 and Jam_Local) <> 0; IsLocal := (MsgHdr^.JamHdr.Attr1 and Jam_Local) <> 0;
End; End;
Function TMsgBaseJAM.IsCrash: Boolean; {Is current msg crash} Function TMsgBaseJAM.IsCrash: Boolean; {Is current msg crash}
Begin Begin
IsCrash := (MsgHdr^.JamHdr.Attr1 and Jam_Crash) <> 0; IsCrash := (MsgHdr^.JamHdr.Attr1 and Jam_Crash) <> 0;
End; End;
Function TMsgBaseJAM.IsKillSent: Boolean; {Is current msg kill sent} Function TMsgBaseJAM.IsKillSent: Boolean; {Is current msg kill sent}
Begin Begin
IsKillSent := (MsgHdr^.JamHdr.Attr1 and Jam_KillSent) <> 0; IsKillSent := (MsgHdr^.JamHdr.Attr1 and Jam_KillSent) <> 0;
End; End;
Function TMsgBaseJAM.IsSent: Boolean; {Is current msg sent} Function TMsgBaseJAM.IsSent: Boolean; {Is current msg sent}
Begin Begin
IsSent := (MsgHdr^.JamHdr.Attr1 and Jam_Sent) <> 0; IsSent := (MsgHdr^.JamHdr.Attr1 and Jam_Sent) <> 0;
End; End;
Function TMsgBaseJAM.IsFAttach: Boolean; {Is current msg file attach} Function TMsgBaseJAM.IsFAttach: Boolean; {Is current msg file attach}
Begin Begin
IsFAttach := (MsgHdr^.JamHdr.Attr1 and Jam_FAttch) <> 0; IsFAttach := (MsgHdr^.JamHdr.Attr1 and Jam_FAttch) <> 0;
End; End;
//Function TMsgBaseJAM.IsReqRct: Boolean; {Is current msg request receipt} //Function TMsgBaseJAM.IsReqRct: Boolean; {Is current msg request receipt}
@ -1300,24 +1258,21 @@ Function TMsgBaseJAM.IsFAttach: Boolean; {Is current msg file attach}
// IsRetRct := False; // IsRetRct := False;
// End; // End;
Function TMsgBaseJAM.IsFileReq: Boolean; {Is current msg a file request} Function TMsgBaseJAM.IsFileReq: Boolean; {Is current msg a file request}
Begin Begin
IsFileReq := (MsgHdr^.JamHdr.Attr1 and Jam_Freq) <> 0; IsFileReq := (MsgHdr^.JamHdr.Attr1 and Jam_Freq) <> 0;
End; End;
Function TMsgBaseJAM.IsRcvd: Boolean; {Is current msg received} Function TMsgBaseJAM.IsRcvd: Boolean; {Is current msg received}
Begin Begin
IsRcvd := (MsgHdr^.JamHdr.Attr1 and Jam_Rcvd) <> 0; IsRcvd := (MsgHdr^.JamHdr.Attr1 and Jam_Rcvd) <> 0;
End; End;
Function TMsgBaseJAM.IsPriv: Boolean; {Is current msg priviledged/private} Function TMsgBaseJAM.IsPriv: Boolean; {Is current msg priviledged/private}
Begin Begin
IsPriv := (MsgHdr^.JamHdr.Attr1 and Jam_Priv) <> 0; IsPriv := (MsgHdr^.JamHdr.Attr1 and Jam_Priv) <> 0;
End; End;
Function TMsgBaseJAM.IsDeleted: Boolean; {Is current msg deleted} Function TMsgBaseJAM.IsDeleted: Boolean; {Is current msg deleted}
Begin Begin

View File

@ -16,8 +16,8 @@ Const
SqNullFrame = 0; SqNullFrame = 0;
SqFrameMsg = 0; SqFrameMsg = 0;
SqFrameFree = 1; SqFrameFree = 1;
SqFrameRLE = 2; // SqFrameRLE = 2;
SqFrameLZW = 3; // SqFrameLZW = 3;
SqFromSize = 36; SqFromSize = 36;
SqToSize = 36; SqToSize = 36;
SqSubjSize = 72; SqSubjSize = 72;