summaryrefslogtreecommitdiffstats
path: root/src/WebAdmin.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-02-07 12:26:41 +0100
committermadmaxoft <github@xoft.cz>2014-02-07 12:26:41 +0100
commite165da946e8c1d836b11c33ba444e842472b2bfe (patch)
tree639c4140871a28b51eeb9c969fe5867d10fff780 /src/WebAdmin.cpp
parentFixed wiki link in auto-generated settings.ini. (diff)
downloadcuberite-e165da946e8c1d836b11c33ba444e842472b2bfe.tar
cuberite-e165da946e8c1d836b11c33ba444e842472b2bfe.tar.gz
cuberite-e165da946e8c1d836b11c33ba444e842472b2bfe.tar.bz2
cuberite-e165da946e8c1d836b11c33ba444e842472b2bfe.tar.lz
cuberite-e165da946e8c1d836b11c33ba444e842472b2bfe.tar.xz
cuberite-e165da946e8c1d836b11c33ba444e842472b2bfe.tar.zst
cuberite-e165da946e8c1d836b11c33ba444e842472b2bfe.zip
Diffstat (limited to '')
-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;
}