? mailhandler-448592-update-node.patch
Index: mailhandler.retrieve.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mailhandler/Attic/mailhandler.retrieve.inc,v
retrieving revision 1.1.2.14
diff -u -p -r1.1.2.14 mailhandler.retrieve.inc
--- mailhandler.retrieve.inc	26 Oct 2008 19:54:12 -0000	1.1.2.14
+++ mailhandler.retrieve.inc	29 Apr 2009 17:48:18 -0000
@@ -342,6 +342,19 @@ function mailhandler_process_message($he
 
   $node->date = format_date($header->udate, 'custom', 'Y-m-d H:i:s O');
   $node->format = $mailbox['format'];
+  
+  // if this is an update to an exsisting node, we need to import that node and
+  // update it, otherwise it wont pass validation
+  if($node->nid) {
+    $updated_node = node_load($node->nid);
+    
+    // Copy new fields over the old
+    foreach($node as $key => $value) {
+      $updated_node->$key = $value;
+    }
+    
+    $node = $update_node;
+  }
 
   return $node;
 }