summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/SystemBackendPosix.cpp8
-rw-r--r--src/modules/SystemBackendPosix.h12
-rw-r--r--src/modules/SystemBackendProc.cpp6
-rw-r--r--src/modules/SystemBackendProc.h10
-rw-r--r--src/modules/UserBackendMysql.cpp13
-rw-r--r--src/modules/UserBackendMysql.h7
6 files changed, 26 insertions, 30 deletions
diff --git a/src/modules/SystemBackendPosix.cpp b/src/modules/SystemBackendPosix.cpp
index c8135a3..21e5c75 100644
--- a/src/modules/SystemBackendPosix.cpp
+++ b/src/modules/SystemBackendPosix.cpp
@@ -70,8 +70,8 @@ SystemBackendPosix::~SystemBackendPosix() {
}
-void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const sigc::slot<void, const std::vector<FSInfo>& > &callback) {
- std::vector<FSInfo> ret;
+void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) {
+ std::vector<Common::SystemManager::FSInfo> ret;
std::istringstream stream(output);
std::string str;
@@ -83,7 +83,7 @@ void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const si
char *fsName = new char[str.length()+1];
char *mountedOn = new char[str.length()+1];
- FSInfo info;
+ Common::SystemManager::FSInfo info;
if(std::sscanf(str.c_str(), "%s %lld %lld %lld %*d%% %s", fsName, &info.total, &info.used, &info.available, mountedOn) == 5) {
info.fsName = fsName;
@@ -99,7 +99,7 @@ void SystemBackendPosix::fsInfoCallback(int, const std::string &output, const si
callback(ret);
}
-bool SystemBackendPosix::fsInfo(const sigc::slot<void, const std::vector<FSInfo>& > &callback) {
+bool SystemBackendPosix::getFSInfo(const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback) {
std::vector<std::string> argv;
argv.push_back("/bin/df");
diff --git a/src/modules/SystemBackendPosix.h b/src/modules/SystemBackendPosix.h
index a307f22..b12af6b 100644
--- a/src/modules/SystemBackendPosix.h
+++ b/src/modules/SystemBackendPosix.h
@@ -55,13 +55,13 @@ class SystemBackendPosix : private Common::SystemBackend {
setChildHandler();
}
- void fsInfoCallback(int, const std::string &output, const sigc::slot<void, const std::vector<FSInfo>& > &callback);
+ void fsInfoCallback(int, const std::string &output, const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback);
protected:
- virtual bool fsInfo(const sigc::slot<void, const std::vector<FSInfo>& > &callback);
+ virtual bool getFSInfo(const sigc::slot<void, const std::vector<Common::SystemManager::FSInfo>& > &callback);
- virtual bool doShutdown(const sigc::slot<void> &callback) {return exec(sigc::hide(callback), "/sbin/halt");}
- virtual bool doReboot(const sigc::slot<void> &callback) {return exec(sigc::hide(callback), "/sbin/reboot");}
+ virtual bool shutdown(const sigc::slot<void> &callback) {return exec(sigc::hide(callback), "/sbin/halt");}
+ virtual bool reboot(const sigc::slot<void> &callback) {return exec(sigc::hide(callback), "/sbin/reboot");}
public:
~SystemBackendPosix();
@@ -71,14 +71,14 @@ class SystemBackendPosix : private Common::SystemBackend {
return;
backend = new SystemBackendPosix();
- SystemBackend::registerBackend(backend);
+ Common::SystemManager::get()->registerBackend(backend);
}
static void unregisterBackend() {
if(!backend)
return;
- SystemBackend::unregisterBackend(backend);
+ Common::SystemManager::get()->unregisterBackend(backend);
delete backend;
backend = 0;
}
diff --git a/src/modules/SystemBackendProc.cpp b/src/modules/SystemBackendProc.cpp
index 3a0d33d..501f779 100644
--- a/src/modules/SystemBackendProc.cpp
+++ b/src/modules/SystemBackendProc.cpp
@@ -34,7 +34,7 @@ namespace Modules {
SystemBackendProc *SystemBackendProc::backend = 0;
-bool SystemBackendProc::uptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback) {
+bool SystemBackendProc::getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback) {
unsigned long uptime = 0, idleTime = 0;
uptimeFile.seekg(0, std::ios::beg);
@@ -58,7 +58,7 @@ bool SystemBackendProc::uptimeInfo(const sigc::slot<void, unsigned long, unsigne
return true;
}
-bool SystemBackendProc::memoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback) {
+bool SystemBackendProc::getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback) {
unsigned long totalMem = 0, freeMem = 0, totalSwap = 0, freeSwap = 0;
meminfoFile.seekg(0, std::ios::beg);
@@ -95,7 +95,7 @@ bool SystemBackendProc::memoryInfo(const sigc::slot<void, unsigned long, unsigne
return true;
}
-bool SystemBackendProc::loadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback) {
+bool SystemBackendProc::getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback) {
unsigned long currentLoad = 0, nProcesses = 0;
float loadAvg1 = 0, loadAvg5 = 0, loadAvg15 = 0;
diff --git a/src/modules/SystemBackendProc.h b/src/modules/SystemBackendProc.h
index bd4767d..7174551 100644
--- a/src/modules/SystemBackendProc.h
+++ b/src/modules/SystemBackendProc.h
@@ -38,9 +38,9 @@ class SystemBackendProc : private Common::SystemBackend {
SystemBackendProc() : uptimeFile("/proc/uptime"), meminfoFile("/proc/meminfo"), loadFile("/proc/loadavg") {}
protected:
- virtual bool uptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback);
- virtual bool memoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback);
- virtual bool loadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback);
+ virtual bool getUptimeInfo(const sigc::slot<void, unsigned long, unsigned long> &callback);
+ virtual bool getMemoryInfo(const sigc::slot<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback);
+ virtual bool getLoadInfo(const sigc::slot<void, unsigned long, unsigned long, float, float, float> &callback);
public:
static void registerBackend() {
@@ -48,14 +48,14 @@ class SystemBackendProc : private Common::SystemBackend {
return;
backend = new SystemBackendProc();
- SystemBackend::registerBackend(backend);
+ Common::SystemManager::get()->registerBackend(backend);
}
static void unregisterBackend() {
if(!backend)
return;
- SystemBackend::unregisterBackend(backend);
+ Common::SystemManager::get()->unregisterBackend(backend);
delete backend;
backend = 0;
}
diff --git a/src/modules/UserBackendMysql.cpp b/src/modules/UserBackendMysql.cpp
index db3c32b..39b0652 100644
--- a/src/modules/UserBackendMysql.cpp
+++ b/src/modules/UserBackendMysql.cpp
@@ -22,6 +22,7 @@
#include "UserBackendMysql.h"
#include <Common/ActionManager.h>
#include <Common/ConfigEntry.h>
+#include <Common/ConfigManager.h>
#include <Common/Logger.h>
#include <sstream>
@@ -130,11 +131,11 @@ void UserBackendMysql::configFinished() {
mysql = mysql_init(0);
mysql_real_connect(mysql, host.c_str(), username.c_str(), passwd.c_str(), db.c_str(), port, unixSocket.empty() ? 0 : unixSocket.c_str(), 0);
- UserBackend::registerBackend(backend);
+ Core::UserManager::get()->registerBackend(backend);
}
-bool UserBackendMysql::userList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback) {
+bool UserBackendMysql::getUserList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback) {
mysql_ping(mysql);
mysql_real_query(mysql, queryListUsers.c_str(), queryListUsers.length());
@@ -159,7 +160,7 @@ bool UserBackendMysql::userList(const sigc::slot<void, const std::map<unsigned l
return true;
}
-bool UserBackendMysql::userInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback) {
+bool UserBackendMysql::getUserInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback) {
mysql_ping(mysql);
std::string query = queryUserById;
@@ -196,10 +197,6 @@ bool UserBackendMysql::userInfo(unsigned long uid, const sigc::slot<void, const
return true;
}
-bool UserBackendMysql::password(unsigned long uid _UNUSED_PARAMETER_, const std::string &password _UNUSED_PARAMETER_, const sigc::slot<void, bool> &callback _UNUSED_PARAMETER_) {
- return false;
-}
-
void UserBackendMysql::registerBackend() {
if(backend)
@@ -214,7 +211,7 @@ void UserBackendMysql::unregisterBackend() {
return;
Common::ConfigManager::get()->unregisterConfigurable(backend);
- UserBackend::unregisterBackend(backend);
+ Core::UserManager::get()->unregisterBackend(backend);
delete backend;
backend = 0;
diff --git a/src/modules/UserBackendMysql.h b/src/modules/UserBackendMysql.h
index 60b2bd9..ac82d67 100644
--- a/src/modules/UserBackendMysql.h
+++ b/src/modules/UserBackendMysql.h
@@ -21,8 +21,8 @@
#define MAD_MODULES_USERBACKENDMYSQL_H_
#include <Core/UserBackend.h>
+#include <Core/UserManager.h>
#include <Common/Configurable.h>
-#include <Common/ConfigManager.h>
#include <mysql/mysql.h>
@@ -50,9 +50,8 @@ class UserBackendMysql : private Core::UserBackend, private Common::Configurable
virtual bool handleConfigEntry(const Common::ConfigEntry &entry, bool);
virtual void configFinished();
- virtual bool userList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback);
- virtual bool userInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback);
- virtual bool password(unsigned long uid, const std::string &password, const sigc::slot<void, bool> &callback);
+ virtual bool getUserList(const sigc::slot<void, const std::map<unsigned long, Common::UserInfo>& > &callback);
+ virtual bool getUserInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback);
public:
virtual ~UserBackendMysql() {