3 require File.dirname(__FILE__) + '/../config/environment'
5 exit 0 unless recipient = ARGV[0].match(/^([cm])-(\d+)-(.*)$/)
8 comment = DiaryComment.find(recipient[2])
9 digest = comment.digest
10 from = comment.diary_entry.user
13 message = Message.find(recipient[2])
14 digest = message.digest
15 from = message.recipient
19 exit 0 unless recipient[3] == digest[0,6]
21 mail = Mail.new(STDIN.readlines.join)
24 body = mail.html_part || mail.text_part
29 message = Message.new({
32 :sent_on => mail.date.new_offset(0),
33 :title => mail.subject.sub(/\[OpenStreetMap\] */, ""),
35 }, :without_protection => true)
38 Notifier.message_notification(message).deliver