/[notice-sender]/trunk/Nos.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/Nos.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 39 by dpavlin, Tue May 17 22:23:40 2005 UTC revision 43 by dpavlin, Wed May 18 12:29:35 2005 UTC
# Line 175  sub add_member_to_list { Line 175  sub add_member_to_list {
175          return $this_user->id;          return $this_user->id;
176  }  }
177    
178    =head2 list_members
179    
180     my @members = list_members(
181            list => 'My list',
182     );
183    
184    Returns array of hashes with user informations like this:
185    
186     $member = {
187            full_name => 'Dobrica Pavlinusic',
188            email => 'dpavlin@rot13.org
189     }
190    
191    =cut
192    
193    sub list_members {
194            my $self = shift;
195    
196            my $args = {@_};
197    
198            my $list_name = $args->{'list'} || confess "need list name";
199    
200            my $lists = $self->{'loader'}->find_class('lists');
201            my $user_list = $self->{'loader'}->find_class('user_list');
202    
203            my $this_list = $lists->search( name => $list_name )->first || croak "can't find list $list_name\n";
204    
205            my @results;
206    
207            foreach my $user_on_list ($user_list->search(list_id => $this_list->id)) {
208                    my $row = {
209                            full_name => $user_on_list->user_id->full_name,
210                            email => $user_on_list->user_id->email,
211                    };
212    
213                    push @results, $row;
214            }
215    
216            return @results;
217    
218    }
219    
220    
221  =head2 add_message_to_list  =head2 add_message_to_list
222    
223  Adds message to one list's queue for later sending.  Adds message to one list's queue for later sending.
# Line 370  sub inbox_message { Line 413  sub inbox_message {
413                  $user_id = $sent_msg->user_id || carp "no user_id";                  $user_id = $sent_msg->user_id || carp "no user_id";
414          }          }
415    
 print "message_id: ",($message_id || "not found"),"\n";  
416    
417          my $is_bounce = 0;          my $is_bounce = 0;
418    
# Line 393  print "message_id: ",($message_id || "no Line 435  print "message_id: ",($message_id || "no
435    
436          $this_received->dbi_commit;          $this_received->dbi_commit;
437    
438            print "message_id: ",($message_id || "not found")," -- $is_bounce\n";
439    
440    
441          warn "inbox is not yet implemented";          warn "inbox is not yet implemented";
442  }  }
443    
# Line 469  sub _get_list { Line 514  sub _get_list {
514    
515  package Nos::SOAP;  package Nos::SOAP;
516    
517    use Carp;
518    
519  =head1 SOAP methods  =head1 SOAP methods
520    
521  This methods are thin wrappers to provide SOAP calls. They are grouped in  This methods are thin wrappers to provide SOAP calls. They are grouped in
# Line 517  sub NewList { Line 564  sub NewList {
564          }          }
565  }  }
566    
567    
568  =head2 AddMemberToList  =head2 AddMemberToList
569    
570   $member_id = AddMemberToList(   $member_id = AddMemberToList(
571          list => "My list",          list => 'My list',
572          email => "e-mail@example.com",          email => 'e-mail@example.com',
573          name => "Full Name"          name => 'Full Name'
574   );   );
575    
576  =cut  =cut
# Line 539  sub AddMemberToList { Line 587  sub AddMemberToList {
587          }          }
588  }  }
589    
590    
591    =head2 ListMembers
592    
593     my @members = ListMembers(
594            list => 'My list',
595     );
596    
597    Returns array of hashes with user informations, see C<list_members>.
598    
599    =cut
600    
601    sub ListMembers {
602            my $self = shift;
603    
604            my $list_name;
605    
606            if ($_[0] !~ m/^HASH/) {
607                    $list_name = shift;
608            } else {
609                    $list_name = $_[0]->{'list'};
610            }
611    
612            return $nos->list_members( list => $list_name );
613    }
614    
615  =head2 AddMessageToList  =head2 AddMessageToList
616    
617   $message_id = AddMessageToList(   $message_id = AddMessageToList(

Legend:
Removed from v.39  
changed lines
  Added in v.43

  ViewVC Help
Powered by ViewVC 1.1.26