summaryrefslogtreecommitdiffstats
blob: 63d4690354c3d78d1dccf1b794dc53383c9e14c1 (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
25
26
27
28
29
30
31
32
33
34
35
/*
 * Copyright (c) 2012 Catalin Badea
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

#include <Swift/Controllers/HistoryController.h>
#include <Swiften/History/SQLiteHistoryManager.h>
#include <Swiften/History/HistoryMessage.h>

namespace Swift {

HistoryController::HistoryController() : remoteArchiveSupported_(false) {
	std::string file("testDB.db");
	localHistory_ = new SQLiteHistoryManager(file);
}

HistoryController::~HistoryController() {
	delete localHistory_;
}

void HistoryController::addMessage(const JID& baseJID, const JID& fromJID, const std::string& displayNick, const std::string& messageBody, boost::posix_time::ptime timeStamp) {
	HistoryMessage message(messageBody, baseJID, fromJID, displayNick, timeStamp);
	localHistory_->addMessage(message);
}

std::vector<HistoryMessage> HistoryController::getMessages(const JID& baseJID) const {
	return localHistory_->getMessages(baseJID);
}

std::vector<JID> HistoryController::getAllContacts() const {
	return localHistory_->getAllContacts();
}

}