### Eclipse Workspace Patch 1.0 #P mailsave Index: mailsave_to_image_attach/mailsave_to_image_attach.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/mailsave/mailsave_to_image_attach/mailsave_to_image_attach.module,v retrieving revision 1.2 diff -u -r1.2 mailsave_to_image_attach.module --- mailsave_to_image_attach/mailsave_to_image_attach.module 23 Oct 2007 22:04:02 -0000 1.2 +++ mailsave_to_image_attach/mailsave_to_image_attach.module 21 Mar 2008 22:04:29 -0000 @@ -93,15 +93,30 @@ $file->error = 0; $file->source = 'mailsave'; - - // START OF CODE FROM image_attach.module - - //$image->title = $_POST['image_title']; + // The following code is adapted from image_attach.module + // The key change is that image nodes will follow the default image publish settings, unless the 'parent' + // node (via mailhandler) explicitly defines a publication setting, in which case this is used instead. $image->uid = $node->uid; $image->name = $node->name; $image->created = $node->created; $image->type = 'image'; + // Set the image node's defaults according to the configured preferences + $node_options = variable_get('node_options_image', array('status', 'promote')); + foreach (array('status', 'promote', 'sticky') as $option) { + $image->$option = in_array($option, $node_options); + } + + // If the parent node is configured to be unpublished then set the image node unpublished too + if (isset($node->status) && !$node->status) { + $image->status = 0; + } + + // Set comment default, if mailhandler hasn't already set something + if (module_exists('comment') && !isset($node->comment)) { + $image->comment = variable_get('comment_image', COMMENT_NODE_READ_WRITE); + } + // image_prepare($image, 'image'); image_prepare($image, $file); @@ -116,7 +131,7 @@ } } - // END OF CODE FROM image_attach.module + // End of code adapted from image_attach.module } }