1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 22:13:12 +02:00

Allow use of a non-map type as the root RPC element.

This commit is contained in:
Sadie Powell
2025-02-24 03:21:42 +00:00
parent 2ccd182d2e
commit a111b40560
4 changed files with 59 additions and 41 deletions
+5 -3
View File
@@ -116,7 +116,6 @@ public:
Anope::string param;
if (xmlrpc_value_type(value) != XMLRPC_TYPE_STRING)
{
// TODO: error;
xmlrpc_env_set_fault(&env, RPC::ERR_INVALID_REQUEST, "Anope XML-RPC only supports strings");
SendError(reply, env);
xmlrpc_DECREF(value);
@@ -160,8 +159,11 @@ public:
return;
}
auto *value = xmlrpc_struct_new(&env);
SerializeMap(env, value, request);
xmlrpc_value *value;
if (request.GetRoot())
value = SerializeElement(env, request.GetRoot().value());
else
value = xmlrpc_nil_new(&env);
auto *response = xmlrpc_mem_block_new(&env, 0);
xmlrpc_serialize_response(&env, response, value);