On Sun, 2005-05-15 at 15:18 +0530, Joshua N Pritikin wrote:
> I want to add a hook before store_content_commit or after
> store_content_prepare to run "diff -u file.new file | mail ...".

To make this concrete, here is a Kwiki::Notify::Mail patch.

-- 
If you are an American then support http://fairtax.org
 (Permanently replace 50,000+ pages of tax law with about 200 pages.)
--- Mail.pm     Wed Jan 26 02:19:23 2005
+++ /usr/local/share/perl/5.8.4/Kwiki/Notify/Mail.pm    Sun May 15 15:36:46 2005
@@ -21,9 +21,8 @@
 
 sub register {
     my $registry = shift;
-    $registry->add(hook => 'page:store',
-                  post => 'notify',
-                 );
+    $registry->add(hook => 'page:store_content_commit',
+                  pre => 'notify');
 }
 
 sub notify {
@@ -43,7 +42,10 @@
                              $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";
+
+    my $file_path = $self->file_path;
+    $body .= `diff --text -bBiu $file_path $file_path.new`;
 
     $notify_mail_obj->mail_it($to,$from,$subject,$body);
     return $self;

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to