extensions/geoip/extension.cpp
changeset 1293 2a71249ca0ab
parent 1272 95787f8d2b77
child 1330 ab94316bb52b
     1.1 --- a/extensions/geoip/extension.cpp	Thu Aug 09 19:14:15 2007 +0000
     1.2 +++ b/extensions/geoip/extension.cpp	Thu Aug 09 19:48:46 2007 +0000
     1.3 @@ -90,9 +90,10 @@
     1.4  	StripPort(ip);
     1.5  
     1.6  	ccode = GeoIP_country_code_by_addr(gi, ip);
     1.7 -	pCtx->StringToLocal(params[2], 3, (ccode) ? ccode : "er");
     1.8  
     1.9 -	return 1;
    1.10 +	pCtx->StringToLocal(params[2], 3, ccode ? ccode : "");
    1.11 +
    1.12 +	return ccode ? 1 : 0;
    1.13  }
    1.14  
    1.15  static cell_t sm_Geoip_Code3(IPluginContext *pCtx, const cell_t *params)
    1.16 @@ -104,9 +105,9 @@
    1.17  	StripPort(ip);
    1.18  
    1.19  	ccode = GeoIP_country_code3_by_addr(gi, ip);
    1.20 -	pCtx->StringToLocal(params[2], 4, (ccode) ? ccode : "err");
    1.21 +	pCtx->StringToLocal(params[2], 4, ccode ? ccode : "");
    1.22  
    1.23 -	return 1;
    1.24 +	return ccode ? 1 : 0;
    1.25  }
    1.26  
    1.27  static cell_t sm_Geoip_Country(IPluginContext *pCtx, const cell_t *params)
    1.28 @@ -118,9 +119,9 @@
    1.29  	StripPort(ip);
    1.30  
    1.31  	ccode = GeoIP_country_name_by_addr(gi, ip);
    1.32 -	pCtx->StringToLocal(params[2], params[3], (ccode) ? ccode : "error");
    1.33 +	pCtx->StringToLocal(params[2], params[3], (ccode) ? ccode : "");
    1.34  
    1.35 -	return 1;
    1.36 +	return ccode ? 1 : 0;
    1.37  }
    1.38  
    1.39  const sp_nativeinfo_t geoip_natives[] =