diff options
author | Erich Eckner <git@eckner.net> | 2019-05-30 16:17:02 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-05-30 16:17:02 +0200 |
commit | 76df851d4a53f694f0901d8a4af8c113757e70d3 (patch) | |
tree | 8d6ece3bbb57f79a6daabf98c24b9fb840f8d565 | |
parent | 4bef54899a8c3ed6974bebe20b0605a7cddb1c50 (diff) | |
download | units-76df851d4a53f694f0901d8a4af8c113757e70d3.tar.xz |
popimapunit.pas: evaluate X-Spam-Level header
-rw-r--r-- | popimapunit.pas | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/popimapunit.pas b/popimapunit.pas index 8d841b1..595eef6 100644 --- a/popimapunit.pas +++ b/popimapunit.pas @@ -12,14 +12,18 @@ type tMarkenValiditaet = (mvKeine,mvGueltig,mvUngueltig); tBefehlAusfuehrenErgebnis = (baeOk,baeError,baeTimeOut); tMailProtocol = (mpPop, mpImap); + tSpamLevel = (slSpam,slHam,slUnbekannt); tPopImapClient = class; tNachricht = class(tMyStringList) private _marke: tMarkenValiditaet; + _spam: tSpamLevel; procedure pruefeMarke; + procedure pruefeSpam; function rMarke: tMarkenValiditaet; + function rSpam: tSpamLevel; public id,groesze: longint; sdbName,gueltigerAdressat: string; @@ -29,6 +33,8 @@ type function istGleich(n: tNachricht): boolean; property marke: tMarkenValiditaet read rMarke; + property spam: tSpamLevel + read rSpam; end; tPopImapThread = class(tThread) @@ -76,6 +82,7 @@ type function von(n: longint): string; function zeit(n: longint): string; function marke(n: longint): tMarkenValiditaet; + function spam(n: longint): tSpamLevel; procedure threadAnhalten; procedure aufThreadWarten; procedure loesche(n: longint); @@ -295,12 +302,37 @@ begin closeFile(f); end; +procedure tNachricht.pruefeSpam; +var + s: string; +begin + s:=grepFirst('^[Xx]-Spam-Status:\s'); + if s='' then begin + _spam:=slUnbekannt; + exit; + end; + + if _spam<>slUnbekannt then + exit; + erstesArgument(s,':'); + if erstesArgument(s,',')='No' then + _spam:=slHam + else + _spam:=slSpam; +end; + function tNachricht.rMarke: tMarkenValiditaet; begin pruefeMarke; result:=_marke; end; +function tNachricht.rSpam: tSpamLevel; +begin + pruefeSpam; + result:=_spam; +end; + procedure tNachricht.kopiereVon(n: tNachricht); begin text:=n.text; @@ -796,6 +828,11 @@ begin result:=_nachrichten[n].marke; end; +function tPopImapClient.spam(n: longint): tSpamLevel; +begin + result:=_nachrichten[n].spam; +end; + procedure tPopImapClient.threadAnhalten; begin _thread.beenden:=true; |