Skip to content

Commit

Permalink
Item9551: Prepare for test release
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/ImmediateNotifyPlugin@8780 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Aug 26, 2010
1 parent 17caa18 commit 80ad61c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
4 changes: 3 additions & 1 deletion data/System/ImmediateNotifyPlugin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ __Note:__ You do not need to install anything on the browser to use this plugin.
---++ Plugin Info

| Plugin Author: | TWiki:Main/WalterMundt & TWiki:Main/JuergenPabel |
| Plugin Version: | v0.3.1 (05 Jan 2010) |
| Plugin Version: | %$VERSION% |
| Plugin Release: | %$RELEASE% |
| Change History: | <!-- specify latest version first -->&nbsp; |
| 26 Aug 2010 | Test release - Foswikitask:Item9551 |
| 05 Jan 2010 | Ported to Foswiki (Foswiki:Main.WillNoris) |
| 21 May 2007 | Bugs:Item3969 - 8bit email fix (Foswiki:Main.WillNorris) |
| 26 Jul 2006: | (v0.3) - Foswiki:Main.SteffenPoulsen: Ported to TWiki-4 / Dakar |
Expand Down
28 changes: 16 additions & 12 deletions lib/Foswiki/Plugins/ImmediateNotifyPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $VERSION = '$Rev$';
# This is a free-form string you can use to "name" your own plugin version.
# It is *not* used by the build automation tools, but is reported as part
# of the version number in PLUGINDESCRIPTIONS.
$RELEASE = 'Dakar';
$RELEASE = 'v0.4 (testing)';

$pluginName = 'ImmediateNotifyPlugin'; # Name of this Plugin

Expand Down Expand Up @@ -177,10 +177,10 @@ sub afterSaveHandler {
return;
}

# SMELL: We should not have to parse out topic text. But the old preferences
# cache is still loaded in the afterSaveHandler. So we would miss changes made
# to the IMMEDIATENOTIFY setting in this save.
#my $nameString = Foswiki::Func::getPreferencesValue('IMMEDIATENOTIFY') || '';
# SMELL: We should not have to parse out topic text. But the old preferences
# cache is still loaded in the afterSaveHandler. So we would miss changes made
# to the IMMEDIATENOTIFY setting in this save.
#my $nameString = Foswiki::Func::getPreferencesValue('IMMEDIATENOTIFY') || '';

my @names;
$IMREGEX = qr/$Foswiki::regex{setRegex}IMMEDIATENOTIFY\s*=\s*(.*?)$/sm;
Expand All @@ -197,16 +197,18 @@ sub afterSaveHandler {

my $notifyTopic =
Foswiki::Func::readTopicText( $web, "WebImmediateNotify" );
debug("- $pluginName: no WebImmediateNotify topic found in $web") unless ($notifyTopic);
debug("- $pluginName: no WebImmediateNotify topic found in $web")
unless ($notifyTopic);

while ( $notifyTopic =~
/(\t+|( )+)\* (?:\%MAINWEB\%|$Foswiki::cfg{UsersWebName})\.([^\r\n]+)/go )
/(\t+|( )+)\* (?:\%MAINWEB\%|$Foswiki::cfg{UsersWebName})\.([^\r\n]+)/go
)
{
push @names, $3 if $3;
debug("- $pluginName: Adding $3") if ($3);
}

unless ( scalar @names) {
unless ( scalar @names ) {
debug("- $pluginName: No names registered for notification.");
return;
}
Expand All @@ -231,14 +233,16 @@ sub afterSaveHandler {
/(\t+|( )+)\* Set IMMEDIATENOTIFYMETHOD = ([^\r\n]+)/ )
{
@methodList = split / *[, ] */, $3;
} else {
}
else {
@methodList = ("SMTP");
}
if ( scalar @methodList) {
}
if ( scalar @methodList ) {
debug("- $pluginName: User $user: @methodList");
}

#elsif ( !exists( $group{$member} ) ) {
else {
else {
debug(
"- $pluginName: User $user chosen no methods, defaulting to SMTP."
);
Expand Down
21 changes: 11 additions & 10 deletions lib/Foswiki/Plugins/ImmediateNotifyPlugin/SMTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ sub handleNotify {
my ($users) = @_;
my ($skin) = Foswiki::Func::getPreferencesValue("SKIN");
my ($template) = Foswiki::Func::readTemplate( 'smtp', 'immediatenotify' );

# &$debug("- SMTP: template read $template");
my ($from) = Foswiki::Func::getPreferencesValue("WIKIWEBMASTER");

Expand All @@ -43,23 +44,23 @@ sub handleNotify {
foreach my $userName ( keys %$users ) {

my ($to);
&$debug("- SMTP: userName $userName");
&$debug("- SMTP: userName $userName");
my @emails = Foswiki::Func::wikinameToEmails($userName);
foreach my $email (@emails) {
$to .= $email . ",";
}
if ($to) {
my $msg = $template;
$msg =~ s/%EMAILTO%/$to/go;
&$debug("- SMTP: Sending mail to $to ($userName)");
&$debug("- SMTP: MESSAGE ($msg)");
my $msg = $template;
$msg =~ s/%EMAILTO%/$to/go;
&$debug("- SMTP: Sending mail to $to ($userName)");
&$debug("- SMTP: MESSAGE ($msg)");

my $foswiki = new Foswiki( $Foswiki::cfg{DefaultUserLogin} );
my $foswikiNet = $foswiki->net();
my $error = $foswikiNet->sendEmail($msg);
my $foswiki = new Foswiki( $Foswiki::cfg{DefaultUserLogin} );
my $foswikiNet = $foswiki->net();
my $error = $foswikiNet->sendEmail($msg);

&$debug("- SMTP: Error ($error)") if ($error);
}
&$debug("- SMTP: Error ($error)") if ($error);
}

}
}
Expand Down

0 comments on commit 80ad61c

Please sign in to comment.