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,79 +307,66 @@ 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
If St Then If St Then
@ -548,9 +535,10 @@ Type
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);
@ -741,7 +729,6 @@ Function TMsgBaseJAM.WriteMsg: Word;
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);
@ -1101,21 +1087,18 @@ Function TMsgBaseJAM.GetString(MaxLen: Word): String;
WPos : LongInt; WPos : LongInt;
WLen : Byte; WLen : Byte;
StrDone : Boolean; StrDone : Boolean;
// TxtOver: Boolean;
StartSoft : Boolean; StartSoft : Boolean;
CurrLen : Word; CurrLen : Word;
// PPos: LongInt;
TmpCh : Char; TmpCh : Char;
Begin Begin
StrDone := False; StrDone := False;
CurrLen := 0; CurrLen := 0;
// PPos := JM^.TxtPos;
WPos := 0; WPos := 0;
WLen := 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: ;
@ -1126,50 +1109,39 @@ Function TMsgBaseJAM.GetString(MaxLen: Word): String;
#$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 End Else
Else
StartSoft := False; 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; End;
If StrDone Then
Begin If StrDone Then Begin
GetString[0] := Chr(CurrLen); GetString[0] := Chr(CurrLen);
End End Else
Else If EOM Then Begin
If EOM Then
Begin
GetString[0] := Chr(CurrLen); GetString[0] := Chr(CurrLen);
End End Else Begin
Else If WLen = 0 Then Begin
Begin
If WLen = 0 Then
Begin
GetString[0] := Chr(CurrLen); GetString[0] := Chr(CurrLen);
Dec(JM^.TxtPos); Dec(JM^.TxtPos);
End End Else Begin
Else
Begin
GetString[0] := Chr(WLen); GetString[0] := Chr(WLen);
JM^.TxtPos := WPos; JM^.TxtPos := WPos;
End; End;
End; 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
@ -1188,61 +1160,51 @@ Function TMsgBaseJAM.GetFrom: String; {Get from name on current msg}
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}
Function TMsgBaseJAM.GetCost: Word; {Get cost of current msg} //Begin
Begin // GetCost := MsgHdr^.JamHdr.Cost;
GetCost := MsgHdr^.JamHdr.Cost; //End;
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;
@ -1258,25 +1220,21 @@ Function TMsgBaseJAM.IsLocal: Boolean; {Is current msg local}
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;
@ -1300,7 +1258,6 @@ 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;
@ -1312,13 +1269,11 @@ Function TMsgBaseJAM.IsRcvd: Boolean; {Is current msg received}
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
IsDeleted := (MsgHdr^.JamHdr.Attr1 and Jam_Deleted) <> 0; IsDeleted := (MsgHdr^.JamHdr.Attr1 and Jam_Deleted) <> 0;

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;