MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / process

Method process

plugins/chatlog/chatlog.cpp:51–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50
51void 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++ ***

Callers

nothing calls this directly

Calls 4

bz_getLocaltimeFunction · 0.85
bz_getPlayerCallsignFunction · 0.85
bzu_GetTeamNameFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected