summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Roster/RosterFileStorage.cpp')
-rw-r--r--Swiften/Roster/RosterFileStorage.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/Swiften/Roster/RosterFileStorage.cpp b/Swiften/Roster/RosterFileStorage.cpp
index de7b442..31b6c5e 100644
--- a/Swiften/Roster/RosterFileStorage.cpp
+++ b/Swiften/Roster/RosterFileStorage.cpp
@@ -6,19 +6,21 @@
#include <Swiften/Roster/RosterFileStorage.h>
-#include <boost/smart_ptr/make_shared.hpp>
+#include <Swiften/Entity/GenericPayloadPersister.h>
+#include <Swiften/Serializer/PayloadSerializers/RosterSerializer.h>
+#include <Swiften/Parser/PayloadParsers/RosterParser.h>
-namespace Swift {
+using namespace Swift;
+
+typedef GenericPayloadPersister<RosterPayload, RosterParser, RosterSerializer> RosterPersister;
RosterFileStorage::RosterFileStorage(const boost::filesystem::path& path) : path(path) {
}
-// FIXME
-void RosterFileStorage::setRoster(boost::shared_ptr<RosterPayload> r) {
- roster.reset();
- if (r) {
- roster = boost::make_shared<RosterPayload>(*r);
- }
+boost::shared_ptr<RosterPayload> RosterFileStorage::getRoster() const {
+ return RosterPersister().loadPayloadGeneric(path);
}
+void RosterFileStorage::setRoster(boost::shared_ptr<RosterPayload> roster) {
+ RosterPersister().savePayload(roster, path);
}