3 require File.dirname(__FILE__) + '/../config/environment'
6 exit 0 unless recipient = ARGV[0].match(/^([cm])-(\d+)-(.*)$/)
9 comment = DiaryComment.find(recipient[2])
10 digest = comment.digest
11 from = comment.diary_entry.user
14 message = Message.find(recipient[2])
15 digest = message.digest
16 from = message.recipient
20 exit 0 unless recipient[3] == digest[0,6]
22 mail = Mail.new(STDIN)
24 message = Message.new(:sender => from, :recipient => to,
25 :sent_on => Time.now.getutc,
26 :title => mail["Subject"],
27 :body => mail.body.map { |l| l.rstrip }.join("\n"))
30 Notifier::deliver_message_notification(message)