Only mark a message as read after we have validated the email reply
authorTom Hughes <tom@compton.nu>
Fri, 16 Mar 2012 15:44:40 +0000 (15:44 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 16 Mar 2012 15:44:40 +0000 (15:44 +0000)
script/deliver-message

index 7382f251adfa5c4cdec2a2cabf621253be67ac7e..6dffea96cbff9633dcc023f9f8a6cc7937c18c2a 100755 (executable)
@@ -14,12 +14,12 @@ else
   digest = message.digest
   from = message.recipient
   to = message.sender
-
-  message.update_attribute(:message_read, true)
 end
 
 exit 0 unless recipient[3] == digest[0,6]
 
+message.update_attribute(:message_read, true) if message
+
 mail = Mail.new(STDIN.readlines.join)
 
 if mail.multipart?