[Cpan-forum-commit] rev 203 - in trunk: . bin lib/CPAN lib/CPAN/Forum/RM

svn at pti.co.il svn at pti.co.il
Wed Aug 30 09:30:10 IDT 2006


Author: gabor
Date: 2006-08-30 09:30:09 +0300 (Wed, 30 Aug 2006)
New Revision: 203

Added:
   trunk/lib/CPAN/Forum/RM/Notify.pm
   trunk/lib/CPAN/Forum/RM/Search.pm
   trunk/lib/CPAN/Forum/RM/UserAccounts.pm
Modified:
   trunk/
   trunk/TODO
   trunk/bin/populate.pl
   trunk/lib/CPAN/Forum.pm
Log:
more run-modes are moved to separate files



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11072
   + 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11073

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2006-08-30 06:30:03 UTC (rev 202)
+++ trunk/TODO	2006-08-30 06:30:09 UTC (rev 203)
@@ -21,6 +21,8 @@
   Improve the populate.pl, look at CPANTS for ideas:
   http://search.cpan.org/src/DOMM/Module-CPANTS-ProcessCPAN-0.62/bin/update_authors.pl
   Finish the recent.pl file and maybe replace the populate.pl by using recent.pl
+# use this file to retreive list of CPAN authors and their e-mail address 
+# http://www.cpan.org/authors/01mailrc.txt.gz
 
 
   Cleanup the schema. Currently the schema/schema.sql is not the same as the
@@ -47,6 +49,7 @@
   
   Include number of AnnoCPAN posts
   
+  Provide atom feed
 
   BUG:
   When I try to reply and the original subject is already 50 chars long

Modified: trunk/bin/populate.pl
===================================================================
--- trunk/bin/populate.pl	2006-08-30 06:30:03 UTC (rev 202)
+++ trunk/bin/populate.pl	2006-08-30 06:30:09 UTC (rev 203)
@@ -32,8 +32,6 @@
 
 print "This operation can take a couple of minutes\n";
 
