# Blosxom Plugin: rss20
# Author(s): Andrew Cowie <andrew@operationaldynamics.com>
# Version: 2005-05-07
# Licence terms same as blosxom itself.
# Inspired by plugins atomfeed and rss10.
#
# Usage:
#
# Install this file in your plugin directory, and add the *.rss20
# flavour files to your data directory.
#
# Your RSS feed will be at $url$path/index.rss20
#
# This plugin will use whoami's author information if available, but 
# you'll want to change the default below.
#

package rss20;

# --- Configurable variables -----

$default_author = "Ray Burkholder";

# --- Plug-in package variables -----

$author = '';

$blog_modified_date = '';

$utc_date = '';

$feed_yr = '2007';

# --------------------------------

sub start {
  1;
}

sub head {
  my $newest = 0;
  foreach my $date ( values %blosxom::files ) {
  	if ($date > $newest) {
		$newest = $date;
	}
  }
  $ENV{TZ} = "GMT";
  my ($dw,$mo,$mo_num,$da,$ti,$yr) = blosxom::nice_date($newest);
  $blog_modified_date = "$dw, $da $mo $yr $ti:00 GMT";
  $feed_yr = "$yr";
}

sub story {
  my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;

  $ENV{TZ} = "GMT";
  my ($dw,$mo,$mo_num,$da,$ti,$yr) = blosxom::nice_date($blosxom::files{"$blosxom::datadir$path/$filename.$blosxom::file_extension"});
  $utc_date = "$dw, $da $mo $yr $ti:00 GMT";

  # Set authorship if available, falling back to $atomfeed::author
  $author = $whoami::fullname || $fauxami::name || $default_author || '';
  
  1;
}

1;
