summaryrefslogtreecommitdiffstats
blob: 16c53c485d9e8490cecf27247eab38cf71f9e5f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "Slimber/FileVCardCollection.h"

#include <boost/filesystem/fstream.hpp>

#include "Swiften/Elements/VCard.h"
#include "Swiften/Serializer/PayloadSerializers/VCardSerializer.h"

namespace Swift {

FileVCardCollection::FileVCardCollection(boost::filesystem::path dir) : vcardsPath(dir) {
	vcard = boost::shared_ptr<VCard>(new VCard());
}

boost::shared_ptr<VCard> FileVCardCollection::getOwnVCard() const {
	return vcard;
}

void FileVCardCollection::setOwnVCard(boost::shared_ptr<VCard> v) {
	boost::filesystem::ofstream file(vcardsPath / std::string("vcard.xml"));
	file << VCardSerializer().serializePayload(v);
	file.close();
}

}