? .svn
? mailhandler_node/.svn
? mailhandler_node/plugins/.svn
? plugins/.svn
? plugins/export_ui/.svn
? translations/.svn
Index: mailhandler_node/plugins/MailhandlerNodeProcessor.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mailhandler/mailhandler_node/plugins/Attic/MailhandlerNodeProcessor.inc,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 MailhandlerNodeProcessor.inc
--- mailhandler_node/plugins/MailhandlerNodeProcessor.inc	10 Aug 2010 02:35:50 -0000	1.1.2.3
+++ mailhandler_node/plugins/MailhandlerNodeProcessor.inc	30 Sep 2010 14:59:36 -0000
@@ -74,7 +74,6 @@ class MailhandlerNodeProcessor extends F
   }
 
   protected function submitNode($node, $header, $mailbox, $origbody) {
-    global $user;
     // Handle revision information now that the final 'type' is known
     if ($node->nid) {
       $vid = db_result(db_query('SELECT n.vid FROM {node} n WHERE n.nid = %d', $node->nid));
@@ -92,6 +91,11 @@ class MailhandlerNodeProcessor extends F
     // Invoke hook_mailhandler
     $node = _mailhandler_node_hooks('midsave', $node, $header, $mailbox);
     list($fromaddress, $fromname) = mailhandler_get_fromaddress($header, $mailbox);
+    // TODO: support mailhandler_user_load
+    $account = user_load(array('mail' => $fromaddress));
+    if (!$account) {
+      $account = drupal_anonymous_user();
+    }
     // Reset the static cache
     form_set_error(NULL, '', TRUE);
     node_validate($node);
@@ -100,7 +104,7 @@ class MailhandlerNodeProcessor extends F
       $node = node_submit($node);
       // Save the node
       if (!empty($node->nid)) {
-        if (node_access('update', $node)) {
+        if (node_access('update', $node, $account)) {
           node_save($node);
           watchdog('mailhandler', 'Updated %title by %from.', array('%title' => $node->title, '%from' => $fromaddress));
         }
@@ -110,7 +114,7 @@ class MailhandlerNodeProcessor extends F
         }
       }
       else {
-        if (node_access('create', $node)) {
+        if (node_access('create', $node, $account)) {
           node_save($node);
           watchdog('mailhandler', 'Added %title by %from.', array('%title' => $node->title, '%from' => $fromaddress));
         }
@@ -415,4 +419,4 @@ function _mailhandler_node_hooks($op, $o
     }
   }
   return $object;
-}
\ No newline at end of file
+}
