From 061fe72cfbb9f6dce6adf329a0124e051ff736eb Mon Sep 17 00:00:00 2001 From: Eric Sherman Date: Tue, 13 Mar 2012 13:25:35 -0400 Subject: [PATCH] run the before-add-message hook upon sending I wanted to be able to set labels upon sending and didn't find a sensible place to do it other than in a before-add-message hook. And since the message is added to the index immediately after sending, it seems correct to run the before-add-message hook here. --- bin/heliotrope-server | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/heliotrope-server b/bin/heliotrope-server index 264aff5..2c379ec 100644 --- a/bin/heliotrope-server +++ b/bin/heliotrope-server @@ -74,6 +74,9 @@ class HeliotropeServer < Sinatra::Base { :response => :ok, :status => :seen } else run_sendmail! rawbody, message + if @hooks.enabled? "before-add-message" + message, labels, state = @hooks.run "before-add-message", :message => message, :labels => labels, :state => state + end result = add_message message, rawbody, labels, state + ["sent"], extra (message.to + message.cc + message.cc).each { |c| @metaindex.touch_contact! c } result