summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Badea <catalin.badea392@gmail.com>2012-06-27 12:02:47 (GMT)
committerCătălin Badea <catalin.badea392@gmail.com>2012-08-11 15:52:56 (GMT)
commitfc40104bf6e6d915561f95015e0b5617d97880e4 (patch)
treebbe91142e4c4dfcdaf32d4041694a8834a6683d8 /Swift/Controllers/HistoryController.cpp
parent9f11ec4954b7c860623c799827e73c40e73acfac (diff)
downloadswift-contrib-fc40104bf6e6d915561f95015e0b5617d97880e4.zip
swift-contrib-fc40104bf6e6d915561f95015e0b5617d97880e4.tar.bz2
Log messages to the sqlite db and dump all messages in the history viewer
Diffstat (limited to 'Swift/Controllers/HistoryController.cpp')
-rw-r--r--Swift/Controllers/HistoryController.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/Swift/Controllers/HistoryController.cpp b/Swift/Controllers/HistoryController.cpp
index a19e321..c82892a 100644
--- a/Swift/Controllers/HistoryController.cpp
+++ b/Swift/Controllers/HistoryController.cpp
@@ -6,19 +6,26 @@
#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_;
- }
+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 JID& toJID, std::string messageBody, boost::posix_time::ptime timeStamp) {
- std::cout << baseJID << " " << fromJID << " " << toJID << " " << messageBody << " " << to_simple_string(timeStamp);
- }
+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 {
+ return localHistory_->getMessages();
+}
}