--- node_import/supported/auto_nodetitle.inc.orig	2008-03-17 08:09:39.000000000 +0000
+++ node_import/supported/auto_nodetitle.inc	2008-09-27 15:52:24.000000000 +0100
@@ -1,5 +1,5 @@
 <?php
-
+// $Id$
 /**
  * @file
  * Support for the auto_nodetitle module.
@@ -13,6 +13,39 @@ function auto_nodetitle_node_import_prep
   if (($setting == AUTO_NODETITLE_ENABLED) || ($setting == AUTO_NODETITLE_OPTIONAL && empty($node->title))) {
     token_get_values('node', $node, TRUE); // Flush first!
     auto_nodetitle_set_title($node);
+
+  // Check for unique title setting
+    $globals = $node->node_import_auto_nodetitle;
+    unset($node->node_import_auto_nodetitle);
+    $unique_title = $globals['unique_title_auto'];
+
+    if ($unique_title) {
+      $count = db_fetch_object(db_query("SELECT count(*) cnt FROM {node} WHERE title = '%s' AND type = '%s'", $node->title, $node->type));
+      if ($count->cnt > 0) {
+        $errors[] = t('The node title %title is not unique for this node type.', array('%title' => $node->title));
+      }
+    }
+  return $errors;
   }
 }
 
+  /**
+ * Implementation of hook_node_import_global().
+ */
+function auto_nodetitle_node_import_global($type, $global_values) {
+  $form = array();
+  $setting = auto_nodetitle_get_setting($type);
+  if (($setting == AUTO_NODETITLE_ENABLED) || ($setting == AUTO_NODETITLE_OPTIONAL && empty($node->title))) {
+    $globals = $global_values['node_import_auto_nodetitle'];
+    if (!isset($globals['unique_title_auto'])) {
+      $globals['unique_title_auto'] = 0;
+      }
+    $form['node_import_auto_nodetitle']['unique_title_auto'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Titles generated by Automatic Nodetitles must be unique for this node type.'),
+    '#description' => t('Check this box if you do not want to import nodes if there is already a node with the same title.'),
+    '#default_value' => $globals['unique_title_auto'],
+    );
+  return $form;
+  }
+}
