--- trunk/Nos.pm 2005/05/25 15:02:12 51 +++ trunk/Nos.pm 2005/05/25 15:03:10 52 @@ -108,7 +108,10 @@ my $arg = {@_}; confess "need list name" unless ($arg->{'list'}); - confess "need list email" unless ($arg->{'list'}); + confess "need list email" unless ($arg->{'email'}); + + $arg->{'list'} = lc($arg->{'list'}); + $arg->{'email'} = lc($arg->{'email'}); my $l = $self->_get_list($arg->{'list'}) || $self->_add_list( @_ ) || @@ -139,9 +142,9 @@ my $arg = {@_}; - my $email = $arg->{'email'} || croak "can't add user without e-mail"; + my $email = lc($arg->{'email'}) || croak "can't add user without e-mail"; my $name = $arg->{'name'} || ''; - my $list_name = $arg->{'list'} || croak "need list name"; + my $list_name = lc($arg->{'list'}) || croak "need list name"; my $list = $self->_get_list($list_name) || croak "list $list_name doesn't exist"; @@ -200,7 +203,7 @@ my $args = {@_}; - my $list_name = $args->{'list'} || confess "need list name"; + my $list_name = lc($args->{'list'}) || confess "need list name"; my $lists = $self->{'loader'}->find_class('lists'); my $user_list = $self->{'loader'}->find_class('user_list'); @@ -246,6 +249,8 @@ croak "need name or email of user to delete" unless ($args->{'name'} || $args->{'email'}); + $args->{'email'} = lc($args->{'email'}) if ($args->{'email'}); + my $key = 'name'; $key = 'email' if ($args->{'email'}); @@ -283,7 +288,7 @@ my $args = {@_}; - my $list_name = $args->{'list'} || confess "need list name"; + my $list_name = lc($args->{'list'}) || confess "need list name"; my $message_text = $args->{'message'} || croak "need message"; my $m = Email::Simple->new($message_text) || croak "can't parse message"; @@ -352,7 +357,7 @@ my $arg = {@_}; - my $list_name = $arg->{'list'} || ''; + my $list_name = lc($arg->{'list'}) || ''; my $driver = $arg->{'driver'} || ''; my $sleep = $arg->{'sleep'}; $sleep ||= 3 unless defined($sleep); @@ -363,8 +368,9 @@ if (lc($driver) eq 'smtp') { $email_send_driver = 'Email::Send::SMTP'; @email_send_options = ['127.0.0.1']; + } else { + warn "dumping all messages to STDERR\n"; } - warn "using $driver [$email_send_driver]\n"; my $lists = $self->{'loader'}->find_class('lists'); my $queue = $self->{'loader'}->find_class('queue'); @@ -467,6 +473,8 @@ return unless ($arg->{'message'}); croak "need list name" unless ($arg->{'list'}); + $arg->{'list'} = lc($arg->{'list'}); + my $this_list = $self->_get_list($arg->{'list'}) || croak "can't find list ".$arg->{'list'}."\n"; my $m = Email::Simple->new($arg->{'message'}) || croak "can't parse message"; @@ -484,7 +492,7 @@ my $hash; foreach my $a (@addrs) { - if ($a->address =~ m/\+([a-f0-9]{$hl})@/) { + if ($a->address =~ m/\+([a-f0-9]{$hl})@/i) { $hash = $1; last; } @@ -508,7 +516,7 @@ my $users = $self->{'loader'}->find_class('users'); my $from = $m->header('From'); $from = $1 if ($from =~ m/<(.*)>/); - my $this_user = $users->search( email => $from )->first; + my $this_user = $users->search( email => lc($from) )->first; $user_id = $this_user->id if ($this_user); } @@ -569,8 +577,8 @@ my $arg = {@_}; - my $name = $arg->{'list'} || confess "can't add list without name"; - my $email = $arg->{'email'} || confess "can't add list without e-mail"; + my $name = lc($arg->{'list'}) || confess "can't add list without name"; + my $email = lc($arg->{'email'}) || confess "can't add list without e-mail"; my $from_addr = $arg->{'from'}; my $lists = $self->{'loader'}->find_class('lists'); @@ -611,7 +619,7 @@ my $lists = $self->{'loader'}->find_class('lists') || confess "can't find lists class"; - return $lists->search({ name => $name })->first; + return $lists->search({ name => lc($name) })->first; } ###