[Mimedefang] Globals
Steffen Kaiser
skmimedefang at smail.inf.fh-bonn-rhein-sieg.de
Fri Jul 9 07:35:05 EDT 2004
On Thu, 8 Jul 2004, Rich West wrote:
Hmm, I'd populate a global variable when the slave starts or in
filter_initialize. I do so, anyway.
> sub is_list
> {
> $listname = (split("\@", $listname))[0];
> $listname = (split("\<", $listname))[1];
^^^^ Angle brackets are not mandatory.
> foreach $list (@lists)
> {
> chop($list);
> return 1 if ($list =~ /^$listname/i);
^^^^^ here you check only, if the recipient
begins with a name of a list.
> }
> return 0;
> }
BTW: How about preparing the name cache a bit more in order to avoid the
foreach loop each time you lookup a name, e.g.
1) use a hash:
%mailists = ( 'list1' => 1
, 'list2' => 1, ... );
Then you can do simply return $mailists{lc($listname)}
2) or use a large string: $mailists = '@list1 at list2@list3 at ...@';
then do: return index($mailists, '@' . lc($listname) . '@') >= 0;
(Because '@' is never part of listname, it's save.)
Bye,
--
Steffen Kaiser
More information about the MIMEDefang
mailing list