summaryrefslogtreecommitdiffstats
path: root/src/WebAdmin.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-04-19 19:53:14 +0200
committerMattes D <github@xoft.cz>2015-04-19 19:53:14 +0200
commitba6f5aea4c088b92365b6636d96873a82706c8c8 (patch)
treed8c6f3a3eda7c0ed1f70bc5a01b97b90d940eab4 /src/WebAdmin.cpp
parentClientHandle: Fixed re-sending refused right-clicks. (diff)
parentRefresh plugin list before trying to load. (diff)
downloadcuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar
cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar.gz
cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar.bz2
cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar.lz
cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar.xz
cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar.zst
cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.zip
Diffstat (limited to 'src/WebAdmin.cpp')
-rw-r--r--src/WebAdmin.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp
index 13cf3cc41..aff3b4710 100644
--- a/src/WebAdmin.cpp
+++ b/src/WebAdmin.cpp
@@ -464,10 +464,10 @@ sWebAdminPage cWebAdmin::GetPage(const HTTPRequest & a_Request)
{
if ((*itr)->GetWebTitle() == Split[1])
{
- Page.Content = (*itr)->HandleWebRequest(&a_Request);
+ Page.Content = (*itr)->HandleWebRequest(a_Request);
cWebPlugin * WebPlugin = *itr;
FoundPlugin = WebPlugin->GetWebTitle();
- AString TabName = WebPlugin->GetTabNameForRequest(&a_Request).first;
+ AString TabName = WebPlugin->GetTabNameForRequest(a_Request).first;
Page.PluginName = FoundPlugin;
Page.TabName = TabName;
break;
@@ -489,20 +489,32 @@ AString cWebAdmin::GetDefaultPage(void)
Content += "<h4>Server Name:</h4>";
Content += "<p>" + AString( cRoot::Get()->GetServer()->GetServerID()) + "</p>";
+ // Display a list of all plugins:
Content += "<h4>Plugins:</h4><ul>";
- cPluginManager * PM = cPluginManager::Get();
- const cPluginManager::PluginMap & List = PM->GetAllPlugins();
- for (cPluginManager::PluginMap::const_iterator itr = List.begin(); itr != List.end(); ++itr)
+ struct cPluginCallback:
+ public cPluginManager::cPluginCallback
{
- if (itr->second == nullptr)
+ AString & m_Content;
+
+ cPluginCallback(AString & a_Content):
+ m_Content(a_Content)
{
- continue;
}
- AppendPrintf(Content, "<li>%s V.%i</li>", itr->second->GetName().c_str(), itr->second->GetVersion());
- }
+
+ virtual bool Item(cPlugin * a_Plugin) override
+ {
+ if (a_Plugin->IsLoaded())
+ {
+ AppendPrintf(m_Content, "<li>%s V.%i</li>", a_Plugin->GetName().c_str(), a_Plugin->GetVersion());
+ }
+ return false;
+ }
+ } Callback(Content);
+ cPluginManager::Get()->ForEachPlugin(Callback);
Content += "</ul>";
- Content += "<h4>Players:</h4><ul>";
+ // Display a list of all players:
+ Content += "<h4>Players:</h4><ul>";
cPlayerAccum PlayerAccum;
cWorld * World = cRoot::Get()->GetDefaultWorld(); // TODO - Create a list of worlds and players
if (World != nullptr)