OSDN Git Service

スキンが <SPAMMINESS/> でスパム度数を取得できるようになった。
authoryoffy <yoffy>
Thu, 21 Oct 2004 06:39:34 +0000 (06:39 +0000)
committeryoffy <yoffy>
Thu, 21 Oct 2004 06:39:34 +0000 (06:39 +0000)
GikoSystem.pas

index 1848691..c01b189 100644 (file)
@@ -992,9 +992,16 @@ function TGikoSys.SkinedRes(
        Res: TResRec;
        No: string
 ): string;
+var
+       spamminess      : Extended;
+       wordCount               : TWordCount;
 begin
 
+       wordCount := TWordCount.Create;
        try
+               spamminess := Floor( FBayesian.Parse(
+                       Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
+
                Skin := CustomStringReplace( Skin, '<NUMBER/>',
                        '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
                Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
@@ -1004,6 +1011,7 @@ begin
                Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
                Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
                Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
+               Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
 
                //----- \82©\82¿\82ã\81`\82µ\82á\8cÝ\8a·\97p\81B\83R\83\81\83\93\83g\83A\83E\83g\82µ\82Ä\82à\82æ\82µ
                Skin := CustomStringReplace( Skin, '&NUMBER',
@@ -1015,10 +1023,12 @@ begin
                Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
                Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
                Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
+               Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
                //----- \82±\82±\82Ü\82Å
 
                Result := Skin;
        finally
+               wordCount.Free;
        end;
 
 end;
@@ -1042,6 +1052,8 @@ var
        SkinNewRes: string;
        SkinRes: string;
 
+       strTmp : string;
+
        function LoadSkin( fileName: string ): string;
        begin
                Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
@@ -1280,10 +1292,12 @@ begin
                                                try
                                                        if NewReceiveNo <= (i + 1) then
                                                                // \90V\92\85\83\8c\83X
-                                                               SaveList.Add( ReplaceRes( SkinNewRes ) )
+                                                               strTmp := ReplaceRes( SkinNewRes )
                                                        else
                                                                // \92Ê\8fí\82Ì\83\8c\83X
-                                                               SaveList.Add( ReplaceRes( SkinRes ) );
+                                                               strTmp := ReplaceRes( SkinRes );
+
+                                                       SaveList.Add( strTmp );
                                                except
                                                end;
                                        end;