summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2012-05-04 21:39:30 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-05-11 19:29:38 (GMT)
commit0f91f88ac69644fb7e7bdbf601b7e098194490fa (patch)
treee66ca4acbf869c82bba607ca9c394a47615c6e6e /Swift/Controllers
parent15ed4a079a8bbe3cc9ee2ca47233be7b890464ec (diff)
downloadswift-0f91f88ac69644fb7e7bdbf601b7e098194490fa.zip
swift-0f91f88ac69644fb7e7bdbf601b7e098194490fa.tar.bz2
Showing stream encryption status in the roster header. Provide native certificate viewers on click.
Native viewers for Windows and Mac OS X are implemented. Added TODOs to OpenSSL based TLS interface related to CRL and OCSP. Resolves: #167 License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/MainController.cpp8
-rw-r--r--Swift/Controllers/MainController.h1
-rw-r--r--Swift/Controllers/UIInterfaces/MainWindow.h5
-rw-r--r--Swift/Controllers/UnitTest/MockMainWindow.h2
4 files changed, 15 insertions, 1 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 7bd89cb..40b4ded 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -72,6 +72,7 @@
#include <Swiften/FileTransfer/FileTransferManager.h>
#include <Swiften/Client/ClientXMLTracer.h>
#include <Swift/Controllers/SettingConstants.h>
+#include <Swiften/Client/StanzaChannel.h>
namespace Swift {
@@ -285,6 +286,7 @@ void MainController::handleConnected() {
rosterController_ = new RosterController(jid_, client_->getRoster(), client_->getAvatarManager(), uiFactory_, client_->getNickManager(), client_->getNickResolver(), client_->getPresenceOracle(), client_->getSubscriptionManager(), eventController_, uiEventStream_, client_->getIQRouter(), settings_, client_->getEntityCapsProvider(), ftOverview_);
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));
contactEditController_ = new ContactEditController(rosterController_, client_->getVCardManager(), uiFactory_, uiEventStream_);
@@ -327,6 +329,7 @@ void MainController::handleConnected() {
client_->getVCardManager()->requestOwnVCard();
rosterController_->setEnabled(true);
+ rosterController_->getWindow()->setStreamEncryptionStatus(client_->isStreamEncrypted());
profileController_->setAvailable(true);
contactEditController_->setAvailable(true);
/* Send presence later to catch all the incoming presences. */
@@ -417,6 +420,11 @@ void MainController::handleInputIdleChanged(bool idle) {
}
}
+void MainController::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, bool remember, bool loginAutomatically) {
jid_ = JID(username);
if (!jid_.isValid() || jid_.getNode().empty()) {
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index 14de4eb..eeba9f3 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -103,6 +103,7 @@ namespace Swift {
void handlePurgeSavedLoginRequest(const std::string& username);
void sendPresence(boost::shared_ptr<Presence> presence);
void handleInputIdleChanged(bool);
+ void handleShowCertificateRequest();
void logout();
void signOut();
void setReconnectTimer();
diff --git a/Swift/Controllers/UIInterfaces/MainWindow.h b/Swift/Controllers/UIInterfaces/MainWindow.h
index 93584e7..23328b4 100644
--- a/Swift/Controllers/UIInterfaces/MainWindow.h
+++ b/Swift/Controllers/UIInterfaces/MainWindow.h
@@ -10,7 +10,7 @@
#include "Swiften/JID/JID.h"
#include "Swiften/Elements/StatusShow.h"
#include "Swiften/Elements/DiscoItems.h"
-
+#include "Swiften/TLS/Certificate.h"
#include "Swiften/Base/boost_bsignals.h"
#include <boost/shared_ptr.hpp>
@@ -35,9 +35,12 @@ namespace Swift {
virtual void setRosterModel(Roster* roster) = 0;
virtual void setConnecting() = 0;
virtual void setAvailableAdHocCommands(const std::vector<DiscoItems::Item>& commands) = 0;
+ virtual void setStreamEncryptionStatus(bool tlsInPlaceAndValid) = 0;
+ virtual void openCertificateDialog(const std::vector<Certificate::ref>& chain) = 0;
boost::signal<void (StatusShow::Type, const std::string&)> onChangeStatusRequest;
boost::signal<void ()> onSignOutRequest;
+ boost::signal<void ()> onShowCertificateRequest;
private:
bool canDelete_;
diff --git a/Swift/Controllers/UnitTest/MockMainWindow.h b/Swift/Controllers/UnitTest/MockMainWindow.h
index f773062..be1a932 100644
--- a/Swift/Controllers/UnitTest/MockMainWindow.h
+++ b/Swift/Controllers/UnitTest/MockMainWindow.h
@@ -22,6 +22,8 @@ namespace Swift {
virtual void setMyStatusType(StatusShow::Type /*type*/) {};
virtual void setAvailableAdHocCommands(const std::vector<DiscoItems::Item>& /*commands*/) {};
virtual void setConnecting() {};
+ virtual void setStreamEncryptionStatus(bool /*tlsInPlaceAndValid*/) {}
+ virtual void openCertificateDialog(const std::vector<Certificate::ref>& /*chain*/) {}
Roster* roster;
};