whatsnewfm-0.7.2/0000755000175000017500000000000011653760460012705 5ustar mitchmitchwhatsnewfm-0.7.2/welcome0000644000175000017500000000215511653760460014266 0ustar mitchmitch===================== FRESHMEAT.NET DAILY UPDATE ====================== SOFTWARE: [001] whatsnewfm (Welcome message) [002] whatsnewfm (2nd Welcome message) ======================================================================== [001] whatsnewfm (Welcome message) Description: Congratulations! Changes: whatsnewfm.pl and your .procmailrc have been installed properly. Once you have subscribed to the freecode newsletter, you will be informed of any updates concerning whatsnewfm. Don't forget to add whatsnewfm to your 'hot' database! License: GPL http://freecode.com/projects/whatsnewfm/ ======================================================================== [002] whatsnewfm (2nd Welcome message) Description: This is a second welcome message because a freecode newsletter with less than two releases is considered broken and will bring up an error message. Changes: none :-) License: GPL http://freecode.com/projects/whatsnewfm/ ======================================================================== Today's news on the web: http://freecode.com/today Change your subscription: http://freecode.com/account/edit whatsnewfm-0.7.2/whatsnewfm.pl0000755000175000017500000011202411653760460015430 0ustar mitchmitch#!/usr/bin/perl -w ############################################################################# # my $id='whatsnewfm.pl v0.7.2 2011-11-01'; # Filters the freecode newsletter for 'new' or 'interesting' entries. # # Copyright (C) 2000-2011 Christian Garbs # Joerg Plate # Dominik Brettnacher # Pedro Melo Cunha # Matthew Gabeler-Lee # Bernd Rilling # Jost Krieger # Francois Marier # # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # ############################################################################# # # v0.7.2 # 2011/11/01--> BUGFIX: Newsletter format has changed: # Freshmeat has become Freecode. # # v0.7.1 # 2009/05/30--> BUGFIX: Newsletter format has changed. # # v0.7.0 # 2009/03/23--> Add scoring of licenses via LICSCORE. # 2009/03/19--> BUGFIX: Support the new Newsletter format of FM3 # # v0.6.6 # v0.6.5 # 2004/04/11--> Make score regexp match multiline as proposed in # Sourceforge request #930403. # # v0.6.4 # 2004/02/13--> Copy Content-type etc. to output mails as proposed in # Sourceforge bug #891520. # 2003/08/24--> Fix typo in manpage. # # v0.6.3 # 2003/08/07--> Parameters of sendmail(1) call can be configured via MAIL_OPT # as wanted in Sourceforge bug #728895. # # v0.6.2 # 2003/04/27--> Changed expiration algorithm for 'old' entries. # Expiration after one day is not possible any more. # 2003/04/23--> BUGFIX: Multiline release subjects were not handled # correctly (Sourceforge bug #726261). # 2003/03/09--> Call sendmail(1) as advised in `perldoc -q "send mail"`. # No need for the "sendmail fixes" regarding dot-lines any more. # 2003/02/26--> Removed old filenames from documentation. # 2003/02/03--> Use %hashes instead of @arrays for configuration file keys. # # v0.6.1 # 2003/01/05--> BUGFIX: Number of added projects to old database in # | newsletter was wrong. # `-> Changed open("<") call to more secure three-parameter form. # # v0.6.0 # 2003/01/04--> No changes, v0.5.3 seems stable enough to be released. # # v0.5.3 # 2002/12/29--> Configuration file can be selected. # # v0.5.2 # 2002/12/04--> BUGFIX: 0.5.1 didn't run at all. Silly mistake :-( # # v0.5.1 # 2002/12/03--> Inclusion of manpage from Debian package. # 2002/11/26--> Removed DATE_CMD backwards compatibility. # # v0.5.0 # 2002/11/24--> Removed file locking code. # |-> Changed all @arrays and %hashes to corresponding $references. # |-> Using BerkeleyDB::Hash for storage of databases. # |-> Added function prototypes. # `-> Added BerkeleyDB locking method. # 2002/11/24--> Simpler computation of timestamp. DATE_CMD not needed # any more. # 2002/11/23--> Help text updates. # # >> 0.4.x branch forked off # # v0.4.11 # 2002/11/19--> Removed warnings under Perl 5.8.0 # # v0.4.10 # 2001/11/07--> BUGFIX: Newsletter format has changed. # # v0.4.9 # 2001/10/19--> BUGFIX: Corrected calculation of value $db_new in summary. # | (bug is result of changes on 2001/10/01) # |-> Scoring of editorial articles is possible now. # `-> List of skipped articles can be shown. # 2001/10/13--> Configuration file warnings are included in 'new' mails. # 2001/10/01--> A news item that got filtered out because of a low score # is not added to the 'old' database so it will "reappear" # with the next release if you change your scoring rules. # 2001/09/07--> BUGFIX: Test message didn't work. # # v0.4.8 # 2001/08/15--> BUGFIX: Categories were missing in 'hot' mails. # # v0.4.7 # 2001/08/10--> BUGFIX: Newsletter format has changed. # # v0.4.6 # 2001/07/28--> Scoring of Freshmeat Categories added. # 2001/07/21--> Updated help text. # # v0.4.5 # 2001/07/19--> BUGFIX: Newsletter format has changed. # # v0.4.4 # 2001/06/23--> BUGFIX: Warning message about changed newsletter format # was not generated correctly. # 2001/05/31--> "view" accepts optional regexp to filter the output. # # v0.4.3 # 2001/02/11--> Summary can be printed at top or bottom of a parsed # newsletter. # 2001/02/08--> Comments from 'hot' database are included in 'hot' mails. # `-> BUGFIX: Existing comments in 'hot' database could not # be updated. # 2001/02/07--> BUGFIX: URL was missing in articles. # `-> BUGFIX: Project ID was missing in 'hot' mails. # # v0.4.2 # 2001/02/05--> BUGFIX: freshmeat has changed the newsletter format. # |-> Improved detection of changes in newsletter format. # `-> Two releases of the same project within one newsletter # are handled correctly. # # v0.4.1 # 2001/02/02--> BUGFIX: A line with a single dot "." within freetext # fields (e.g. release details) caused sendmail to end # the mail at that point. # 2001/01/31--> Changes in the newsletter format should be detected and # the user gets a warning mail telling him to update # whatsnewfm. # # v0.4.0 # 2001/01/31--> BUGFIX: freshmeat has changed the newsletter format. # # v0.2.6 # 2001/01/30--> New items with less than a specified score will not be shown. # # v0.2.5 # 2000/11/25--> Freshmeat editorials are included in the list of new # applications. # # v0.2.4 # 2000/11/10--> Removed warnings that only appeared on Perl 5.6 # # v0.2.3 # 2000/10/30--> Reacted to a change in the newsletter format (item name). # 2000/10/08--> "add" and "del" give more verbose messages. # # v0.2.2 # 2000/09/20--> Added scoring of newsletters. # 2000/09/19--> "add" and "del" produce affirmative messages. # # v0.2.1 # 2000/09/08--> BUGFIX: Statistic calculations at the end of a # | newsletter were broken. # |-> You can "view" all entries in the 'hot' database. # `-> Configuration is read from a configuration file. The # script doesn't need to be edited any more. # # v0.2.0 # 2000/08/22--> BUGFIX: freshmeat has changed the newsletter format. # 2000/08/05--> Updates can be sent as one big or several small mails. # # v0.0.3 # 2000/08/04--> BUGFIX: No empty mails are sent any more. # `-> Display of help text # 2000/08/03--> BUGFIX: Comments in the 'hot' database were deleted # | after every run. # |-> Major code cleanup. # `-> You can "add" and "del" entries from the 'hot' database. # # v0.0.2 # 2000/08/03--> A list of interesting applications is kept and you are # | informed of updates of these applications. # `-> Databases are locked properly. # # v0.0.1 # 2000/07/17--> generated Appindex link is wrong, thus it is removed. # The link can't be generated offline, because there is not # enough information contained in the newsletter. # 2000/07/14--> removed the dot because "sendmail" will treat it as end # of mail in the middle of the newsletter... # 2000/07/12--> a dot before the separator line to allow copy'n'paste to # the "mail" program - bad idea[TM] (see 2000/07/14) # 2000/07/11--> statistics are generated # 2000/07/07--> it works # 2000/07/06--> first piece of code # # # $Id: whatsnewfm.pl,v 1.112 2009/03/26 20:55:14 mastermitch Exp $ # # ############################################################################# ##########################[ documentation ]################################## =head1 NAME whatsnewfm - filter the daily newsletter from freecode.com =head1 SYNOPSIS B [ B<-c> F ] B [ B<-c> F ] B [ I ] B [ B<-c> F ] B [ I [ I ] ] B [ B<-c> F ] B [ I ] [ I ] [ ... ] =head1 DESCRIPTION whatsnewfm is a utility to filter the daily newsletter from freecode.com The main purpose is to cut the huge newsletter to a smaller size by only showing items that you didn't see before. The items already seen will be stored in a database. After some time, the items expire and will be shown again the next time they are included in a newsletter. If you find an item that you consider particularly useful, you can add it to a "hot" list. Items in the hot list are checked for updates so that you don't miss anything about your favourite programs. =head1 OPTIONS =over 5 =item B<-c> F This optional parameter selects a different configuration file. Default is F<~/.whatsnewfmrc>. =item B Standard mode of operation. A mail containing a newsletter will be read from stdin, parsed and the results mailed. =item B B [ I ] Prints the "hot" database. If I is given, only entries matching that regular expression are printed. Pattern matches are always case-insensitive. =item B B [ I [ I ] ] Adds I to the "hot" database. An optional I describing the project may be given. If no I is given on the command line, data will be read from stdin. Each line must consist of a I optionally followed by a whitespace and a I. =item B B [ I ] [ I ] [ ... ] Removes I from the "hot" database. Multiple Is may be given. If no I is given on the command line, data will be read from stdin. Each line must consist of one or more Is (separated by whitespace) to be deleted. =back =head1 FILES =over 5 =item I<~/.whatsnewfmrc> Personal whatsnewfm configuration file. =item I<~/.whatsnewfm.db> Personal database with "hot" and "old" entries. =back =head1 BUGS Please report bugs to >. =head1 AUTHOR whatsnewfm was written by Christian Garbs >. =head1 AVAILABILITY Look for updates at >. =head1 COPYRIGHT whatsnewfm is licensed under the GNU GPL. =cut ##########################[ import modules ]################################# use strict; use warnings; use BerkeleyDB::Hash; #####################[ declare global variables ]############################ # global configuration hash: my $config; # global database environment my $db_env; # where to look for the configuration file (default): $config->{CONFIGFILE} = "~/.whatsnewfmrc"; # information my $whatsnewfm_homepages = [ "http://www.cgarbs.de/whatsnewfm.en.html" , "http://github.com/mmitch/whatsnewfm", "http://sourceforge.net/projects/whatsnewfm/" ]; my $whatsnewfm_author = "Christian Garbs "; # configuration file my $cfg_allowed_keys = { "DB_NAME" => 0, "EXPIRE" => 0, "LIST_SKIPPED" => 0, "MAILTO" => 0, "MAIL_CMD" => 0, "MAIL_OPT" => 0, "SCORE_MIN" => 0, "SUMMARY_AT" => 0, "UPDATE_MAIL" => 0, }; my $cfg_optional_keys = { "LIST_SKIPPED" => 0, "SUMMARY_AT" => 0, }; my $cfg_warnings = []; my $skipped_already_seen = []; my $skipped_low_score = []; my $separator = "*" . "="x76 . "*\n"; # main routine now at the bottom! ########################[ display help text ]################################ sub display_help() { print << "EOF"; $id filter mode for newsletters (reads from stdin): whatsnewfm.pl [-c ] print the "hot" list to stdout: whatsnewfm.pl [-c ] view [regexp] add one new application to the "hot" list: whatsnewfm.pl [-c ] add [comment] add multiple new applications to the "hot" list (from stdin): whatsnewfm.pl [-c ] add remove applications from the "hot" list: whatsnewfm.pl [-c ] del [project id] [project id] [...] or a list from stdin: whatsnewfm.pl [-c ] del the optional parameter -c selects the configuration file to use (default: ~/.whatsnewfmrc) EOF } ##############[ view the entries in the 'hot' database ]##################### sub view_entries(@) { my $db = open_hot_db(); if ($_[0]) { foreach my $project (keys %{$db}) { my $line = "$project\t$db->{$project}"; if ($line =~ /$_[0]/i) { print "$line\n"; } } } else { foreach my $project (keys %{$db}) { print "$project\t$db->{$project}\n"; } } close_hot_db(); } ###############[ calculate the score for a news item ]####################### sub do_scoring($) { my $app = shift; $app->{'score'} = 0; if (defined $app->{'description'}) { foreach my $score ( @{$config->{'SCORE'}}) { if ($app->{'description'} =~ /$score->{'regexp'}/is) { $app->{'score'} += $score->{'score'}; } } } if (defined $app->{'category'}) { foreach my $score ( @{$config->{'CATSCORE'}}) { if ($app->{'category'} =~ /$score->{'regexp'}/is) { $app->{'score'} += $score->{'score'}; } } } if (defined $app->{'license'}) { foreach my $score ( @{$config->{'LICSCORE'}}) { if ($app->{'license'} =~ /$score->{'regexp'}/is) { $app->{'score'} += $score->{'score'}; } } } } ################[ add an entry to the 'hot' database ]####################### sub add_entry(@) { my $hot = open_hot_db(); if (@_) { my $project = lc shift @_; my $comment = ""; $comment = join " ", @_ if @_; if (exists $hot->{$project}) { print "$project updated.\n"; } else { print "$project added.\n"; } $hot->{$project} = $comment; } else { while (my $line=) { chomp $line; my ($project, $comment) = split /\s/, $line, 2; $comment = "" unless $comment; $project = lc $project; if (exists $hot->{$project}) { print "$project updated.\n"; } else { print "$project added.\n"; } $hot->{$project} = $comment; } } my $hot_written = close_hot_db($hot); print "You now have $hot_written entries in your hot database.\n"; } #############[ remove an entry from the 'hot' database ]##################### sub remove_entry(@) { my $hot = open_hot_db(); if (@_) { foreach my $project (@_) { $project = lc $project; if (exists $hot->{$project}) { delete $hot->{$project}; print "$project deleted.\n"; } else { print "$project not in database.\n"; } } } else { while (my $line=) { chomp $line; my @projects = split /\s/, $line; foreach my $project (@projects) { $project = lc $project; if (exists $hot->{$project}) { delete $hot->{$project}; print "$project deleted.\n"; } else { print "$project not in database.\n"; } } } } my $hot_written = close_hot_db($hot); print "You now have $hot_written entries in your hot database.\n"; } ########################[ parse a newsletter ]############################### sub parse_newsletter() { my $database; my $new_app; my $interesting; my $this_time_new; my $subject = "Subject: Freecode Newsletter (no subject?)\n"; my $encoding = ''; my $position = 1; # 1-> after mail header # 0-> within releases my $hot_written = 0; my $db_written = 0; my $db_expired = 0; my $db_new = 0; my $releases = 0; my $releases_new = 0; my $end = 0; my $hot_applications = []; my $new_applications = []; ### generate current timestamp my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); my $timestamp = ($mon+1) + ($year+1900)*12; # Move comparison timestamp half a month into the past. This way # an item added on 31.01. won't be expired on 01.02. if the # expiration is set to 1 month. It will be expired on # 16.02. instead, which is better (error distribution). my $timestamp_cmp = $timestamp - ($mday < 16); ### read databases $database = open_old_db(); $interesting = open_hot_db(); ### expire 'old' entries foreach my $number (keys %{$database}) { if (($database->{$number}+$config->{'EXPIRE'}) < $timestamp_cmp) { $db_expired++; delete $database->{$number}; } } ### process email headers while () { last if /^$/; if (/^Subject:\s/) { $subject=$_; } elsif (/^MIME-version:\s/) { $encoding .= $_; } elsif (/^Content-type:\s/) { $encoding .= $_; } elsif (/^Content-transfer-encoding:\s/) { $encoding .= $_; } } ### process email body while (my $line=) { chomp $line; if (($position > 0) and ($line =~ /^SOFTWARE:/)) { $position = 0; while ($end == 0) { chomp $line; if ($line !~ /^\s*$/) { if ($line =~ /========================================================================/) { $end = 1; } } $line=; $end = 1 unless defined $line; } } elsif ($position == 0) { ### parse an release entry # empty line while ((defined $line) and ($line =~ /^\s*$/)) { $line=; } next unless defined $line; my $release_nr; # title while ((defined $line) and ($line !~ /^\[\d+\] /)) { $line=; } next unless defined $line; $line =~ s/^(\[\d+\]) //; $release_nr = $1; chomp $line; $new_app->{'subject'} = $line; $line=; while ((defined $line) and ($line !~ /^\s*$/)) { # multiline subject field! chomp $line; $new_app->{'subject'} .= ' ' . $line; $line=; } next unless defined $line; ### body: general tag-based parser ahead: my %tags = (); my $tag = undef; my $text = ''; # read while ($line = ) { # skip empty lines next if $line =~ /^\s*$/; # check for new tag if ($line =~ /^(Changes|Description|License|Project Tags|Release Tags):\s*(.*)$/) { # save old tag $tags{$tag} = $text if defined $tag; # start new tag $tag = $1; $text = defined $2 ? $2 : ''; } # check for project url (last tag) elsif ($line =~ m!^http://freecode.com/projects/(.+)$!) { # save old tag $tags{$tag} = $text if defined $tag; # save url chomp $line; $tags{'URL'} = $line; # save project id $tags{'ID'} = $1; # and break the loop last; } # or just save the line else { $text .= $line; } } # map known tags to new_app hash $new_app->{'changes'} = $tags{'Changes'}; $new_app->{'description'} = $tags{'Description'}; $new_app->{'license'} = $tags{'License'}; $new_app->{'project_id'} = $tags{'ID'}; $new_app->{'project_link'} = $tags{'URL'}; # unused: $tags{'Release Tags'}; if (defined $tags{'Project Tags'}) { $new_app->{'category'} = $tags{'Project Tags'}; $new_app->{'category'} =~ s/\n/,/g; delete $new_app->{'category'} if $new_app->{'category'} eq ''; } ### count it and do the scoring $releases++; do_scoring($new_app); ### save a 'hot' entry if (($new_app->{'project_id'}) and (exists $interesting->{$new_app->{'project_id'}})) { # also remember the comments from the hot database (if any) if ($interesting->{$new_app->{'project_id'}} !~ /^\s*$/) { $new_app->{'comments'} = $interesting->{$new_app->{'project_id'}}; } push @{$hot_applications}, $new_app; } # LOOKOUT, there's an elsif coming! ### save a 'new' entry if it is not already in the 'hot' list ### if the same project appears twice in a newsletter, it is found ### with %this_time_new (although %database is already set) elsif (((! exists $database->{$new_app->{'project_id'}}) or (exists $this_time_new->{$new_app->{'project_id'}})) and (! exists $interesting->{$new_app->{'project_id'}})) { $releases_new++; if ($new_app->{'score'} >= $config->{'SCORE_MIN'}) { # only add when not scored out $database->{$new_app->{'project_id'}} = $timestamp; $this_time_new->{$new_app->{'project_id'}} = $timestamp; $db_new++; } push @{$new_applications}, $new_app; } else { # already seen push @{$skipped_already_seen}, $new_app->{'subject'}; } # wait for separator (UGLY, change this routine somehow) # sorry (much more UGLY than original) my $end = 0; while ($end == 0) { chomp $line; if ($line !~ /^\s*$/) { if ($line =~ /========================================================================/) { $end = 1; } } $line=; $end = 1 unless defined $line; } $new_app = {}; } } ### write databases $db_written = close_old_db($database); $hot_written = close_hot_db($interesting); ### send mails mail_hot_apps($hot_applications, $encoding); mail_new_apps($subject, $releases, $releases_new, $hot_written, $db_new, $db_written, $db_expired, $new_applications, $encoding); } #################[ initialize database environment ]######################### sub initialize_db_env() { if (! defined $db_env) { $db_env = new BerkeleyDB::Env, { -Flags => BerkeleyDB::DB_INIT_CDB } } } #######################[ open 'hot' database ]############################### sub open_hot_db() { my %hash; initialize_db_env(); tie %hash, 'BerkeleyDB::Hash', { -Filename => $config->{DB_NAME}, -Subname => "hot", -Flags => BerkeleyDB::Hash::DB_CREATE }; return \%hash; } #######################[ open 'old' database ]############################### sub open_old_db() { my %hash; initialize_db_env(); tie %hash, 'BerkeleyDB::Hash', { -Filename => $config->{DB_NAME}, -Subname => "old", -Flags => BerkeleyDB::Hash::DB_CREATE }; return \%hash; } #####################[ write the 'old' database ]############################ sub close_old_db() { my $db = shift; my $written = keys %{$db}; untie %{$db}; return $written; } #####################[ write the 'hot' database ]############################ sub close_hot_db() { my $db = shift; my $written = keys %{$db}; untie %{$db}; return $written; } ######################[ close an "update" mail ]############################# sub close_hot() { print MAIL_HOT << "EOF"; This information has been brought to you by: $id EOF close MAIL_HOT or die "can't close mailer \"$config->{'MAIL_CMD'}\": $!"; } ##################[ format summary of a "new" mail ]######################### sub format_summary($$$$$$$) { my ($releases, $releases_new, $hot_written, $db_new, $db_written, $db_expired, $score_killed) = @_; my $already_seen=@{$skipped_already_seen}; my $difference=$releases-$releases_new-$already_seen; my $remaining=$releases_new-$score_killed; my $summary = << "EOF"; This newsletter has been filtered by: $id It contained $releases releases. EOF if ($releases > 1) { # 1 release is not enough to ensure proper operation! $summary .= << "EOF"; $already_seen releases have been skipped as 'already seen'. $score_killed releases have been skipped as 'low score'. $remaining releases are shown in this mail, while $difference releases have been sent separately as 'hot'. EOF ; } else { $summary .= << "EOF"; !! This mail did not contain more than 1 release. !! This is looks like an error. !! Perhaps the processed mail was no newsletter at all? !! !! If this error repeats within the next days then most likely the !! newsletter format has changed (or whatsnewfm is broken). You !! should then visit the whatsnewfm homepage and look for an !! updated version of whatsnewfm. !! !! If there is neither a new version available nor a message that !! the error is already being fixed, please inform the author !! about the error you encountered. !! !! homepage: EOF ; foreach my $whatsnewfm_homepage (@{$whatsnewfm_homepages}) { $summary .= " !! $whatsnewfm_homepage\n"; } $summary .= << "EOF"; !! author: !! $whatsnewfm_author EOF ; } $summary .= << "EOF"; Your \'hot\' database has $hot_written entries. $db_expired entries from your 'old' database have expired, while $db_new items were added. Your 'old' database now has $db_written entries. EOF $summary .= "\n$separator"; return $summary } ######################[ open an "update" mail ]############################## sub open_hot_mail($$) { my ($new_app, $encoding) = @_; open MAIL_HOT, "| $config->{'MAIL_CMD'} $config->{'MAIL_OPT'}" or die "can't fork mailer \"$config->{'MAIL_CMD'}\": $!"; print MAIL_HOT "To: $config->{'MAILTO'}\n"; if ($config->{'UPDATE_MAIL'} eq "single") { print MAIL_HOT "Subject: whatsnewfm.pl: Updates of interesting applications\n"; } else { print MAIL_HOT "Subject: whatsnewfm.pl: Update: $new_app->{'subject'}\n"; } print MAIL_HOT "X-Loop: sent by whatsnewfm.pl script\n"; print MAIL_HOT $encoding; print MAIL_HOT "\n"; print MAIL_HOT "$separator"; } ########################[ open a "new" mail ]################################ sub open_new_mail($$) { my ($subject, $encoding) = @_; open MAIL_NEW, "| $config->{'MAIL_CMD'} $config->{'MAIL_OPT'}" or die "can't fork mailer \"$config->{'MAIL_CMD'}\": $!"; print MAIL_NEW "To: $config->{'MAILTO'}\n"; print MAIL_NEW $subject; print MAIL_NEW "X-Loop: sent by whatsnewfm.pl daemon\n"; print MAIL_NEW $encoding; print MAIL_NEW "\n"; print MAIL_NEW "$separator"; } ###########################[ fold a line ]################################## sub fold_line($$$$) { my ($string, $max, $separator, $prefix) = (@_); my $ret = ''; while (length $string > $max) { my $pos = $max; while ($pos > 0) { if ( substr($string, $pos, 1) eq $separator ) { $ret .= substr($string, 0, $pos+1) . "\n" . $prefix; $string = substr($string, $pos+1); last; } $pos--; } if ($pos == 0) { $pos = index($string, $separator); if ( $pos > 0) { $ret .= substr($string, 0, $pos+1) . "\n" . $prefix; $string = substr($string, $pos+1); } else { last; } } } return $ret . $string; } ###################[ read the configuration file ]########################### sub read_config() { my $config_file = $config->{CONFIGFILE}; my @scores = (); my @catscores = (); my @licscores = (); ### look for config file $config_file =~ s/^~/$ENV{'HOME'}/; if (! -e $config_file) { die "configuration file \"$config_file\" not found!\n"; } ### read the config file open CONF, "<", "$config_file" or die "could not open configuration file \"$config_file\": $!"; while (my $line = ) { chomp $line; $line =~ s/\s+$//; $line =~ s/^\s+//; if (($line ne "") and ($line !~ /^\#/)) { my ($key, $value) = split /=/, $line, 2; if (exists $config->{$key}) { warn "$0 warning:\n"; warn "duplicate keyword \"$key\" in configuration file at line $.\n"; push @{$cfg_warnings}, "duplicate keyword \"$key\" at line $."; } if (defined $value) { $key = uc $key; if ($key eq "SCORE") { my ($score, $regexp) = split /\t/, $value, 2; if ((! defined $regexp) or ($regexp eq "")) { warn "$0 warning:\n"; warn "no REGEXP given in configuration file at line $.\n"; push @{$cfg_warnings}, "no REGEXP given at line $."; } elsif ($score =~ /[+-]\d+/) { push @scores, { 'score' => $score, 'regexp' => $regexp }; } else { warn "$0 warning:\n"; warn "SCORE value not numeric in configuration file at line $.\n"; push @{$cfg_warnings}, "SCORE value not numeric at line $."; } } elsif ($key eq "CATSCORE") { my ($score, $regexp) = split /\t/, $value, 2; if ((! defined $regexp) or ($regexp eq "")) { warn "$0 warning:\n"; warn "no REGEXP given in configuration file at line $.\n"; push @{$cfg_warnings}, "no REGEXP given at line $."; } elsif ($score =~ /[+-]\d+/) { push @catscores, { 'score' => $score, 'regexp' => $regexp }; } else { warn "$0 warning:\n"; warn "SCORE value not numeric in configuration file at line $.\n"; push @{$cfg_warnings}, "SCORE value not numeric at line $."; } } elsif ($key eq "LICSCORE") { my ($score, $regexp) = split /\t/, $value, 2; if ((! defined $regexp) or ($regexp eq "")) { warn "$0 warning:\n"; warn "no REGEXP given in configuration file at line $.\n"; push @{$cfg_warnings}, "no REGEXP given at line $."; } elsif ($score =~ /[+-]\d+/) { push @licscores, { 'score' => $score, 'regexp' => $regexp }; } else { warn "$0 warning:\n"; warn "SCORE value not numeric in configuration file at line $.\n"; push @{$cfg_warnings}, "SCORE value not numeric at line $."; } } elsif ( exists $cfg_allowed_keys->{$key} ) { $config->{$key} = $value; } else { warn "$0 warning:\n"; warn "unknown keyword \"$key\" in configuration file at line $.\n"; push @{$cfg_warnings}, "unknown keyword \"$key\" at line $."; } } else { warn "$0 fatal error:\n"; die "keyword \"$key\" has no value in configuration file at line $.\n"; } } } close CONF or die "could not close configuration file \"$config_file\": $!"; ### is the config file complete? foreach my $key (keys %{$cfg_allowed_keys}) { if (! exists $config->{$key}) { if ( exists $cfg_optional_keys->{$key} ) { warn "$0 fatal error:\n"; die "keyword \"$key\" is missing in configuration file \"$config_file\"\n"; } else { warn "$0 warning:\n"; warn "using default value for \"$key\"\n"; push @{$cfg_warnings}, "using default value for \"$key\""; } } } ### lowercase some values $config->{'SUMMARY_AT'} = lc $config->{'SUMMARY_AT'}; $config->{'LIST_SKIPPED'} = lc $config->{'LIST_SKIPPED'}; ### default values $config->{'SUMMARY_AT'} = 'bottom' unless exists $config->{'SUMMARY_AT'} && $config->{'SUMMARY_AT'} && $config->{'SUMMARY_AT'} eq 'top'; $config->{'LIST_SKIPPED'} = 'no' unless exists $config->{'LIST_SKIPPED'} && $config->{'LIST_SKIPPED'} && ( $config->{'LIST_SKIPPED'} eq 'top' || $config->{'LIST_SKIPPED'} eq 'bottom' ); $config->{'MAIL_OPT'} = '-oi -t' unless exists $config->{'MAIL_OPT'}; ### expand ~ to home directory $config->{'DB_NAME'} =~ s/^~/$ENV{'HOME'}/; $config->{'MAIL_CMD'} =~ s/^~/$ENV{'HOME'}/; $config->{'SCORE'} = \@scores; $config->{'CATSCORE'} = \@catscores; $config->{'LICSCORE'} = \@licscores; } #####################[ format application entry ]############################ sub format_application($) { my ($app) = (@_); my $text = ''; if (defined $app->{'subject'}) { $text .= "\n $app->{'subject'}\n\n"; } if (defined $app->{'description'}) { $text .= "$app->{'description'}\n"; } if (defined $app->{'changes'}) { $text .= " changes:"; if (defined $app->{'urgency'}) { $text .= " ($app->{'urgency'} urgency)"; } $text .= "\n$app->{'changes'}\n"; } if (defined $app->{'author'}) { $text .= " added by: $app->{'author'}\n"; } if (defined $app->{'category'}) { $text .= " category: " . fold_line($app->{'category'}, 57, ',', ' ') . "\n"; } if (defined $app->{'project_link'}) { $text .= "project page: $app->{'project_link'}\n"; } if (defined $app->{'newslink'}) { $text .= " details: $app->{'newslink'}\n"; } if (defined $app->{'date'}) { $text .= " date: $app->{'date'}\n"; } if (defined $app->{'license'}) { $text .= " license: $app->{'license'}\n"; } if (defined $app->{'project_id'}) { $text .= " project id: $app->{'project_id'}\n"; } if (defined $app->{'score'}) { $text .= " score: $app->{'score'}\n"; } if (defined $app->{'comments'}) { $text .= "your comment: $app->{'comments'}\n"; } $text .= "\n$separator"; return $text; } ######################[ mail all 'hot' entries ]############################# sub mail_hot_apps($$) { my ($hot_applications, $encoding) = @_; my $first_hot = 1; foreach my $new_app (@{$hot_applications}) { if ($first_hot == 1) { $first_hot=0; open_hot_mail($new_app, $encoding); } # don't show a score on hot entries delete $new_app->{'score'}; print MAIL_HOT format_application($new_app); if ($config->{'UPDATE_MAIL'} ne "single") { close_hot(); $first_hot=1; } } ### close mailer if ($first_hot == 0) { close_hot(); } } ###################[ format list of skipped items ]########################## sub format_skipped() { my $skipped = ""; if (@{$skipped_already_seen} > 0) { $skipped .= "\n These news items were skipped as 'already seen':\n\n"; foreach my $item (@{$skipped_already_seen}) { $skipped .= " * $item\n"; } } if (@{$skipped_low_score} > 0) { $skipped .= "\n These news items were skipped as 'low score':\n\n"; foreach my $item (@{$skipped_low_score}) { $skipped .= " * $item\n"; } } $skipped .= "\n$separator" unless $skipped eq ""; return $skipped; } ########[ format configuration file warnings for "new" mail ]################ sub format_warnings() { my $warnings = ""; if (@{$cfg_warnings} > 0) { $warnings .= "\n Your configuration file ~/.whatsnewfmrc " . "produced the following warnings:\n\n"; foreach my $warn (@{$cfg_warnings}) { $warnings .= " * $warn\n"; } $warnings .= "\n Please see the whatsnewfm documentation " . "for details.\n\n$separator"; } return $warnings; } ######################[ mail all 'new' entries ]############################# sub mail_new_apps($$$$$$$$$) { my ($subject, $releases, $releases_new, $hot_written, $db_new, $db_written, $db_expired, $new_applications, $encoding) = @_; my $new_app; ### only keep applications with at least minimum score my $score_killed = @{$new_applications}; $skipped_low_score = [ map { $_->{'subject'} } grep {$_->{'score'} < $config->{'SCORE_MIN'}} @{$new_applications} ]; $new_applications = [ grep {$_->{'score'} >= $config->{'SCORE_MIN'}} @{$new_applications} ]; $score_killed -= @{$new_applications}; ### sort by score $new_applications = [ sort { $b->{'score'} <=> $a->{'score'} } @{$new_applications} ]; ### get summary my $summary = format_summary($releases, $releases_new, $hot_written, $db_new, $db_written, $db_expired, $score_killed); ### get warnings my $warnings = format_warnings(); ### get skipped list my $skipped = format_skipped(); ### open mailer open_new_mail($subject, $encoding); ### print warnings (if any) print MAIL_NEW $warnings; ### print summary if you want it at the beggining print MAIL_NEW $summary if $config->{'SUMMARY_AT'} eq 'top'; ### list skipped items if you want them at the beggining print MAIL_NEW $skipped if $config->{'LIST_SKIPPED'} eq 'top'; ### print application entries foreach my $new_app (@{$new_applications}) { print MAIL_NEW format_application($new_app); } ### list skipped items if you want them at the bottom print MAIL_NEW $skipped if $config->{'LIST_SKIPPED'} eq 'bottom'; ### print summary if you want it at the end print MAIL_NEW $summary if $config->{'SUMMARY_AT'} eq 'bottom'; ### close mailer close MAIL_NEW or die "can't close mailer \"$config->{'MAIL_CMD'}\": $!"; } ###########################[ main routine ]################################## if (@ARGV>1) { if ($ARGV[0] eq "-c") { shift @ARGV; $config->{CONFIGFILE} = shift @ARGV; } } if ($ARGV[0]) { if ($ARGV[0] eq "add") { shift @ARGV; read_config(); add_entry(@ARGV); } elsif ($ARGV[0] eq "del") { shift @ARGV; read_config(); remove_entry(@ARGV); } elsif ($ARGV[0] eq "view") { shift @ARGV; read_config(); view_entries(@ARGV); } else { display_help(); } } else { read_config(); parse_newsletter(); } exit 0; whatsnewfm-0.7.2/COPYING0000644000175000017500000004310311653760460013741 0ustar mitchmitch GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. whatsnewfm-0.7.2/whatsnewfmrc.sample0000644000175000017500000000240411653760460016620 0ustar mitchmitch# This is a sample configuration file for whatsnewfm (http://www.cgarbs.de) # Please edit the following variables to your needs and copy this file # to ~/.whatsnewfmrc # # *==> Who should get the mail with new programs? # MAILTO=someuser@example.com # # *==> Where are the databases located? # DB_NAME=~/.whatsnewfm.db # # *==> After how many months does an entry in the "old" database expire? # EXPIRE=12 # # *==> Collect "hot" updates in a single mail or send multiple mails? # UPDATE_MAIL=single # UPDATE_MAIL=multiple # # *==> Where in the mail message should we place the summary of new apps? # SUMMARY_AT=bottom # SUMMARY_AT=top # # *==> Where in the mail message should we place the list of skipped items? # LIST_SKIPPED=no # LIST_SKIPPED=bottom # LIST_SKIPPED=top # # *==> Scoring (release text): score_value regexp # (see "perldoc perlre" for help on regexp's) # #SCORE=+50 mp3 #SCORE=-999 usb # # *==> Category Scoring: score_value regexp # (see "perldoc perlre" for help on regexp's) # #CATSCORE=+150 Editorial #CATSCORE=+050 Multimedia #CATSCORE=-999 WWW # # *==> Items with a score less than this are ignored: # SCORE_MIN=-999 # # *==> How to send mail (mail program and parameters): # MAIL_CMD=/usr/lib/sendmail MAIL_OPT=-oi -t whatsnewfm-0.7.2/HISTORY0000644000175000017500000001337411653760460014001 0ustar mitchmitch whatsnewfm HISTORY 2011/11/01 - 0.7.2 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Newsletter format has changed: Freshmeat has become Freecode. 2009/05/30 - 0.7.1 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Newsletter format has changed. 2009/03/26 - 0.7.0 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: support the new newsletter format of the FM3 relaunch. (patch by by Bernd Rilling) - Releases can be scored by license, see the LICSCORE parameter. (patch by Jost Krieger) 2006/09/13 - 0.6.6 ~~~~~~~~~~~~~~~~~~~~ - Describe maildrop integration. (by Josip Rodin, see http://bugs.debian.org/385764) 2004/04/13 - 0.6.5 ~~~~~~~~~~~~~~~~~~~~ - Regular expressions for scoring the releases now match over multiple lines. 2004/02/15 - 0.6.4 ~~~~~~~~~~~~~~~~~~~~ - Fix rare problems with '=20' appearing in whatsnewfm mails. Charset and encoding are now copied from the newsletter. 2003/08/18 - 0.6.3 ~~~~~~~~~~~~~~~~~~~~ - Parameters of sendmail(1) call can be configured. You propably need to add "MAIL_OPT=-oi -t" to your configuration file. 2003/04/27 - 0.6.2 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Multiline subjects in the newsletter were not handled correctly. - Removed obsolete filenames from documentation. - Changed expiration algorithm for old database. Entries will stay at least 15 days in the database. - Use different parameters for sending mail. 2003/01/11 - 0.6.1 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Number of projects added to the old database shown in the newsletter statistics was wrong. 2003/01/04 - 0.6.0 ~~~~~~~~~~~~~~~~~~~~ - No changes, v0.5.3 seems stable and is released as v0.6.0. 2002/12/29 - 0.5.3 ~~~~~~~~~~~~~~~~~~~~ - Location and name of configuration file can be changed. - Small documentation updates. 2002/12/04 - 0.5.2 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: v0.5.2 didn't run at all. 2002/12/03 - 0.5.1 ~~~~~~~~~~~~~~~~~~~~ - Added a manpage. - Instructions on how to import old databases from v0.4.x. - DATE_CMD configuration variable mustn't be used any more. 2002/11/24 - 0.5.0 ~~~~~~~~~~~~~~~~~~~~ - Use Berkeley DB to store data. 2002/11/21 - 0.4.11 ~~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Perl 5.8 showed some warnings on startup. - Some minor changes in README file. 2001/11/07 - 0.4.10 ~~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Newsletter format has changed. 2001/10/19 - 0.4.9 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Welcome message was not working correctly. - Added scoring of editorial articles. - A list of skipped articles can be shown (new parameter LIST_SKIPPED). - Warnings concerning your configuration file are sent via mail. - Items skipped with 'low score' will not be added to the list of 'already seen' projects any more. 2001/08/15 - 0.4.8 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Categories were missing in 'hot' mails. 2001/08/10 - 0.4.7 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Newsletter format has changed. 2001/07/28 - 0.4.6 ~~~~~~~~~~~~~~~~~~~~ - Added scoring of Freshmeat Categories. - Updated help text (whatsnewfm.pl -h). 2001/07/19 - 0.4.5 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Newsletter format has changed. 2001/06/23 - 0.4.4 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Welcome message was not working correctly. - BUGFIX: Warning message about changed newsletter format was not generated correctly. - "view" accepts optional regexp to filter the output. - Minor documentation updates. 2001/02/11 - 0.4.3 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Existing comments in 'hot' database could not be updated. - BUGFIX: URL was missing in articles. - BUGFIX: Project ID was missing in 'hot' mails. - The newsletter summary can be printed at top or bottom of a parsed newsletter (add SUMMARY_AT=top to your ~/.whatsnewfmrc). - Comments from 'hot' database are included in 'hot' mails. 2001/02/05 - 0.4.2 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: freshmeat has changed the syntax of the newsletter. - Improved detection of changes in newsletter format. - Two releases of the same project within one newsletter are handled correctly. 2001/02/02 - 0.4.1 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: A line with a single dot "." within freetext fields (e.g. release details) caused sendmail to end the mail at that point. - Changes in the newsletter format should be detected and the user gets a warning mail telling him to update whatsnewfm. 2001/01/31 - 0.4.0 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: freshmeat has changed the syntax of the newsletter. 2001/01/30 - 0.2.6 ~~~~~~~~~~~~~~~~~~~~ - New items with less than a specified score will not be shown. 2000/11/25 - 0.2.5 ~~~~~~~~~~~~~~~~~~~~ - Freshmeat editorials are included in the list of new applications. 2000/11/10 - 0.2.4 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Perl 5.6 showed some warnings on startup. 2000/10/30 - 0.2.3 ~~~~~~~~~~~~~~~~~~~~ - Reacted to a change in the newsletter format (item name). - "add" and "del" give more verbose messages. 2000/09/22 - 0.2.2 ~~~~~~~~~~~~~~~~~~~~ - Added scoring of newsletter items. - Adding and removing items from the "hot" database now gives affirmative messages. 2000/09/10 - 0.2.1 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Statistic calculations at the end of a parsed newsletter were broken. - Configuration is read from a configuration file (you don't need to edit the script any more). - You can print the contents of your 'hot' database. 2000/08/22 - 0.2.0 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: freshmeat has changed the syntax of the newsletter. - Updates can be sent as one big or several small mails. 2000/08/04 - 0.0.3 ~~~~~~~~~~~~~~~~~~~~ - BUGFIX: Empty update mail were sent when there were no updates. - BUGFIX: Comments in the "hot" database were deleted every time. - Entries can be added or removed from the "hot" database. - A help text is shown when wrong command line arguments are given. - *Major* code cleanup (even subroutines now!). - added this HISTORY file whatsnewfm-0.7.2/README0000644000175000017500000003276611653760460013603 0ustar mitchmitch whatsnewfm 0.7.2 ~~~~~~~~~~~~~~~~ 2011/11/01 (c) 2000-2011 by Christian Garbs Joerg Plate Dominik Brettnacher Pedro Melo Cunha Matthew Gabeler-Lee Bernd Rilling Jost Krieger Francois Marier Licensed under GNU GPL (see COPYING for details) Contents ~~~~~~~~ Description . . . . . . . . . . . . . . 1 Contact . . . . . . . . . . . . . . . . 2 Requirements . . . . . . . . . . . . . 3 Usage . . . . . . . . . . . . . . . . . 4 The configuration file . . . . . . . . 5 The "hot" database . . . . . . . . . . 6 Data import from v0.4.x . . . . . . . . 7 Manpage . . . . . . . . . . . . . . . . 8 Download . . . . . . . . . . . . . . . 9 Thanks . . . . . . . . . . . . . . . . 10 Feel free to contact the author at for any questions or suggestions. [1] Description ~~~~~~~~~~~~~~~ whatsnewfm is a utility to filter the daily newsletter from http://freecode.com The main purpose is to cut the huge newsletter to a smaller size by only showing items that you didn't see before. The items already seen will be stored in a database. After some time, the items expire and will be shown again the next time they are included in a newsletter. If you find an item that you consider particularly useful, you can add it to a "hot" list. Items in the hot list are checked for updates so that you don't miss anything about your favourite programs. [2] Contact ~~~~~~~~~~~ Please contact me by email: Christian Garbs If you encounter a bug, please tell me. Known bugs will be listed in the issue tracker and you might find a cure for it in the git repository if I have not yet released a new version. See [9] for further information. [3] Requirements ~~~~~~~~~~~~~~~~ * procmail, maildrop or something else (otherwise you will have to send every newsletter through the filter by hand) * perl, sendmail or sendmail-compatible mailer * BerkeleyDB Perl module [4] Usage ~~~~~~~~~ 1) Extract the archive to a directory of your favour. 2) Copy the file "whatsnewfmrc.sample" to "~/.whatsnewfmrc" and edit it to your needs. See [4] for details. 3) Add the following lines to your ~/.procmailrc to send all newsletters through the whatsnewfm filter: :0 w : * ^Subject: Freecode Daily Update: * !^X-Loop:.*whatsnewfm | /path/to/whatsnewfm.pl Alternatively, if you are using maildrop, you need to add something like this to your ~/.mailfilter: if (/^Subject: Freecode Daily Update:/ && !/^X-Loop:.*whatsnewfm/) { xfilter "/path/to/whatsnewfm.pl" } 4) Add whatsnewfm to your hot database: "whatsnewfm.pl add whatsnewfm" 5) Check your setup by mailing the file "welcome" to yourself with "Freecode Daily Update: TEST" as subject: mail -s "Freecode Daily Update: TEST" your@email < welcome You should then receive an update information for the whatsnewfm application. This is good. Otherwise, there is an error in your setup. 6) If you're not yet subscribed to the freecode newsletter, do so at http://freecode.com 7) If one of the new applications is interesting to you, then add it to your "hot" database. See [6] for details. [5] The configuration file ~~~~~~~~~~~~~~~~~~~~~~~~~~ The configuration file is a plain text file in your home directory named ".whatsnewfmrc". The location and name of the configuration file can be changed with the -c option. Lines beginning with "#" are treated as comments. Other lines consist of keywords and values: KEYWORD=VALUE You need to specify the following keywords: * MAILTO=email@address This is the eMail address to which the filtered newsletter and the updates of "hot" programs are sent. * DB_NAME=~/.whatsnewfm.db This is the filename where the "hot" and "old" databases are kept. * EXPIRE=12 After this time (in months) an entry from the "old" database expires. * UPDATE_MAIL=single All updates of "hot" applications from one newsletter are sent in one single eMail. If you would like to have a unique eMail for every application, set this key to "multiple" instead of "single". * SUMMARY_AT=bottom Prints the summary at the bottom of a processed newsletter. If you want the summary to be printed at the top, set this to "top". Default value is 'bottom'. * LIST_SKIPPED=no Show a list the skipped news items (low score and already seen). Possible values are 'no' (no list), 'bottom' or 'top'. Default value is 'no'. * MAIL_CMD=/usr/lib/sendmail This is the location of your sendmail command (or any command that can be called in the same way as sendmail). * MAIL_OPT=-oi -t Your sendmail command is called with these parameters. * SCORE= This enables scoring of newsletter items (release text and articles). This keyword can appear multiple times (it may also be omitted). Each value consists of a score (either a negative or positive integer value) and a regular expression, both separated by a tabulator (\t). If the regular expression is found within the descriptive text of a news item, the score value is added to the score of that news item. Regular expressions are matched case-insensitive. The news items then are listed according to their score values. To learn more about perl regexps, confer the "perldoc perlre" help page. * CATSCORE= This works exactly like the SCORE keyword, except that not the release text but the Freshmeat Category fields are scored. Try "CATSCORE=+100Editorial" to mark all editorial articles. * LICSCORE= This works exactly like the SCORE keyword, except that not the release text but the Freshmeat License fields are scored. Try "LICSCORE=-50Proprietary" to score down all proprietary software. * SCORE_MIN=-999 Newsletter items with a score lower than this value will not be displayed. If an essential keyword is missing, you will get a message like this: * using default value for "MAIL_OPT" Add the keyword to your configuration file to get rid of the message. [6] The "hot" database ~~~~~~~~~~~~~~~~~~~~~~ This database contains the applications that you are interested in. You will be informed of every update within these applications. The applications are identified by the "project id" that is shown in the parsed freecode newsletter. To see what is in the database, just may use "less" or "cat" on the database file (although the 'view' command (see below) should be used, that's what I wrote it for). To edit the database, please use the whatsnewfm commands as shown below - DON'T edit the files with a text editor. Some strange things might happen when you edit the database while whatsnewfm is running in the background (your text editor won't recognize a lock on the database). These examples use the project id "whatsnewfm" - in case you forgot: That's the program you're just reading about. To view all applications that are in the database, just type this: whatsnewfm.pl view This just prints the whole database file on stdout. If you want to cut the output down to some entries, you can add a regular expression to the view command (instead of using grep): whatsnewfm.pl view ^li This will print all entries entries starting with "li". The regular expression is always matched case-insensitive. To add an application to the database, just type this: whatsnewfm.pl add whatsnewfm You can enter a comment to help you remember what this application does (good for project ids that are acronymns): whatsnewfm.pl add whatsnewfm Parses the freecode newsletter. If you want to enter multiple applications (eg copy'n'paste while reading the new freecode newsletter) you can start whatsnewfm like this: whatsnewfm.pl add whatsnewfm.pl then reads from stdin. Every line must begin with a project id. Comments might follow after a whitespace character (space, tab or the like). If you're finished, press CTRL-D. All entered applications will be added to the "hot" database. Deleting applications is as easy as adding applications. You can give the project ids directly (just one or even more): whatsnewfm.pl del whatsnewfm You can also give the ids on stdin (like the add command): whatsnewfm.pl del This time multiple project ids are allowed on one line when they are separated by whitespaces. [7] Data import from v0.4.x ~~~~~~~~~~~~~~~~~~~~~~~~~~~ To import your "hot" database from an older version, run this small shell script. Replace ~/.whatsnewfm.db.hot with the filename of your "hot" database from version 0.4.x. while read LINE ; do ./whatsnewfm.pl add $LINE done < ~/.whatsnewfm.db.hot To import your "old" database, use this Perl script. Change $new_database and $old_database to the filenames you actually use. #!/usr/bin/perl use warnings; use strict; use BerkeleyDB::Hash; my $new_database = "~/.whatsnewfm.db"; my $old_database = "~/.whatsnewfm.db.old"; my $count = 0; $new_database =~ s/^~/$ENV{HOME}/; $old_database =~ s/^~/$ENV{HOME}/; my $db_env = new BerkeleyDB::Env, BerkeleyDB::DB_INIT_CDB; my %hash; tie %hash, 'BerkeleyDB::Hash', { -Filename => $new_database, -Subname => "old", -Flags => BerkeleyDB::Hash::DB_CREATE }; open OLD, "<$old_database" or die "can't open `$old_database': $!"; while () { my ($p, $t) = split /\t/; $hash{$p} = $t; $count++; } close OLD or die "can't close `$old_database': $!"; untie %hash; print "$count old projects imported.\n"; [8] Manpage ~~~~~~~~~~~ A manpage is included in the whatsnewfm Perl script. You can extract it with the pod2* commands. For example: pod2man whatsnewfm.pl whatsnewfm.pl.1 pod2text whatsnewfm.pl whatsnewfm.txt pod2html whatsnewfm.pl whatsnewfm.html [9] Download ~~~~~~~~~~~~ * You can download new and old versions of whatsnewfm from these locations: http://www.cgarbs.de/whatsnewfm.en.html http://whatsnewfm.sourceforge.net/ * Unreleased development versions are available from the git repository: web: http://github.com/mmitch/whatsnewfm clone: git://github.com/mmitch/whatsnewfm.git * Issue tracking is currently moving from ditz to github: http://github.com/mmitch/whatsnewfm/issues http://www.cgarbs.de/ditz/whatsnewfm/ [10] Thanks ~~~~~~~~~~~ * Francois Marier identified the renaming of Freshmeat to Freecode and provided a patch at https://github.com/mmitch/whatsnewfm/pull/1 (fixed in v0.7.2). * Again many thanks to everybody who informed me when the newsletter format changed again in March 2009. As I lost my newsletter subscription during the Freshmeat relaunch, I really didn't notice myself. * Bernd Rilling sent a patch for the newletter format mentioned above (sourceforge bug #2691997, fixed in v0.7.0). * Jost Krieger sent a patch to score the license of releases (included in v0.7.0). * Dave Woolaway suggested the use of multiline regexp matches for scoring (sourceforge feature request #930403, included in v0.6.5). * Matthew Gabeler-Lee wrote a patch to fix '=20' appearing in mails sent by whatsnewfm (sourceforge bug #891520, fixed in v0.6.4). * scottbbbb pointed out that the sendmail options should be configurable (sourceforge bug #728895, fixed in v0.6.3, backported to v0.4.15). * Scott reported a bug with multiline subjects within the newsletter (sourceforge bug #726261, fixed in v0.6.2, backported to v0.4.14). * Josef 'Jupp' Schugt made some annotations to the expire algorithm for the 'old' database (changes included on v0.6.2 and backported to v0.4.14). * Roger H. Goun reported a bug in the RPMs of v0.4.12. * Matthias Kluwe discovered and fixed the warnings under Perl 5.8.0 (fixed in v0.4.11). He also made some annotations to the README (included in v0.4.4). * Edelhard Becker was the first to inform me about the format change that was fixed in v0.4.10. * Nikolaus Filus requested the new features in v0.4.9. * Jost Krieger noticed and fixed the missing Categories in the 'hot' mails (fixed in v0.4.7). * Francisco suggested the scoring of Freshmeat categories (included in v0.4.6). * Pedro Melo Cunha sent a patch to move the newsletter summary to the top of the mail (included in v0.4.3). * Eugen Dedu reported the missing Project ID in "hot" mails (fixed in v0.4.3). He also suggested to include the comments from the "hot" database in an update notification. * Dominik Brettnacher sent a patch to include the freshmeat editorials into the list of new applications (included in v0.2.5). * Joerg Plate sent a patch for those annoying warnings with Perl 5.6 (fixed in v0.2.4). * Piotr Sieklucki provided the initial version of the whatsnewfm RPM and .deb packages. He also suggested the SCORE_MIN feature and maintained the mirror at wombat.eu.org for some time. * All those people who told me that whatsnewfm didn't work any more when freshmeat changed the newsletter format. Apparently someone really uses this piece of software :-) * Michael Reinsch for keeping on asking and not being convinced by my wrong thoughts. Only because of him versions beyond v0.0.1 do exist.