-# use this file to retreive list of CPAN authors and their e-mail address 
-# http://www.cpan.org/authors/01mailrc.txt.gz
 
 if (not $opts{source}) {
     my $file = "02packages.details.txt";

Added: trunk/lib/CPAN/Forum/RM/Notify.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Notify.pm	2006-08-30 06:30:03 UTC (rev 202)
+++ trunk/lib/CPAN/Forum/RM/Notify.pm	2006-08-30 06:30:09 UTC (rev 203)
@@ -0,0 +1,126 @@
+package CPAN::Forum::RM::Notify;
+use strict;
+use warnings;
+
+=head2 notify
+
+Send out e-mails upon receiving a submission.
+
+=cut
+
+sub notify {
+    my ($self, $post_id) = @_;
+    
+    my $post = CPAN::Forum::Posts->retrieve($post_id);
+
+    my $message = 
+        _text2mail ($post->text) .
+        "\n\n" .
+        "To write a respons, access\n".
+        "http://$ENV{HTTP_HOST}/response_form/" . $post->id .
+        "\n\n" .
+        "To see the full thread, access\n" .
+        "http://$ENV{HTTP_HOST}/threads/" . $post->thread .
+        "\n\n" .
+        "--\n" .
+        "You are getting this messages from $ENV{HTTP_HOST}\n" .
+        "To change your subscription information visit http://$ENV{HTTP_HOST}/mypan/\n";
+    # disclaimer ?
+    # X-lits: field ?
+
+    my $subject = sprintf ("[%s] %s",  $post->gid->name, $post->subject); # TODO _subject_escape ?
+
+    my $FROM = $self->config("from");
+    $self->log->debug("FROM field set to be $FROM");
+    my %mail = (
+        From     => $FROM,
+        Subject  => $subject,
+        Message  => $message,
+    );
+
+
+    $self->fetch_subscriptions(\%mail, $post);
+}
+
+=head2 notify_admin
+
+Notify the administrator about a new registration
+
+=cut
+
+sub notify_admin {
+    my ($self, $user) = @_;
+
+    my $FROM = $self->config("from");
+
+    my $msg = "\nUsername: " . $user->username . "\n"; 
+
+    # TODO: the admin should be able to configure if she wants to get messages on
+    # every new user (field update_on_new_user)
+    my $admin = CPAN::Forum::Users->retrieve(1);
+    my %mail = (
+        To      => $admin->email,
+        From     => $FROM,
+        Subject => "New Forum user: " . $user->username,
+        Message => $msg,
+    );
+    $self->_my_sendmail(%mail);
+}
+
+=head2 rss
+
+Provide RSS feed
+/rss/all  latest N entries
+/rss/dist/Distro-Name  latest N entries of that distro name
+/rss/author/PAUSEID
+
+=cut
+
+sub rss {
+    my $self = shift;
+    
+    my $limit  = $self->config("rss_size") || 10;
+    my @params = @{$self->param("path_parameters")};
+    my $it;
+    if (@params > 1) {
+        if ($params[0] eq 'dist') {
+            my $dist = $params[1];
+            $self->log->debug("rss of dist: '$dist'");
+            my ($group) = CPAN::Forum::Groups->search({ name => $dist });
+            $it = CPAN::Forum::Posts->search(gid => $group->id, {order_by => 'date DESC'});
+        }
+        elsif ($params[0] eq 'author') {
+            my $pauseid = uc $params[1];
+            $self->log->debug("rss of author: '$pauseid'");
+            $it = CPAN::Forum::Posts->search_post_by_pauseid($pauseid);
+        }
+        else {
+            $self->log->warning("rss requested for $params[0]");
+        }
+    }
+    else {
+        $it = CPAN::Forum::Posts->retrieve_latest($limit);
+    }
+
+    require XML::RSS::SimpleGen;
+    my $url = "http://$ENV{HTTP_HOST}/";
+    my $rss = XML::RSS::SimpleGen->new( $url, "CPAN Forum", "Discussing Perl CPAN modules");
+    $rss->language( 'en' );
+
+    my $admin = CPAN::Forum::Users->retrieve(1); # TODO this is a hard coded user id of the administrator !
+    # and this reveals the e-mail of the administrator. not a good idea I guess.
+    $rss->webmaster($admin->email);
+
+    while (my $post = $it->next() and $limit--) {
+        my $title = sprintf "[%s] %s", $post->gid->name, $post->subject;
+        $rss->item($url. "posts/" . $post->id(), $title); # TODO _subject_escape ?
+    }
+
+    $self->header_props(-type => 'application/rss+xml');
+    
+    return $rss->as_string();
+}
+
+
+1;
+

Added: trunk/lib/CPAN/Forum/RM/Search.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Search.pm	2006-08-30 06:30:03 UTC (rev 202)
+++ trunk/lib/CPAN/Forum/RM/Search.pm	2006-08-30 06:30:09 UTC (rev 203)
@@ -0,0 +1,151 @@
+package CPAN::Forum::RM::Search;
+use strict;
+use warnings;
+
+# currently returning the number of results but this might change
+sub _search_results {
+    my ($self, $t, $params) = @_;
+    
+    $params->{per_page} = $self->config("per_page");
+
+    my $pager   = CPAN::Forum::Posts->mysearch($params);
+    my @results = $pager->search_where();
+    my $total   = $pager->total_entries;
+    $self->log->debug("number of entries: total=$total");
+    my $data = $self->build_listing(\@results);
+
+    $t->param(messages       => $data);
+    $t->param(total          => $total);
+    $t->param(previous_page  => $pager->previous_page);
+    $t->param(next_page      => $pager->next_page);
+    $t->param(first_entry    => $pager->first);
+    $t->param(last_entry     => $pager->last);
+    $t->param(first_page     => 1)                      if $pager->current_page != 1;
+    $t->param(last_page      => $pager->last_page)      if $pager->current_page != $pager->last_page;
+    return $pager->total_entries;
+}
+
+sub module_search_form {
+    my ($self, $errors) = @_;
+    my $t = $self->load_tmpl("module_search_form.tmpl");
+    $t->param($_=>1) foreach @$errors;
+    $t->output;
+}
+
+sub module_search {
+    my ($self) = @_;
+
+    my $q = $self->query;
+    my $txt = $q->param("q");
+    $txt =~ s/^\s+|\s+$//g;
+
+    # remove taint if there is
+    if ($txt =~ /^([\w:.%-]+)$/) {
+        $txt = $1;
+    } else {
+        $self->log->debug("Tained search: $txt");
+    }
+
+    if (not $txt) {
+        return $self->module_search_form(['invalid_search_term']);
+    }
+    $self->log->debug("group name search term: $txt");
+    $txt =~ s/::/-/g;
+    $txt = '%' . $txt . '%';
+    
+    my $it =  CPAN::Forum::Groups->search_like(name => $txt);
+    my $cnt = CPAN::Forum::Groups->sql_count_like("name", $txt)->select_val;
+    my @group_names;
+    my @group_ids;
+    while (my $group  = $it->next) {
+        push @group_names, $group->name;
+        push @group_ids, $group->id;
+    }
+    if (not @group_names) {
+        return $self->module_search_form(['no_module_found']);
+    }
+    
+    #$self->log->debug("GROUP NAMES: @group_names");
+
+    my $t = $self->load_tmpl("module_select_form.tmpl",
+    );
+    $t->param("group_selector" => $self->_group_selector(\@group_names, \@group_ids));
+    $t->output;
+}
+
+sub search {
+    my ($self) = @_;
+    my $q      = $self->query;
+    my $name   = $q->param("name")    || '';
+    my $what   = $q->param("what")    || '';
+    $name      =~ s/^\s+|\s+$//g;
+    my $any_result = 0;
+
+    # kill the taint checking (why do I use taint checking if I kill it then ?)
+    if ($name =~ /(.*)/) { $name    = $1; }
+    $name =~ s/::/-/g if $what eq "module";
+    
+    my $t = $self->load_tmpl("search.tmpl",
+        associate => $q,
+        loop_context_vars => 1,
+    );
+    my $it;
+
+    if (not $what and not $name) {
+        $what = $self->session->param('search_what');
+        $name = $self->session->param('search_name');
+    }
+
+    $self->session->param(search_what => $what);
+    $self->session->param(search_name => $name);
+
+    if ($what and $name) {
+        if ($what eq "module" or $what eq "pauseid") {
+            my $it;
+            if ($what eq "module") {
+               $it =  CPAN::Forum::Groups->search_like(name => '%' . $name . '%');
+            } else {
+                my ($author) = CPAN::Forum::Authors->search(pauseid => uc $name);
+                if ($author) {
+                    $it =  CPAN::Forum::Groups->search(pauseid => $author->id);
+                } 
+            }
+            my @things;
+            if ($it) {
+                while (my $group  = $it->next) {
+                    push @things, {name => $group->name};
+                }
+            }
+            $any_result = 1 if @things;
+            $t->param(groups => \@things);
+            $t->param($what => 1);
+        } elsif ($what eq "user") {
+            my @things;
+            my $it =  CPAN::Forum::Users->search_like(username => '%' . lc($name) . '%');
+            while (my $user  = $it->next) {
+                push @things, {username => $user->username};
+            }
+            $any_result = 1 if @things;
+            $t->param(users => \@things);
+            $t->param($what => 1);
+        } else {
+            my %where;
+            if ($what eq "subject") { %where = (subject => {'LIKE', '%' . $name . '%'}); }
+            if ($what eq "text")    { %where = (text    => {'LIKE', '%' . $name . '%'}); }
+            $self->log->debug("Search 1: " . join "|", %where);
+            if (%where) {
+
+                $self->log->debug("Search 2: " . join "|", %where);
+
+                my $page = $q->param('page') || 1;
+                $any_result = $self->_search_results($t, {where => \%where, page => $page});
+                $t->param($what => 1);
+            }
+        }
+        $t->param(no_results => not $any_result);
+    }
+    $t->output;
+}
+
+1;
+

Added: trunk/lib/CPAN/Forum/RM/UserAccounts.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/UserAccounts.pm	2006-08-30 06:30:03 UTC (rev 202)
+++ trunk/lib/CPAN/Forum/RM/UserAccounts.pm	2006-08-30 06:30:09 UTC (rev 203)
@@ -0,0 +1,56 @@
+package CPAN::Forum::RM::UserAccounts;
+use strict;
+use warnings;
+
+sub selfconfig {
+    my ($self, $errs) = @_;
+    my $t = $self->load_tmpl("change_password.tmpl");
+    my ($user) = CPAN::Forum::Users->retrieve($self->session->param('uid'));
+    $t->param(fname => $user->fname);
+    $t->param(lname => $user->lname);
+
+    $t->param($errs) if $errs;
+    $t->output;
+}
+
+sub change_info {
+    my ($self) = @_;
+    my $q = $self->query;
+    
+    if ($q->param('fname') !~ /^[a-zA-Z]*$/) {
+        return $self->selfconfig({"bad_fname" => 1});
+    }
+    if ($q->param('lname') !~ /^[a-zA-Z]*$/) {
+        return $self->selfconfig({"bad_lname" => 1});
+    }
+
+    my ($user) = CPAN::Forum::Users->retrieve($self->session->param('uid'));
+    $user->fname($q->param('fname'));
+    $user->lname($q->param('lname'));
+    $user->update;
+
+    return $self->selfconfig({done => 1});
+
+}
+
+
+sub change_password {
+    my ($self) = @_;
+    my $q = $self->query;
+
+    if (not $q->param('password') or not $q->param('pw') or ($q->param('password') ne $q->param('pw'))) {
+        return $self->selfconfig({bad_pw_pair => 1});
+    }
+    
+    my ($user) = CPAN::Forum::Users->retrieve($self->session->param('uid'));
+    $user->password($q->param('password'));
+    $user->update;
+
+    return $self->selfconfig({done => 1});
+
+}
+
+
+
+1;
+

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2006-08-30 06:30:03 UTC (rev 202)
+++ trunk/lib/CPAN/Forum.pm	2006-08-30 06:30:09 UTC (rev 203)
@@ -542,7 +542,10 @@
 use base 'CPAN::Forum::RM::Users';
 use base 'CPAN::Forum::RM::Admin';
 use base 'CPAN::Forum::RM::Other';
+use base 'CPAN::Forum::RM::Notify';
+use base 'CPAN::Forum::RM::Search';
 use base 'CPAN::Forum::RM::Subscriptions';
+use base 'CPAN::Forum::RM::UserAccounts';
 my %RM_MAP = (
     author                  => 'CPAN::Forum::RM::Author',
 
@@ -567,6 +570,18 @@
 
     mypan                   => 'CPAN::Forum::RM::Subscriptions',
     update_subscription     => 'CPAN::Forum::RM::Subscriptions',
+
+    notify                  => 'CPAN::Forum::RM::Notify',
+    notify_admin            => 'CPAN::Forum::RM::Notify',
+    rss                     => 'CPAN::Forum::RM::Notify',
+
+    module_search_form      => 'CPAN::Forum::RM::Search',
+    module_search           => 'CPAN::Forum::RM::Search',
+    search                  => 'CPAN::Forum::RM::Search',
+
+    selfconfig              => 'CPAN::Forum::RM::UserAccounts',
+    change_info             => 'CPAN::Forum::RM::UserAccounts',
+    change_password         => 'CPAN::Forum::RM::UserAccounts',
 );
 
 =head2 setup
@@ -701,30 +716,7 @@
     $t->output;
 }
 
