summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCătălin Badea <catalin.badea392@gmail.com>2012-08-21 17:45:40 (GMT)
committerCătălin Badea <catalin.badea392@gmail.com>2012-08-21 17:46:49 (GMT)
commit8539b9f1ef656147196ae57a3403b321d1032513 (patch)
tree99525b4b746a9e71a0e811b70e7c49be86ee9521 /Swift/Controllers
parente5548caf08dbb4fe4208a23ece9e8e9e0667a8dd (diff)
downloadswift-contrib-catalinb/history2.zip
swift-contrib-catalinb/history2.tar.bz2
Add experimental flags.catalinb/history2
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp2
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp7
-rw-r--r--Swift/Controllers/MainController.cpp10
-rw-r--r--Swift/Controllers/Storages/FileStorages.cpp8
4 files changed, 24 insertions, 3 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp
index 754401b..b5fe0c0 100644
--- a/Swift/Controllers/Chat/ChatControllerBase.cpp
+++ b/Swift/Controllers/Chat/ChatControllerBase.cpp
@@ -146,7 +146,9 @@ void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool
postSendMessage(message->getBody(), boost::dynamic_pointer_cast<Stanza>(message));
onActivity(message->getBody());
+#ifdef SWIFT_EXPERIMENTAL_HISTORY
logMessage(body, selfJID_, toJID_, now, false);
+#endif
}
void ChatControllerBase::handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog> catalog, ErrorPayload::ref error) {
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index b2ba871..fcd1f04 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -195,11 +195,14 @@ void MUCController::rejoin() {
muc_->setPassword(*password_);
}
//FIXME: check for received activity
+#ifdef SWIFT_EXPERIMENTAL_HISTORY
if (lastActivity_ == boost::posix_time::not_a_date_time && historyController_) {
lastActivity_ = historyController_->getLastTimeStampFromMUC(selfJID_, toJID_);
}
-
muc_->joinWithContextSince(nick_, lastActivity_);
+#else
+ muc_->joinAs(nick_);
+#endif
}
}
@@ -276,7 +279,9 @@ void MUCController::handleJoinComplete(const std::string& nick) {
nick_ = nick;
chatWindow_->addSystemMessage(joinMessage);
+#ifdef SWIFT_EXPERIMENTAL_HISTORY
addRecentLogs();
+#endif
clearPresenceQueue();
shouldJoinOnReconnect_ = true;
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 2955cee..2c02ba8 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -221,10 +221,12 @@ void MainController::resetClient() {
eventWindowController_ = NULL;
delete chatsManager_;
chatsManager_ = NULL;
+#ifdef SWIFT_EXPERIMENTAL_HISTORY
delete historyController_;
historyController_ = NULL;
delete historyViewController_;
historyViewController_ = NULL;
+#endif
delete ftOverview_;
ftOverview_ = NULL;
delete rosterController_;
@@ -301,10 +303,14 @@ 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_);
+#ifdef SWIFT_EXPERIMENTAL_HISTORY
+ historyController_ = new HistoryController(storages_->getHistoryStorage());
historyViewController_ = new HistoryViewController(jid_, uiEventStream_, historyController_, client_->getNickResolver(), client_->getAvatarManager(), client_->getPresenceOracle(), uiFactory_);
+ 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_);
+#else
+ 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_, NULL);
+#endif
client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1));
chatsManager_->setAvatarManager(client_->getAvatarManager());
diff --git a/Swift/Controllers/Storages/FileStorages.cpp b/Swift/Controllers/Storages/FileStorages.cpp
index 27c245d..cff87d3 100644
--- a/Swift/Controllers/Storages/FileStorages.cpp
+++ b/Swift/Controllers/Storages/FileStorages.cpp
@@ -19,7 +19,9 @@ 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");
+#ifdef SWIFT_EXPERIMENTAL_HISTORY
historyStorage = new SQLiteHistoryStorage((baseDir / "history.db").string());
+#endif
}
FileStorages::~FileStorages() {
@@ -27,7 +29,9 @@ FileStorages::~FileStorages() {
delete avatarStorage;
delete capsStorage;
delete vcardStorage;
+#ifdef SWIFT_EXPERIMENTAL_HISTORY
delete historyStorage;
+#endif
}
VCardStorage* FileStorages::getVCardStorage() const {
@@ -47,7 +51,11 @@ RosterStorage* FileStorages::getRosterStorage() const {
}
HistoryStorage* FileStorages::getHistoryStorage() const {
+#ifdef SWIFT_EXPERIMENTAL_HISTORY
return historyStorage;
+#else
+ return NULL;
+#endif
}
}