All files / Scripts/row ForefrontAntispam.ts

100% Statements 17/17
100% Branches 3/3
100% Functions 4/4
100% Lines 15/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 463x 3x   3x   3x 18x                                         14x 2x 2x     12x     97x   2x 1x 1x 17x   1x      
import { mhaStrings } from "../mhaStrings";
import { AntiSpamReport } from "./Antispam";
import { Header } from "./Header";
import { Row } from "./Row";
 
export class ForefrontAntiSpamReport extends AntiSpamReport {
    private forefrontAntiSpamRows: Row[] = [
        new Row("ARC", mhaStrings.mhaArc, "X-Forefront-Antispam-Report"),
        new Row("CTRY", mhaStrings.mhaCountryRegion, "X-Forefront-Antispam-Report"),
        new Row("LANG", mhaStrings.mhaLang, "X-Forefront-Antispam-Report"),
        new Row("SCL", mhaStrings.mhaScl, "X-MS-Exchange-Organization-SCL"),
        new Row("PCL", mhaStrings.mhaPcl, "X-Forefront-Antispam-Report"),
        new Row("SFV", mhaStrings.mhaSfv, "X-Forefront-Antispam-Report"),
        new Row("IPV", mhaStrings.mhaIpv, "X-Forefront-Antispam-Report"),
        new Row("H", mhaStrings.mhaHelo, "X-Forefront-Antispam-Report"),
        new Row("PTR", mhaStrings.mhaPtr, "X-Forefront-Antispam-Report"),
        new Row("CIP", mhaStrings.mhaCip, "X-Forefront-Antispam-Report"),
        new Row("CAT", mhaStrings.mhaCat, "X-Forefront-Antispam-Report"),
        new Row("SFTY", mhaStrings.mhaSfty, "X-Forefront-Antispam-Report"),
        new Row("SRV", mhaStrings.mhaSrv, "X-Forefront-Antispam-Report"),
        new Row("X-CustomSpam", mhaStrings.mhaCustomSpam, "X-Forefront-Antispam-Report"),
        new Row("SFS", mhaStrings.mhaSfs, "SFS"),
        new Row("source", mhaStrings.mhaSource, "X-Microsoft-Antispam"),
        new Row("unparsed", mhaStrings.mhaUnparsed, "X-Microsoft-Antispam")
    ];
 
    public override add(header: Header): boolean {
        if (header.header.toUpperCase() === "X-Forefront-Antispam-Report".toUpperCase()) {
            this.parse(header.value);
            return true;
        }
 
        return false;
    }
 
    public override get rows(): Row[] { return this.forefrontAntiSpamRows; }
    public override toString(): string {
        if (!this.exists()) return "";
        const ret = ["ForefrontAntiSpamReport"];
        this.rows.forEach(function (row) {
            if (row.value) { ret.push(row.toString()); }
        });
        return ret.join("\n");
    }
}