summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-05-14 13:56:32 +0100
committerSadie Powell <sadie@witchery.services>2021-05-14 13:56:32 +0100
commit4350a11c663b0d75f8119743bffb7736d87abd4d (patch)
treebb3276c57e6c49eacbdd3e18272b9eea167e9230
parent1288e9e593bfa014548b1aa48aac4afda98002c8 (diff)
Fix sending malformed pong messages in some cases.
-rw-r--r--include/clientprotocolmsg.h7
-rw-r--r--src/coremods/core_user/core_user.cpp2
2 files changed, 5 insertions, 4 deletions
diff --git a/include/clientprotocolmsg.h b/include/clientprotocolmsg.h
index 53122cff9..144af9e44 100644
--- a/include/clientprotocolmsg.h
+++ b/include/clientprotocolmsg.h
@@ -668,9 +668,10 @@ struct ClientProtocol::Messages::Pong : public ClientProtocol::Message
Pong(const std::string& cookie, const std::string& server = "")
: ClientProtocol::Message("PONG", ServerInstance->Config->GetServerName())
{
- PushParamRef(ServerInstance->Config->GetServerName());
- if (!server.empty())
- PushParamRef(server);
+ if (server.empty())
+ PushParamRef(ServerInstance->Config->GetServerName());
+ else
+ PushParam(server);
PushParamRef(cookie);
}
};
diff --git a/src/coremods/core_user/core_user.cpp b/src/coremods/core_user/core_user.cpp
index 2431215f3..622e82c75 100644
--- a/src/coremods/core_user/core_user.cpp
+++ b/src/coremods/core_user/core_user.cpp
@@ -83,7 +83,7 @@ class CommandPing : public SplitCommand
return CMD_FAILURE;
}
- ClientProtocol::Messages::Pong pong(parameters[0], origin ? parameters[1] : "");
+ ClientProtocol::Messages::Pong pong(parameters[0], origin ? parameters[1] : ServerInstance->Config->GetServerName());
user->Send(ServerInstance->GetRFCEvents().pong, pong);
return CMD_SUCCESS;
}