| 49 | |
| 50 | |
| 51 | void ChatLogger::process(bz_EventData* eventData) { |
| 52 | if (eventData->eventType != bz_eRawChatMessageEvent) { |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | FILE* fp = fopen(filePath.c_str(), "a+"); |
| 57 | if (!fp) { |
| 58 | return; |
| 59 | } |
| 60 | |
| 61 | bz_ChatEventData_V1* data = (bz_ChatEventData_V1*)eventData; |
| 62 | |
| 63 | bz_Time now; |
| 64 | bz_getLocaltime(&now); |
| 65 | |
| 66 | const char* from = bz_getPlayerCallsign(data->from); |
| 67 | const char* to = bz_getPlayerCallsign(data->to); |
| 68 | |
| 69 | const char* team = bzu_GetTeamName(data->team); |
| 70 | |
| 71 | fprintf(fp, "%d:%d:%d %d.%d.%d", now.year, now.month, now.day, now.hour, now.minute, now.second); |
| 72 | fprintf(fp, "%s to %s :%s\n", from ? from : "Unknown", to ? to : (team ? team : "General"), data->message.c_str()); |
| 73 | fclose(fp); |
| 74 | } |
| 75 | |
| 76 | // Local Variables: *** |
| 77 | // mode: C++ *** |
nothing calls this directly
no test coverage detected