summaryrefslogtreecommitdiffstats
path: root/src/Server/UserManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server/UserManager.cpp')
-rw-r--r--src/Server/UserManager.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/Server/UserManager.cpp b/src/Server/UserManager.cpp
index d763a8b..3b5887a 100644
--- a/src/Server/UserManager.cpp
+++ b/src/Server/UserManager.cpp
@@ -26,44 +26,46 @@ namespace Server {
UserManager UserManager::userManager;
-bool UserManager::Compare::operator() (const UserBackend *b1, const UserBackend *b2) {
+bool UserManager::Compare::operator() (boost::shared_ptr<UserBackend> b1, boost::shared_ptr<UserBackend> b2) {
if(b1->getPriority() == b2->getPriority())
- return (b1 > b2);
+ return (b1.get() > b2.get());
else
return (b1->getPriority() > b2->getPriority());
}
-bool UserManager::getUserList(const boost::function1<void, const std::map<unsigned long, Common::UserInfo>& > &callback) {
- for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
- if((*backend)->getUserList(callback))
- return true;
+boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserManager::getUserList() {
+ for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > ret = (*backend)->getUserList();
+ if(ret)
+ return ret;
}
- return false;
+ return boost::shared_ptr<std::map<unsigned long, Common::UserInfo> >();
}
-bool UserManager::getUserInfo(unsigned long uid, const boost::function1<void, const Common::UserInfo&> &callback) {
- for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
- if((*backend)->getUserInfo(uid, callback))
- return true;
+boost::shared_ptr<Common::UserInfo> UserManager::getUserInfo(unsigned long uid) {
+ for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ boost::shared_ptr<Common::UserInfo> ret = (*backend)->getUserInfo(uid);
+ if(ret)
+ return ret;
}
- return false;
+ return boost::shared_ptr<Common::UserInfo>();
}
-bool UserManager::setPassword(unsigned long uid, const std::string &password, const boost::function1<void, bool> &callback) {
- for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
- if((*backend)->setPassword(uid, password, callback))
+bool UserManager::setPassword(unsigned long uid, const std::string &password) {
+ for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ if((*backend)->setPassword(uid, password))
return true;
}
return false;
}
-bool UserManager::addUser(const Common::UserInfo &userInfo, const boost::function1<void, bool> &callback) {
- for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
- if((*backend)->addUser(userInfo, callback))
+bool UserManager::addUser(const Common::UserInfo &userInfo) {
+ for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ if((*backend)->addUser(userInfo))
return true;
}