diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-27 19:58:24 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-27 19:58:24 +0200 |
commit | b40ba0cf91603b695f1f2380cbd39966a458f22f (patch) | |
tree | 1fec48ddc59eb1392fac38495b230e4b2cbf7528 /src/Server/RequestHandlers | |
parent | e1d8490f0654a3da0b900407d80d91d8d0da68c8 (diff) | |
download | mad-b40ba0cf91603b695f1f2380cbd39966a458f22f.tar mad-b40ba0cf91603b695f1f2380cbd39966a458f22f.zip |
Use Unicode-aware String class instead of std::string
Diffstat (limited to 'src/Server/RequestHandlers')
9 files changed, 85 insertions, 85 deletions
diff --git a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp index 1348541..d446485 100644 --- a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp @@ -37,17 +37,17 @@ void ConnectionRequestHandlerGroup::handleAuthMethodRequest(boost::shared_ptr<co Common::XmlData::List *list = ret->createList("methods"); - std::set<std::string> methods = application->getAuthManager()->getMethods(); + std::set<Core::String> methods = application->getAuthManager()->getMethods(); - for(std::set<std::string>::iterator method = methods.begin(); method != methods.end(); ++method) { + for(std::set<Core::String>::iterator method = methods.begin(); method != methods.end(); ++method) { Common::XmlData::List::iterator entry = list->addEntry(); entry->set("name", *method); Common::XmlData::List *subList = entry->createList("subMethods"); - std::vector<std::string> subMethods = application->getAuthManager()->getSubMethods(*method); + std::vector<Core::String> subMethods = application->getAuthManager()->getSubMethods(*method); - for(std::vector<std::string>::iterator subMethod = subMethods.begin(); subMethod != subMethods.end(); ++subMethod) { + for(std::vector<Core::String>::iterator subMethod = subMethods.begin(); subMethod != subMethods.end(); ++subMethod) { Common::XmlData::List::iterator subEntry = subList->addEntry(); subEntry->set("name", *subMethod); @@ -59,8 +59,8 @@ void ConnectionRequestHandlerGroup::handleAuthRequest(boost::shared_ptr<const Co std::vector<boost::uint8_t> response; boost::shared_ptr<const Common::AuthContext> authContext = application->getConnectionManager()->authenticateConnection(connection, - packet->get<const std::string&>("method"), packet->get<const std::string&>("subMethod"), - packet->get<const std::string&>("user"), packet->get<const std::vector<boost::uint8_t>&>("data"), + packet->get<const Core::String&>("method"), packet->get<const Core::String&>("subMethod"), + packet->get<const Core::String&>("user"), packet->get<const std::vector<boost::uint8_t>&>("data"), response); if(!response.empty()) @@ -86,13 +86,13 @@ void ConnectionRequestHandlerGroup::handleDaemonListRequest(boost::shared_ptr<co Common::XmlData::List::iterator entry = list->addEntry(); entry->set("name", daemon->getName()); - entry->set("address", daemon->getIP()); + entry->set("address", daemon->getIP().c_str()); entry->set("state", daemon->getState()); } } void ConnectionRequestHandlerGroup::handleIdentifyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) { - application->getConnectionManager()->identifyDaemonConnection(connection, packet->get<const std::string&>("hostname")); + application->getConnectionManager()->identifyDaemonConnection(connection, packet->get<const Core::String&>("hostname")); ret->setType("OK"); } @@ -102,10 +102,10 @@ void ConnectionRequestHandlerGroup::handleLogRequest(boost::shared_ptr<const Com boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time); - const std::string ×tr = packet->get<const std::string&>("timestamp"); - if(!timestr.empty()) { + const Core::String ×tr = packet->get<const Core::String&>("timestamp"); + if(!timestr.isEmpty()) { try { - timestamp = boost::posix_time::from_iso_string(timestr); + timestamp = boost::posix_time::from_iso_string(timestr.extract()); } catch(...) {} } @@ -115,8 +115,8 @@ void ConnectionRequestHandlerGroup::handleLogRequest(boost::shared_ptr<const Com static_cast<Core::Logger::MessageCategory>(packet->get<long>("category")), static_cast<Core::Logger::MessageLevel>(packet->get<long>("level")), timestamp, - packet->get<const std::string&>("message"), - application->getConnectionManager()->getDaemonName(connection)); + packet->get<const Core::String&>("message").extract(), + application->getConnectionManager()->getDaemonName(connection).extract()); } catch(Core::Exception &e) { application->logf(Core::Logger::LOG_ERROR, "Can't determine daemon name: %s", e.what()); diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp index e258b89..8f6909e 100644 --- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp @@ -50,11 +50,11 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared try { ConnectionManager *connectionManager = dynamic_cast<Application&>(*getApplication()).getConnectionManager(); - boost::shared_ptr<Common::Connection> daemonCon = connectionManager->getDaemonConnection(packet->get<const std::string&>("daemon")); + boost::shared_ptr<Common::Connection> daemonCon = connectionManager->getDaemonConnection(packet->get<const Core::String&>("daemon")); boost::shared_ptr<Common::Request> request; if(type == "DaemonCommand") - request.reset(new Requests::CommandRequest(getApplication(), (packet->get<const std::string&>("command") == "reboot"))); + request.reset(new Requests::CommandRequest(getApplication(), packet->get<const Core::String&>("command").matches("reboot"))); else if(type == "DaemonFSInfo") request.reset(new Common::Requests::FSInfoRequest(getApplication())); else // type == "GetDaemonStatus" @@ -69,7 +69,7 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared ret.set("ErrorCode", e.getErrorCode()); ret.set("SubCode", e.getSubCode()); ret.set("SubSubCode", e.getSubSubCode()); - ret.set("Where", e.getWhere()); + ret.set("Where", e.getWhere().c_str()); sendPacket(ret); signalFinished(); @@ -83,7 +83,7 @@ void DaemonRequestHandlerGroup::DaemonRequestHandler::requestFinished(boost::sha ret.set("ErrorCode", error.getErrorCode()); ret.set("SubCode", error.getSubCode()); ret.set("SubSubCode", error.getSubSubCode()); - ret.set("Where", error.getWhere()); + ret.set("Where", error.getWhere().c_str()); sendPacket(ret); } @@ -101,7 +101,7 @@ DaemonRequestHandlerGroup::DaemonRequestHandlerGroup() { types.insert("GetDaemonStatus"); } -boost::shared_ptr<Common::RequestHandler> DaemonRequestHandlerGroup::createRequestHandler(Common::Application *application, const std::string &type) { +boost::shared_ptr<Common::RequestHandler> DaemonRequestHandlerGroup::createRequestHandler(Common::Application *application, const Core::String &type) { if(types.find(type) == types.end()) return boost::shared_ptr<Common::RequestHandler>(); else diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h index 48d8e2c..613e8f3 100644 --- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h +++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h @@ -35,7 +35,7 @@ class MAD_SERVER_EXPORT DaemonRequestHandlerGroup : public Common::RequestHandle private: class DaemonRequestHandler : public Common::RequestHandler { private: - std::string type; + Core::String type; void requestFinished(boost::shared_ptr<const Common::XmlData> packet, Core::Exception error); @@ -43,20 +43,20 @@ class MAD_SERVER_EXPORT DaemonRequestHandlerGroup : public Common::RequestHandle virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet); public: - DaemonRequestHandler(Common::Application *application, const std::string &type0) + DaemonRequestHandler(Common::Application *application, const Core::String &type0) : Common::RequestHandler(application), type(type0) {} }; - std::set<std::string> types; + std::set<Core::String> types; public: DaemonRequestHandlerGroup(); - virtual const std::set<std::string>& getPacketTypes() { + virtual const std::set<Core::String>& getPacketTypes() { return types; } - virtual boost::shared_ptr<Common::RequestHandler> createRequestHandler(Common::Application *application, const std::string &type); + virtual boost::shared_ptr<Common::RequestHandler> createRequestHandler(Common::Application *application, const Core::String &type); }; } diff --git a/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.cpp b/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.cpp index 05aadf8..be9cc58 100644 --- a/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.cpp +++ b/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.cpp @@ -56,11 +56,11 @@ void UserListDiffUploadRequestHandler::handlePacket(boost::shared_ptr<const Comm UserListManager *userListManager = dynamic_cast<Application*>(getApplication())->getUserListManager(); - if(name.empty()) { // Request - name = packet->get<const std::string&>("name"); + if(name.isEmpty()) { // Request + name = packet->get<const Core::String&>("name"); - if(name.empty()) - name = boost::posix_time::to_simple_string(boost::posix_time::second_clock::universal_time()); + if(name.isEmpty()) + name = boost::posix_time::to_simple_string(boost::posix_time::second_clock::universal_time()).c_str(); Common::XmlData ret; ret.setType("Continue"); diff --git a/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.h b/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.h index 3d74253..15196b5 100644 --- a/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.h +++ b/src/Server/RequestHandlers/UserListDiffUploadRequestHandler.h @@ -31,7 +31,7 @@ namespace RequestHandlers { class UserListDiffUploadRequestHandler : public Common::RequestHandler { private: - std::string name; + Core::String name; protected: virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet); diff --git a/src/Server/RequestHandlers/UserListRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserListRequestHandlerGroup.cpp index bb18194..cfe2a28 100644 --- a/src/Server/RequestHandlers/UserListRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/UserListRequestHandlerGroup.cpp @@ -31,12 +31,12 @@ void UserListRequestHandlerGroup::handleUserListListRequest(boost::shared_ptr<co if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - const std::set<std::string> &userLists = application->getUserListManager()->getUserLists(); + const std::set<Core::String> &userLists = application->getUserListManager()->getUserLists(); ret->setType("OK"); Common::XmlData::List *list = ret->createList("userLists"); - for(std::set<std::string>::const_iterator userList = userLists.begin(); userList != userLists.end(); ++userList) { + for(std::set<Core::String>::const_iterator userList = userLists.begin(); userList != userLists.end(); ++userList) { Common::XmlData::List::iterator entry = list->addEntry(); entry->set("name", *userList); @@ -48,7 +48,7 @@ void UserListRequestHandlerGroup::handleUserListDownloadRequest(boost::shared_pt if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - boost::shared_ptr<Common::UserLists::UserList> userList = application->getUserListManager()->loadUserList(packet->get<const std::string&>("name")); + boost::shared_ptr<Common::UserLists::UserList> userList = application->getUserListManager()->loadUserList(packet->get<const Core::String&>("name")); if(!userList) throw(Core::Exception(Core::Exception::NOT_FOUND)); @@ -60,7 +60,7 @@ void UserListRequestHandlerGroup::handleUserListCopyRequest(boost::shared_ptr<co if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - application->getUserListManager()->copyUserList(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName")); + application->getUserListManager()->copyUserList(packet->get<const Core::String&>("fromName"), packet->get<const Core::String&>("toName")); ret->setType("OK"); } @@ -69,7 +69,7 @@ void UserListRequestHandlerGroup::handleUserListRenameRequest(boost::shared_ptr< if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - application->getUserListManager()->renameUserList(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName")); + application->getUserListManager()->renameUserList(packet->get<const Core::String&>("fromName"), packet->get<const Core::String&>("toName")); ret->setType("OK"); } @@ -78,7 +78,7 @@ void UserListRequestHandlerGroup::handleUserListRemoveRequest(boost::shared_ptr< if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - application->getUserListManager()->removeUserList(packet->get<const std::string&>("name")); + application->getUserListManager()->removeUserList(packet->get<const Core::String&>("name")); ret->setType("OK"); } @@ -88,12 +88,12 @@ void UserListRequestHandlerGroup::handleUserListDiffListRequest(boost::shared_pt if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - const std::set<std::string> &userListDiffs = application->getUserListManager()->getUserListDiffs(); + const std::set<Core::String> &userListDiffs = application->getUserListManager()->getUserListDiffs(); ret->setType("OK"); Common::XmlData::List *list = ret->createList("userListDiffs"); - for(std::set<std::string>::const_iterator diff = userListDiffs.begin(); diff != userListDiffs.end(); ++diff) { + for(std::set<Core::String>::const_iterator diff = userListDiffs.begin(); diff != userListDiffs.end(); ++diff) { Common::XmlData::List::iterator entry = list->addEntry(); entry->set("name", *diff); @@ -105,7 +105,7 @@ void UserListRequestHandlerGroup::handleUserListDiffDownloadRequest(boost::share if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - boost::shared_ptr<Common::UserLists::UserListDiff> diff = application->getUserListManager()->loadUserListDiff(packet->get<const std::string&>("name")); + boost::shared_ptr<Common::UserLists::UserListDiff> diff = application->getUserListManager()->loadUserListDiff(packet->get<const Core::String&>("name")); if(!diff) throw(Core::Exception(Core::Exception::NOT_FOUND)); @@ -117,7 +117,7 @@ void UserListRequestHandlerGroup::handleUserListDiffCopyRequest(boost::shared_pt if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - application->getUserListManager()->copyUserListDiff(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName")); + application->getUserListManager()->copyUserListDiff(packet->get<const Core::String&>("fromName"), packet->get<const Core::String&>("toName")); ret->setType("OK"); } @@ -126,7 +126,7 @@ void UserListRequestHandlerGroup::handleUserListDiffRenameRequest(boost::shared_ if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - application->getUserListManager()->renameUserListDiff(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName")); + application->getUserListManager()->renameUserListDiff(packet->get<const Core::String&>("fromName"), packet->get<const Core::String&>("toName")); ret->setType("OK"); } @@ -135,7 +135,7 @@ void UserListRequestHandlerGroup::handleUserListDiffRemoveRequest(boost::shared_ if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - application->getUserListManager()->removeUserListDiff(packet->get<const std::string&>("name")); + application->getUserListManager()->removeUserListDiff(packet->get<const Core::String&>("name")); ret->setType("OK"); } diff --git a/src/Server/RequestHandlers/UserListUploadRequestHandler.cpp b/src/Server/RequestHandlers/UserListUploadRequestHandler.cpp index 307863a..9de6257 100644 --- a/src/Server/RequestHandlers/UserListUploadRequestHandler.cpp +++ b/src/Server/RequestHandlers/UserListUploadRequestHandler.cpp @@ -57,11 +57,11 @@ void UserListUploadRequestHandler::handlePacket(boost::shared_ptr<const Common:: UserListManager *userListManager = dynamic_cast<Application*>(getApplication())->getUserListManager(); - if(name.empty()) { // Request - name = packet->get<const std::string&>("name"); + if(name.isEmpty()) { // Request + name = packet->get<const Core::String&>("name"); - if(name.empty()) - name = boost::posix_time::to_simple_string(boost::posix_time::second_clock::universal_time()); + if(name.isEmpty()) + name = boost::posix_time::to_simple_string(boost::posix_time::second_clock::universal_time()).c_str(); Common::XmlData ret; ret.setType("Continue"); diff --git a/src/Server/RequestHandlers/UserListUploadRequestHandler.h b/src/Server/RequestHandlers/UserListUploadRequestHandler.h index 4a20a4c..46672a5 100644 --- a/src/Server/RequestHandlers/UserListUploadRequestHandler.h +++ b/src/Server/RequestHandlers/UserListUploadRequestHandler.h @@ -31,7 +31,7 @@ namespace RequestHandlers { class UserListUploadRequestHandler : public Common::RequestHandler { private: - std::string name; + Core::String name; protected: virtual void handlePacket(boost::shared_ptr<const Common::XmlData> packet); diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp index 1d99c2e..f43ec86 100644 --- a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp @@ -36,10 +36,10 @@ void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Comm boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time); - const std::string ×tr = packet->get<const std::string&>("timestamp"); - if(!timestr.empty()) { + const Core::String ×tr = packet->get<const Core::String&>("timestamp"); + if(!timestr.isEmpty()) { try { - timestamp = boost::posix_time::from_iso_string(timestr); + timestamp = boost::posix_time::from_iso_string(timestr.extract()); } catch(...) {} } @@ -49,7 +49,7 @@ void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Comm ret->setType("OK"); if(!timestamp.is_not_a_date_time()) - ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); + ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); if(users) { Common::XmlData::List *list = ret->createList("users"); @@ -72,10 +72,10 @@ void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr<const Comm boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time); - const std::string ×tr = packet->get<const std::string&>("timestamp"); - if(!timestr.empty()) { + const Core::String ×tr = packet->get<const Core::String&>("timestamp"); + if(!timestr.isEmpty()) { try { - timestamp = boost::posix_time::from_iso_string(timestr); + timestamp = boost::posix_time::from_iso_string(timestr.extract()); } catch(...) {} } @@ -86,12 +86,12 @@ void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr<const Comm if(uid) info = application->getUserManager()->getUserInfo(uid, ×tamp); else - info = application->getUserManager()->getUserInfoByName(packet->get<const std::string&>("name"), ×tamp); + info = application->getUserManager()->getUserInfoByName(packet->get<const Core::String&>("name"), ×tamp); ret->setType("OK"); if(!timestamp.is_not_a_date_time()) - ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); + ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); if(info) { ret->set("uid", info->getUid()); @@ -108,10 +108,10 @@ void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr<const boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time); - const std::string ×tr = packet->get<const std::string&>("timestamp"); - if(!timestr.empty()) { + const Core::String ×tr = packet->get<const Core::String&>("timestamp"); + if(!timestr.isEmpty()) { try { - timestamp = boost::posix_time::from_iso_string(timestr); + timestamp = boost::posix_time::from_iso_string(timestr.extract()); } catch(...) {} } @@ -121,7 +121,7 @@ void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr<const ret->setType("OK"); if(!timestamp.is_not_a_date_time()) - ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); + ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); if(groups) { Common::XmlData::List *list = ret->createList("groups"); @@ -141,10 +141,10 @@ void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Com boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time); - const std::string ×tr = packet->get<const std::string&>("timestamp"); - if(!timestr.empty()) { + const Core::String ×tr = packet->get<const Core::String&>("timestamp"); + if(!timestr.isEmpty()) { try { - timestamp = boost::posix_time::from_iso_string(timestr); + timestamp = boost::posix_time::from_iso_string(timestr.extract()); } catch(...) {} } @@ -154,7 +154,7 @@ void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Com ret->setType("OK"); if(!timestamp.is_not_a_date_time()) - ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); + ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); if(groups) { Common::XmlData::List *list = ret->createList("groups"); @@ -175,10 +175,10 @@ void UserRequestHandlerGroup::handleGroupInfoRequest(boost::shared_ptr<const Com boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time); - const std::string ×tr = packet->get<const std::string&>("timestamp"); - if(!timestr.empty()) { + const Core::String ×tr = packet->get<const Core::String&>("timestamp"); + if(!timestr.isEmpty()) { try { - timestamp = boost::posix_time::from_iso_string(timestr); + timestamp = boost::posix_time::from_iso_string(timestr.extract()); } catch(...) {} } @@ -189,12 +189,12 @@ void UserRequestHandlerGroup::handleGroupInfoRequest(boost::shared_ptr<const Com if(gid) info = application->getUserManager()->getGroupInfo(gid, ×tamp); else - info = application->getUserManager()->getGroupInfoByName(packet->get<const std::string&>("name"), ×tamp); + info = application->getUserManager()->getGroupInfoByName(packet->get<const Core::String&>("name"), ×tamp); ret->setType("OK"); if(!timestamp.is_not_a_date_time()) - ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); + ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); if(info) { ret->set("gid", info->getGid()); @@ -209,10 +209,10 @@ void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr<const boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time); - const std::string ×tr = packet->get<const std::string&>("timestamp"); - if(!timestr.empty()) { + const Core::String ×tr = packet->get<const Core::String&>("timestamp"); + if(!timestr.isEmpty()) { try { - timestamp = boost::posix_time::from_iso_string(timestr); + timestamp = boost::posix_time::from_iso_string(timestr.extract()); } catch(...) {} } @@ -222,7 +222,7 @@ void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr<const ret->setType("OK"); if(!timestamp.is_not_a_date_time()) - ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); + ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); Common::XmlData::List *list = ret->createList("users"); @@ -240,10 +240,10 @@ void UserRequestHandlerGroup::handleFullUserGroupListRequest(boost::shared_ptr<c boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time); - const std::string ×tr = packet->get<const std::string&>("timestamp"); - if(!timestr.empty()) { + const Core::String ×tr = packet->get<const Core::String&>("timestamp"); + if(!timestr.isEmpty()) { try { - timestamp = boost::posix_time::from_iso_string(timestr); + timestamp = boost::posix_time::from_iso_string(timestr.extract()); } catch(...) {} } @@ -253,7 +253,7 @@ void UserRequestHandlerGroup::handleFullUserGroupListRequest(boost::shared_ptr<c ret->setType("OK"); if(!timestamp.is_not_a_date_time()) - ret->set("timestamp", boost::posix_time::to_iso_string(timestamp)); + ret->set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); if(userGroups) { Common::XmlData::List *list = ret->createList("userGroupList"); @@ -273,9 +273,9 @@ void UserRequestHandlerGroup::handleUserInfoCheckRequest(boost::shared_ptr<const if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const std::string&>("username")); + Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const Core::String&>("username")); userInfo.setGid(packet->get<unsigned long>("gid")); - userInfo.setFullName(packet->get<const std::string&>("fullName")); + userInfo.setFullName(packet->get<const Core::String&>("fullName")); application->getUserManager()->checkUserInfo(userInfo); @@ -287,9 +287,9 @@ void UserRequestHandlerGroup::handleUserAddRequest(boost::shared_ptr<const Commo if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const std::string&>("username")); + Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const Core::String&>("username")); userInfo.setGid(packet->get<unsigned long>("gid")); - userInfo.setFullName(packet->get<const std::string&>("fullName")); + userInfo.setFullName(packet->get<const Core::String&>("fullName")); application->getUserManager()->addUser(userInfo); @@ -301,9 +301,9 @@ void UserRequestHandlerGroup::handleUserUpdateRequest(boost::shared_ptr<const Co if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const std::string&>("username")); + Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const Core::String&>("username")); userInfo.setGid(packet->get<unsigned long>("gid")); - userInfo.setFullName(packet->get<const std::string&>("fullName")); + userInfo.setFullName(packet->get<const Core::String&>("fullName")); application->getUserManager()->updateUser(packet->get<unsigned long>("origUid"), userInfo); @@ -326,7 +326,7 @@ void UserRequestHandlerGroup::handleGroupInfoCheckRequest(boost::shared_ptr<cons if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - application->getUserManager()->checkGroupInfo(Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const std::string&>("name"))); + application->getUserManager()->checkGroupInfo(Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const Core::String&>("name"))); ret->setType("OK"); } @@ -336,7 +336,7 @@ void UserRequestHandlerGroup::handleGroupAddRequest(boost::shared_ptr<const Comm if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - application->getUserManager()->addGroup(Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const std::string&>("name"))); + application->getUserManager()->addGroup(Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const Core::String&>("name"))); ret->setType("OK"); } @@ -347,7 +347,7 @@ void UserRequestHandlerGroup::handleGroupUpdateRequest(boost::shared_ptr<const C throw(Core::Exception(Core::Exception::PERMISSION)); application->getUserManager()->updateGroup(packet->get<unsigned long>("origGid"), - Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const std::string&>("name"))); + Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const Core::String&>("name"))); ret->setType("OK"); } @@ -388,7 +388,7 @@ void UserRequestHandlerGroup::handlePasswordSetRequest(boost::shared_ptr<const C if(!connection->isAuthenticated()) throw(Core::Exception(Core::Exception::PERMISSION)); - application->getUserManager()->setPassword(packet->get<unsigned long>("uid"), packet->get<const std::string&>("password")); + application->getUserManager()->setPassword(packet->get<unsigned long>("uid"), packet->get<const Core::String&>("password")); ret->setType("OK"); } |