diff options
author | Catalin Badea <catalin.badea392@gmail.com> | 2012-06-26 09:51:15 (GMT) |
---|---|---|
committer | Cătălin Badea <catalin.badea392@gmail.com> | 2012-08-11 15:52:56 (GMT) |
commit | 9f11ec4954b7c860623c799827e73c40e73acfac (patch) | |
tree | 16121a3d52854d21d7467c4819b35f4e225c2fb5 /Swift | |
parent | 39dfd6c2068e3d6850f607fd400031203b846e57 (diff) | |
download | swift-contrib-9f11ec4954b7c860623c799827e73c40e73acfac.zip swift-contrib-9f11ec4954b7c860623c799827e73c40e73acfac.tar.bz2 |
Added SqliteManager to build. not working
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 8 | ||||
-rw-r--r-- | Swift/Controllers/HistoryController.cpp | 17 | ||||
-rw-r--r-- | Swift/Controllers/HistoryController.h | 12 | ||||
-rw-r--r-- | Swift/Controllers/MainController.cpp | 1 |
4 files changed, 34 insertions, 4 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index 40e703a..f17e7c4 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -134,8 +134,9 @@ void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool } } preSendMessageRequest(message); + + boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time(); if (useDelayForLatency_) { - boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time(); message->addPayload(boost::make_shared<Delay>(now, selfJID_)); } if (isCorrectionMessage) { @@ -145,6 +146,9 @@ void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool stanzaChannel_->sendMessage(message); postSendMessage(message->getBody(), boost::dynamic_pointer_cast<Stanza>(message)); onActivity(message->getBody()); + + // log message + historyController_->addMessage(getBaseJID(), selfJID_, toJID_, body, now); } void ChatControllerBase::handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog> catalog, ErrorPayload::ref error) { @@ -251,6 +255,8 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m } else { lastMessagesUIID_[from] = addMessage(body, senderDisplayNameFromMessage(from), isIncomingMessageFromMe(message), label, std::string(avatarManager_->getAvatarPath(from).string()), timeStamp); + // void HistoryController::addMessage(const JID& baseJID, const JID& fromJID, const JID& toJID, std::string messageBody, boost::posix_time::ptime timeStamp) { + historyController_->addMessage(getBaseJID(), from, message->getTo(), body, timeStamp); } } chatWindow_->show(); diff --git a/Swift/Controllers/HistoryController.cpp b/Swift/Controllers/HistoryController.cpp index f04fceb..a19e321 100644 --- a/Swift/Controllers/HistoryController.cpp +++ b/Swift/Controllers/HistoryController.cpp @@ -5,9 +5,20 @@ */ #include <Swift/Controllers/HistoryController.h> - -#include <Swift/Controllers/UIInterfaces/HistoryWindowFactory.h> -#include <Swift/Controllers/UIEvents/RequestHistoryUIEvent.h> +#include <Swiften/History/SQLiteHistoryManager.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 JID& toJID, std::string messageBody, boost::posix_time::ptime timeStamp) { + std::cout << baseJID << " " << fromJID << " " << toJID << " " << messageBody << " " << to_simple_string(timeStamp); + } + } diff --git a/Swift/Controllers/HistoryController.h b/Swift/Controllers/HistoryController.h index dedf840..9949c19 100644 --- a/Swift/Controllers/HistoryController.h +++ b/Swift/Controllers/HistoryController.h @@ -7,9 +7,21 @@ #pragma once #include <Swiften/JID/JID.h> +#include <boost/date_time/posix_time/posix_time.hpp> namespace Swift { + class HistoryManager; + class JID; class HistoryController { + public: + HistoryController(); + ~HistoryController(); + + void addMessage(const JID& baseJID, const JID& fromJID, const JID& toJID, std::string messageBody, boost::posix_time::ptime timeStamp); + + private: + HistoryManager* localHistory_; + bool remoteArchiveSupported_; }; } diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index abaeea5..793e72f 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -198,6 +198,7 @@ MainController::~MainController() { delete fileTransferListController_; delete xmlConsoleController_; delete historyController_; + delete historyViewController_; delete xmppURIController_; delete soundEventController_; delete systemTrayController_; |