[Cpan-forum-commit] rev 143 - branches/db_changes/lib/CPAN
svn at pti.co.il
svn at pti.co.il
Fri Mar 25 10:38:36 IST 2005
Author: gabor
Date: 2005-03-25 10:38:36 +0200 (Fri, 25 Mar 2005)
New Revision: 143
Modified:
branches/db_changes/lib/CPAN/Forum.pm
Log:
make sure people subscribing to All will also receive messages, and fix a bug that seems people have not received followups earlier
Modified: branches/db_changes/lib/CPAN/Forum.pm
===================================================================
--- branches/db_changes/lib/CPAN/Forum.pm 2005-03-24 07:44:49 UTC (rev 142)
+++ branches/db_changes/lib/CPAN/Forum.pm 2005-03-25 08:38:36 UTC (rev 143)
@@ -2212,32 +2212,39 @@
Subject => $subject,
Message => $message,
);
- sendmail(%mail);
+ #sendmail(%mail);
my %to;
# subscriptions to "all" messages in the current group
- #warn $post->gid;
- #warn $post->uid->id;
+ $self->log->debug("Processing messages for allposts");
my $it = CPAN::Forum::Subscriptions->search(allposts => 1, gid => $post->gid);
- #warn $it;
- _sendmail($it, \%mail, \%to);
+ $self->_sendmail($it, \%mail, \%to);
+ $it = CPAN::Forum::Subscriptions_all->search(allposts => 1);
+ $self->_sendmail($it, \%mail, \%to);
# subscription to thread "starters" in the current group
if ($post->thread == $post->id) {
+ $self->log->debug("Processing messages for thread starter");
my $it = CPAN::Forum::Subscriptions->search(starters => 1, gid => $post->gid->id);
- _sendmail($it, \%mail, \%to);
+ $self->_sendmail($it, \%mail, \%to);
+ $it = CPAN::Forum::Subscriptions_all->search(starters => 1);
+ $self->_sendmail($it, \%mail, \%to);
} else {
- my %ids;
+ $self->log->debug("Processing messages for followups");
+ my %ids; # of users who posted in this thread
my $pit = CPAN::Forum::Posts->search(thread => $post->thread);
while (my $p = $pit->next) {
$ids{$p->uid}=1;
+ $self->log->debug("Ids: " . $p->uid);
}
my $it = CPAN::Forum::Subscriptions->search(followups => 1, gid => $post->gid->id);
- _sendmail($it, \%mail, \%to, \%ids);
+ $self->_sendmail($it, \%mail, \%to, \%ids);
# uid => is one of the uids in the current thread.
+ $it = CPAN::Forum::Subscriptions_all->search(followups => 1);
+ $self->_sendmail($it, \%mail, \%to, \%ids);
}
@@ -2245,16 +2252,21 @@
}
sub _sendmail {
- my ($it, $mail, $to, $ids) = @_;
+ my ($self, $it, $mail, $to, $ids) = @_;
while (my $s = $it->next) {
my $email = $s->uid->email;
+ $self->log->debug("Sending to $email ?");
$mail->{To} = $email;
#warn "Sending ? to $email\n";
- next if $ids and not $ids->{$s->uid};
+ $self->log->debug("Processing uid: " . $s->uid->username) if $ids;
+ next if $ids and not $ids->{$s->uid->username};
+ $self->log->debug("Sending to $email id was found");
next if $_[2]->{$email}++;
+ $self->log->debug("Sending to $email first time sending");
#warn "Yes, Sending to $email\n";
sendmail(%$mail);
+ $self->log->debug("Sent to $email");
}
}
More information about the Cpan-forum-commit
mailing list