1 #$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/Notify.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
3 package RT::Action::Notify;
4 require RT::Action::SendEmail;
5 @ISA = qw(RT::Action::SendEmail);
7 # {{{ sub SetRecipients
11 Sets the recipients of this meesage to Owner, Requestor, AdminCc, Cc or All.
12 Explicitly B<does not> notify the creator of the transaction.
19 $arg = $self->Argument;
21 $arg =~ s/\bAll\b/Owner,Requestor,AdminCc,Cc/;
23 my ( @To, @PseudoTo, @Cc, @Bcc );
26 if ($arg =~ /\bOtherRecipients\b/) {
27 if ($self->TransactionObj->Message->First) {
28 push (@Cc, $self->TransactionObj->Message->First->GetHeader('RT-Send-Cc'));
29 push (@Bcc, $self->TransactionObj->Message->First->GetHeader('RT-Send-Bcc'));
33 if ( $arg =~ /\bRequestor\b/ ) {
34 push ( @To, @{ $self->TicketObj->Requestors->Emails } );
39 if ( $arg =~ /\bCc\b/ ) {
41 #If we have a To, make the Ccs, Ccs, otherwise, promote them to To
43 push ( @Cc, @{ $self->TicketObj->Cc->Emails } );
44 push ( @Cc, @{ $self->TicketObj->QueueObj->Cc->Emails } );
47 push ( @Cc, @{ $self->TicketObj->Cc->Emails } );
48 push ( @To, @{ $self->TicketObj->QueueObj->Cc->Emails } );
52 if ( ( $arg =~ /\bOwner\b/ )
53 && ( $self->TicketObj->OwnerObj->id != $RT::Nobody->id ) )
56 # If we're not sending to Ccs or requestors,
57 # then the Owner can be the To.
59 push ( @Bcc, $self->TicketObj->OwnerObj->EmailAddress );
62 push ( @To, $self->TicketObj->OwnerObj->EmailAddress );
67 if ( $arg =~ /\bAdminCc\b/ ) {
68 push ( @Bcc, @{ $self->TicketObj->AdminCc->Emails } );
69 push ( @Bcc, @{ $self->TicketObj->QueueObj->AdminCc->Emails } );
72 if ($RT::UseFriendlyToLine) {
75 "\"$arg of $RT::rtname Ticket #"
76 . $self->TicketObj->id . "\":;" );
80 my $creator = $self->TransactionObj->CreatorObj->EmailAddress();
82 #Strip the sender out of the To, Cc and AdminCc and set the
83 # recipients fields used to build the message by the superclass.
85 $RT::Logger->debug("$self: To is ".join(",",@To));
86 $RT::Logger->debug("$self: Cc is ".join(",",@Cc));
87 $RT::Logger->debug("$self: Bcc is ".join(",",@Bcc));
89 @{ $self->{'To'} } = grep ( !/^$creator$/, @To );
90 @{ $self->{'Cc'} } = grep ( !/^$creator$/, @Cc );
91 @{ $self->{'Bcc'} } = grep ( !/^$creator$/, @Bcc );
92 @{ $self->{'PseudoTo'} } = @PseudoTo;