summaryrefslogtreecommitdiffstats
path: root/src/Server/RequestHandlers
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-05-24 15:09:24 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-05-24 15:09:24 +0200
commita8ad2278025467f7cc9c9974d7e82be5752fb697 (patch)
tree49186e5989be68e9139c9a951356d1ad93e68ac0 /src/Server/RequestHandlers
parent8501b9171c4064a2b383945693bb027eefffc2ab (diff)
downloadmad-a8ad2278025467f7cc9c9974d7e82be5752fb697.tar
mad-a8ad2278025467f7cc9c9974d7e82be5752fb697.zip
Interface des UserManager ?berarbeitet
Diffstat (limited to 'src/Server/RequestHandlers')
-rw-r--r--src/Server/RequestHandlers/GroupListRequestHandler.cpp14
-rw-r--r--src/Server/RequestHandlers/UserInfoRequestHandler.cpp13
-rw-r--r--src/Server/RequestHandlers/UserListRequestHandler.cpp14
3 files changed, 25 insertions, 16 deletions
diff --git a/src/Server/RequestHandlers/GroupListRequestHandler.cpp b/src/Server/RequestHandlers/GroupListRequestHandler.cpp
index 1ca2b92..356e105 100644
--- a/src/Server/RequestHandlers/GroupListRequestHandler.cpp
+++ b/src/Server/RequestHandlers/GroupListRequestHandler.cpp
@@ -42,11 +42,13 @@ void GroupListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
// TODO Require authentication
- boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > info = UserManager::get()->getGroupList();
+
Common::XmlPacket ret;
- if(info) {
+ try {
+ boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > info = UserManager::get()->getGroupList();
+
ret.setType("OK");
ret.addList("groups");
@@ -58,10 +60,12 @@ void GroupListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
entry.add("name", group->second.getName());
}
}
-
- else {
+ catch(Net::Exception e) {
ret.setType("Error");
- ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED);
+ ret.add("ErrorCode", e.getErrorCode());
+ ret.add("SubCode", e.getSubCode());
+ ret.add("SubSubCode", e.getSubSubCode());
+ ret.add("Where", e.getWhere());
}
sendPacket(ret);
diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp
index 287d026..e4ef447 100644
--- a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp
+++ b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp
@@ -42,11 +42,11 @@ void UserInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) {
// TODO Require authentication
- boost::shared_ptr<Common::UserInfo> info = UserManager::get()->getUserInfo(packet["uid"]);
-
Common::XmlPacket ret;
- if(info) {
+ try {
+ boost::shared_ptr<Common::UserInfo> info = UserManager::get()->getUserInfo(packet["uid"]);
+
ret.setType("OK");
ret.add("uid", info->getUid());
@@ -54,9 +54,12 @@ void UserInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) {
ret.add("username", info->getUsername());
ret.add("fullName", info->getFullName());
}
- else {
+ catch(Net::Exception e) {
ret.setType("Error");
- ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED);
+ ret.add("ErrorCode", e.getErrorCode());
+ ret.add("SubCode", e.getSubCode());
+ ret.add("SubSubCode", e.getSubSubCode());
+ ret.add("Where", e.getWhere());
}
sendPacket(ret);
diff --git a/src/Server/RequestHandlers/UserListRequestHandler.cpp b/src/Server/RequestHandlers/UserListRequestHandler.cpp
index 713753b..37db6d5 100644
--- a/src/Server/RequestHandlers/UserListRequestHandler.cpp
+++ b/src/Server/RequestHandlers/UserListRequestHandler.cpp
@@ -42,11 +42,11 @@ void UserListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
// TODO Require authentication
- boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > info = UserManager::get()->getUserList();
-
Common::XmlPacket ret;
- if(info) {
+ try {
+ boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > info = UserManager::get()->getUserList();
+
ret.setType("OK");
ret.addList("users");
@@ -60,10 +60,12 @@ void UserListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
entry.add("fullName", user->second.getFullName());
}
}
-
- else {
+ catch(Net::Exception e) {
ret.setType("Error");
- ret.add("ErrorCode", Net::Exception::NOT_IMPLEMENTED);
+ ret.add("ErrorCode", e.getErrorCode());
+ ret.add("SubCode", e.getSubCode());
+ ret.add("SubSubCode", e.getSubSubCode());
+ ret.add("Where", e.getWhere());
}
sendPacket(ret);