summaryrefslogtreecommitdiffstats
path: root/src/Common/UserLists/Util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/UserLists/Util.cpp')
-rw-r--r--src/Common/UserLists/Util.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/Common/UserLists/Util.cpp b/src/Common/UserLists/Util.cpp
index cf04218..483383e 100644
--- a/src/Common/UserLists/Util.cpp
+++ b/src/Common/UserLists/Util.cpp
@@ -77,9 +77,13 @@ void Util::serializeUserListDiff(const UserListDiff *diff, XmlData *data) {
for(std::set<UserListEntry>::const_iterator user = diff->getDeletedUsers().begin(); user != diff->getDeletedUsers().end(); ++user)
serializeUserListEntry(&*user, userList->addEntry());
- userList = data->createList("unchangedUsers");
- for(std::set<UserListEntry>::const_iterator user = diff->getUnchangedUsers().begin(); user != diff->getUnchangedUsers().end(); ++user)
- serializeUserListEntry(&*user, userList->addEntry());
+ userList = data->createList("updatedUsers");
+ const UserListDiff::EntryListMap::left_map &updatedUsers = diff->getUpdatedUsers().left;
+ for(UserListDiff::EntryListMap::left_const_iterator user = updatedUsers.begin(); user != updatedUsers.end(); ++user) {
+ XmlData::List *entryList = userList->addEntry()->createList("entry");
+ serializeUserListEntry(&user->first, entryList->addEntry());
+ serializeUserListEntry(&user->second, entryList->addEntry());
+ }
}
boost::shared_ptr<UserListDiff> Util::deserializeUserListDiff(const XmlData *data) {
@@ -97,10 +101,15 @@ boost::shared_ptr<UserListDiff> Util::deserializeUserListDiff(const XmlData *dat
diff->insertDeletedUser(deserializeUserListEntry(user));
}
- userList = data->getList("unchangedUsers");
+ userList = data->getList("updatedUsers");
if(userList) {
- for(XmlData::List::const_iterator user = userList->begin(); user != userList->end(); ++user)
- diff->insertUnchangedUser(deserializeUserListEntry(user));
+ for(XmlData::List::const_iterator user = userList->begin(); user != userList->end(); ++user) {
+ const XmlData::List *entryList = user->getList("entry");
+ if(entryList->getSize() != 2)
+ continue;
+
+ diff->insertUpdatedUser(deserializeUserListEntry(entryList->begin()), deserializeUserListEntry(entryList->begin()+1));
+ }
}
return diff;