summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorMili Verma <mili.verma@isode.com>2015-07-06 14:10:25 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-07-07 10:49:49 (GMT)
commitf10c9618f8ccd9e44c9a45a69179883b39a445f5 (patch)
treec22b7ddfaa5aaba08edb1ae62650a45dce6af9e7 /Swift
parent88e392fd98a1d49d787860f4b504a01f082c6ae6 (diff)
downloadswift-f10c9618f8ccd9e44c9a45a69179883b39a445f5.zip
swift-f10c9618f8ccd9e44c9a45a69179883b39a445f5.tar.bz2
Add hidden option to prevent disconnect when smartcard removed
This patch adds an option 'disconnectOnCardRemoval' to system-settings.xml which when set to false allows the user's session to stay connected if the smartcard is removed. The default value of this option is true if it is not specified. Test-information: Tested on Windows using NIST smartcards. Tested true and false values set for this option in the file and also when option is not specified (true). Unit tests pass. Change-Id: I7e421b4153ff7d3000f41999add20d339076c96e
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/SettingConstants.cpp3
-rw-r--r--Swift/Controllers/SettingConstants.h11
-rw-r--r--Swift/QtUI/QtSwift.cpp4
3 files changed, 16 insertions, 2 deletions
diff --git a/Swift/Controllers/SettingConstants.cpp b/Swift/Controllers/SettingConstants.cpp
index 33ed17d..d740686 100644
--- a/Swift/Controllers/SettingConstants.cpp
+++ b/Swift/Controllers/SettingConstants.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 Isode Limited.
+ * Copyright (c) 2012-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -27,4 +27,5 @@ const SettingsProvider::Setting<std::string> SettingConstants::DICT_FILE("dictFi
const SettingsProvider::Setting<std::string> SettingConstants::INVITE_AUTO_ACCEPT_MODE("inviteAutoAcceptMode", "presence");
const SettingsProvider::Setting<std::string> SettingConstants::TRELLIS_GRID_SIZE("trellisGridSize", "");
const SettingsProvider::Setting<std::string> SettingConstants::TRELLIS_GRID_POSITIONS("trellisGridPositions", "");
+const SettingsProvider::Setting<bool> SettingConstants::DISCONNECT_ON_CARD_REMOVAL("disconnectOnCardRemoval", true);
}
diff --git a/Swift/Controllers/SettingConstants.h b/Swift/Controllers/SettingConstants.h
index b441303..eca3199 100644
--- a/Swift/Controllers/SettingConstants.h
+++ b/Swift/Controllers/SettingConstants.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 Isode Limited.
+ * Copyright (c) 2012-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -86,5 +86,14 @@ namespace Swift {
* Its value is a Qt serialized representation.
*/
static const SettingsProvider::Setting<std::string> TRELLIS_GRID_POSITIONS;
+ /**
+ * The #DISCONNECT_ON_CARD_REMOVAL setting
+ * specifies whether or not to sign out the user when
+ * the smartcard is removed.
+ *
+ * If set true Swift will sign out the user when the
+ * smart card is removed; else not.
+ */
+ static const SettingsProvider::Setting<bool> DISCONNECT_ON_CARD_REMOVAL;
};
}
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 20d7bc9..6d8ac7b 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -23,6 +23,7 @@
#include <Swiften/Elements/Presence.h>
#include <Swiften/Client/Client.h>
#include <Swiften/Base/Paths.h>
+#include <Swiften/TLS/TLSContextFactory.h>
#include <SwifTools/Application/PlatformApplicationPathProvider.h>
#include <SwifTools/AutoUpdater/AutoUpdater.h>
@@ -32,6 +33,7 @@
#include <Swift/Controllers/Storages/FileStoragesFactory.h>
#include <Swift/Controllers/Settings/XMLSettingsProvider.h>
#include <Swift/Controllers/Settings/SettingsProviderHierachy.h>
+#include <Swift/Controllers/SettingConstants.h>
#include <Swift/Controllers/MainController.h>
#include <Swift/Controllers/ApplicationInfo.h>
#include <Swift/Controllers/BuildVersion.h>
@@ -144,6 +146,8 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
settingsHierachy_->addProviderToTopOfStack(xmlSettings_);
settingsHierachy_->addProviderToTopOfStack(qtSettings_);
+ networkFactories_.getTLSContextFactory()->setDisconnectOnCardRemoval(settingsHierachy_->getSetting(SettingConstants::DISCONNECT_ON_CARD_REMOVAL));
+
std::map<std::string, std::string> emoticons;
loadEmoticonsFile(":/emoticons/emoticons.txt", emoticons);
loadEmoticonsFile(P2QSTRING(pathToString(Paths::getExecutablePath() / "emoticons.txt")), emoticons);