| 285 | |
| 286 | |
| 287 | void StatsLink::process(bz_EventData* eventData) { |
| 288 | if (!eventData || !bz_getPublic()) { |
| 289 | return; |
| 290 | } |
| 291 | |
| 292 | if (eventData->eventType == bz_eGetWorldEvent) { |
| 293 | bz_GetWorldEventData_V1* data = (bz_GetWorldEventData_V1*)eventData; |
| 294 | mapFile = data->worldFile.c_str(); |
| 295 | if (!mapFile.size()) { |
| 296 | if (data->worldBlob) { |
| 297 | mapFile = "Custom"; |
| 298 | } |
| 299 | else { |
| 300 | mapFile = "Random"; |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | else { |
| 305 | if ((eventData->eventType == bz_eListServerUpdateEvent) || |
| 306 | (eventData->eventType == bz_eWorldFinalized)) { |
| 307 | std::string params = "action=add&"; |
| 308 | getPushHeader(params); |
| 309 | |
| 310 | buildHTMLPlayerList(params); |
| 311 | |
| 312 | buildStateHash(params); |
| 313 | |
| 314 | bz_addURLJob(url.c_str(), NULL, params.c_str()); |
| 315 | } |
| 316 | else if (eventData->eventType == bz_ePlayerPartEvent) { |
| 317 | bz_PlayerJoinPartEventData_V1* data = (bz_PlayerJoinPartEventData_V1*)eventData; |
| 318 | std::string params = "action=part"; |
| 319 | getPushHeader(params); |
| 320 | |
| 321 | // we use -1 for the parted player, then skip them in the player list. |
| 322 | // this way we always get all player data on a part |
| 323 | if (data->playerID) { |
| 324 | buildHTMLPlayer(params, data->playerID, -1); |
| 325 | } |
| 326 | |
| 327 | buildHTMLPlayerList(params, data->playerID); |
| 328 | |
| 329 | bz_addURLJob(url.c_str(), NULL, params.c_str()); |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | // Local Variables: *** |
| 335 | // mode: C++ *** |
no test coverage detected