-# currently returning the number of results but this might change
-sub _search_results {
-    my ($self, $t, $params) = @_;
-    
-    $params->{per_page} = $self->config("per_page");
 
-    my $pager   = CPAN::Forum::Posts->mysearch($params);
-    my @results = $pager->search_where();
-    my $total   = $pager->total_entries;
-    $self->log->debug("number of entries: total=$total");
-    my $data = $self->build_listing(\@results);
-
-    $t->param(messages       => $data);
-    $t->param(total          => $total);
-    $t->param(previous_page  => $pager->previous_page);
-    $t->param(next_page      => $pager->next_page);
-    $t->param(first_entry    => $pager->first);
-    $t->param(last_entry     => $pager->last);
-    $t->param(first_page     => 1)                      if $pager->current_page != 1;
-    $t->param(last_page      => $pager->last_page)      if $pager->current_page != $pager->last_page;
-    return $pager->total_entries;
-}
-
-
 =head2 all
 
 An alias of the C<home()> run-mode.
@@ -912,32 +904,6 @@
     $self->_my_sendmail(%mail);
 }
 
-=head2 notify_admin
-
-Notify the administrator about a new registration
-
-=cut
-
-sub notify_admin {
-    my ($self, $user) = @_;
-
-    my $FROM = $self->config("from");
-
-    my $msg = "\nUsername: " . $user->username . "\n"; 
-
-    # TODO: the admin should be able to configure if she wants to get messages on
-    # every new user (field update_on_new_user)
-    my $admin = CPAN::Forum::Users->retrieve(1);
-    my %mail = (
-        To      => $admin->email,
-        From     => $FROM,
-        Subject => "New Forum user: " . $user->username,
-        Message => $msg,
-    );
-    $self->_my_sendmail(%mail);
-}
-
-
 =head2 _group_selector
 
 
