Skip to content

Commit

Permalink
do not format the message if OnServerMessage is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
IS4Code committed Oct 27, 2018
1 parent a5e6ca1 commit f480163
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,17 +310,19 @@ typedef void (*FUNC_logprintf)(const char *msg, ...);

void HOOK_logprintf(const char *msg, ...)
{
char buffer[1024];
va_list arguments;
va_start(arguments, msg);
vsnprintf(buffer, sizeof(buffer), msg, arguments);
va_end(arguments);

bool bAllow;
if (CPlugin::Get()->IsOnServerMessageEnabled())
if(CPlugin::Get()->IsOnServerMessageEnabled())
{
char buffer[1024];
va_list arguments;
va_start(arguments, msg);
vsnprintf(buffer, sizeof(buffer), msg, arguments);
va_end(arguments);

bAllow = CCallbackManager::OnServerMessage(buffer);
else
}else{
bAllow = true;
}

if(bAllow)
{
Expand Down

0 comments on commit f480163

Please # to comment.