Ignore:
Timestamp:
10/17/09 11:46:21 (3 years ago)
Author:
KennethLavrsen
Message:

Item1302: mailnotify ignores -news operand
It is a bug that goes back to TWiki 4.0. The -news was documented but never implemented
Fixing it as speced would cause trouble for people.
And the spec is bad. It would not work well. So instead of implenting a bad spec I decided to implement -nonews and -nochanges which will give people the flexibility AND maintain status quo for those already$

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm

    r5270 r5289  
    2727 
    2828our $VERSION = '$Rev$'; 
    29 our $RELEASE = '15 Oct 2009'; 
     29our $RELEASE = '17 Oct 2009'; 
    3030our $SHORTDESCRIPTION = 'Supports e-mail notification of changes'; 
    3131 
    3232our $verbose = 0; 
     33our $nonews = 0; 
     34our $nochanges = 0; 
    3335 
    3436# PROTECTED STATIC ensure the contrib is initernally initialised 
     
    4042=pod 
    4143 
    42 ---++ StaticMethod mailNotify($webs, $session, $verbose, $exwebs) 
     44---++ StaticMethod mailNotify($webs, $session, $verbose, $exwebs, $nonewsmode, $nochangesmode) 
    4345   * =$webs= - filter list of names webs to process. Wildcards (*) may be used. 
    4446   * =$session= - optional session object. If not given, will use a local object. 
    4547   * =$verbose= - true to get verbose (debug) output. 
    4648   * =$exwebs = - filter list of webs to exclude. 
     49   * =$nonewsmode = the notify script was called with the -nonews option so we skip news mode 
     50   * =$nochangesmode = the notify script was called with the -nochanges option 
    4751 
    4852Main entry point. 
     
    5559 
    5660sub mailNotify { 
    57     my ( $webs, $twiki, $noisy, $exwebs ) = @_; 
     61    my ( $webs, $twiki, $noisy, $exwebs, $nonewsmode, $nochangesmode ) = @_; 
    5862 
    5963    $verbose = $noisy; 
     64    $nonews = $nonewsmode || 0; 
     65    $nochanges = $nochangesmode || 0; 
    6066 
    6167    my $webstr; 
     
    208214# PRIVATE: Read the webnotify, and notify changes 
    209215sub _processWeb { 
    210     my ( $twiki, $web ) = @_; 
     216    my ( $twiki, $web, $nonews, $nochanges ) = @_; 
    211217 
    212218    if ( !Foswiki::Func::webExists($web) ) { 
     
    315321 
    316322    # Now generate emails for each recipient 
    317     my $report = 
    318       _sendChangesMails( $twiki, $web, \%changeset, 
    319         Foswiki::Time::formatTime($timeOfLastNotify) ); 
    320  
    321     $report .= _sendNewsletterMails( $twiki, $web, \%allSet ); 
    322  
     323    my $report = ''; 
     324     
     325    if ( !$nochanges ) { 
     326        $report .= _sendChangesMails( $twiki, $web, \%changeset, 
     327          Foswiki::Time::formatTime($timeOfLastNotify) ); 
     328    } 
     329 
     330    if ( !$nonews ) { 
     331        $report .= _sendNewsletterMails( $twiki, $web, \%allSet ); 
     332    } 
     333     
    323334    if ( $timeOfLastChange != 0 ) { 
    324335        if ( open( F, '>', $notmeta ) ) { 
Note: See TracChangeset for help on using the changeset viewer.