summaryrefslogtreecommitdiffstats
path: root/src/Common/Backends
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/Backends')
-rw-r--r--src/Common/Backends/NetworkUserBackend.cpp75
1 files changed, 30 insertions, 45 deletions
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<const std::map<unsigned long, UserInfo> > NetworkUserBackend::
throw result.second;
if(timestamp) {
- try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
- }
- catch(...) {}
+ boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("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<const UserInfo> NetworkUserBackend::getUserInfo(unsigned long
throw result.second;
if(timestamp) {
- try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
- }
- catch(...) {}
+ boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp");
+ if(!t.is_not_a_date_time())
+ *timestamp = t;
}
unsigned long uid2 = result.first->get<unsigned long>("uid");
@@ -205,10 +197,9 @@ boost::shared_ptr<const UserInfo> NetworkUserBackend::getUserInfoByName(const Co
throw result.second;
if(timestamp) {
- try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
- }
- catch(...) {}
+ boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp");
+ if(!t.is_not_a_date_time())
+ *timestamp = t;
}
unsigned long uid = result.first->get<unsigned long>("uid");
@@ -237,10 +228,9 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getUserGro
throw result.second;
if(timestamp) {
- try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
- }
- catch(...) {}
+ boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("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<const std::map<unsigned long, GroupInfo> > NetworkUserBackend:
throw result.second;
if(timestamp) {
- try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
- }
- catch(...) {}
+ boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("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<const GroupInfo> NetworkUserBackend::getGroupInfo(unsigned lon
throw result.second;
if(timestamp) {
- try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
- }
- catch(...) {}
+ boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp");
+ if(!t.is_not_a_date_time())
+ *timestamp = t;
}
unsigned long gid2 = result.first->get<unsigned long>("gid");
@@ -328,10 +316,9 @@ boost::shared_ptr<const GroupInfo> NetworkUserBackend::getGroupInfoByName(const
throw result.second;
if(timestamp) {
- try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
- }
- catch(...) {}
+ boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp");
+ if(!t.is_not_a_date_time())
+ *timestamp = t;
}
unsigned long gid = result.first->get<unsigned long>("gid");
@@ -354,10 +341,9 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getGroupUs
throw result.second;
if(timestamp) {
- try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
- }
- catch(...) {}
+ boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("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<const std::multimap<unsigned long, unsigned long> > NetworkUse
throw result.second;
if(timestamp) {
- try {
- *timestamp = boost::posix_time::from_iso_string(result.first->get<const Core::String&>("timestamp").extract());
- }
- catch(...) {}
+ boost::posix_time::ptime t = result.first->get<boost::posix_time::ptime>("timestamp");
+ if(!t.is_not_a_date_time())
+ *timestamp = t;
}
const XmlData::List *list = result.first->getList("userGroupList");