From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: stopping a loop iteration without exiting it Date: Fri, 5 Jan 2018 17:58:31 -0600 Organization: JSA Research & Innovation Message-ID: References: <81971548-23c9-4927-a6a8-6f0f1dba896b@googlegroups.com> Injection-Date: Fri, 5 Jan 2018 23:58:32 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="12699"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:49773 Date: 2018-01-05T17:58:31-06:00 List-Id: Jeffrey R. Carter" wrote in message news:p2o0mp$brp$1@dont-email.me... ... > I've never written a spam filter, but I'd imagine that one would be > structured something like > > All_Msgs : loop > exit All_Msgs when Msg_Source.Is_Empty; > > Msg := Msg_Source.Get; > Is_Spam := False; > > All_Patterns : for Pattern of Patterns loop > Is_Spam := Pattern.Check (Msg); > > if Is_Spam then > Reject (Message => Msg); > > exit All_Patterns; > end if; > end loop All_Patterns; > > if not Is_Spam then > Allow (Message => Msg); > end if; > end loop All_Msgs; > > and moving on to the next pattern would be "return False;" in Check. > Reality is probably more complex than this. Definitely. There are a number of different dispositions (Block [don't accept the message in the first place, not possible in this part of the algorithm], Delete, Quarantine [for human inspection], or Allow). One also has to deal with white lists, and the possibility that a pattern might cause a white list trigger. I also have two levels of white list (allow unconditionally, or allow but quarantine questionable mail). And there are patterns specifically for different parts of the message (the text, the HTML markup, links, headers, etc.) Plus there are actions associated with the success or failure of certain patterns (such as checking linked websites for known spam sites). I've probably missed some cases, too. Randy.