summaryrefslogtreecommitdiffstats
path: root/src/modules/UserBackendMysql/UserBackendMysql.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-06-09 19:01:02 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-06-09 19:01:02 +0200
commit766c56a693e8b1bd4293459bb256abdc0515a0b5 (patch)
treeda8e51003cf801344e22b0b2b2e28a48d6a8b74c /src/modules/UserBackendMysql/UserBackendMysql.cpp
parent452320b5ec31447a526735016fa07589cb848032 (diff)
downloadmad-766c56a693e8b1bd4293459bb256abdc0515a0b5.tar
mad-766c56a693e8b1bd4293459bb256abdc0515a0b5.zip
Teile der Namespaces Common und Net in den neuen Namespace Core verschoben
Diffstat (limited to 'src/modules/UserBackendMysql/UserBackendMysql.cpp')
-rw-r--r--src/modules/UserBackendMysql/UserBackendMysql.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/src/modules/UserBackendMysql/UserBackendMysql.cpp b/src/modules/UserBackendMysql/UserBackendMysql.cpp
index b020310..f0e9b2e 100644
--- a/src/modules/UserBackendMysql/UserBackendMysql.cpp
+++ b/src/modules/UserBackendMysql/UserBackendMysql.cpp
@@ -20,10 +20,10 @@
#include <config.h>
#include "UserBackendMysql.h"
-#include <Common/ConfigEntry.h>
-#include <Common/ConfigManager.h>
-#include <Common/Logger.h>
-#include <Net/ThreadManager.h>
+#include <Core/ConfigEntry.h>
+#include <Core/ConfigManager.h>
+#include <Core/Logger.h>
+#include <Core/ThreadManager.h>
#include <sstream>
@@ -36,7 +36,7 @@ namespace Modules {
boost::shared_ptr<UserBackendMysql> UserBackendMysql::backend;
-bool UserBackendMysql::handleConfigEntry(const Common::ConfigEntry &entry, bool handled) {
+bool UserBackendMysql::handleConfigEntry(const Core::ConfigEntry &entry, bool handled) {
if(handled)
return false;
@@ -65,7 +65,7 @@ bool UserBackendMysql::handleConfigEntry(const Common::ConfigEntry &entry, bool
val = strtol(entry[1][0].c_str(), &endptr, 10);
if(endptr != 0 || val < 0 || val > 65535)
- Common::Logger::log(Common::Logger::WARNING, "UserBackendMysql: Invalid port");
+ Core::Logger::log(Core::Logger::WARNING, "UserBackendMysql: Invalid port");
else
port = val;
}
@@ -121,7 +121,7 @@ bool UserBackendMysql::handleConfigEntry(const Common::ConfigEntry &entry, bool
void UserBackendMysql::configFinished() {
if(db.empty()) {
- Common::Logger::log(Common::Logger::ERROR, "UserBackendMysql: No database name given");
+ Core::Logger::log(Core::Logger::ERROR, "UserBackendMysql: No database name given");
return;
}
@@ -132,17 +132,17 @@ void UserBackendMysql::configFinished() {
}
-boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserBackendMysql::getUserList() throw(Net::Exception) {
- Net::ThreadManager::get()->detach();
+boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserBackendMysql::getUserList() throw(Core::Exception) {
+ Core::ThreadManager::get()->detach();
if(mysql_ping(mysql))
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
mysql_real_query(mysql, queryListUsers.c_str(), queryListUsers.length());
MYSQL_RES *result = mysql_use_result(mysql);
if(!result || mysql_num_fields(result) < 4)
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > users(new std::map<unsigned long, Common::UserInfo>());
@@ -158,11 +158,11 @@ boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserBackendMysql::
return users;
}
-boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfo(unsigned long uid) throw(Net::Exception) {
- Net::ThreadManager::get()->detach();
+boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfo(unsigned long uid) throw(Core::Exception) {
+ Core::ThreadManager::get()->detach();
if(mysql_ping(mysql))
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
std::string query = queryUserById;
@@ -177,7 +177,7 @@ boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfo(unsigned long
MYSQL_RES *result = mysql_use_result(mysql);
if(!result || mysql_num_fields(result) < 4)
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
MYSQL_ROW row = mysql_fetch_row(result);
@@ -192,14 +192,14 @@ boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfo(unsigned long
return user;
}
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
}
-boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfoByName(const std::string &name) throw(Net::Exception) {
- Net::ThreadManager::get()->detach();
+boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfoByName(const std::string &name) throw(Core::Exception) {
+ Core::ThreadManager::get()->detach();
if(mysql_ping(mysql))
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
boost::scoped_array<char> escapedName(new char[name.length()*2+1]);
@@ -211,7 +211,7 @@ boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfoByName(const st
MYSQL_RES *result = mysql_use_result(mysql);
if(!result || mysql_num_fields(result) < 4)
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
MYSQL_ROW row = mysql_fetch_row(result);
@@ -226,14 +226,14 @@ boost::shared_ptr<Common::UserInfo> UserBackendMysql::getUserInfoByName(const st
return user;
}
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
}
-boost::shared_ptr<std::set<unsigned long> > UserBackendMysql::getUserGroupList(unsigned long uid) throw(Net::Exception) {
- Net::ThreadManager::get()->detach();
+boost::shared_ptr<std::set<unsigned long> > UserBackendMysql::getUserGroupList(unsigned long uid) throw(Core::Exception) {
+ Core::ThreadManager::get()->detach();
if(mysql_ping(mysql))
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
std::ostringstream tmp;
tmp << '"';
@@ -246,7 +246,7 @@ boost::shared_ptr<std::set<unsigned long> > UserBackendMysql::getUserGroupList(u
MYSQL_RES *result = mysql_use_result(mysql);
if(!result || mysql_num_fields(result) < 1)
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
boost::shared_ptr<std::set<unsigned long> > groups(new std::set<unsigned long>);
@@ -257,17 +257,17 @@ boost::shared_ptr<std::set<unsigned long> > UserBackendMysql::getUserGroupList(u
}
-boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserBackendMysql::getGroupList() throw(Net::Exception) {
- Net::ThreadManager::get()->detach();
+boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserBackendMysql::getGroupList() throw(Core::Exception) {
+ Core::ThreadManager::get()->detach();
if(mysql_ping(mysql))
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
mysql_real_query(mysql, queryListGroups.c_str(), queryListGroups.length());
MYSQL_RES *result = mysql_use_result(mysql);
if(!result || mysql_num_fields(result) < 2)
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > groups(new std::map<unsigned long, Common::GroupInfo>());
@@ -280,11 +280,11 @@ boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserBackendMysql:
return groups;
}
-std::string UserBackendMysql::getGroupName(unsigned long gid) throw(Net::Exception) {
- Net::ThreadManager::get()->detach();
+std::string UserBackendMysql::getGroupName(unsigned long gid) throw(Core::Exception) {
+ Core::ThreadManager::get()->detach();
if(mysql_ping(mysql))
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
std::string query = queryGroupById;
@@ -299,21 +299,21 @@ std::string UserBackendMysql::getGroupName(unsigned long gid) throw(Net::Excepti
MYSQL_RES *result = mysql_use_result(mysql);
if(!result || mysql_num_fields(result) < 2)
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
MYSQL_ROW row = mysql_fetch_row(result);
if(row)
return row[1];
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
}
-unsigned long UserBackendMysql::getGroupId(const std::string &name) throw(Net::Exception) {
- Net::ThreadManager::get()->detach();
+unsigned long UserBackendMysql::getGroupId(const std::string &name) throw(Core::Exception) {
+ Core::ThreadManager::get()->detach();
if(mysql_ping(mysql))
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
boost::scoped_array<char> escapedName(new char[name.length()*2+1]);
@@ -325,21 +325,21 @@ unsigned long UserBackendMysql::getGroupId(const std::string &name) throw(Net::E
MYSQL_RES *result = mysql_use_result(mysql);
if(!result || mysql_num_fields(result) < 2)
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
MYSQL_ROW row = mysql_fetch_row(result);
if(row)
return strtoul(row[0], 0, 10);
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
}
-boost::shared_ptr<std::set<unsigned long> > UserBackendMysql::getGroupUserList(unsigned long gid) throw(Net::Exception) {
- Net::ThreadManager::get()->detach();
+boost::shared_ptr<std::set<unsigned long> > UserBackendMysql::getGroupUserList(unsigned long gid) throw(Core::Exception) {
+ Core::ThreadManager::get()->detach();
if(mysql_ping(mysql))
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
std::ostringstream tmp;
tmp << '"';
@@ -352,7 +352,7 @@ boost::shared_ptr<std::set<unsigned long> > UserBackendMysql::getGroupUserList(u
MYSQL_RES *result = mysql_use_result(mysql);
if(!result || mysql_num_fields(result) < 1)
- throw Net::Exception(Net::Exception::NOT_AVAILABLE);
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
boost::shared_ptr<std::set<unsigned long> > users(new std::set<unsigned long>);
@@ -368,14 +368,14 @@ void UserBackendMysql::registerBackend() {
return;
backend.reset(new UserBackendMysql());
- Common::ConfigManager::get()->registerConfigurable(backend.get());
+ Core::ConfigManager::get()->registerConfigurable(backend.get());
}
void UserBackendMysql::unregisterBackend() {
if(!backend)
return;
- Common::ConfigManager::get()->unregisterConfigurable(backend.get());
+ Core::ConfigManager::get()->unregisterConfigurable(backend.get());
Server::UserManager::get()->unregisterBackend(backend);
backend.reset();