Here's a patch. This could be improved if Kwiki wrote out the content
to "page.new" and then renamed to "page". Using this procedure would
make the write atomic too.
--- Mail.pm Wed Sep 1 05:41:53 2004
+++ /usr/local/share/perl/5.8.4/Kwiki/Notify/Mail.pm Sun Nov 28 07:37:42 2004
@@ -20,11 +20,26 @@
sub register {
my $registry = shift;
- $registry->add(page_hook_store => 'notify');
+ $registry->add(page_hook_prestore => 'notify');
}
sub notify {
- my $meta_data = $self->hub->edit->pages->current->metadata;
+ my $page = shift;
+ my $new_content = $page->content;
+
+ my $diff;
+ if (-r $page->file_path) {
+ my $newname = $page->file_path.'.new';
+ my $tmp = io($newname);
+ $tmp->print($new_content);
+ $tmp->close;
+ $diff = io(join(' ', '/usr/bin/diff', '-u', $page->file_path, $newname, '|'))->utf8->all;
+ unlink $newname;
+ } else {
+ $diff = "New page added\n";
+ }
+
+ my $meta_data = $page->metadata;
my $site_title = $self->config->site_title;
my $edited_by = $meta_data->{edit_by} || 'unknown name';
@@ -35,7 +50,7 @@
$site_title,
$page_name,
$edited_by) || 'unknown';
- my $body = "$site_title page $page_name edited by $edited_by\n";
+ my $body = "$site_title page $page_name edited by $edited_by\n\n$diff";
$self->mail_it($to,$from,$subject,$body);
return $self;
Message body not shown because it is not plain text.