Index: mollom.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.admin.inc,v
retrieving revision 1.39
diff -u -p -r1.39 mollom.admin.inc
--- mollom.admin.inc	20 Sep 2010 03:39:10 -0000	1.39
+++ mollom.admin.inc	21 Sep 2010 00:44:25 -0000
@@ -327,6 +327,23 @@ function mollom_admin_blacklist_form($fo
     'links' => t('Links'),
     'author' => t('Author name'),
   );
+  $matches = array(
+    'contains' => t('contains'),
+    'exact' => t('exact'),
+  );
+
+  $form['filter'] = array(
+    '#type' => 'container',
+    '#attributes' => array(
+      'class' => array('container-inline'),
+    ),
+  );
+  $form['filter']['text'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Filter'),
+    '#size' => 20,
+    '#id' => 'mollom-blacklist-filter',
+  );
 
   $form['blacklist'] = array();
   // Do not retrieve the current blacklist when submitting the form.
@@ -337,8 +354,15 @@ function mollom_admin_blacklist_form($fo
         continue;
       }
       $row = array(
-        'context' => array('#markup' => check_plain($contexts[$entry['context']])),
-        'text' => array('#markup' => check_plain($entry['text'])),
+        'context' => array(
+          '#markup' => check_plain($contexts[$entry['context']]),
+        ),
+        'match' => array(
+          '#markup' => check_plain($matches[$entry['match']]),
+        ),
+        'text' => array(
+          '#markup' => check_plain($entry['text']),
+        ),
       );
       $row['actions']['delete'] = array(
         '#type' => 'link',
@@ -362,6 +386,12 @@ function mollom_admin_blacklist_form($fo
     '#default_value' => 'everything',
     '#required' => TRUE,
   );
+  $form['entry']['match'] = array(
+    '#type' => 'select',
+    '#options' => $matches,
+    '#default_value' => 'contains',
+    '#required' => TRUE,
+  );
   $form['entry']['text'] = array(
     '#type' => 'textfield',
     '#size' => 40,
@@ -391,6 +421,7 @@ function mollom_admin_blacklist_form_sub
   $data = array(
     'text' => $form_state['values']['entry']['text'],
     'context' => $form_state['values']['entry']['context'],
+    'match' => $form_state['values']['entry']['match'],
     'reason' => $form_state['values']['entry']['reason'],
   );
   $result = mollom('mollom.addBlacklistText', $data);
@@ -398,12 +429,13 @@ function mollom_admin_blacklist_form_sub
   $args = array(
     '@text' => $data['text'],
     '@context' => $data['context'],
+    '@match' => $data['match'],
     '@reason' => $data['reason'],
   );
   if ($result === TRUE) {
     drupal_set_message(t('The entry was added to the blacklist.'));
     _mollom_watchdog(array(
-      'Added @text (@context) to @reason blacklist.' => $args,
+      'Added @text (@context, @match) to @reason blacklist.' => $args,
       'Data:<pre>@data</pre>' => array('@data' => $data),
       'Result:<pre>@result</pre>' => array('@result' => $result),
     ));
@@ -411,7 +443,7 @@ function mollom_admin_blacklist_form_sub
   else {
     drupal_set_message(t('An error occurred upon trying to add the text to the blacklist.'), 'error');
     _mollom_watchdog(array(
-      'Failed to add @text (%context) to @reason blacklist.' => $args,
+      'Failed to add @text (@context, @match) to @reason blacklist.' => $args,
       'Data:<pre>@data</pre>' => array('@data' => $data),
       'Result:<pre>@result</pre>' => array('@result' => $result),
     ), WATCHDOG_ERROR);
@@ -425,6 +457,7 @@ function theme_mollom_admin_blacklist_fo
   $form = $variables['form'];
   $header = array(
     t('Context'),
+    t('Matches'),
     t('Text'),
     '',
   );
@@ -432,6 +465,7 @@ function theme_mollom_admin_blacklist_fo
 
   $rows[] = array(
     drupal_render($form['entry']['context']),
+    drupal_render($form['entry']['match']),
     drupal_render($form['entry']['text']),
     drupal_render($form['entry']['actions']),
   );
@@ -439,13 +473,25 @@ function theme_mollom_admin_blacklist_fo
   foreach (element_children($form['blacklist']) as $id) {
     $rows[] = array(
       drupal_render($form['blacklist'][$id]['context']),
-      drupal_render($form['blacklist'][$id]['text']),
+      drupal_render($form['blacklist'][$id]['match']),
+      array(
+        'data' => drupal_render($form['blacklist'][$id]['text']),
+        'class' => array('mollom-blacklist-text'),
+      ),
       drupal_render($form['blacklist'][$id]['actions']),
     );
   }
 
   // This table is never empty due to the form.
-  $output  = theme('table', array('header' => $header, 'rows' => $rows));
+  $output = drupal_render($form['filter']);
+  $output .= theme('table', array(
+    'header' => $header,
+    'rows' => $rows,
+    'attributes' => array(
+      'id' => 'mollom-blacklist',
+    ),
+  ));
+  drupal_add_js(drupal_get_path('module', 'mollom') . '/mollom.admin.js');
   $output .= drupal_render_children($form);
 
   return $output;
Index: mollom.admin.js
===================================================================
RCS file: mollom.admin.js
diff -N mollom.admin.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ mollom.admin.js	21 Sep 2010 00:36:58 -0000
@@ -0,0 +1,25 @@
+// $Id: mollom.js,v 1.9 2010/08/04 03:58:46 dries Exp $
+(function ($) {
+
+/**
+ * Filters blacklist entries.
+ */
+Drupal.behaviors.mollomBlacklistFilter = {
+  attach: function (context) {
+    var self = this;
+    $('#mollom-blacklist', context).once('mollom-blacklist-filter', function () {
+      // Build a list of all entries to optimize performance.
+      self.$entries = $(this).find('.mollom-blacklist-text');
+      // Attach the filter.
+      var $filter = $('#mollom-blacklist-filter', context)
+        .keyup(function () {
+          self.$entries
+            .parent().hide().end()
+            .filter(':contains("' + $filter.val() + '")')
+              .parent().show();
+        });
+    });
+  }
+};
+
+})(jQuery);
