Changeset 3974 for trunk/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm
- Timestamp:
- 05/24/09 12:15:55 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm
r3947 r3974 133 133 }; 134 134 135 my $ret = Foswiki::Contrib::MailerContrib::parsePageList( $subscribed, $who, 136 $topicList ); 135 my $ret = parsePageList( $subscribed, $who, $topicList ); 137 136 138 137 return ( !defined( $subscribed->{not_subscribed} ) … … 165 164 push( @{ $subscribed->{not_subscribed} }, $stopic ); 166 165 } 167 return '';168 166 } 169 167 170 168 =pod 169 171 170 ---+++ sub parsePageList ( $object, $who, $spec, $unsubscribe ) => unprocessable remainder of $spec line 172 calls the $topicSub (ref to sub)once per identified topic entry.173 * $object ( is a hashref) can be used to set status' and its definition is dependent on $topicSub174 * $object->{topicSub} _must_ be a sub ref and _must_ return an empty string175 * $unsubscribe can be set to '-' to force an unsubscription (used by SubscribePlugin)176 177 $object is a functor.171 Calls the $object->{topicSub} once per identified topic entry. 172 * $object (a hashref) may be a hashref that has the field, =topicSub=, 173 which _may_ be a sub ref as follows: 174 =&topicSub($object, $who, $unsubscribe, $webTopic, $options, $childDepth)= 175 * =$unsubscribe= can be set to '-' to force an unsubscription 176 (used by SubscribePlugin) 178 177 179 178 =cut … … 184 183 #ASSERT(defined($object->{topicSub})); 185 184 186 return $spec if ( ! defined( $object->{topicSub} ) );185 return $spec if ( !$object || !defined( $object->{topicSub} ) ); 187 186 188 187 $spec =~ s/,/ /g; 189 188 190 #TODO: refine the $2 regex to be proper web.topic/topic/* style.. 189 # $1: + or -, optional 190 # $2: the wildcarded topic specifier (may be quoted) 191 # TODO: refine the $2 regex to be proper web.topic/topic/* style.. 192 # $3: options 193 # $4: child depth 191 194 while ( $spec =~ 192 s/^\s*([+-])?\s*([\w.\*]+)([!?]?)\s*(?:\((\d+)\))?/&{$object->{topicSub}}($object, $who, $unsubscribe||$1, $2, $3, $4)/e 193 ) 194 { 195 195 s/^\s*([+-])?\s*([*\w.]+|'.*?'|".*?")([!?]?)\s*(?:\((\d+)\))?//) { 196 my ( $us, $webTopic, $options, $childDepth ) = ( 197 $unsubscribe||$1||'+', $2, $3, $4||0 ); 198 $webTopic =~ s/^(['"])(.*)\1$/$2/; # remove quotes 199 &{$object->{topicSub}}( 200 $object, $who, $us, $webTopic, $options, $childDepth); 196 201 #go 197 202 } … … 205 210 if ( !Foswiki::Func::webExists($web) ) { 206 211 207 # print STDERR "**** ERROR mailnotifier cannot find web $web\n";212 # print STDERR "**** ERROR mailnotifier cannot find web $web\n"; 208 213 return ''; 209 214 }
Note: See TracChangeset
for help on using the changeset viewer.
