108 |
my $arg = {@_}; |
my $arg = {@_}; |
109 |
|
|
110 |
confess "need list name" unless ($arg->{'list'}); |
confess "need list name" unless ($arg->{'list'}); |
111 |
confess "need list email" unless ($arg->{'list'}); |
confess "need list email" unless ($arg->{'email'}); |
112 |
|
|
113 |
|
$arg->{'list'} = lc($arg->{'list'}); |
114 |
|
$arg->{'email'} = lc($arg->{'email'}); |
115 |
|
|
116 |
my $l = $self->_get_list($arg->{'list'}) || |
my $l = $self->_get_list($arg->{'list'}) || |
117 |
$self->_add_list( @_ ) || |
$self->_add_list( @_ ) || |
142 |
|
|
143 |
my $arg = {@_}; |
my $arg = {@_}; |
144 |
|
|
145 |
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"; |
146 |
my $name = $arg->{'name'} || ''; |
my $name = $arg->{'name'} || ''; |
147 |
my $list_name = $arg->{'list'} || croak "need list name"; |
my $list_name = lc($arg->{'list'}) || croak "need list name"; |
148 |
|
|
149 |
my $list = $self->_get_list($list_name) || croak "list $list_name doesn't exist"; |
my $list = $self->_get_list($list_name) || croak "list $list_name doesn't exist"; |
150 |
|
|
203 |
|
|
204 |
my $args = {@_}; |
my $args = {@_}; |
205 |
|
|
206 |
my $list_name = $args->{'list'} || confess "need list name"; |
my $list_name = lc($args->{'list'}) || confess "need list name"; |
207 |
|
|
208 |
my $lists = $self->{'loader'}->find_class('lists'); |
my $lists = $self->{'loader'}->find_class('lists'); |
209 |
my $user_list = $self->{'loader'}->find_class('user_list'); |
my $user_list = $self->{'loader'}->find_class('user_list'); |
249 |
|
|
250 |
croak "need name or email of user to delete" unless ($args->{'name'} || $args->{'email'}); |
croak "need name or email of user to delete" unless ($args->{'name'} || $args->{'email'}); |
251 |
|
|
252 |
|
$args->{'email'} = lc($args->{'email'}) if ($args->{'email'}); |
253 |
|
|
254 |
my $key = 'name'; |
my $key = 'name'; |
255 |
$key = 'email' if ($args->{'email'}); |
$key = 'email' if ($args->{'email'}); |
256 |
|
|
288 |
|
|
289 |
my $args = {@_}; |
my $args = {@_}; |
290 |
|
|
291 |
my $list_name = $args->{'list'} || confess "need list name"; |
my $list_name = lc($args->{'list'}) || confess "need list name"; |
292 |
my $message_text = $args->{'message'} || croak "need message"; |
my $message_text = $args->{'message'} || croak "need message"; |
293 |
|
|
294 |
my $m = Email::Simple->new($message_text) || croak "can't parse message"; |
my $m = Email::Simple->new($message_text) || croak "can't parse message"; |
357 |
|
|
358 |
my $arg = {@_}; |
my $arg = {@_}; |
359 |
|
|
360 |
my $list_name = $arg->{'list'} || ''; |
my $list_name = lc($arg->{'list'}) || ''; |
361 |
my $driver = $arg->{'driver'} || ''; |
my $driver = $arg->{'driver'} || ''; |
362 |
my $sleep = $arg->{'sleep'}; |
my $sleep = $arg->{'sleep'}; |
363 |
$sleep ||= 3 unless defined($sleep); |
$sleep ||= 3 unless defined($sleep); |
368 |
if (lc($driver) eq 'smtp') { |
if (lc($driver) eq 'smtp') { |
369 |
$email_send_driver = 'Email::Send::SMTP'; |
$email_send_driver = 'Email::Send::SMTP'; |
370 |
@email_send_options = ['127.0.0.1']; |
@email_send_options = ['127.0.0.1']; |
371 |
|
} else { |
372 |
|
warn "dumping all messages to STDERR\n"; |
373 |
} |
} |
|
warn "using $driver [$email_send_driver]\n"; |
|
374 |
|
|
375 |
my $lists = $self->{'loader'}->find_class('lists'); |
my $lists = $self->{'loader'}->find_class('lists'); |
376 |
my $queue = $self->{'loader'}->find_class('queue'); |
my $queue = $self->{'loader'}->find_class('queue'); |
473 |
return unless ($arg->{'message'}); |
return unless ($arg->{'message'}); |
474 |
croak "need list name" unless ($arg->{'list'}); |
croak "need list name" unless ($arg->{'list'}); |
475 |
|
|
476 |
|
$arg->{'list'} = lc($arg->{'list'}); |
477 |
|
|
478 |
my $this_list = $self->_get_list($arg->{'list'}) || croak "can't find list ".$arg->{'list'}."\n"; |
my $this_list = $self->_get_list($arg->{'list'}) || croak "can't find list ".$arg->{'list'}."\n"; |
479 |
|
|
480 |
my $m = Email::Simple->new($arg->{'message'}) || croak "can't parse message"; |
my $m = Email::Simple->new($arg->{'message'}) || croak "can't parse message"; |
492 |
my $hash; |
my $hash; |
493 |
|
|
494 |
foreach my $a (@addrs) { |
foreach my $a (@addrs) { |
495 |
if ($a->address =~ m/\+([a-f0-9]{$hl})@/) { |
if ($a->address =~ m/\+([a-f0-9]{$hl})@/i) { |
496 |
$hash = $1; |
$hash = $1; |
497 |
last; |
last; |
498 |
} |
} |
516 |
my $users = $self->{'loader'}->find_class('users'); |
my $users = $self->{'loader'}->find_class('users'); |
517 |
my $from = $m->header('From'); |
my $from = $m->header('From'); |
518 |
$from = $1 if ($from =~ m/<(.*)>/); |
$from = $1 if ($from =~ m/<(.*)>/); |
519 |
my $this_user = $users->search( email => $from )->first; |
my $this_user = $users->search( email => lc($from) )->first; |
520 |
$user_id = $this_user->id if ($this_user); |
$user_id = $this_user->id if ($this_user); |
521 |
} |
} |
522 |
|
|
577 |
|
|
578 |
my $arg = {@_}; |
my $arg = {@_}; |
579 |
|
|
580 |
my $name = $arg->{'list'} || confess "can't add list without name"; |
my $name = lc($arg->{'list'}) || confess "can't add list without name"; |
581 |
my $email = $arg->{'email'} || confess "can't add list without e-mail"; |
my $email = lc($arg->{'email'}) || confess "can't add list without e-mail"; |
582 |
my $from_addr = $arg->{'from'}; |
my $from_addr = $arg->{'from'}; |
583 |
|
|
584 |
my $lists = $self->{'loader'}->find_class('lists'); |
my $lists = $self->{'loader'}->find_class('lists'); |
619 |
|
|
620 |
my $lists = $self->{'loader'}->find_class('lists') || confess "can't find lists class"; |
my $lists = $self->{'loader'}->find_class('lists') || confess "can't find lists class"; |
621 |
|
|
622 |
return $lists->search({ name => $name })->first; |
return $lists->search({ name => lc($name) })->first; |
623 |
} |
} |
624 |
|
|
625 |
### |
### |