? 637222_blacklist_rule_never_expires.patch
Index: blacklist.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/blacklist/blacklist.module,v
retrieving revision 1.5
diff -u -p -r1.5 blacklist.module
--- blacklist.module	26 Jun 2009 14:46:14 -0000	1.5
+++ blacklist.module	11 Nov 2010 21:19:53 -0000
@@ -226,11 +226,19 @@ function blacklist_mask_form($form_state
     $default = _find_expiration();
   }
 
+  // Make an associative array from all the $expirations times.
+  $expiration_options = drupal_map_assoc($expirations, 'format_interval');
+
+  // Substitute the word 'never' for a 0 expiry time.
+  if ($expiration_options[0] == 0) {
+    $expiration_options[0] = 'never';
+  }
+
   $form['expires'] = array(
     '#type' => 'select',
     '#title' => t('Expires in'),
     '#description' => t('Time until entry expires. Need to run cron at least with according frequency!'),
-    '#options' => drupal_map_assoc($expirations, 'format_interval'),
+    '#options' => $expiration_options,
     '#default_value' => isset($default) ? $default : 900,
   );
 
@@ -246,7 +254,13 @@ function blacklist_mask_form_submit($for
   $now = time();
 
   $data = $form_state['values'];
-  $data['expires'] += $now; // We store the date not the time until.
+
+  if ($data['expires'] == 0) {
+    $data['expires'] = '2147483647'; // The End Of Time as we know it. :)
+  }
+  else {
+    $data['expires'] += $now; // We store the date not the time until.
+  }
 
   if (isset($data['bid'])) {
     drupal_write_record('blacklist', $data, 'bid');
@@ -407,7 +421,7 @@ function blacklist_user($type, &$form, &
 }
 
 function _expiration() {
-  return array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200);
+  return array(0, 900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200);
 }
 
 /**
@@ -429,6 +443,7 @@ function _find_expiration() {
     $default = $delta_next < $delta_prev ? $timestep : $default;
     $delta_prev = $delta_next;
   }
+
   return $default;
 }
 
