diff options
author | Cătălin Badea <catalin.badea392@gmail.com> | 2012-08-21 17:45:40 (GMT) |
---|---|---|
committer | Cătălin Badea <catalin.badea392@gmail.com> | 2012-08-21 17:46:49 (GMT) |
commit | 8539b9f1ef656147196ae57a3403b321d1032513 (patch) | |
tree | 99525b4b746a9e71a0e811b70e7c49be86ee9521 /Swift | |
parent | e5548caf08dbb4fe4208a23ece9e8e9e0667a8dd (diff) | |
download | swift-contrib-catalinb/history2.zip swift-contrib-catalinb/history2.tar.bz2 |
Add experimental flags.catalinb/history2
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 7 | ||||
-rw-r--r-- | Swift/Controllers/MainController.cpp | 10 | ||||
-rw-r--r-- | Swift/Controllers/Storages/FileStorages.cpp | 8 | ||||
-rw-r--r-- | Swift/QtUI/QtChatView.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindow.cpp | 2 |
6 files changed, 26 insertions, 7 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 } } diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index cc5119f..eaec3b6 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -66,10 +66,6 @@ QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent, bool disableAutoScro viewReady_ = false; isAtBottom_ = true; resetView(); - - if (disableAutoScroll) { - webPage_->mainFrame()->evaluateJavaScript("var disableAutoScroll = true;"); - } } void QtChatView::handleClearRequested() { diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index 7ec0c93..ced375f 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -123,9 +123,11 @@ QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStr QAction* joinMUCAction = new QAction(tr("Enter &Room…"), this); connect(joinMUCAction, SIGNAL(triggered()), SLOT(handleJoinMUCAction())); actionsMenu->addAction(joinMUCAction); +#ifdef SWIFT_EXPERIMENTAL_HISTORY QAction* viewLogsAction = new QAction(tr("&View History…"), this); connect(viewLogsAction, SIGNAL(triggered()), SLOT(handleViewLogsAction())); actionsMenu->addAction(viewLogsAction); +#endif addUserAction_ = new QAction(tr("&Add Contact…"), this); connect(addUserAction_, SIGNAL(triggered(bool)), this, SLOT(handleAddUserActionTriggered(bool))); actionsMenu->addAction(addUserAction_); |