From a7a285eb61dd83afc892bc1d64ffe14b9f1426a3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 27 Sep 2009 23:51:34 +0200 Subject: Completely migrate to Unicode String class --- src/Common/Backends/NetworkUserBackend.cpp | 75 ++++++++++++------------------ 1 file changed, 30 insertions(+), 45 deletions(-) (limited to 'src/Common/Backends') diff --git a/src/Common/Backends/NetworkUserBackend.cpp b/src/Common/Backends/NetworkUserBackend.cpp index 87d9b4f..f46f588 100644 --- a/src/Common/Backends/NetworkUserBackend.cpp +++ b/src/Common/Backends/NetworkUserBackend.cpp @@ -31,9 +31,7 @@ const Core::String NetworkUserBackend::name("NetworkUserBackend"); void NetworkUserBackend::SimpleUserRequest::sendRequest() { XmlData packet; packet.setType(type); - - if(!timestamp.is_not_a_date_time()) - packet.set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); + packet.set("timestamp", timestamp); sendPacket(packet); } @@ -42,9 +40,7 @@ void NetworkUserBackend::IdUserRequest::sendRequest() { XmlData packet; packet.setType(type); packet.set(idType, id); - - if(!timestamp.is_not_a_date_time()) - packet.set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); + packet.set("timestamp", timestamp); sendPacket(packet); } @@ -53,9 +49,7 @@ void NetworkUserBackend::NameUserRequest::sendRequest() { XmlData packet; packet.setType(type); packet.set("name", name); - - if(!timestamp.is_not_a_date_time()) - packet.set("timestamp", boost::posix_time::to_iso_string(timestamp).c_str()); + packet.set("timestamp", timestamp); sendPacket(packet); } @@ -137,10 +131,9 @@ boost::shared_ptr > NetworkUserBackend:: throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } const XmlData::List *users = result.first->getList("users"); @@ -173,10 +166,9 @@ boost::shared_ptr NetworkUserBackend::getUserInfo(unsigned long throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } unsigned long uid2 = result.first->get("uid"); @@ -205,10 +197,9 @@ boost::shared_ptr NetworkUserBackend::getUserInfoByName(const Co throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } unsigned long uid = result.first->get("uid"); @@ -237,10 +228,9 @@ boost::shared_ptr > NetworkUserBackend::getUserGro throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } const XmlData::List *groups = result.first->getList("groups"); @@ -269,10 +259,9 @@ boost::shared_ptr > NetworkUserBackend: throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } const XmlData::List *groups = result.first->getList("groups"); @@ -302,10 +291,9 @@ boost::shared_ptr NetworkUserBackend::getGroupInfo(unsigned lon throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } unsigned long gid2 = result.first->get("gid"); @@ -328,10 +316,9 @@ boost::shared_ptr NetworkUserBackend::getGroupInfoByName(const throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } unsigned long gid = result.first->get("gid"); @@ -354,10 +341,9 @@ boost::shared_ptr > NetworkUserBackend::getGroupUs throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } const XmlData::List *users = result.first->getList("users"); @@ -386,10 +372,9 @@ boost::shared_ptr > NetworkUse throw result.second; if(timestamp) { - try { - *timestamp = boost::posix_time::from_iso_string(result.first->get("timestamp").extract()); - } - catch(...) {} + boost::posix_time::ptime t = result.first->get("timestamp"); + if(!t.is_not_a_date_time()) + *timestamp = t; } const XmlData::List *list = result.first->getList("userGroupList"); -- cgit v1.2.3