- Timestamp:
- 11/19/08 15:00:00 (4 years ago)
- Location:
- trunk/MailerContrib/lib/Foswiki
- Files:
-
- 1 edited
- 1 moved
-
. (moved) (moved from trunk/MailerContrib/lib/TWiki)
-
Contrib/MailerContrib/WebNotify.pm (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/MailerContrib/lib/Foswiki/Contrib/MailerContrib/WebNotify.pm
r781 r811 2 2 # 3 3 # Copyright (C) 2004 Wind River Systems Inc. 4 # Copyright (C) 1999-2007 TWiki Contributors.5 # All Rights Reserved. TWiki Contributors4 # Copyright (C) 1999-2007 Foswiki Contributors. 5 # All Rights Reserved. Foswiki Contributors 6 6 # are listed in the AUTHORS file in the root of this distribution. 7 7 # NOTE: Please extend that file, not this notice. … … 21 21 =pod 22 22 23 ---+ package TWiki::Contrib::MailerContrib::WebNotify23 ---+ package Foswiki::Contrib::MailerContrib::WebNotify 24 24 Object that represents the contents of a %NOTIFYTOPIC% topic in a TWiki web. 25 25 26 Note that =$ TWiki::Plugins::SESSION= is used to find the TWiki session, and26 Note that =$Foswiki::Plugins::SESSION= is used to find the TWiki session, and 27 27 must be set up before this class is used. 28 28 29 29 =cut 30 30 31 package TWiki::Contrib::MailerContrib::WebNotify;31 package Foswiki::Contrib::MailerContrib::WebNotify; 32 32 33 33 use strict; … … 36 36 use Assert; 37 37 38 require TWiki::Func;39 require TWiki::Contrib::MailerContrib;40 require TWiki::Contrib::MailerContrib::Subscriber;41 require TWiki::Contrib::MailerContrib::Subscription;38 require Foswiki::Func; 39 require Foswiki::Contrib::MailerContrib; 40 require Foswiki::Contrib::MailerContrib::Subscriber; 41 require Foswiki::Contrib::MailerContrib::Subscription; 42 42 43 43 =pod … … 62 62 63 63 # Ensure the contrib is initialised 64 TWiki::Contrib::MailerContrib::initContrib();64 Foswiki::Contrib::MailerContrib::initContrib(); 65 65 66 66 $this->{web} = $web; 67 $this->{topic} = $topic || $ TWiki::cfg{NotifyTopicName} || 'WebNotify';67 $this->{topic} = $topic || $Foswiki::cfg{NotifyTopicName} || 'WebNotify'; 68 68 $this->{pretext} = ''; 69 69 $this->{posttext} = ''; … … 71 71 $this->{noexpandgroups} = $noexpandgroups; 72 72 73 if( TWiki::Func::topicExists( $web, $topic )) {73 if( Foswiki::Func::topicExists( $web, $topic )) { 74 74 $this->_load(); 75 75 } … … 89 89 sub writeWebNotify { 90 90 my $this = shift; 91 TWiki::Func::saveTopicText(91 Foswiki::Func::saveTopicText( 92 92 $this->{web}, 93 93 $this->{topic}, … … 114 114 unless ( $noAdd || defined( $subscriber )) { 115 115 $subscriber = 116 new TWiki::Contrib::MailerContrib::Subscriber( $name );116 new Foswiki::Contrib::MailerContrib::Subscriber( $name ); 117 117 $this->{subscribers}{$name} = $subscriber; 118 118 } … … 151 151 my @names = ($name); 152 152 unless ($this->{noexpandgroups}) { 153 if (defined & TWiki::Func::eachGroupMember) {154 my $it = TWiki::Func::eachGroupMember( $name );153 if (defined &Foswiki::Func::eachGroupMember) { 154 my $it = Foswiki::Func::eachGroupMember( $name ); 155 155 if( $it ) { 156 156 @names = (); … … 161 161 } 162 162 } else { 163 my $user = TWiki::User->new($this->{session}, '', $name);163 my $user = Foswiki::User->new($this->{session}, '', $name); 164 164 if ($user->isGroup) { 165 165 @names = map {$_->wikiName} @{$user->groupMembers}; … … 170 170 foreach my $n (@names) { 171 171 my $subscriber = $this->getSubscriber( $n ); 172 my $sub = new TWiki::Contrib::MailerContrib::Subscription(172 my $sub = new Foswiki::Contrib::MailerContrib::Subscription( 173 173 $topics, $depth, $opts ); 174 174 $subscriber->subscribe( $sub ); … … 193 193 my @names = ( $name ); 194 194 unless ($this->{noexpandgroups}) { 195 if (defined & TWiki::Func::eachGroupMember) {196 my $it = TWiki::Func::eachGroupMember( $name );195 if (defined &Foswiki::Func::eachGroupMember) { 196 my $it = Foswiki::Func::eachGroupMember( $name ); 197 197 if( $it ) { 198 198 @names = (); … … 203 203 } 204 204 } else { 205 my $user = TWiki::User->new($this->{session}, '', $name);205 my $user = Foswiki::User->new($this->{session}, '', $name); 206 206 if ($user->isGroup) { 207 207 @names = map {$_->wikiName} @{$user->groupMembers}; … … 212 212 foreach my $n (@names) { 213 213 my $subscriber = $this->getSubscriber( $n ); 214 my $sub = new TWiki::Contrib::MailerContrib::Subscription(214 my $sub = new Foswiki::Contrib::MailerContrib::Subscription( 215 215 $topics, $depth, 0 ); 216 216 $subscriber->unsubscribe( $sub ); … … 247 247 248 248 ---++ processChange($change, $db, $changeSet, $seenSet, $allSet) 249 * =$change= - ref of a TWiki::Contrib::Mailer::Change250 * =$db= - TWiki::Contrib::MailerContrib::UpData database of parent references249 * =$change= - ref of a Foswiki::Contrib::Mailer::Change 250 * =$db= - Foswiki::Contrib::MailerContrib::UpData database of parent references 251 251 * =$changeSet= - ref of a hash mapping emails to sets of changes 252 252 * =$seenSet= - ref of a hash recording indices of topics already seen … … 264 264 my $web = $change->{WEB}; 265 265 my %authors = map { $_ => 1 } 266 @{ TWiki::Contrib::MailerContrib::Subscriber::getEmailAddressesForUser(266 @{Foswiki::Contrib::MailerContrib::Subscriber::getEmailAddressesForUser( 267 267 $change->{author})}; 268 268 … … 272 272 if ($subs && !$subscriber->isUnsubscribedFrom( $topic, $db )) { 273 273 274 next unless TWiki::Func::checkAccessPermission(274 next unless Foswiki::Func::checkAccessPermission( 275 275 'VIEW', $name, undef, $topic, $this->{web}, undef ); 276 276 … … 306 306 ---++ processCompulsory($topic, $db, \%allSet) 307 307 * =$topic= - topic name 308 * =$db= - TWiki::Contrib::MailerContrib::UpData database of parent references308 * =$db= - Foswiki::Contrib::MailerContrib::UpData database of parent references 309 309 * =\%allSet= - ref of a hash that maps topics to email addresses for news subscriptions 310 310 … … 346 346 my $this = shift; 347 347 348 my ( $meta, $text ) = TWiki::Func::readTopic(348 my ( $meta, $text ) = Foswiki::Func::readTopic( 349 349 $this->{web}, $this->{topic} ); 350 350 my $in_pre = 1; … … 354 354 # join \ terminated lines 355 355 $text =~ s/\\\r?\n//gs; 356 my $webRE = qr/(?:$ TWiki::cfg{UsersWebName}\.)?/o;356 my $webRE = qr/(?:$Foswiki::cfg{UsersWebName}\.)?/o; 357 357 foreach my $baseline ( split ( /\r?\n/, $text )) { 358 my $line = TWiki::Func::expandCommonVariables(358 my $line = Foswiki::Func::expandCommonVariables( 359 359 $baseline, $this->{topic}, $this->{web}, $meta); 360 if( $line =~ /^\s+\*\s$webRE($ TWiki::regex{wikiWordRegex})\s+\-\s+($TWiki::cfg{MailerContrib}{EmailFilterIn}+)\s*$/o361 && $1 ne $ TWiki::cfg{DefaultUserWikiName}) {360 if( $line =~ /^\s+\*\s$webRE($Foswiki::regex{wikiWordRegex})\s+\-\s+($Foswiki::cfg{MailerContrib}{EmailFilterIn}+)\s*$/o 361 && $1 ne $Foswiki::cfg{DefaultUserWikiName}) { 362 362 # Main.WikiName - email@domain (legacy format) 363 363 $this->subscribe( $2, '*', 0, 0 ); 364 364 $in_pre = 0; 365 365 } 366 elsif ( $line =~ /^\s+\*\s$webRE($ TWiki::regex{wikiWordRegex}|'.*?'|".*?"|$TWiki::cfg{MailerContrib}{EmailFilterIn})\s*(:.*)?$/o367 && $1 ne $ TWiki::cfg{DefaultUserWikiName}) {366 elsif ( $line =~ /^\s+\*\s$webRE($Foswiki::regex{wikiWordRegex}|'.*?'|".*?"|$Foswiki::cfg{MailerContrib}{EmailFilterIn})\s*(:.*)?$/o 367 && $1 ne $Foswiki::cfg{DefaultUserWikiName}) { 368 368 my $subscriber = $1; 369 369 # Get the topic list from the last bracket matched. Have to do it … … 397 397 $this->{topicSub} = \&_subscribeTopic; 398 398 399 my $ret = TWiki::Contrib::MailerContrib::parsePageList($this, $who, $spec, $unsubscribe);399 my $ret = Foswiki::Contrib::MailerContrib::parsePageList($this, $who, $spec, $unsubscribe); 400 400 if ( $ret =~ m/\S/ ) { 401 TWiki::Func::writeWarning(401 Foswiki::Func::writeWarning( 402 402 "Badly formatted page list at $who: $spec"); 403 403 return -1; … … 409 409 my ( $this, $who, $unsubscribe, $webTopic, $options, $childDepth ) = @_; 410 410 411 my ($web, $topic) = TWiki::Func::normalizeWebTopicName($this->{web}, $webTopic);411 my ($web, $topic) = Foswiki::Func::normalizeWebTopicName($this->{web}, $webTopic); 412 412 413 413 #print STDERR "_subscribeTopic($topic)\n"; … … 438 438 unless (defined $this->{nomail}{$name}) { 439 439 $this->{nomail}{$name} = 1; 440 TWiki::Func::writeWarning(440 Foswiki::Func::writeWarning( 441 441 "Failed to find permitted email for '". 442 442 $subscriber->stringify()."' when processing web '$web'");
Note: See TracChangeset
for help on using the changeset viewer.
