-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetMasterServer.cpp
More file actions
40 lines (31 loc) · 1.2 KB
/
GetMasterServer.cpp
File metadata and controls
40 lines (31 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "Client.hpp"
#include "GetMasterServer.hpp"
namespace GetMasterServer {
void Init(Client* client, IqClass* iq) {
std::string packetValue = "<get_master_server resource='"; //pve_004_r1' load_index='255'/>
std::string PacketData = iq->data;
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_string(PacketData.c_str());
pugi::xml_node node = doc.first_child();
for (const Channels& ch : m_Channels) {
if (strcmp(ch.selected_channel_resource.c_str(), node.attribute("channel").value()) == 0) {
Channels* channel = new Channels();
client->Channel = channel;
client->Channel->resource = ch.resource.c_str();
printf("%s\n", client->Channel->resource);
break;
}
}
if (client->Channel != NULL) {
packetValue.append(client->Channel->resource);
packetValue.append("' load_index='255'/>");
printf("%s\n", packetValue.c_str());
std::string resultIq = client->Iq->PrepareData(client, packetValue);
printf("%s\n", resultIq.c_str());
client->sendPacket(client->clientSocket, std::vector<char>(resultIq.begin(), resultIq.end()));
}
else {
printf("[Iq] not founded MasterServer for player.\n");
}
}
}