]> git.notmuchmail.org Git - sup/commitdiff
added before-edit hook from Pierre Baillet
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 14 Nov 2007 16:46:37 +0000 (16:46 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 14 Nov 2007 16:46:37 +0000 (16:46 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@702 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/modes/edit-message-mode.rb

index 52447e8345e979b5a44bdc89f492efe1e31a14d1..64ca73dc4446507fa78caf5d9657012b424dc405 100644 (file)
@@ -24,6 +24,16 @@ Return value:
   use the default signature.
 EOS
 
+  HookManager.register "before-edit", <<EOS
+Modifies message body and headers before editing a new message. Variables
+should be modified in place.
+Variables:
+       header: a hash of headers. See 'signature' hook for documentation.
+       body: an array of lines of body text.
+Return value:
+       none
+EOS
+
   attr_reader :status
   attr_accessor :body, :header
   bool_reader :edited
@@ -51,6 +61,8 @@ EOS
     @message_id = "<#{Time.now.to_i}-sup-#{rand 10000}@#{Socket.gethostname}>"
     @edited = false
     @skip_top_rows = opts[:skip_top_rows] || 0
+    
+    HookManager.run "before-edit", :header => @header, :body => @body
 
     super opts
     regen_text