3 require File.join(File.dirname(__FILE__), "..", "config", "environment")
5 if recipient = ARGV[0].match(/^c-(\d+)-(\d+)-(.*)$/)
6 comment = DiaryComment.find(recipient[1])
7 digest = comment.digest
8 date = comment.created_at
9 from = comment.diary_entry.subscribers.find(recipient[2])
12 elsif recipient = ARGV[0].match(/^m-(\d+)-(.*)$/)
13 message = Message.find(recipient[1])
14 digest = message.digest
15 date = message.sent_on
16 from = message.recipient
23 exit 0 unless from.active?
24 exit 0 unless token == digest[0, 6]
25 exit 0 if date < 1.month.ago
27 message&.update(:message_read => true)
29 mail = Mail.new($stdin.read
30 .encode(:universal_newline => true)
31 .encode(:crlf_newline => true))
33 message = Message.from_mail(mail, from, to)
36 UserMailer.message_notification(message).deliver