summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanos Doukoudakis <thanos.doukoudakis@isode.com>2018-07-19 17:13:55 (GMT)
committerKevin Smith <git@kismith.co.uk>2018-07-19 18:40:10 (GMT)
commit5b4a0ba19ae6994db6a193a231fd2486bff6f0ec (patch)
treeeb5616c9977d0a76c0442879fce4cdc023e19c4e
parentcc4bdf756f3e9f9451231d59d2b5dcacd1af6d1e (diff)
downloadswift-5b4a0ba19ae6994db6a193a231fd2486bff6f0ec.zip
swift-5b4a0ba19ae6994db6a193a231fd2486bff6f0ec.tar.bz2
Rename MainController to AccountController
Change-Id: I9c006a2435294f2afb95a95bd856ad64274a8752 Test-Information: None.
-rw-r--r--Swift/Controllers/AccountController.cpp (renamed from Swift/Controllers/MainController.cpp)96
-rw-r--r--Swift/Controllers/AccountController.h (renamed from Swift/Controllers/MainController.h)6
-rw-r--r--Swift/Controllers/SConscript2
-rw-r--r--Swift/QtUI/QtSwift.cpp10
-rw-r--r--Swift/QtUI/QtSwift.h4
5 files changed, 59 insertions, 59 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/AccountController.cpp
index 91140c2..048d140 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/AccountController.cpp
@@ -4,7 +4,7 @@
* See the COPYING file for more information.
*/
-#include <Swift/Controllers/MainController.h>
+#include <Swift/Controllers/AccountController.h>
#include <cstdlib>
#include <memory>
@@ -99,7 +99,7 @@ static const std::string CLIENT_NAME = "Swift";
static const std::string CLIENT_NODE = "http://swift.im";
-MainController::MainController(
+AccountController::AccountController(
EventLoop* eventLoop,
NetworkFactories* networkFactories,
UIFactory* uiFactories,
@@ -160,7 +160,7 @@ MainController::MainController(
notifier_ = new TogglableNotifier(notifier);
notifier_->setPersistentEnabled(settings_->getSetting(SettingConstants::SHOW_NOTIFICATIONS));
eventController_ = new EventController();
- eventController_->onEventQueueLengthChange.connect(boost::bind(&MainController::handleEventQueueLengthChange, this, _1));
+ eventController_->onEventQueueLengthChange.connect(boost::bind(&AccountController::handleEventQueueLengthChange, this, _1));
systemTrayController_ = new SystemTrayController(eventController_, systemTray);
loginWindow_ = uiFactory_->createLoginWindow(uiEventStream_);
@@ -173,24 +173,24 @@ MainController::MainController(
xmppURIController_ = new XMPPURIController(uriHandler_, uiEventStream_);
- loginWindow_->onLoginRequest.connect(boost::bind(&MainController::handleLoginRequest, this, _1, _2, _3, _4, _5, _6, _7));
- loginWindow_->onPurgeSavedLoginRequest.connect(boost::bind(&MainController::handlePurgeSavedLoginRequest, this, _1));
- loginWindow_->onCancelLoginRequest.connect(boost::bind(&MainController::handleCancelLoginRequest, this));
- loginWindow_->onQuitRequest.connect(boost::bind(&MainController::handleQuitRequest, this));
+ loginWindow_->onLoginRequest.connect(boost::bind(&AccountController::handleLoginRequest, this, _1, _2, _3, _4, _5, _6, _7));
+ loginWindow_->onPurgeSavedLoginRequest.connect(boost::bind(&AccountController::handlePurgeSavedLoginRequest, this, _1));
+ loginWindow_->onCancelLoginRequest.connect(boost::bind(&AccountController::handleCancelLoginRequest, this));
+ loginWindow_->onQuitRequest.connect(boost::bind(&AccountController::handleQuitRequest, this));
idleDetector_->setIdleTimeSeconds(settings->getSetting(SettingConstants::IDLE_TIMEOUT));
- idleDetector_->onIdleChanged.connect(boost::bind(&MainController::handleInputIdleChanged, this, _1));
+ idleDetector_->onIdleChanged.connect(boost::bind(&AccountController::handleInputIdleChanged, this, _1));
xmlConsoleController_ = new XMLConsoleController(uiEventStream_, uiFactory_);
fileTransferListController_ = new FileTransferListController(uiEventStream_, uiFactory_);
- settings_->onSettingChanged.connect(boost::bind(&MainController::handleSettingChanged, this, _1));
+ settings_->onSettingChanged.connect(boost::bind(&AccountController::handleSettingChanged, this, _1));
}
-MainController::~MainController() {
- idleDetector_->onIdleChanged.disconnect(boost::bind(&MainController::handleInputIdleChanged, this, _1));
+AccountController::~AccountController() {
+ idleDetector_->onIdleChanged.disconnect(boost::bind(&AccountController::handleInputIdleChanged, this, _1));
purgeCachedCredentials();
//setManagersOffline();
@@ -209,11 +209,11 @@ MainController::~MainController() {
delete uiEventStream_;
}
-void MainController::purgeCachedCredentials() {
+void AccountController::purgeCachedCredentials() {
safeClear(password_);
}
-void MainController::resetClient() {
+void AccountController::resetClient() {
purgeCachedCredentials();
resetCurrentError();
resetPendingReconnects();
@@ -275,13 +275,13 @@ void MainController::resetClient() {
clientInitialized_ = false;
}
-void MainController::handleSettingChanged(const std::string& settingPath) {
+void AccountController::handleSettingChanged(const std::string& settingPath) {
if (settingPath == SettingConstants::SHOW_NOTIFICATIONS.getKey()) {
notifier_->setPersistentEnabled(settings_->getSetting(SettingConstants::SHOW_NOTIFICATIONS));
}
}
-void MainController::resetPendingReconnects() {
+void AccountController::resetPendingReconnects() {
timeBeforeNextReconnect_ = -1;
if (reconnectTimer_) {
reconnectTimer_->stop();
@@ -290,14 +290,14 @@ void MainController::resetPendingReconnects() {
resetCurrentError();
}
-void MainController::resetCurrentError() {
+void AccountController::resetCurrentError() {
if (lastDisconnectError_) {
lastDisconnectError_->conclude();
lastDisconnectError_ = std::shared_ptr<ErrorEvent>();
}
}
-void MainController::handleConnected() {
+void AccountController::handleConnected() {
boundJID_ = client_->getJID();
resetCurrentError();
resetPendingReconnects();
@@ -315,9 +315,9 @@ void MainController::handleConnected() {
fileTransferListController_->setFileTransferOverview(ftOverview_);
chattables_ = std::make_unique<Chattables>();
rosterController_ = new RosterController(boundJID_, client_->getRoster(), client_->getAvatarManager(), uiFactory_, client_->getNickManager(), client_->getNickResolver(), client_->getPresenceOracle(), client_->getSubscriptionManager(), eventController_, uiEventStream_, client_->getIQRouter(), settings_, client_->getEntityCapsProvider(), client_->getClientBlockListManager(), client_->getVCardManager(), *chattables_);
- rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2));
- rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this));
- rosterController_->getWindow()->onShowCertificateRequest.connect(boost::bind(&MainController::handleShowCertificateRequest, this));
+ rosterController_->onChangeStatusRequest.connect(boost::bind(&AccountController::handleChangeStatusRequest, this, _1, _2));
+ rosterController_->onSignOutRequest.connect(boost::bind(&AccountController::signOut, this));
+ rosterController_->getWindow()->onShowCertificateRequest.connect(boost::bind(&AccountController::handleShowCertificateRequest, this));
blockListController_ = new BlockListController(client_->getClientBlockListManager(), uiEventStream_, uiFactory_, eventController_);
@@ -382,7 +382,7 @@ void MainController::handleConnected() {
client_->requestRoster();
GetDiscoInfoRequest::ref discoInfoRequest = GetDiscoInfoRequest::create(JID(boundJID_.getDomain()), client_->getIQRouter());
- discoInfoRequest->onResponse.connect(boost::bind(&MainController::handleServerDiscoInfoResponse, this, _1, _2));
+ discoInfoRequest->onResponse.connect(boost::bind(&AccountController::handleServerDiscoInfoResponse, this, _1, _2));
discoInfoRequest->send();
client_->getVCardManager()->requestOwnVCard();
@@ -401,18 +401,18 @@ void MainController::handleConnected() {
adHocManager_->setOnline(true);
}
-void MainController::handleEventQueueLengthChange(int count) {
+void AccountController::handleEventQueueLengthChange(int count) {
dock_->setNumberOfPendingMessages(count);
}
-void MainController::reconnectAfterError() {
+void AccountController::reconnectAfterError() {
if (reconnectTimer_) {
reconnectTimer_->stop();
}
performLoginFromCachedCredentials();
}
-void MainController::handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText) {
+void AccountController::handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText) {
std::shared_ptr<Presence> presence(new Presence());
if (show == StatusShow::None) {
// Note: this is misleading, None doesn't mean unavailable on the wire.
@@ -438,7 +438,7 @@ void MainController::handleChangeStatusRequest(StatusShow::Type show, const std:
}
}
-void MainController::sendPresence(std::shared_ptr<Presence> presence) {
+void AccountController::sendPresence(std::shared_ptr<Presence> presence) {
rosterController_->getWindow()->setMyStatusType(presence->getShow());
rosterController_->getWindow()->setMyStatusText(presence->getStatus());
systemTrayController_->setMyStatusType(presence->getShow());
@@ -452,7 +452,7 @@ void MainController::sendPresence(std::shared_ptr<Presence> presence) {
}
}
-void MainController::handleInputIdleChanged(bool idle) {
+void AccountController::handleInputIdleChanged(bool idle) {
if (!statusTracker_) {
//Haven't logged in yet.
return;
@@ -480,12 +480,12 @@ void MainController::handleInputIdleChanged(bool idle) {
}
}
-void MainController::handleShowCertificateRequest() {
+void AccountController::handleShowCertificateRequest() {
std::vector<Certificate::ref> chain = client_->getStanzaChannel()->getPeerCertificateChain();
rosterController_->getWindow()->openCertificateDialog(chain);
}
-void MainController::handleLoginRequest(const std::string &username, const std::string &password, const std::string& certificatePath, CertificateWithKey::ref certificate, const ClientOptions& options, bool remember, bool loginAutomatically) {
+void AccountController::handleLoginRequest(const std::string &username, const std::string &password, const std::string& certificatePath, CertificateWithKey::ref certificate, const ClientOptions& options, bool remember, bool loginAutomatically) {
jid_ = JID(username);
if (options.singleSignOn && (!jid_.isValid() || !jid_.getNode().empty())) {
loginWindow_->setMessage(QT_TRANSLATE_NOOP("", "User address invalid. User address should be of the form 'wonderland.lit'"));
@@ -533,12 +533,12 @@ void MainController::handleLoginRequest(const std::string &username, const std::
}
}
-void MainController::handlePurgeSavedLoginRequest(const std::string& username) {
+void AccountController::handlePurgeSavedLoginRequest(const std::string& username) {
settings_->removeProfile(username);
loginWindow_->removeAvailableAccount(username);
}
-void MainController::performLoginFromCachedCredentials() {
+void AccountController::performLoginFromCachedCredentials() {
if (settings_->getSetting(SettingConstants::FORGET_PASSWORDS) && password_.empty()) {
/* Then we can't try to login again. */
return;
@@ -563,16 +563,16 @@ void MainController::performLoginFromCachedCredentials() {
client_->setCertificateTrustChecker(certificateTrustChecker_);
client_->onDataRead.connect(boost::bind(&XMLConsoleController::handleDataRead, xmlConsoleController_, _1));
client_->onDataWritten.connect(boost::bind(&XMLConsoleController::handleDataWritten, xmlConsoleController_, _1));
- client_->onDisconnected.connect(boost::bind(&MainController::handleDisconnected, this, _1));
- client_->onConnected.connect(boost::bind(&MainController::handleConnected, this));
+ client_->onDisconnected.connect(boost::bind(&AccountController::handleDisconnected, this, _1));
+ client_->onConnected.connect(boost::bind(&AccountController::handleConnected, this));
client_->setSoftwareVersion(CLIENT_NAME, buildVersion);
- client_->getVCardManager()->onVCardChanged.connect(boost::bind(&MainController::handleVCardReceived, this, _1, _2));
+ client_->getVCardManager()->onVCardChanged.connect(boost::bind(&AccountController::handleVCardReceived, this, _1, _2));
presenceNotifier_ = new PresenceNotifier(client_->getStanzaChannel(), notifier_, client_->getMUCRegistry(), client_->getAvatarManager(), client_->getNickResolver(), client_->getPresenceOracle(), networkFactories_->getTimerFactory());
- presenceNotifier_->onNotificationActivated.connect(boost::bind(&MainController::handleNotificationClicked, this, _1));
+ presenceNotifier_->onNotificationActivated.connect(boost::bind(&AccountController::handleNotificationClicked, this, _1));
eventNotifier_ = new EventNotifier(eventController_, notifier_, client_->getAvatarManager(), client_->getNickResolver());
- eventNotifier_->onNotificationActivated.connect(boost::bind(&MainController::handleNotificationClicked, this, _1));
+ eventNotifier_->onNotificationActivated.connect(boost::bind(&AccountController::handleNotificationClicked, this, _1));
if (certificate_) {
client_->setCertificate(certificate_);
}
@@ -595,7 +595,7 @@ void MainController::performLoginFromCachedCredentials() {
client_->connect(clientOptions);
}
-void MainController::handleDisconnected(const boost::optional<ClientError>& error) {
+void AccountController::handleDisconnected(const boost::optional<ClientError>& error) {
if (rosterController_) {
rosterController_->getWindow()->setStreamEncryptionStatus(false);
}
@@ -700,7 +700,7 @@ void MainController::handleDisconnected(const boost::optional<ClientError>& erro
}
}
-void MainController::setReconnectTimer() {
+void AccountController::setReconnectTimer() {
if (timeBeforeNextReconnect_ < 0) {
timeBeforeNextReconnect_ = 1;
} else {
@@ -710,15 +710,15 @@ void MainController::setReconnectTimer() {
reconnectTimer_->stop();
}
reconnectTimer_ = networkFactories_->getTimerFactory()->createTimer(timeBeforeNextReconnect_ * 1000);
- reconnectTimer_->onTick.connect(boost::bind(&MainController::reconnectAfterError, this));
+ reconnectTimer_->onTick.connect(boost::bind(&AccountController::reconnectAfterError, this));
reconnectTimer_->start();
}
-void MainController::handleCancelLoginRequest() {
+void AccountController::handleCancelLoginRequest() {
signOut();
}
-void MainController::signOut() {
+void AccountController::signOut() {
if (settings_->getSetting(SettingConstants::FORGET_PASSWORDS)) {
purgeCachedCredentials();
}
@@ -729,7 +729,7 @@ void MainController::signOut() {
resetClient();
}
-void MainController::logout() {
+void AccountController::logout() {
if (settings_->getSetting(SettingConstants::FORGET_PASSWORDS)) {
purgeCachedCredentials();
}
@@ -745,7 +745,7 @@ void MainController::logout() {
setManagersOffline();
}
-void MainController::setManagersOffline() {
+void AccountController::setManagersOffline() {
if (chatsManager_) {
chatsManager_->setOnline(false);
}
@@ -760,7 +760,7 @@ void MainController::setManagersOffline() {
}
}
-void MainController::handleServerDiscoInfoResponse(std::shared_ptr<DiscoInfo> info, ErrorPayload::ref error) {
+void AccountController::handleServerDiscoInfoResponse(std::shared_ptr<DiscoInfo> info, ErrorPayload::ref error) {
if (!error) {
chatsManager_->setServerDiscoInfo(info);
adHocManager_->setServerDiscoInfo(info);
@@ -774,7 +774,7 @@ void MainController::handleServerDiscoInfoResponse(std::shared_ptr<DiscoInfo> in
}
}
-void MainController::enableMessageCarbons() {
+void AccountController::enableMessageCarbons() {
auto enableCarbonsRequest = EnableCarbonsRequest::create(client_->getIQRouter());
enableCarbonsRequestHandlerConnection_ = enableCarbonsRequest->onResponse.connect([&](Payload::ref /*payload*/, ErrorPayload::ref error) {
if (error) {
@@ -788,7 +788,7 @@ void MainController::enableMessageCarbons() {
enableCarbonsRequest->send();
}
-void MainController::handleVCardReceived(const JID& jid, VCard::ref vCard) {
+void AccountController::handleVCardReceived(const JID& jid, VCard::ref vCard) {
if (!jid.equals(jid_, JID::WithoutResource) || !vCard) {
return;
}
@@ -804,7 +804,7 @@ void MainController::handleVCardReceived(const JID& jid, VCard::ref vCard) {
}
}
-void MainController::handleNotificationClicked(const JID& jid) {
+void AccountController::handleNotificationClicked(const JID& jid) {
assert(chatsManager_);
if (clientInitialized_) {
if (client_->getMUCRegistry()->isMUC(jid)) {
@@ -816,7 +816,7 @@ void MainController::handleNotificationClicked(const JID& jid) {
}
}
-void MainController::handleQuitRequest() {
+void AccountController::handleQuitRequest() {
if (client_ && client_->isActive()) {
quitRequested_ = true;
client_->disconnect();
@@ -835,7 +835,7 @@ void MainController::handleQuitRequest() {
#define SERIALIZE_SAFE_STRING(option) result += safeByteArrayToString(Base64::encode(options.option)); result += ",";
#define SERIALIZE_URL(option) SERIALIZE_STRING(option.toString())
-std::string MainController::serializeClientOptions(const ClientOptions& options) {
+std::string AccountController::serializeClientOptions(const ClientOptions& options) {
std::string result;
SERIALIZE_BOOL(useStreamCompression);
switch (options.useTLS) {
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/AccountController.h
index b345e0e..30ae265 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/AccountController.h
@@ -82,9 +82,9 @@ namespace Swift {
class ContactSuggester;
class ContactsFromXMPPRoster;
- class MainController {
+ class AccountController {
public:
- MainController(
+ AccountController(
EventLoop* eventLoop,
NetworkFactories* networkFactories,
UIFactory* uiFactories,
@@ -99,7 +99,7 @@ namespace Swift {
IdleDetector* idleDetector,
const std::map<std::string, std::string>& emoticons,
bool useDelayForLatency);
- ~MainController();
+ ~AccountController();
private:
void resetClient();
diff --git a/Swift/Controllers/SConscript b/Swift/Controllers/SConscript
index 31b4541..cbd3bf3 100644
--- a/Swift/Controllers/SConscript
+++ b/Swift/Controllers/SConscript
@@ -51,7 +51,7 @@ if env["SCONS_STAGE"] == "build" :
"Highlighting/Highlighter.cpp",
"HistoryController.cpp",
"HistoryViewController.cpp",
- "MainController.cpp",
+ "AccountController.cpp",
"PresenceNotifier.cpp",
"PreviousStatusStore.cpp",
"ProfileController.cpp",
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 28c7044..8de5d70 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -35,7 +35,7 @@
#include <Swift/Controllers/ApplicationInfo.h>
#include <Swift/Controllers/BuildVersion.h>
-#include <Swift/Controllers/MainController.h>
+#include <Swift/Controllers/AccountController.h>
#include <Swift/Controllers/SettingConstants.h>
#include <Swift/Controllers/Settings/SettingsProviderHierachy.h>
#include <Swift/Controllers/Settings/XMLSettingsProvider.h>
@@ -299,7 +299,7 @@ QtSwift::~QtSwift() {
for (auto* factory : uiFactories_) {
delete factory;
}
- for (auto* controller : mainControllers_) {
+ for (auto* controller : accountControllers_) {
delete controller;
}
delete notifier_;
@@ -403,7 +403,7 @@ QtLoginWindow* QtSwift::addAccount() {
auto tabs = new QtChatTabs(settingsHierarchy_, true);
QtUIFactory* uiFactory = new QtUIFactory(settingsHierarchy_, qtSettings_, tabs, splitter_, systemTrays_[systemTrays_.size() - 1], networkFactories_.getTimerFactory(), statusCache_, autoUpdater_, emoticons_, enableAdHocCommandOnJID_);
uiFactories_.push_back(uiFactory);
- MainController* mainController = new MainController(
+ AccountController* accountController = new AccountController(
&clientMainThreadCaller_,
&networkFactories_,
uiFactory,
@@ -418,9 +418,9 @@ QtLoginWindow* QtSwift::addAccount() {
&idleDetector_,
emoticons_,
useDelayForLatency_);
- mainControllers_.push_back(mainController);
+ accountControllers_.push_back(accountController);
- //FIXME - mainController has already created the window, so we can pass null here and get the old one
+ //FIXME - accountController has already created the window, so we can pass null here and get the old one
auto loginWindow = uiFactory->createLoginWindow(nullptr);
return dynamic_cast<QtLoginWindow*>(loginWindow);
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index d876cd8..811b6e4 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -43,7 +43,7 @@ namespace Swift {
class CertificateStorageFactory;
class Dock;
class EventLoop;
- class MainController;
+ class AccountController;
class Notifier;
class QtChatTabs;
class QtChatWindowFactory;
@@ -89,7 +89,7 @@ namespace Swift {
PlatformTLSFactories tlsFactories_;
BoostNetworkFactories networkFactories_;
QtChatWindowFactory* chatWindowFactory_;
- std::vector<MainController*> mainControllers_;
+ std::vector<AccountController*> accountControllers_;
std::vector<QtSystemTray*> systemTrays_;
std::vector<QtUIFactory*> uiFactories_;
QtSettingsProvider* qtSettings_;