summaryrefslogtreecommitdiffstats
path: root/src/WebAdmin.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-09 01:14:42 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-09 01:14:42 +0100
commit9d1c9097e3a62f11cce94d1807c16a310eba6c2c (patch)
treef186174dd8567c9f0d43969a19782d8fdb2fb2ed /src/WebAdmin.cpp
parentMerge branch 'master' into playerimprovements (diff)
parentMerge pull request #656 from mc-server/ReloadGroups (diff)
downloadcuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar.gz
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar.bz2
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar.lz
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar.xz
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar.zst
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.zip
Diffstat (limited to 'src/WebAdmin.cpp')
-rw-r--r--src/WebAdmin.cpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp
index e6a5a01b3..e88de5947 100644
--- a/src/WebAdmin.cpp
+++ b/src/WebAdmin.cpp
@@ -42,6 +42,7 @@ public:
cWebAdmin::cWebAdmin(void) :
m_IsInitialized(false),
+ m_IsRunning(false),
m_TemplateScript("<webadmin_template>")
{
}
@@ -52,29 +53,26 @@ cWebAdmin::cWebAdmin(void) :
cWebAdmin::~cWebAdmin()
{
- if (m_IsInitialized)
- {
- LOGD("Stopping WebAdmin...");
- }
+ ASSERT(!m_IsRunning); // Was the HTTP server stopped properly?
}
-void cWebAdmin::AddPlugin( cWebPlugin * a_Plugin )
+void cWebAdmin::AddPlugin(cWebPlugin * a_Plugin)
{
- m_Plugins.remove( a_Plugin );
- m_Plugins.push_back( a_Plugin );
+ m_Plugins.remove(a_Plugin);
+ m_Plugins.push_back(a_Plugin);
}
-void cWebAdmin::RemovePlugin( cWebPlugin * a_Plugin )
+void cWebAdmin::RemovePlugin(cWebPlugin * a_Plugin)
{
- m_Plugins.remove( a_Plugin );
+ m_Plugins.remove(a_Plugin);
}
@@ -87,7 +85,8 @@ bool cWebAdmin::Init(void)
{
LOGWARN("Regenerating webadmin.ini, all settings will be reset");
m_IniFile.AddHeaderComment(" This file controls the webadmin feature of MCServer");
- m_IniFile.AddHeaderComment(" Username format: [User:*username*] | Password format: Password=*password*; for example:");
+ m_IniFile.AddHeaderComment(" Username format: [User:*username*]");
+ m_IniFile.AddHeaderComment(" Password format: Password=*password*; for example:");
m_IniFile.AddHeaderComment(" [User:admin]");
m_IniFile.AddHeaderComment(" Password=admin");
}
@@ -134,7 +133,24 @@ bool cWebAdmin::Start(void)
m_TemplateScript.Close();
}
- return m_HTTPServer.Start(*this);
+ m_IsRunning = m_HTTPServer.Start(*this);
+ return m_IsRunning;
+}
+
+
+
+
+
+void cWebAdmin::Stop(void)
+{
+ if (!m_IsRunning)
+ {
+ return;
+ }
+
+ LOGD("Stopping WebAdmin...");
+ m_HTTPServer.Stop();
+ m_IsRunning = false;
}