summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/HistoryController.cpp7
-rw-r--r--Swift/Controllers/HistoryController.h6
-rw-r--r--Swift/Controllers/HistoryViewController.h3
-rw-r--r--Swift/Controllers/MainController.cpp6
-rw-r--r--Swift/Controllers/Storages/FileStorages.cpp7
-rw-r--r--Swift/Controllers/Storages/FileStorages.h3
6 files changed, 19 insertions, 13 deletions
diff --git a/Swift/Controllers/HistoryController.cpp b/Swift/Controllers/HistoryController.cpp
index 6ab1235..d730236 100644
--- a/Swift/Controllers/HistoryController.cpp
+++ b/Swift/Controllers/HistoryController.cpp
@@ -5,19 +5,16 @@
*/
#include <Swift/Controllers/HistoryController.h>
-#include <Swiften/History/SQLiteHistoryManager.h>
+#include <Swiften/History/HistoryStorage.h>
#include <Swiften/History/HistoryMessage.h>
#include <boost/date_time/c_local_time_adjustor.hpp>
namespace Swift {
-HistoryController::HistoryController() : remoteArchiveSupported_(false) {
- std::string file("testDB.db");
- localHistory_ = new SQLiteHistoryManager(file);
+HistoryController::HistoryController(HistoryStorage* localHistoryStorage) : localHistory_(localHistoryStorage) {
}
HistoryController::~HistoryController() {
- delete localHistory_;
}
void HistoryController::addMessage(const std::string& message, const JID& fromJID, const JID& toJID, HistoryMessage::Type type, const boost::posix_time::ptime& timeStamp) {
diff --git a/Swift/Controllers/HistoryController.h b/Swift/Controllers/HistoryController.h
index f231724..8c86409 100644
--- a/Swift/Controllers/HistoryController.h
+++ b/Swift/Controllers/HistoryController.h
@@ -12,14 +12,14 @@
#include <set>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/History/HistoryMessage.h>
-#include <Swiften/History/HistoryManager.h>
+#include <Swiften/History/HistoryStorage.h>
namespace Swift {
class JID;
class HistoryController {
public:
- HistoryController();
+ HistoryController(HistoryStorage* localHistoryStorage);
~HistoryController();
void addMessage(const std::string& message, const JID& fromJID, const JID& toJID, HistoryMessage::Type type, const boost::posix_time::ptime& timeStamp);
@@ -34,7 +34,7 @@ namespace Swift {
boost::signal<void (const HistoryMessage&)> onNewMessage;
private:
- HistoryManager* localHistory_;
+ HistoryStorage* localHistory_;
bool remoteArchiveSupported_;
};
}
diff --git a/Swift/Controllers/HistoryViewController.h b/Swift/Controllers/HistoryViewController.h
index 283254d..f44c968 100644
--- a/Swift/Controllers/HistoryViewController.h
+++ b/Swift/Controllers/HistoryViewController.h
@@ -11,9 +11,9 @@
#include <boost/shared_ptr.hpp>
#include <Swift/Controllers/UIEvents/UIEventStream.h>
-#include <Swiften/History/HistoryManager.h>
#include <Swiften/JID/JID.h>
#include <Swiften/Presence/PresenceOracle.h>
+#include <Swiften/History/HistoryStorage.h>
#include <set>
namespace Swift {
@@ -25,7 +25,6 @@ namespace Swift {
class HistoryController;
class NickResolver;
class AvatarManager;
- class HistoryMessage;
class HistoryViewController {
public:
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 9ac97f4..2955cee 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -172,7 +172,6 @@ MainController::MainController(
idleDetector_->onIdleChanged.connect(boost::bind(&MainController::handleInputIdleChanged, this, _1));
xmlConsoleController_ = new XMLConsoleController(uiEventStream_, uiFactory_);
- historyController_ = new HistoryController();
fileTransferListController_ = new FileTransferListController(uiEventStream_, uiFactory_);
@@ -197,7 +196,6 @@ MainController::~MainController() {
resetClient();
delete fileTransferListController_;
delete xmlConsoleController_;
- delete historyController_;
delete xmppURIController_;
delete soundEventController_;
delete systemTrayController_;
@@ -223,6 +221,8 @@ void MainController::resetClient() {
eventWindowController_ = NULL;
delete chatsManager_;
chatsManager_ = NULL;
+ delete historyController_;
+ historyController_ = NULL;
delete historyViewController_;
historyViewController_ = NULL;
delete ftOverview_;
@@ -301,9 +301,9 @@ void MainController::handleConnected() {
* want to have the user's nick available and this means it will
* be before they receive stanzas that need it (e.g. bookmarks).*/
client_->getVCardManager()->requestOwnVCard();
+ historyController_ = new HistoryController(storages_->getHistoryStorage());
chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_, client_->getRoster(), !settings_->getSetting(SettingConstants::REMEMBER_RECENT_CHATS), settings_, historyController_);
-
historyViewController_ = new HistoryViewController(jid_, uiEventStream_, historyController_, client_->getNickResolver(), client_->getAvatarManager(), client_->getPresenceOracle(), uiFactory_);
client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1));
diff --git a/Swift/Controllers/Storages/FileStorages.cpp b/Swift/Controllers/Storages/FileStorages.cpp
index 6447099..27c245d 100644
--- a/Swift/Controllers/Storages/FileStorages.cpp
+++ b/Swift/Controllers/Storages/FileStorages.cpp
@@ -9,6 +9,7 @@
#include "Swift/Controllers/Storages/AvatarFileStorage.h"
#include "Swift/Controllers/Storages/CapsFileStorage.h"
#include "Swift/Controllers/Storages/RosterFileStorage.h"
+#include <Swiften/History/SQLiteHistoryStorage.h>
namespace Swift {
@@ -18,6 +19,7 @@ FileStorages::FileStorages(const boost::filesystem::path& baseDir, const JID& ji
capsStorage = new CapsFileStorage(baseDir / "caps");
avatarStorage = new AvatarFileStorage(baseDir / "avatars", baseDir / profile / "avatars");
rosterStorage = new RosterFileStorage(baseDir / profile / "roster.xml");
+ historyStorage = new SQLiteHistoryStorage((baseDir / "history.db").string());
}
FileStorages::~FileStorages() {
@@ -25,6 +27,7 @@ FileStorages::~FileStorages() {
delete avatarStorage;
delete capsStorage;
delete vcardStorage;
+ delete historyStorage;
}
VCardStorage* FileStorages::getVCardStorage() const {
@@ -43,4 +46,8 @@ RosterStorage* FileStorages::getRosterStorage() const {
return rosterStorage;
}
+HistoryStorage* FileStorages::getHistoryStorage() const {
+ return historyStorage;
+}
+
}
diff --git a/Swift/Controllers/Storages/FileStorages.h b/Swift/Controllers/Storages/FileStorages.h
index 28df314..5e89db8 100644
--- a/Swift/Controllers/Storages/FileStorages.h
+++ b/Swift/Controllers/Storages/FileStorages.h
@@ -15,6 +15,7 @@ namespace Swift {
class AvatarFileStorage;
class CapsFileStorage;
class RosterFileStorage;
+ class HistoryStorage;
class JID;
/**
@@ -43,11 +44,13 @@ namespace Swift {
virtual AvatarStorage* getAvatarStorage() const;
virtual CapsStorage* getCapsStorage() const;
virtual RosterStorage* getRosterStorage() const;
+ virtual HistoryStorage* getHistoryStorage() const;
private:
VCardFileStorage* vcardStorage;
AvatarFileStorage* avatarStorage;
CapsFileStorage* capsStorage;
RosterFileStorage* rosterStorage;
+ HistoryStorage* historyStorage;
};
}