fixed silly design decisions in geoip that were copied over from amxmodx. natives now return true/false and the buffer is zeroed instead of filled with "ERROR"

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401299
This commit is contained in:
David Anderson
2007-08-09 19:48:46 +00:00
parent 000d5792e3
commit 0adbf810b8
2 changed files with 13 additions and 12 deletions
+7 -6
View File
@@ -90,9 +90,10 @@ static cell_t sm_Geoip_Code2(IPluginContext *pCtx, const cell_t *params)
StripPort(ip);
ccode = GeoIP_country_code_by_addr(gi, ip);
pCtx->StringToLocal(params[2], 3, (ccode) ? ccode : "er");
return 1;
pCtx->StringToLocal(params[2], 3, ccode ? ccode : "");
return ccode ? 1 : 0;
}
static cell_t sm_Geoip_Code3(IPluginContext *pCtx, const cell_t *params)
@@ -104,9 +105,9 @@ static cell_t sm_Geoip_Code3(IPluginContext *pCtx, const cell_t *params)
StripPort(ip);
ccode = GeoIP_country_code3_by_addr(gi, ip);
pCtx->StringToLocal(params[2], 4, (ccode) ? ccode : "err");
pCtx->StringToLocal(params[2], 4, ccode ? ccode : "");
return 1;
return ccode ? 1 : 0;
}
static cell_t sm_Geoip_Country(IPluginContext *pCtx, const cell_t *params)
@@ -118,9 +119,9 @@ static cell_t sm_Geoip_Country(IPluginContext *pCtx, const cell_t *params)
StripPort(ip);
ccode = GeoIP_country_name_by_addr(gi, ip);
pCtx->StringToLocal(params[2], params[3], (ccode) ? ccode : "error");
pCtx->StringToLocal(params[2], params[3], (ccode) ? ccode : "");
return 1;
return ccode ? 1 : 0;
}
const sp_nativeinfo_t geoip_natives[] =