[Server] Implement getPluginListSample()

pull/249/merge
Koncord 8 years ago
parent b223d0fa1e
commit 5ddad6a4c6

@ -350,6 +350,33 @@ Networking *Networking::getPtr()
return sThis;
}
Networking::PluginListSample Networking::getPluginListSample()
{
PluginListSample pls;
unsigned id = 0;
while(true)
{
unsigned field = 0;
auto name = "";
Script::Call<Script::CallbackIdentity("OnRequestPluginList")>(name, id, field);
if(strlen(name) == 0)
break;
HashList hashList;
while(true)
{
auto hash = "";
Script::Call<Script::CallbackIdentity("OnRequestPluginList")>(hash, id, field);
if(strlen(hash) == 0)
break;
hashList.push_back((unsigned)stoul(hash));
field++;
}
pls.push_back({name, hashList});
id++;
}
return pls;
}
void Networking::stopServer(int code)
{
running = false;

@ -55,7 +55,10 @@ namespace mwmp
static const Networking &get();
static Networking *getPtr();
typedef std::vector<unsigned> HashList;
typedef std::vector<std::pair<std::string, HashList>> PluginListSample;
private:
PluginListSample getPluginListSample();
std::string serverPassword;
static Networking *sThis;

Loading…
Cancel
Save