You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Hontvari Jozsef <ho...@solware.com> on 2003/05/19 23:59:21 UTC
[PATCH] AttachmentFileNameIs matcher
This matcher can be used to refuse emails with SCR, PIF, EXE etc. (you
decide) attachments.
Here is a usage example (also see javadoc):
<!-- file extensions indicating virus (.pi is a wrong .pif) -->
<mailet
match="AttachmentFileNameIs=*.scr,*.bat,*.pif,*.pi,*.com,*.bmp,*.exe"
class="ToProcessor">
<processor> bounce </processor>
<notice> EXE, BMP, BAT, PIF, SCR file file attachments are not
allowed </notice>
</mailet>
If it is accepted I'll create the user doc too.
AttachmentFileNameIs.zip
[PATCH] AttachmentFileNameIs matcher doc
Posted by Hontvari Jozsef <ho...@solware.com>.
----- Original Message -----
From: "Hontvari Jozsef" <ho...@solware.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Monday, May 19, 2003 11:59 PM
Subject: [PATCH] AttachmentFileNameIs matcher
> This matcher can be used to refuse emails with SCR, PIF, EXE etc. (you
> decide) attachments.
>
> Here is a usage example (also see javadoc):
> <!-- file extensions indicating virus (.pi is a wrong .pif) -->
> <mailet
> match="AttachmentFileNameIs=*.scr,*.bat,*.pif,*.pi,*.com,*.bmp,*.exe"
> class="ToProcessor">
> <processor> bounce </processor>
> <notice> EXE, BMP, BAT, PIF, SCR file file attachments are not
> allowed </notice>
> </mailet>
>
> If it is accepted I'll create the user doc too.
>
>
> AttachmentFileNameIs.zip
>
----------------------------------------------------------------------------
----
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
RE: [PATCH] AttachmentFileNameIs matcher
Posted by "Noel J. Bergman" <no...@devtech.com>.
>>>Also, I think we should keep the same pattern of having
>>>non-regex first, and then regex versions later
>> At this point it is so easy to do it, why not? If he indicated that he
>> would prefer to start with this, and then just change the implementation
to
>> extend regex support, that would be OK.
> Regex is a necessary evil, but it is unmistakenly evil, evil, evil.
Ahhh ... LOL I understand. Personally, I happen to LIKE regex. LOL But I
see the point that you were trying to make. I was thinking flexibility and
functionality; you were thinking, "How are we EVER going to explain that to
end users?!?!?" ;-)
OK, I'll commit it as-is, and then look at how to add regex without losing
the easy way.
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
Re: Regex naming convention
Posted by Serge Knystautas <se...@lokitech.com>.
Noel J. Bergman wrote:
> Regex suffix.
+1
--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com/
p. 1.301.656.5501
e. sergek@lokitech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
Re: Regex naming convention
Posted by Hontvari Jozsef <ho...@solware.com>.
> RecipientIsRegex, HostIs and HostIsRegex, AttachmentFileNameIs and
> AttachmentFileNameIsRegex, etc.?
I thought as much. It is reasonable to have two version, both for user
friendliness, and maybe for better resource usage. And that is a natural
naming convention, as I remember I have seen similar naming several times.
----- Original Message -----
From: "Noel J. Bergman" <no...@devtech.com>
To: "James Developers List" <ja...@jakarta.apache.org>
Sent: Tuesday, May 20, 2003 7:30 PM
Subject: Regex naming convention
> > we have to consider that there will be a broad spectrum of users,
> > some of whom will welcome the power of regex matchers, others who
> > will run in fright[, and] only concern themselves with string
> > comparison matchers
>
> I agree, and we can adopt that as policy. +1
>
> Accordingly, I would like to adopt a naming convention, rather than have
ad
> hoc naming, to both help users distinguish, and to provide guidance to
> developers.
>
> We have just received a recipient matcher based upon regex matching.
Cesar
> called his matcher RecipientMatch. Do we want RecipientIs and
> RecipientIsRegex, HostIs and HostIsRegex, AttachmentFileNameIs and
> AttachmentFileNameIsRegex, etc.? Note: I am proposing just a naming
> pattern, not actual planning any of those classes.
>
> Please advise, so that I can commit his new code.
>
> My preference is for the Regex suffix.
>
> --- Noel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
Regex naming convention
Posted by "Noel J. Bergman" <no...@devtech.com>.
> we have to consider that there will be a broad spectrum of users,
> some of whom will welcome the power of regex matchers, others who
> will run in fright[, and] only concern themselves with string
> comparison matchers
I agree, and we can adopt that as policy. +1
Accordingly, I would like to adopt a naming convention, rather than have ad
hoc naming, to both help users distinguish, and to provide guidance to
developers.
We have just received a recipient matcher based upon regex matching. Cesar
called his matcher RecipientMatch. Do we want RecipientIs and
RecipientIsRegex, HostIs and HostIsRegex, AttachmentFileNameIs and
AttachmentFileNameIsRegex, etc.? Note: I am proposing just a naming
pattern, not actual planning any of those classes.
Please advise, so that I can commit his new code.
My preference is for the Regex suffix.
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
RE: [PATCH] AttachmentFileNameIs matcher
Posted by Danny Angus <da...@apache.org>.
Serge,
> Regex is a necessary evil, but it is unmistakenly evil, evil, evil.
I don't agree, it might not be very much in keeping with the java-ese (javanese ?!) mind set, OO and c style code, and therefore seems odd embedded in Java, but it is essentially whole other language and a language designed and evolved to only perform pattern matching on text and to do it fast and accurately.
IMO regex are unsurpassed at being able to accurately and clearly describe complex and abstract patterns, but you need to learn regex syntax to understand it.
REGEX isn't evil, just foreign.
> I
> think it is important to provide simpler conf options whenever possible.
> I would also like to keep non-regex versions available (of this and
> other matchers).
This is unmistakable true, we have to consider that there will be a broad spectrum of users, some of whom will welcome the power of regex matchers, others who will run in fright at this foreign evil ;-) and only concern themselves with string comparison matchers.
James doesn't require much specialist knowledge to run, we should support both camps where possible.
>
> --
> Serge Knystautas
> President
> Lokitech >> software . strategy . design >> http://www.lokitech.com/
> p. 1.301.656.5501
> e. sergek@lokitech.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
Re: [PATCH] AttachmentFileNameIs matcher
Posted by Serge Knystautas <se...@lokitech.com>.
Noel J. Bergman wrote:
>>Also, I think we should keep the same pattern of having
>>non-regex first, and then regex versions later
>
>
> At this point it is so easy to do it, why not? If he indicated that he
> would prefer to start with this, and then just change the implementation to
> extend regex support, that would be OK.
Regex is a necessary evil, but it is unmistakenly evil, evil, evil. I
think it is important to provide simpler conf options whenever possible.
I would also like to keep non-regex versions available (of this and
other matchers).
--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com/
p. 1.301.656.5501
e. sergek@lokitech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
RE: [PATCH] AttachmentFileNameIs matcher
Posted by "Noel J. Bergman" <no...@devtech.com>.
> I prefer Filename (why would you restrict this to only file
> extensions?).
I wouldn't. :-) That was not my preferred change, either.
> Also, I think we should keep the same pattern of having
> non-regex first, and then regex versions later
At this point it is so easy to do it, why not? If he indicated that he
would prefer to start with this, and then just change the implementation to
extend regex support, that would be OK.
I though that my comment to him "yes, please do the user docs" ought to
reflect that I was in favor of accepting the code.
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
Re: [PATCH] AttachmentFileNameIs matcher
Posted by Serge Knystautas <se...@lokitech.com>.
I prefer Filename (why would you restrict this to only file
extensions?). Also, I think we should keep the same pattern of having
non-regex first, and then regex versions later (we don't have very many,
do we?)
--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com/
p. 1.301.656.5501
e. sergek@lokitech.com
Noel J. Bergman wrote:
> It seems OK, and I like the idea, but I would do one of two things:
>
> - change the code to use regex, and match the filename
> - change the name to AttachmentFileExtIs
>
> If you want to do the former, you could look at GenericRegexMatcher,
> although it will be of only limited help because it matches headers with
> patterns.
>
> Your thoughts? And, yes, please do the user docs. :-)
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org
RE: [PATCH] AttachmentFileNameIs matcher
Posted by "Noel J. Bergman" <no...@devtech.com>.
It seems OK, and I like the idea, but I would do one of two things:
- change the code to use regex, and match the filename
- change the name to AttachmentFileExtIs
If you want to do the former, you could look at GenericRegexMatcher,
although it will be of only limited help because it matches headers with
patterns.
Your thoughts? And, yes, please do the user docs. :-)
--- Noel
-----Original Message-----
From: Hontvari Jozsef [mailto:hontvari2@solware.com]
Sent: Monday, May 19, 2003 17:59
To: James Developers List
Subject: [PATCH] AttachmentFileNameIs matcher
This matcher can be used to refuse emails with SCR, PIF, EXE etc. (you
decide) attachments.
Here is a usage example (also see javadoc):
<!-- file extensions indicating virus (.pi is a wrong .pif) -->
<mailet
match="AttachmentFileNameIs=*.scr,*.bat,*.pif,*.pi,*.com,*.bmp,*.exe"
class="ToProcessor">
<processor> bounce </processor>
<notice> EXE, BMP, BAT, PIF, SCR file file attachments are not
allowed </notice>
</mailet>
If it is accepted I'll create the user doc too.
AttachmentFileNameIs.zip
---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org