mimemess.pas and mimepart.pas - BOM fixes by Michael Van Canneyt

git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@217 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
geby
2021-06-12 14:06:39 +00:00
parent b5ee2d693e
commit 733c96f114
2 changed files with 28 additions and 18 deletions

View File

@@ -1,9 +1,9 @@
{==============================================================================|
| Project : Ararat Synapse | 002.006.000 |
| Project : Ararat Synapse | 002.006.001 |
|==============================================================================|
| Content: MIME message object |
|==============================================================================|
| Copyright (c)1999-2012, Lukas Gebauer |
| Copyright (c)1999-2021, Lukas Gebauer |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
@@ -33,7 +33,7 @@
| DAMAGE. |
|==============================================================================|
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
| Portions created by Lukas Gebauer are Copyright (c)2000-2012. |
| Portions created by Lukas Gebauer are Copyright (c)2000-2021. |
| Portions created by Petr Fejfar are Copyright (c)2011-2012. |
| All Rights Reserved. |
|==============================================================================|
@@ -306,9 +306,9 @@ implementation
constructor TMessHeader.Create;
begin
inherited Create;
FToList := TStringList.Create;
FCCList := TStringList.Create;
FCustomHeaders := TStringList.Create;
FToList := CreateStringList;
FCCList := CreateStringList;
FCustomHeaders := CreateStringList;
FCharsetCode := GetCurCP;
end;
@@ -583,7 +583,7 @@ constructor TMimeMess.CreateAltHeaders(HeadClass: TMessHeaderClass);
begin
inherited Create;
FMessagePart := TMimePart.Create;
FLines := TStringList.Create;
FLines := CreateStringList;
FHeader := HeadClass.Create;
end;
@@ -687,7 +687,7 @@ function TMimeMess.AddPartTextFromFile(const FileName: String; const PartParent:
var
tmp: TStrings;
begin
tmp := TStringList.Create;
tmp := CreateStringList;
try
tmp.LoadFromFile(FileName);
Result := AddPartText(tmp, PartParent);
@@ -700,7 +700,7 @@ function TMimeMess.AddPartHTMLFromFile(const FileName: String; const PartParent:
var
tmp: TStrings;
begin
tmp := TStringList.Create;
tmp := CreateStringList;
try
tmp.LoadFromFile(FileName);
Result := AddPartHTML(tmp, PartParent);
@@ -784,7 +784,7 @@ function TMimeMess.AddPartMessFromFile(const FileName: String; const PartParent:
var
tmp: TStrings;
begin
tmp := TStringList.Create;
tmp := CreateStringList;
try
tmp.LoadFromFile(FileName);
Result := AddPartMess(tmp, PartParent);
@@ -801,7 +801,7 @@ var
x: integer;
begin
//merge headers from THeaders and header field from MessagePart
l := TStringList.Create;
l := CreateStringList;
try
FHeader.EncodeHeaders(l);
x := IndexByBegin('CONTENT-TYPE', FMessagePart.Headers);

View File

@@ -1,5 +1,5 @@
{==============================================================================|
| Project : Ararat Synapse | 002.009.001 |
| Project : Ararat Synapse | 002.009.002 |
|==============================================================================|
| Content: MIME support procedures and functions |
|==============================================================================|
@@ -370,6 +370,8 @@ const
{:Generates a unique boundary string.}
function GenerateBoundary: string;
{:Generates a stringlist that does not write a BOM character.}
Function CreateStringList : TStringList;
implementation
@@ -379,11 +381,11 @@ constructor TMIMEPart.Create;
begin
inherited Create;
FOnWalkPart := nil;
FLines := TStringList.Create;
FPartBody := TStringList.Create;
FHeaders := TStringList.Create;
FPrePart := TStringList.Create;
FPostPart := TStringList.Create;
FLines := CreateStringList;
FPartBody := CreateStringList;
FHeaders := CreateStringList;
FPrePart := CreateStringList;
FPostPart := CreateStringList;
FDecodedLines := TMemoryStream.Create;
FSubParts := TList.Create;
FTargetCharset := GetCurCP;
@@ -970,7 +972,7 @@ var
begin
if (FEncodingCode = ME_UU) or (FEncodingCode = ME_XX) then
Encoding := 'base64';
l := TStringList.Create;
l := CreateStringList;
FPartBody.Clear;
FDecodedLines.Position := 0;
try
@@ -1224,4 +1226,12 @@ begin
Result := IntToHex(x, 8) + '_' + IntToHex(y, 8) + '_Synapse_boundary';
end;
function CreateStringList: TStringList;
begin
Result := TStringList.Create;
{$IFDEF UNICODE}
Result.WriteBOM := False;
{$ENDIF}
end;
end.