--- ip2locale.module	2009-05-03 12:17:07.000000000 -0500
+++ ip2locale.module.guy	2010-08-03 06:25:36.000000000 -0500
@@ -133,6 +133,39 @@ function ip2locale_boot() {
    */
   if (variable_get('site_offline', 0) == 1) return FALSE;
 
+  /**
+  * If the site is visited by a search engine bot then we don not want to redirect.
+  */
+  if (module_exists(browscap)) {
+    if (variable_get('ip2locale_debug', FALSE)) {
+        $message = 'Browscap Module: Enabled.';
+        drupal_set_message($message);
+    }
+
+    // check if user agent string matches a search engine user agent string or other crawler (robot / bot / spider)
+    $useragent = $_SERVER['HTTP_USER_AGENT'];
+    if (browscap_is_crawler()) {
+      if (variable_get('ip2locale_debug', FALSE)) {
+        $message = 'Crawler Detected.  No redirect applied.';
+        drupal_set_message($message);
+        drupal_set_message('User Agent: '. $useragent);
+      }
+      return FALSE;
+    }
+    else {
+      if (variable_get('ip2locale_debug', FALSE)) {
+        $message = 'No crawler detected. Redirect will be applied if configured at the <a href="/admin/settings/ip2locale/settings">ip2locale admin settings page</a>.';
+        drupal_set_message($message);
+        drupal_set_message('User Agent: '. $useragent);
+      }
+    }
+  }
+  else {
+    if (variable_get('ip2locale_debug', FALSE)) {
+      drupal_set_message('Browscap module not found. Search engines and other crawlers will also be redirected. Inorder to prevent ip2locale from redirecting search engines and other crawlers (which you may want to index the website) please install the <a href="http://drupal.org/project/browscap">browsercap module</a> and ip2locale will not redirect search engines/crawlers.');
+    }
+  }
+
   if (variable_get('ip2locale_redirect_mode', IP2LOCALE_FIRST_REQUEST_ONLY) == IP2LOCALE_FIRST_REQUEST_ONLY) {
     /**
      * We only want to act if the user comes to the page from an external site/direct hit
@@ -437,4 +470,4 @@ function ip2locale_ip_address() {
     $ip = ip_address();
   }
   return $ip;
-}
\ No newline at end of file
+}