@@ -1005,13 +971,6 @@
 }
 
 
-sub module_search_form {
-    my ($self, $errors) = @_;
-    my $t = $self->load_tmpl("module_search_form.tmpl");
-    $t->param($_=>1) foreach @$errors;
-    $t->output;
-}
-
 =head2 posts
 
 Show a post, the editor and a preview - whichever is needed.
@@ -1428,170 +1387,6 @@
     }
 }
 
-sub selfconfig {
-    my ($self, $errs) = @_;
-    my $t = $self->load_tmpl("change_password.tmpl");
-    my ($user) = CPAN::Forum::Users->retrieve($self->session->param('uid'));
-    $t->param(fname => $user->fname);
-    $t->param(lname => $user->lname);
-
-    $t->param($errs) if $errs;
-    $t->output;
-}
-
-sub change_info {
-    my ($self) = @_;
-    my $q = $self->query;
-    
-    if ($q->param('fname') !~ /^[a-zA-Z]*$/) {
-        return $self->selfconfig({"bad_fname" => 1});
-    }
-    if ($q->param('lname') !~ /^[a-zA-Z]*$/) {
-        return $self->selfconfig({"bad_lname" => 1});
-    }
-
-    my ($user) = CPAN::Forum::Users->retrieve($self->session->param('uid'));
-    $user->fname($q->param('fname'));
-    $user->lname($q->param('lname'));
-    $user->update;
-
-    return $self->selfconfig({done => 1});
-
-}
-
-
-sub change_password {
-    my ($self) = @_;
-    my $q = $self->query;
-
-    if (not $q->param('password') or not $q->param('pw') or ($q->param('password') ne $q->param('pw'))) {
-        return $self->selfconfig({bad_pw_pair => 1});
-    }
-    
-    my ($user) = CPAN::Forum::Users->retrieve($self->session->param('uid'));
-    $user->password($q->param('password'));
-    $user->update;
-
-    return $self->selfconfig({done => 1});
-
-}
-
-
-sub module_search {
-    my ($self) = @_;
-
-    my $q = $self->query;
-    my $txt = $q->param("q");
-    $txt =~ s/^\s+|\s+$//g;
-
-    # remove taint if there is
-    if ($txt =~ /^([\w:.%-]+)$/) {
-        $txt = $1;
-    } else {
-        $self->log->debug("Tained search: $txt");
-    }
-
-    if (not $txt) {
-        return $self->module_search_form(['invalid_search_term']);
-    }
-    $self->log->debug("group name search term: $txt");
-    $txt =~ s/::/-/g;
-    $txt = '%' . $txt . '%';
-    
-    my $it =  CPAN::Forum::Groups->search_like(name => $txt);
-    my $cnt = CPAN::Forum::Groups->sql_count_like("name", $txt)->select_val;
-    my @group_names;
-    my @group_ids;
-    while (my $group  = $it->next) {
-        push @group_names, $group->name;
-        push @group_ids, $group->id;
-    }
-    if (not @group_names) {
-        return $self->module_search_form(['no_module_found']);
-    }
-    
-    #$self->log->debug("GROUP NAMES: @group_names");
-
-    my $t = $self->load_tmpl("module_select_form.tmpl",
-    );
-    $t->param("group_selector" => $self->_group_selector(\@group_names, \@group_ids));
-    $t->output;
-}
-
-sub search {
-    my ($self) = @_;
-    my $q      = $self->query;
-    my $name   = $q->param("name")    || '';
-    my $what   = $q->param("what")    || '';
-    $name      =~ s/^\s+|\s+$//g;
-    my $any_result = 0;
-
-    # kill the taint checking (why do I use taint checking if I kill it then ?)
-    if ($name =~ /(.*)/) { $name    = $1; }
-    $name =~ s/::/-/g if $what eq "module";
-    
-    my $t = $self->load_tmpl("search.tmpl",
-        associate => $q,
-        loop_context_vars => 1,
-    );
-    my $it;
-
-    if (not $what and not $name) {
-        $what = $self->session->param('search_what');
-        $name = $self->session->param('search_name');
-    }
-
-    $self->session->param(search_what => $what);
-    $self->session->param(search_name => $name);
-
-    if ($what and $name) {
-        if ($what eq "module" or $what eq "pauseid") {
-            my $it;
-            if ($what eq "module") {
-               $it =  CPAN::Forum::Groups->search_like(name => '%' . $name . '%');
-            } else {
-                my ($author) = CPAN::Forum::Authors->search(pauseid => uc $name);
-                if ($author) {
-                    $it =  CPAN::Forum::Groups->search(pauseid => $author->id);
-                } 
-            }
-            my @things;
-            if ($it) {
-                while (my $group  = $it->next) {
-                    push @things, {name => $group->name};
-                }
-            }
-            $any_result = 1 if @things;
-            $t->param(groups => \@things);
-            $t->param($what => 1);
-        } elsif ($what eq "user") {
-            my @things;
-            my $it =  CPAN::Forum::Users->search_like(username => '%' . lc($name) . '%');
-            while (my $user  = $it->next) {
-                push @things, {username => $user->username};
-            }
-            $any_result = 1 if @things;
-            $t->param(users => \@things);
-            $t->param($what => 1);
-        } else {
-            my %where;
-            if ($what eq "subject") { %where = (subject => {'LIKE', '%' . $name . '%'}); }
-            if ($what eq "text")    { %where = (text    => {'LIKE', '%' . $name . '%'}); }
-            $self->log->debug("Search 1: " . join "|", %where);
-            if (%where) {
-
-                $self->log->debug("Search 2: " . join "|", %where);
-
-                my $page = $q->param('page') || 1;
-                $any_result = $self->_search_results($t, {where => \%where, page => $page});
-                $t->param($what => 1);
-            }
-        }
-        $t->param(no_results => not $any_result);
-    }
-    $t->output;
-}
-
 sub add_new_group {
     my ($self) = @_;
     if (not $self->session->param("admin")) {
@@ -1615,100 +1410,7 @@
     $t->param(updated => 1);
     $t->output;
 }
-=head2 rss
 
-Provide RSS feed
-/rss/all  latest N entries
-/rss/dist/Distro-Name  latest N entries of that distro name
-/rss/author/PAUSEID
-
-=cut
-
-sub rss {
-    my $self = shift;
-    
-    my $limit  = $self->config("rss_size") || 10;
-    my @params = @{$self->param("path_parameters")};
-    my $it;
-    if (@params > 1) {
-        if ($params[0] eq 'dist') {
-            my $dist = $params[1];
-            $self->log->debug("rss of dist: '$dist'");
-            my ($group) = CPAN::Forum::Groups->search({ name => $dist });
-            $it = CPAN::Forum::Posts->search(gid => $group->id, {order_by => 'date DESC'});
-        }
-        elsif ($params[0] eq 'author') {
-            my $pauseid = uc $params[1];
-            $self->log->debug("rss of author: '$pauseid'");
-            $it = CPAN::Forum::Posts->search_post_by_pauseid($pauseid);
-        }
-        else {
-            $self->log->warning("rss requested for $params[0]");
-        }
-    }
-    else {
-        $it = CPAN::Forum::Posts->retrieve_latest($limit);
-    }
-
-    require XML::RSS::SimpleGen;
-    my $url = "http://$ENV{HTTP_HOST}/";
-    my $rss = XML::RSS::SimpleGen->new( $url, "CPAN Forum", "Discussing Perl CPAN modules");
-    $rss->language( 'en' );
-
-    my $admin = CPAN::Forum::Users->retrieve(1); # TODO this is a hard coded user id of the administrator !
-    # and this reveals the e-mail of the administrator. not a good idea I guess.
-    $rss->webmaster($admin->email);
-
-    while (my $post = $it->next() and $limit--) {
-        my $title = sprintf "[%s] %s", $post->gid->name, $post->subject;
-        $rss->item($url. "posts/" . $post->id(), $title); # TODO _subject_escape ?
-    }
-
-    $self->header_props(-type => 'application/rss+xml');
-    
-    return $rss->as_string();
-}
-
-=head2 notify
-
-Send out e-mails upon receiving a submission.
-
-=cut
-
-sub notify {
-    my ($self, $post_id) = @_;
-    
-    my $post = CPAN::Forum::Posts->retrieve($post_id);
-
-    my $message = 
-        _text2mail ($post->text) .
-        "\n\n" .
-        "To write a respons, access\n".
-        "http://$ENV{HTTP_HOST}/response_form/" . $post->id .
-        "\n\n" .
-        "To see the full thread, access\n" .
-        "http://$ENV{HTTP_HOST}/threads/" . $post->thread .
-        "\n\n" .
-        "--\n" .
-        "You are getting this messages from $ENV{HTTP_HOST}\n" .
-        "To change your subscription information visit http://$ENV{HTTP_HOST}/mypan/\n";
-    # disclaimer ?
-    # X-lits: field ?
-
-    my $subject = sprintf ("[%s] %s",  $post->gid->name, $post->subject); # TODO _subject_escape ?
-
-    my $FROM = $self->config("from");
-    $self->log->debug("FROM field set to be $FROM");
-    my %mail = (
-        From     => $FROM,
-        Subject  => $subject,
-        Message  => $message,
-    );
-
-
-    $self->fetch_subscriptions(\%mail, $post);
-}
-
 sub fetch_subscriptions {
     my ($self, $mail, $post) = @_;
 



More information about the Cpan-forum-commit mailing list