User: sits    
  Date: 08/08/27 02:11:37

  Modified:    lib/Codestriker/Http Input.pm
               lib/Codestriker/Action SubmitNewTopic.pm
               bin      commit-email-codestriker.pl CodestrikerClient.pm
               lib/Codestriker/TopicListeners Email.pm
  Log:
  Provided the ability to specify when creating a topic not to send out an 
email.  Used primarily with post-commit scripts, which already send an email 
out with the Codestriker URL.
  
  
  
  Index: Input.pm
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Input.pm,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- Input.pm  19 Aug 2008 10:50:16 -0000      1.49
  +++ Input.pm  27 Aug 2008 09:11:36 -0000      1.50
  @@ -105,6 +105,7 @@
       my @selected_comments = $query->param('selected_comments');
       $self->{selected_comments} = [EMAIL PROTECTED];
       $self->{default_to_head} = $query->param('default_to_head');
  +    $self->{email_event} = $query->param('email_event');
   
        # Set any missing parameters from the cookie.
       my %cookie = Codestriker::Http::Cookie->get($query);
  @@ -126,6 +127,7 @@
       $self->{format} = "html" if ! defined $self->{format};
       $self->{obsoletes} = "" if ! defined $self->{obsoletes};
       $self->{default_to_head} = 0 if ! defined $self->{default_to_head};
  +    $self->{email_event} = 1 if ! defined $self->{email_event};
   
       my @topic_metrics = $query->param('topic_metric');
       $self->{topic_metric} = [EMAIL PROTECTED];
  
  
  
  
  
  Index: SubmitNewTopic.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Action/SubmitNewTopic.pm,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- SubmitNewTopic.pm 19 Aug 2008 10:50:17 -0000      1.37
  +++ SubmitNewTopic.pm 27 Aug 2008 09:11:36 -0000      1.38
  @@ -46,6 +46,7 @@
       my $obsoletes = $http_input->get('obsoletes');
       my $default_to_head = $http_input->get('default_to_head');
       my $topic_state = $http_input->get('topic_state');
  +    my $email_event = $http_input->get('email_event');
   
       my $feedback = "";
       my $topic_text = "";
  @@ -351,6 +352,7 @@
       
       # Tell all of the topic listener classes that a topic has 
       # just been created.
  +    $topic->{email_event} = $email_event;
       $feedback = Codestriker::TopicListeners::Manager::topic_create($topic);
       
       # Obtain a URL builder object and determine the URL to the topic.
  
  
  
  
  
  Index: commit-email-codestriker.pl
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/bin/commit-email-codestriker.pl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- commit-email-codestriker.pl       22 Aug 2008 01:41:31 -0000      1.2
  +++ commit-email-codestriker.pl       27 Aug 2008 09:11:36 -0000      1.3
  @@ -399,6 +399,7 @@
        reviewers => $current_project->{codestriker_reviewers},
        cc => $current_project->{codestriker_cc},
        topic_state => $current_project->{codestriker_state},
  +     email_event => 0,
        topic_text => join("\n", @difflines)
        });
   }
  
  
  
  
  
  Index: CodestrikerClient.pm
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/bin/CodestrikerClient.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CodestrikerClient.pm      20 Aug 2008 00:43:34 -0000      1.6
  +++ CodestrikerClient.pm      27 Aug 2008 09:11:36 -0000      1.7
  @@ -18,6 +18,7 @@
   #      bug_ids => '1',
   #      email => 'sits',
   #      reviewers => 'root',
  +#      email_event => 0,
   #      topic_text => "Here is some text\nHere is some\n\nMore and 
more...\n"});
   
   package CodestrikerClient;
  @@ -58,6 +59,7 @@
                    reviewers => $params->{reviewers},
                    cc => $params->{cc},
                    topic_state => $params->{topic_state},
  +                 email_event => $params->{email_event},
                    topic_file => [$tempfile_filename]];
       my $response =
        $ua->request(HTTP::Request::Common::POST($self->{url},
  
  
  
  
  
  Index: Email.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/Email.pm,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- Email.pm  18 Aug 2008 11:11:36 -0000      1.34
  +++ Email.pm  27 Aug 2008 09:11:36 -0000      1.35
  @@ -38,6 +38,11 @@
   sub topic_create($$) { 
       my ($self, $topic) = @_;
       
  +    # Check if this action doesn't need to be logged.
  +    if (defined $topic->{email_event} && ! $topic->{email_event}) {
  +     return '';
  +    }
  +    
       # Send an email to the document author and all contributors with the
       # relevant information.  The person who wrote the comment is indicated
       # in the "From" field, and is BCCed the email so they retain a copy.
  @@ -101,6 +106,11 @@
   sub topic_changed($$$$) {
       my ($self, $user_that_made_the_change, $topic_orig, $topic) = @_;
   
  +    # Check if this action doesn't need to be logged.
  +    if (defined $topic->{email_event} && $topic->{email_event} == 0) {
  +     return '';
  +    }
  +
       # Not all changes in the topic changes needs to be sent out to everybody
       # who is working on the topic. The policy of this function is that 
       # the following changes will cause an email to be sent. Otherwise,
  @@ -191,6 +201,11 @@
   sub send_topic_changed_email {
       my ($self, $user_that_made_the_change, $topic_orig, $topic,@to_list) = 
@_;
   
  +    # Check if this action doesn't need to be logged.
  +    if (defined $topic->{email_event} && $topic->{email_event} == 0) {
  +     return '';
  +    }
  +
       my $changes = "";
   
       # Check for author change.
  @@ -323,6 +338,11 @@
   sub comment_create($$$) {
       my ($self, $topic, $comment) = @_;
           
  +    # Check if this action doesn't need to be logged.
  +    if (defined $topic->{email_event} && $topic->{email_event} == 0) {
  +     return '';
  +    }
  +
       my $query = new CGI;
       my $url_builder = Codestriker::Http::UrlBuilder->new($query);
       
  
  
  

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Codestriker-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/codestriker-commits

Reply via email to