Index: feedapi_node.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feedapi/feedapi_node/Attic/feedapi_node.module,v
retrieving revision 1.1.2.18.2.34
diff -u -r1.1.2.18.2.34 feedapi_node.module
--- feedapi_node.module	19 Jun 2009 15:59:48 -0000	1.1.2.18.2.34
+++ feedapi_node.module	25 Jun 2009 14:09:59 -0000
@@ -175,6 +175,12 @@
         '#options' => array('feed' => t('Retrieve from feed'), 'current' => t('Use time of download')),
         '#default_value' => 'feed',
       );
+      $form['drop_old'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Delete nodes that have dropped from feed'),
+        '#description' => t('Check this if you want to delete node items that have fallen off the feed'),
+        '#default_value' => FALSE,
+      );
       $form['x_dedupe'] = array(
         '#type' => 'radios',
         '#title' => t('Duplicates'),
@@ -448,6 +454,23 @@
     }
   }
   
+  // If dropping old nodes from the feed is enabled then collect all the nodes ids that need to be kept
+  if($settings['drop_old']) {
+    if (isset($feed_item->options->original_url)) {
+      $nid = db_result(db_query("SELECT fni.nid FROM {feedapi_node_item} fni JOIN {feedapi_node_item_feed} ff ON ff.feed_item_nid = fni.nid WHERE fni.url = '%s' AND ff.feed_nid = %d", $feed_item->options->original_url, $feed_nid));
+      if ($nid !== FALSE) {
+        return $nid;
+      }
+    }
+    if (isset($feed_item->options->guid)) {
+      $nid = db_result(db_query("SELECT fni.nid FROM {feedapi_node_item} fni JOIN {feedapi_node_item_feed} ff ON ff.feed_item_nid = fni.nid WHERE fni.guid = '%s' AND ff.feed_nid = %d", $feed_item->options->guid, $feed_nid));
+      if ($nid !== FALSE) {
+        return $nid;
+      }
+    }    
+    return 0;
+  }
+  
   if (isset($feed_item->options->original_url) || isset($feed_item->options->guid)) {
     return TRUE;
   }

