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 = '@[EMAIL PROTECTED]@[EMAIL PROTECTED]@';
then do: return index($mailists, '@' . lc($listname) . '@') >= 0;
(Because '@' is never part of listname, it's save.)

Bye,

--
Steffen Kaiser
_______________________________________________
Visit http://www.mimedefang.org and http://www.canit.ca
MIMEDefang mailing list
[EMAIL PROTECTED]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to