Index: country_code.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/country_code/country_code.inc,v
retrieving revision 1.7
diff -u -u -p -r1.7 country_code.inc
--- country_code.inc	17 Oct 2008 00:54:32 -0000	1.7
+++ country_code.inc	17 Oct 2008 14:22:04 -0000
@@ -18,6 +18,17 @@
 define('COUNTRY_CODE_GLOBAL', 'xx');
 
 /**
+ * Return the ip_address.  This is only used for testing.  You can override the
+ * ip address by setting this in your settings.php:
+ *  $conf = array(
+ *    'ip_address' => '24.68.242.194',
+ *  );
+ */
+function _ip_address() {
+  return variable_get('ip_address', ip_address());
+}
+
+/**
  * Return the country code of the user, based on the user's IP address.
  *
  * @TODO: support IP to country (ip2cc) module?
@@ -25,7 +36,7 @@ define('COUNTRY_CODE_GLOBAL', 'xx');
 function country_code() {
   if (empty($_SESSION['country_code'])) {
     // This service already returns not identified country codes as 'xx' (global).
-    $country_code = strtolower(file_get_contents('http://api.hostip.info/country.php?ip=' . ip_address()));
+    $country_code = strtolower(file_get_contents('http://api.hostip.info/country.php?ip=' . _ip_address()));
     country_code_set($country_code);
   }
   return $_SESSION['country_code'];
