summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--QA/Checker/checker.cpp4
-rw-r--r--Slimber/Server.cpp4
-rw-r--r--Sluift/ElementConvertors/DefaultElementConvertor.cpp4
-rw-r--r--SwifTools/Application/ApplicationPathProvider.cpp4
-rw-r--r--SwifTools/Application/MacOSXApplicationPathProvider.cpp4
-rw-r--r--SwifTools/Application/UnixApplicationPathProvider.cpp4
-rw-r--r--SwifTools/AutoUpdater/SparkleAutoUpdater.mm4
-rw-r--r--SwifTools/AutoUpdater/SparkleAutoUpdaterDelegate.mm6
-rw-r--r--SwifTools/CrashReporter.cpp4
-rw-r--r--SwifTools/HunspellChecker.cpp4
-rw-r--r--SwifTools/Notifier/NotificationCenterNotifier.mm4
-rw-r--r--Swift/Controllers/AccountController.cpp6
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp12
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp12
-rw-r--r--Swift/Controllers/Chat/MUCSearchController.cpp12
-rw-r--r--Swift/Controllers/FileTransfer/FileTransferController.cpp6
-rw-r--r--Swift/Controllers/Highlighting/HighlightManager.cpp4
-rw-r--r--Swift/Controllers/Settings/XMLSettingsProvider.cpp10
-rw-r--r--Swift/Controllers/StatusCache.cpp8
-rw-r--r--Swift/Controllers/Storages/AvatarFileStorage.cpp14
-rw-r--r--Swift/Controllers/Storages/CertificateFileStorage.cpp6
-rw-r--r--Swift/QtUI/CAPICertificateSelector.cpp12
-rw-r--r--Swift/QtUI/QtAboutWidget.cpp4
-rw-r--r--Swift/QtUI/QtScaledAvatarCache.cpp8
-rw-r--r--Swift/QtUI/QtSpellCheckerWindow.cpp4
-rw-r--r--Swift/QtUI/QtSwift.cpp8
-rw-r--r--Swift/QtUI/QtTextEdit.cpp4
-rw-r--r--Swift/QtUI/QtUIFactory.cpp6
-rw-r--r--Swift/QtUI/QtWebKitChatView.cpp18
-rw-r--r--Swift/QtUI/Trellis/QtDynamicGridLayout.cpp8
-rw-r--r--Swiften/Avatars/CombinedAvatarProvider.cpp8
-rw-r--r--Swiften/Avatars/VCardUpdateAvatarManager.cpp10
-rw-r--r--Swiften/Base/DateTime.cpp4
-rw-r--r--Swiften/Base/Log.cpp17
-rw-r--r--Swiften/Client/ClientSession.cpp8
-rw-r--r--Swiften/Client/ClientSessionStanzaChannel.cpp4
-rw-r--r--Swiften/Client/CoreClient.cpp32
-rw-r--r--Swiften/Component/ComponentSessionStanzaChannel.cpp4
-rw-r--r--Swiften/Component/CoreComponent.cpp4
-rw-r--r--Swiften/Disco/CapsManager.cpp4
-rw-r--r--Swiften/Disco/DiscoServiceWalker.cpp18
-rw-r--r--Swiften/Entity/PayloadPersister.cpp6
-rw-r--r--Swiften/EventLoop/DummyEventLoop.cpp2
-rw-r--r--Swiften/EventLoop/EventLoop.cpp4
-rw-r--r--Swiften/Examples/SendFile/ReceiveFile.cpp4
-rw-r--r--Swiften/FileTransfer/DefaultFileTransferTransporter.cpp12
-rw-r--r--Swiften/FileTransfer/FailingTransportSession.cpp4
-rw-r--r--Swiften/FileTransfer/FileTransferManagerImpl.cpp4
-rw-r--r--Swiften/FileTransfer/IncomingJingleFileTransfer.cpp68
-rw-r--r--Swiften/FileTransfer/JingleFileTransfer.cpp50
-rw-r--r--Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp6
-rw-r--r--Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp62
-rw-r--r--Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp8
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp34
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp12
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp6
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp30
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp24
-rw-r--r--Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp6
-rw-r--r--Swiften/Jingle/AbstractJingleSessionListener.cpp16
-rw-r--r--Swiften/Jingle/JingleResponder.cpp8
-rw-r--r--Swiften/Jingle/JingleSessionImpl.cpp6
-rw-r--r--Swiften/Jingle/JingleSessionManager.cpp4
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp4
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h8
-rw-r--r--Swiften/LinkLocal/LinkLocalServiceInfo.cpp4
-rw-r--r--Swiften/Network/BOSHConnection.cpp16
-rw-r--r--Swiften/Network/BOSHConnectionPool.cpp4
-rw-r--r--Swiften/Network/BoostConnection.cpp8
-rw-r--r--Swiften/Network/BoostConnectionServer.cpp4
-rw-r--r--Swiften/Network/ChainedConnector.cpp10
-rw-r--r--Swiften/Network/Connector.cpp26
-rw-r--r--Swiften/Network/EnvironmentProxyProvider.cpp4
-rw-r--r--Swiften/Network/GConfProxyProvider.cpp4
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnection.cpp12
-rw-r--r--Swiften/Network/HostAddress.cpp4
-rw-r--r--Swiften/Network/NATPMPInterface.cpp14
-rw-r--r--Swiften/Network/PlatformDomainNameServiceQuery.cpp6
-rw-r--r--Swiften/Network/PlatformNATTraversalWorker.cpp4
-rw-r--r--Swiften/Network/ProxiedConnection.cpp4
-rw-r--r--Swiften/Network/SOCKS5ProxiedConnection.cpp14
-rw-r--r--Swiften/Network/UnboundDomainNameResolver.cpp26
-rw-r--r--Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp6
-rw-r--r--Swiften/Network/WindowsProxyProvider.cpp4
-rw-r--r--Swiften/Parser/IQParser.cpp4
-rw-r--r--Swiften/Parser/LibXMLParser.cpp2
-rw-r--r--Swiften/Parser/PresenceParser.cpp4
-rw-r--r--Swiften/Roster/XMPPRosterController.cpp4
-rw-r--r--Swiften/SASL/WindowsAuthentication.cpp34
-rw-r--r--Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp24
-rw-r--r--Swiften/SASL/WindowsServicePrincipalName.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp6
-rw-r--r--Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp4
-rw-r--r--Swiften/Serializer/StanzaSerializer.cpp4
-rw-r--r--Swiften/Serializer/XMPPSerializer.cpp4
-rw-r--r--Swiften/StreamManagement/StanzaAckRequester.cpp4
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.cpp4
-rw-r--r--Swiften/TLS/CAPICertificate.cpp26
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp4
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLContext.cpp24
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLContextFactory.cpp4
-rw-r--r--Swiften/TLS/Schannel/SchannelContext.cpp12
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportContext.mm68
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportContextFactory.cpp4
105 files changed, 575 insertions, 572 deletions
diff --git a/QA/Checker/checker.cpp b/QA/Checker/checker.cpp
index f4ec6f1..4d6a90e 100644
--- a/QA/Checker/checker.cpp
+++ b/QA/Checker/checker.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2017 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -141,7 +141,7 @@ int main(int argc, char* argv[]) {
141 googleTestWasSuccessful = RUN_ALL_TESTS() == 0 ? true : false; 141 googleTestWasSuccessful = RUN_ALL_TESTS() == 0 ? true : false;
142 } catch (const ::testing::internal::GoogleTestFailureException& e) { 142 } catch (const ::testing::internal::GoogleTestFailureException& e) {
143 googleTestWasSuccessful = false; 143 googleTestWasSuccessful = false;
144 SWIFT_LOG(error) << "GoogleTestFailureException was thrown: " << e.what() << std::endl; 144 SWIFT_LOG(error) << "GoogleTestFailureException was thrown: " << e.what();
145 } 145 }
146 146
147 auto cppUnitWasSuccessful = result.wasSuccessful() ? true : false; 147 auto cppUnitWasSuccessful = result.wasSuccessful() ? true : false;
diff --git a/Slimber/Server.cpp b/Slimber/Server.cpp
index bfa34f5..7bb2ed9 100644
--- a/Slimber/Server.cpp
+++ b/Slimber/Server.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -306,7 +306,7 @@ void Server::handleLinkLocalElementReceived(std::shared_ptr<ToplevelElement> ele
306 306
307void Server::handleConnectFinished(std::shared_ptr<LinkLocalConnector> connector, bool error) { 307void Server::handleConnectFinished(std::shared_ptr<LinkLocalConnector> connector, bool error) {
308 if (error) { 308 if (error) {
309 SWIFT_LOG(warning) << "Error connecting" << std::endl; 309 SWIFT_LOG(warning) << "Error connecting";
310 // TODO: Send back queued stanzas 310 // TODO: Send back queued stanzas
311 } 311 }
312 else { 312 else {
diff --git a/Sluift/ElementConvertors/DefaultElementConvertor.cpp b/Sluift/ElementConvertors/DefaultElementConvertor.cpp
index 75e6706..d3d60ff 100644
--- a/Sluift/ElementConvertors/DefaultElementConvertor.cpp
+++ b/Sluift/ElementConvertors/DefaultElementConvertor.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013-2016 Isode Limited. 2 * Copyright (c) 2013-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -20,7 +20,7 @@ DefaultElementConvertor::~DefaultElementConvertor() {
20} 20}
21 21
22std::shared_ptr<Element> DefaultElementConvertor::convertFromLua(lua_State*, int, const std::string& type) { 22std::shared_ptr<Element> DefaultElementConvertor::convertFromLua(lua_State*, int, const std::string& type) {
23 SWIFT_LOG(warning) << "Unable to convert type '" << type << "'" << std::endl; 23 SWIFT_LOG(warning) << "Unable to convert type '" << type << "'";
24 return std::shared_ptr<Element>(); 24 return std::shared_ptr<Element>();
25} 25}
26 26
diff --git a/SwifTools/Application/ApplicationPathProvider.cpp b/SwifTools/Application/ApplicationPathProvider.cpp
index 8b952bb..77457ef 100644
--- a/SwifTools/Application/ApplicationPathProvider.cpp
+++ b/SwifTools/Application/ApplicationPathProvider.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -25,7 +25,7 @@ boost::filesystem::path ApplicationPathProvider::getProfileDir(const std::string
25 boost::filesystem::create_directory(result); 25 boost::filesystem::create_directory(result);
26 } 26 }
27 catch (const boost::filesystem::filesystem_error& e) { 27 catch (const boost::filesystem::filesystem_error& e) {
28 SWIFT_LOG(error) << e.what() << std::endl; 28 SWIFT_LOG(error) << e.what();
29 } 29 }
30 return result; 30 return result;
31} 31}
diff --git a/SwifTools/Application/MacOSXApplicationPathProvider.cpp b/SwifTools/Application/MacOSXApplicationPathProvider.cpp
index 684d8b2..d7b99b9 100644
--- a/SwifTools/Application/MacOSXApplicationPathProvider.cpp
+++ b/SwifTools/Application/MacOSXApplicationPathProvider.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -23,7 +23,7 @@ boost::filesystem::path MacOSXApplicationPathProvider::getDataDir() const {
23 boost::filesystem::create_directory(result); 23 boost::filesystem::create_directory(result);
24 } 24 }
25 catch (const boost::filesystem::filesystem_error& e) { 25 catch (const boost::filesystem::filesystem_error& e) {
26 SWIFT_LOG(error) << e.what() << std::endl; 26 SWIFT_LOG(error) << e.what();
27 } 27 }
28 return result; 28 return result;
29} 29}
diff --git a/SwifTools/Application/UnixApplicationPathProvider.cpp b/SwifTools/Application/UnixApplicationPathProvider.cpp
index e455d23..a345766 100644
--- a/SwifTools/Application/UnixApplicationPathProvider.cpp
+++ b/SwifTools/Application/UnixApplicationPathProvider.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -54,7 +54,7 @@ boost::filesystem::path UnixApplicationPathProvider::getDataDir() const {
54 boost::filesystem::create_directories(dataPath); 54 boost::filesystem::create_directories(dataPath);
55 } 55 }
56 catch (const boost::filesystem::filesystem_error& e) { 56 catch (const boost::filesystem::filesystem_error& e) {
57 SWIFT_LOG(error) << "file system error: " << e.what() << std::endl; 57 SWIFT_LOG(error) << "file system error: " << e.what();
58 } 58 }
59 return dataPath; 59 return dataPath;
60} 60}
diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
index b4a4c05..274ab3c 100644
--- a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
+++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016-2017 Isode Limited. 2 * Copyright (c) 2016-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -46,7 +46,7 @@ SparkleAutoUpdater::SparkleAutoUpdater(const std::string& appcastFeed) : d(new P
46 46
47 SWIFT_LOG(debug) << (canDoSilentUpdates ? 47 SWIFT_LOG(debug) << (canDoSilentUpdates ?
48 "The current running user has enough permissions to do a silent update." : 48 "The current running user has enough permissions to do a silent update." :
49 "The current running user has insufficient permissions to do a silent update.") << std::endl; 49 "The current running user has insufficient permissions to do a silent update.");
50 50
51 setAppcastFeed(appcastFeed); 51 setAppcastFeed(appcastFeed);
52} 52}
diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdaterDelegate.mm b/SwifTools/AutoUpdater/SparkleAutoUpdaterDelegate.mm
index be58355..b9294d9 100644
--- a/SwifTools/AutoUpdater/SparkleAutoUpdaterDelegate.mm
+++ b/SwifTools/AutoUpdater/SparkleAutoUpdaterDelegate.mm
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016-2017 Isode Limited. 2 * Copyright (c) 2016-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -49,7 +49,7 @@ using namespace Swift;
49- (void)updater:(SUUpdater *)updater failedToDownloadUpdate:(SUAppcastItem *)item error:(NSError *)error { 49- (void)updater:(SUUpdater *)updater failedToDownloadUpdate:(SUAppcastItem *)item error:(NSError *)error {
50 (void)updater; 50 (void)updater;
51 (void)item; 51 (void)item;
52 SWIFT_LOG(error) << ns2StdString([error localizedDescription]) << std::endl; 52 SWIFT_LOG(error) << ns2StdString([error localizedDescription]);
53 onNewUpdateState(AutoUpdater::State::ErrorCheckingForUpdate); 53 onNewUpdateState(AutoUpdater::State::ErrorCheckingForUpdate);
54} 54}
55 55
@@ -71,7 +71,7 @@ using namespace Swift;
71 onNewUpdateState(AutoUpdater::State::NoUpdateAvailable); 71 onNewUpdateState(AutoUpdater::State::NoUpdateAvailable);
72 } 72 }
73 else { 73 else {
74 SWIFT_LOG(error) << ns2StdString([error localizedDescription]) << std::endl; 74 SWIFT_LOG(error) << ns2StdString([error localizedDescription]);
75 onNewUpdateState(AutoUpdater::State::ErrorCheckingForUpdate); 75 onNewUpdateState(AutoUpdater::State::ErrorCheckingForUpdate);
76 } 76 }
77} 77}
diff --git a/SwifTools/CrashReporter.cpp b/SwifTools/CrashReporter.cpp
index bf637c8..b02e73b 100644
--- a/SwifTools/CrashReporter.cpp
+++ b/SwifTools/CrashReporter.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012-2016 Isode Limited. 2 * Copyright (c) 2012-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -46,7 +46,7 @@ CrashReporter::CrashReporter(const boost::filesystem::path& path, const std::str
46 boost::filesystem::create_directories(path); 46 boost::filesystem::create_directories(path);
47 } 47 }
48 catch (const boost::filesystem::filesystem_error& e) { 48 catch (const boost::filesystem::filesystem_error& e) {
49 SWIFT_LOG(error) << "ERROR: " << e.what() << std::endl; 49 SWIFT_LOG(error) << "ERROR: " << e.what();
50 } 50 }
51 } 51 }
52 52
diff --git a/SwifTools/HunspellChecker.cpp b/SwifTools/HunspellChecker.cpp
index 1de369b..019a4dc 100644
--- a/SwifTools/HunspellChecker.cpp
+++ b/SwifTools/HunspellChecker.cpp
@@ -84,12 +84,12 @@ bool HunspellChecker::isAutomaticallyDetectingLanguage() {
84void HunspellChecker::setActiveLanguage(const std::string& language) { 84void HunspellChecker::setActiveLanguage(const std::string& language) {
85 auto dictionaries = detectedDictionaries(); 85 auto dictionaries = detectedDictionaries();
86 if (dictionaries.find(language) != dictionaries.end()) { 86 if (dictionaries.find(language) != dictionaries.end()) {
87 SWIFT_LOG(debug) << "Initialized Hunspell with dic,aff files " << dictionaries[language].dicPath << " , " << dictionaries[language].affPath << std::endl; 87 SWIFT_LOG(debug) << "Initialized Hunspell with dic,aff files " << dictionaries[language].dicPath << " , " << dictionaries[language].affPath;
88 speller_ = std::unique_ptr<Hunspell>(new Hunspell(dictionaries[language].affPath.c_str(), dictionaries[language].dicPath.c_str())); 88 speller_ = std::unique_ptr<Hunspell>(new Hunspell(dictionaries[language].affPath.c_str(), dictionaries[language].dicPath.c_str()));
89 activeLangauge_ = language; 89 activeLangauge_ = language;
90 } 90 }
91 else { 91 else {
92 SWIFT_LOG(warning) << "Unsupported language '" << language << "'" << std::endl; 92 SWIFT_LOG(warning) << "Unsupported language '" << language << "'";
93 } 93 }
94} 94}
95 95
diff --git a/SwifTools/Notifier/NotificationCenterNotifier.mm b/SwifTools/Notifier/NotificationCenterNotifier.mm
index 1538186..e6fdfb6 100644
--- a/SwifTools/Notifier/NotificationCenterNotifier.mm
+++ b/SwifTools/Notifier/NotificationCenterNotifier.mm
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2016 Isode Limited. 2 * Copyright (c) 2015-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -88,7 +88,7 @@ void NotificationCenterNotifier::handleUserNotificationActivated(const std::stri
88 } 88 }
89 } 89 }
90 else { 90 else {
91 SWIFT_LOG(warning) << "Missing callback entry for activated notification. The activate notification may come from another instance." << std::endl; 91 SWIFT_LOG(warning) << "Missing callback entry for activated notification. The activate notification may come from another instance.";
92 } 92 }
93} 93}
94 94
diff --git a/Swift/Controllers/AccountController.cpp b/Swift/Controllers/AccountController.cpp
index b877ce9..a257cc4 100644
--- a/Swift/Controllers/AccountController.cpp
+++ b/Swift/Controllers/AccountController.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -781,10 +781,10 @@ void AccountController::enableMessageCarbons() {
781 auto enableCarbonsRequest = EnableCarbonsRequest::create(client_->getIQRouter()); 781 auto enableCarbonsRequest = EnableCarbonsRequest::create(client_->getIQRouter());
782 enableCarbonsRequestHandlerConnection_ = enableCarbonsRequest->onResponse.connect([&](Payload::ref /*payload*/, ErrorPayload::ref error) { 782 enableCarbonsRequestHandlerConnection_ = enableCarbonsRequest->onResponse.connect([&](Payload::ref /*payload*/, ErrorPayload::ref error) {
783 if (error) { 783 if (error) {
784 SWIFT_LOG(warning) << "Failed to enable carbons." << std::endl; 784 SWIFT_LOG(warning) << "Failed to enable carbons.";
785 } 785 }
786 else { 786 else {
787 SWIFT_LOG(debug) << "Successfully enabled carbons." << std::endl; 787 SWIFT_LOG(debug) << "Successfully enabled carbons.";
788 } 788 }
789 enableCarbonsRequestHandlerConnection_.disconnect(); 789 enableCarbonsRequestHandlerConnection_.disconnect();
790 }); 790 });
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index 5f441f8..debd83f 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -190,7 +190,7 @@ void ChatController::preHandleIncomingMessage(std::shared_ptr<MessageEvent> mess
190 // handle XEP-0184 Message Receipts 190 // handle XEP-0184 Message Receipts
191 // incomming receipts 191 // incomming receipts
192 if (std::shared_ptr<DeliveryReceipt> receipt = message->getPayload<DeliveryReceipt>()) { 192 if (std::shared_ptr<DeliveryReceipt> receipt = message->getPayload<DeliveryReceipt>()) {
193 SWIFT_LOG(debug) << "received receipt for id: " << receipt->getReceivedID() << std::endl; 193 SWIFT_LOG(debug) << "received receipt for id: " << receipt->getReceivedID();
194 if (requestedReceipts_.find(receipt->getReceivedID()) != requestedReceipts_.end()) { 194 if (requestedReceipts_.find(receipt->getReceivedID()) != requestedReceipts_.end()) {
195 chatWindow_->setMessageReceiptState(requestedReceipts_[receipt->getReceivedID()], ChatWindow::ReceiptReceived); 195 chatWindow_->setMessageReceiptState(requestedReceipts_[receipt->getReceivedID()], ChatWindow::ReceiptReceived);
196 requestedReceipts_.erase(receipt->getReceivedID()); 196 requestedReceipts_.erase(receipt->getReceivedID());
@@ -407,7 +407,7 @@ void ChatController::handleWhiteboardStateChange(const ChatWindow::WhiteboardSes
407} 407}
408 408
409void ChatController::handleFileTransferCancel(std::string id) { 409void ChatController::handleFileTransferCancel(std::string id) {
410 SWIFT_LOG(debug) << "handleFileTransferCancel(" << id << ")" << std::endl; 410 SWIFT_LOG(debug) << "handleFileTransferCancel(" << id << ")";
411 if (ftControllers.find(id) != ftControllers.end()) { 411 if (ftControllers.find(id) != ftControllers.end()) {
412 ftControllers[id]->cancel(); 412 ftControllers[id]->cancel();
413 } else { 413 } else {
@@ -416,7 +416,7 @@ void ChatController::handleFileTransferCancel(std::string id) {
416} 416}
417 417
418void ChatController::handleFileTransferStart(std::string id, std::string description) { 418void ChatController::handleFileTransferStart(std::string id, std::string description) {
419 SWIFT_LOG(debug) << "handleFileTransferStart(" << id << ", " << description << ")" << std::endl; 419 SWIFT_LOG(debug) << "handleFileTransferStart(" << id << ", " << description << ")";
420 if (ftControllers.find(id) != ftControllers.end()) { 420 if (ftControllers.find(id) != ftControllers.end()) {
421 ftControllers[id]->start(description); 421 ftControllers[id]->start(description);
422 } else { 422 } else {
@@ -425,7 +425,7 @@ void ChatController::handleFileTransferStart(std::string id, std::string descrip
425} 425}
426 426
427void ChatController::handleFileTransferAccept(std::string id, std::string filename) { 427void ChatController::handleFileTransferAccept(std::string id, std::string filename) {
428 SWIFT_LOG(debug) << "handleFileTransferAccept(" << id << ", " << filename << ")" << std::endl; 428 SWIFT_LOG(debug) << "handleFileTransferAccept(" << id << ", " << filename << ")";
429 if (ftControllers.find(id) != ftControllers.end()) { 429 if (ftControllers.find(id) != ftControllers.end()) {
430 ftControllers[id]->accept(filename); 430 ftControllers[id]->accept(filename);
431 } else { 431 } else {
@@ -434,7 +434,7 @@ void ChatController::handleFileTransferAccept(std::string id, std::string filena
434} 434}
435 435
436void ChatController::handleSendFileRequest(std::string filename) { 436void ChatController::handleSendFileRequest(std::string filename) {
437 SWIFT_LOG(debug) << "ChatController::handleSendFileRequest(" << filename << ")" << std::endl; 437 SWIFT_LOG(debug) << "ChatController::handleSendFileRequest(" << filename << ")";
438 eventStream_->send(std::make_shared<SendFileUIEvent>(getToJID(), filename)); 438 eventStream_->send(std::make_shared<SendFileUIEvent>(getToJID(), filename));
439} 439}
440 440
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 6530a7e..193af7f 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -175,7 +175,7 @@ ChatsManager::~ChatsManager() {
175 roster_->onRosterCleared.disconnect(boost::bind(&ChatsManager::handleRosterCleared, this)); 175 roster_->onRosterCleared.disconnect(boost::bind(&ChatsManager::handleRosterCleared, this));
176 ftOverview_->onNewFileTransferController.disconnect(boost::bind(&ChatsManager::handleNewFileTransferController, this, _1)); 176 ftOverview_->onNewFileTransferController.disconnect(boost::bind(&ChatsManager::handleNewFileTransferController, this, _1));
177 delete joinMUCWindow_; 177 delete joinMUCWindow_;
178 SWIFT_LOG(debug) << "Destroying ChatsManager, containing " << chatControllers_.size() << " chats and " << mucControllers_.size() << " MUCs" << std::endl; 178 SWIFT_LOG(debug) << "Destroying ChatsManager, containing " << chatControllers_.size() << " chats and " << mucControllers_.size() << " MUCs";
179 for (JIDChatControllerPair controllerPair : chatControllers_) { 179 for (JIDChatControllerPair controllerPair : chatControllers_) {
180 delete controllerPair.second; 180 delete controllerPair.second;
181 } 181 }
@@ -311,7 +311,7 @@ void ChatsManager::loadRecents() {
311 boost::archive::text_iarchive ia(deserializeStream); 311 boost::archive::text_iarchive ia(deserializeStream);
312 ia >> recentChats; 312 ia >> recentChats;
313 } catch (const boost::archive::archive_exception& e) { 313 } catch (const boost::archive::archive_exception& e) {
314 SWIFT_LOG(debug) << "Failed to load recents: " << e.what() << std::endl; 314 SWIFT_LOG(debug) << "Failed to load recents: " << e.what();
315 return; 315 return;
316 } 316 }
317 recentChats.erase(std::remove(recentChats.begin(), recentChats.end(), ChatListWindow::Chat()), recentChats.end()); 317 recentChats.erase(std::remove(recentChats.begin(), recentChats.end(), ChatListWindow::Chat()), recentChats.end());
@@ -936,7 +936,7 @@ void ChatsManager::handleUserNicknameChanged(MUCController* mucController, const
936 JID oldMUCChatJID = mucController->getToJID().withResource(oldNickname); 936 JID oldMUCChatJID = mucController->getToJID().withResource(oldNickname);
937 JID newMUCChatJID = mucController->getToJID().withResource(newNickname); 937 JID newMUCChatJID = mucController->getToJID().withResource(newNickname);
938 938
939 SWIFT_LOG(debug) << "nickname change in " << mucController->getToJID().toString() << " from " << oldNickname << " to " << newNickname << std::endl; 939 SWIFT_LOG(debug) << "nickname change in " << mucController->getToJID().toString() << " from " << oldNickname << " to " << newNickname;
940 940
941 // get current chat controller 941 // get current chat controller
942 ChatController *chatController = getChatControllerIfExists(oldMUCChatJID); 942 ChatController *chatController = getChatControllerIfExists(oldMUCChatJID);
@@ -983,7 +983,7 @@ void ChatsManager::handleIncomingMessage(std::shared_ptr<Message> incomingMessag
983 controller->handleIncomingOwnMessage(forwardedMessage); 983 controller->handleIncomingOwnMessage(forwardedMessage);
984 } 984 }
985 else { 985 else {
986 SWIFT_LOG(error) << "Carbons message ignored." << std::endl; 986 SWIFT_LOG(error) << "Carbons message ignored.";
987 } 987 }
988 return; 988 return;
989 } 989 }
@@ -1141,7 +1141,7 @@ void ChatsManager::handleLocalServiceFound(const JID& service, std::shared_ptr<D
1141 && identity.getType() == "text")) { 1141 && identity.getType() == "text")) {
1142 localMUCServiceJID_ = service; 1142 localMUCServiceJID_ = service;
1143 localMUCServiceFinderWalker_->endWalk(); 1143 localMUCServiceFinderWalker_->endWalk();
1144 SWIFT_LOG(debug) << "Use following MUC service for impromptu chats: " << localMUCServiceJID_ << std::endl; 1144 SWIFT_LOG(debug) << "Use following MUC service for impromptu chats: " << localMUCServiceJID_;
1145 break; 1145 break;
1146 } 1146 }
1147 } 1147 }
diff --git a/Swift/Controllers/Chat/MUCSearchController.cpp b/Swift/Controllers/Chat/MUCSearchController.cpp
index 5db917a..0b54d25 100644
--- a/Swift/Controllers/Chat/MUCSearchController.cpp
+++ b/Swift/Controllers/Chat/MUCSearchController.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -92,7 +92,7 @@ void MUCSearchController::handleSearchService(const JID& jid) {
92 delete walker_; 92 delete walker_;
93 } 93 }
94 94
95 SWIFT_LOG(debug) << "Starting walking MUC services" << std::endl; 95 SWIFT_LOG(debug) << "Starting walking MUC services";
96 itemsInProgress_ = 0; 96 itemsInProgress_ = 0;
97 walker_ = new DiscoServiceWalker(jid, iqRouter_); 97 walker_ = new DiscoServiceWalker(jid, iqRouter_);
98 walker_->onServiceFound.connect(boost::bind(&MUCSearchController::handleDiscoServiceFound, this, _1, _2)); 98 walker_->onServiceFound.connect(boost::bind(&MUCSearchController::handleDiscoServiceFound, this, _1, _2));
@@ -113,14 +113,14 @@ void MUCSearchController::handleDiscoServiceFound(const JID& jid, std::shared_pt
113 } 113 }
114 } 114 }
115 if (isMUC) { 115 if (isMUC) {
116 SWIFT_LOG(debug) << "MUC Service found: " << jid << std::endl; 116 SWIFT_LOG(debug) << "MUC Service found: " << jid;
117 services_.erase(std::remove(services_.begin(), services_.end(), jid), services_.end()); 117 services_.erase(std::remove(services_.begin(), services_.end(), jid), services_.end());
118 services_.push_back(jid); 118 services_.push_back(jid);
119 serviceDetails_[jid].setName(name); 119 serviceDetails_[jid].setName(name);
120 serviceDetails_[jid].setJID(jid); 120 serviceDetails_[jid].setJID(jid);
121 serviceDetails_[jid].setComplete(false); 121 serviceDetails_[jid].setComplete(false);
122 itemsInProgress_++; 122 itemsInProgress_++;
123 SWIFT_LOG(debug) << "Requesting items of " << jid << " (" << itemsInProgress_ << " item requests in progress)" << std::endl; 123 SWIFT_LOG(debug) << "Requesting items of " << jid << " (" << itemsInProgress_ << " item requests in progress)";
124 GetDiscoItemsRequest::ref discoItemsRequest = GetDiscoItemsRequest::create(jid, iqRouter_); 124 GetDiscoItemsRequest::ref discoItemsRequest = GetDiscoItemsRequest::create(jid, iqRouter_);
125 discoItemsRequest->onResponse.connect(boost::bind(&MUCSearchController::handleRoomsItemsResponse, this, _1, _2, jid)); 125 discoItemsRequest->onResponse.connect(boost::bind(&MUCSearchController::handleRoomsItemsResponse, this, _1, _2, jid));
126 discoItemsRequest->send(); 126 discoItemsRequest->send();
@@ -132,7 +132,7 @@ void MUCSearchController::handleDiscoServiceFound(const JID& jid, std::shared_pt
132} 132}
133 133
134void MUCSearchController::handleDiscoWalkFinished() { 134void MUCSearchController::handleDiscoWalkFinished() {
135 SWIFT_LOG(debug) << "MUC Walk finished" << std::endl; 135 SWIFT_LOG(debug) << "MUC Walk finished";
136 updateInProgressness(); 136 updateInProgressness();
137} 137}
138 138
@@ -144,7 +144,7 @@ void MUCSearchController::removeService(const JID& jid) {
144 144
145void MUCSearchController::handleRoomsItemsResponse(std::shared_ptr<DiscoItems> items, ErrorPayload::ref error, const JID& jid) { 145void MUCSearchController::handleRoomsItemsResponse(std::shared_ptr<DiscoItems> items, ErrorPayload::ref error, const JID& jid) {
146 itemsInProgress_--; 146 itemsInProgress_--;
147 SWIFT_LOG(debug) << "Items received for " << jid << " (" << itemsInProgress_ << " item requests in progress)" << std::endl; 147 SWIFT_LOG(debug) << "Items received for " << jid << " (" << itemsInProgress_ << " item requests in progress)";
148 updateInProgressness(); 148 updateInProgressness();
149 if (error) { 149 if (error) {
150 handleDiscoError(jid, error); 150 handleDiscoError(jid, error);
diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp
index 27e9dbf..5b86a7b 100644
--- a/Swift/Controllers/FileTransfer/FileTransferController.cpp
+++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2015-2017 Isode Limited. 8 * Copyright (c) 2015-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -82,7 +82,7 @@ boost::uintmax_t FileTransferController::getSize() const {
82} 82}
83 83
84void FileTransferController::start(std::string& description) { 84void FileTransferController::start(std::string& description) {
85 SWIFT_LOG(debug) << "FileTransferController::start" << std::endl; 85 SWIFT_LOG(debug) << "FileTransferController::start";
86 fileReadStream = std::make_shared<FileReadBytestream>(boost::filesystem::path(filename)); 86 fileReadStream = std::make_shared<FileReadBytestream>(boost::filesystem::path(filename));
87 OutgoingFileTransfer::ref outgoingTransfer = ftManager->createOutgoingFileTransfer(otherParty, boost::filesystem::path(filename), description, fileReadStream); 87 OutgoingFileTransfer::ref outgoingTransfer = ftManager->createOutgoingFileTransfer(otherParty, boost::filesystem::path(filename), description, fileReadStream);
88 if (outgoingTransfer) { 88 if (outgoingTransfer) {
@@ -98,7 +98,7 @@ void FileTransferController::start(std::string& description) {
98} 98}
99 99
100void FileTransferController::accept(std::string& file) { 100void FileTransferController::accept(std::string& file) {
101 SWIFT_LOG(debug) << "FileTransferController::accept" << std::endl; 101 SWIFT_LOG(debug) << "FileTransferController::accept";
102 IncomingFileTransfer::ref incomingTransfer = std::dynamic_pointer_cast<IncomingFileTransfer>(transfer); 102 IncomingFileTransfer::ref incomingTransfer = std::dynamic_pointer_cast<IncomingFileTransfer>(transfer);
103 if (incomingTransfer) { 103 if (incomingTransfer) {
104 fileWriteStream = std::make_shared<FileWriteBytestream>(boost::filesystem::path(file)); 104 fileWriteStream = std::make_shared<FileWriteBytestream>(boost::filesystem::path(file));
diff --git a/Swift/Controllers/Highlighting/HighlightManager.cpp b/Swift/Controllers/Highlighting/HighlightManager.cpp
index 2ca77e7..f09d94c 100644
--- a/Swift/Controllers/Highlighting/HighlightManager.cpp
+++ b/Swift/Controllers/Highlighting/HighlightManager.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2014-2017 Isode Limited. 8 * Copyright (c) 2014-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -85,7 +85,7 @@ HighlightConfiguration HighlightManager::highlightConfigurationFromString(const
85 } 85 }
86 catch (boost::archive::archive_exception&) { 86 catch (boost::archive::archive_exception&) {
87 configuration = getDefaultConfig(); 87 configuration = getDefaultConfig();
88 SWIFT_LOG(warning) << "Failed to load highlight configuration. Will use default configuration instead." << std::endl; 88 SWIFT_LOG(warning) << "Failed to load highlight configuration. Will use default configuration instead.";
89 } 89 }
90 return configuration; 90 return configuration;
91} 91}
diff --git a/Swift/Controllers/Settings/XMLSettingsProvider.cpp b/Swift/Controllers/Settings/XMLSettingsProvider.cpp
index f1049f1..a316cef 100644
--- a/Swift/Controllers/Settings/XMLSettingsProvider.cpp
+++ b/Swift/Controllers/Settings/XMLSettingsProvider.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012-2016 Isode Limited. 2 * Copyright (c) 2012-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -20,14 +20,14 @@ XMLSettingsProvider::XMLSettingsProvider(const std::string& xmlConfig) : level_(
20 PlatformXMLParserFactory factory; 20 PlatformXMLParserFactory factory;
21 auto parser = factory.createXMLParser(this, true); 21 auto parser = factory.createXMLParser(this, true);
22 if (parser->parse(xmlConfig)) { 22 if (parser->parse(xmlConfig)) {
23 SWIFT_LOG(debug) << "Found and parsed system config" << std::endl; 23 SWIFT_LOG(debug) << "Found and parsed system config";
24 } 24 }
25 else { 25 else {
26 SWIFT_LOG(debug) << "Found invalid system config" << std::endl; 26 SWIFT_LOG(debug) << "Found invalid system config";
27 } 27 }
28 } 28 }
29 else { 29 else {
30 SWIFT_LOG(debug) << "No system config found" << std::endl; 30 SWIFT_LOG(debug) << "No system config found";
31 } 31 }
32} 32}
33 33
@@ -110,7 +110,7 @@ void XMLSettingsProvider::handleStartElement(const std::string& element, const s
110void XMLSettingsProvider::handleEndElement(const std::string& /*element*/, const std::string& /*ns*/) { 110void XMLSettingsProvider::handleEndElement(const std::string& /*element*/, const std::string& /*ns*/) {
111 if (level_ == SettingLevel) { 111 if (level_ == SettingLevel) {
112 values_[currentElement_] = currentText_; 112 values_[currentElement_] = currentText_;
113 SWIFT_LOG(debug) << "Setting value of " << currentElement_ << " to " << currentText_ << std::endl; 113 SWIFT_LOG(debug) << "Setting value of " << currentElement_ << " to " << currentText_;
114 } 114 }
115 level_--; 115 level_--;
116} 116}
diff --git a/Swift/Controllers/StatusCache.cpp b/Swift/Controllers/StatusCache.cpp
index 3c6baed..f9196f6 100644
--- a/Swift/Controllers/StatusCache.cpp
+++ b/Swift/Controllers/StatusCache.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012-2016 Isode Limited. 2 * Copyright (c) 2012-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -76,13 +76,13 @@ void StatusCache::loadRecents() {
76 previousStatuses_.push_back(PreviousStatus(boost::trim_copy(bits[1]), type)); 76 previousStatuses_.push_back(PreviousStatus(boost::trim_copy(bits[1]), type));
77 } 77 }
78 catch (const boost::bad_lexical_cast& e) { 78 catch (const boost::bad_lexical_cast& e) {
79 SWIFT_LOG(error) << "Failed to load recent status cache entry: " << e.what() << std::endl; 79 SWIFT_LOG(error) << "Failed to load recent status cache entry: " << e.what();
80 } 80 }
81 } 81 }
82 } 82 }
83 } 83 }
84 catch (const boost::filesystem::filesystem_error& e) { 84 catch (const boost::filesystem::filesystem_error& e) {
85 SWIFT_LOG(error) << "Failed to load recents: " << e.what() << std::endl; 85 SWIFT_LOG(error) << "Failed to load recents: " << e.what();
86 } 86 }
87} 87}
88 88
@@ -100,7 +100,7 @@ void StatusCache::saveRecents() {
100 file.close(); 100 file.close();
101 } 101 }
102 catch (const boost::filesystem::filesystem_error& e) { 102 catch (const boost::filesystem::filesystem_error& e) {
103 SWIFT_LOG(error) << "Failed to save recents: " << e.what() << std::endl; 103 SWIFT_LOG(error) << "Failed to save recents: " << e.what();
104 } 104 }
105} 105}
106 106
diff --git a/Swift/Controllers/Storages/AvatarFileStorage.cpp b/Swift/Controllers/Storages/AvatarFileStorage.cpp
index 9d9b9ea..808c432 100644
--- a/Swift/Controllers/Storages/AvatarFileStorage.cpp
+++ b/Swift/Controllers/Storages/AvatarFileStorage.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -30,13 +30,13 @@ AvatarFileStorage::AvatarFileStorage(const boost::filesystem::path& avatarsDir,
30 jidAvatars.insert(std::make_pair(jid, r.first)); 30 jidAvatars.insert(std::make_pair(jid, r.first));
31 } 31 }
32 else if (!r.first.empty() || !r.second.empty()) { 32 else if (!r.first.empty() || !r.second.empty()) {
33 SWIFT_LOG(error) << "Invalid entry in avatars file: " << r.second << std::endl; 33 SWIFT_LOG(error) << "Invalid entry in avatars file: " << r.second;
34 } 34 }
35 } 35 }
36 } 36 }
37 } 37 }
38 catch (...) { 38 catch (...) {
39 SWIFT_LOG(error) << "Error reading avatars file" << std::endl; 39 SWIFT_LOG(error) << "Error reading avatars file";
40 } 40 }
41 } 41 }
42} 42}
@@ -54,7 +54,7 @@ void AvatarFileStorage::addAvatar(const std::string& hash, const ByteArray& avat
54 boost::filesystem::create_directories(avatarPath.parent_path()); 54 boost::filesystem::create_directories(avatarPath.parent_path());
55 } 55 }
56 catch (const boost::filesystem::filesystem_error& e) { 56 catch (const boost::filesystem::filesystem_error& e) {
57 SWIFT_LOG(error) << "filesystem error: " << e.what() << std::endl; 57 SWIFT_LOG(error) << "filesystem error: " << e.what();
58 } 58 }
59 } 59 }
60 60
@@ -63,7 +63,7 @@ void AvatarFileStorage::addAvatar(const std::string& hash, const ByteArray& avat
63 file.write(reinterpret_cast<const char*>(vecptr(avatar)), static_cast<std::streamsize>(avatar.size())); 63 file.write(reinterpret_cast<const char*>(vecptr(avatar)), static_cast<std::streamsize>(avatar.size()));
64 } 64 }
65 catch (const boost::filesystem::filesystem_error& e) { 65 catch (const boost::filesystem::filesystem_error& e) {
66 SWIFT_LOG(error) << "filesystem error: " << e.what() << std::endl; 66 SWIFT_LOG(error) << "filesystem error: " << e.what();
67 } 67 }
68} 68}
69 69
@@ -77,7 +77,7 @@ ByteArray AvatarFileStorage::getAvatar(const std::string& hash) const {
77 readByteArrayFromFile(data, getAvatarPath(hash)); 77 readByteArrayFromFile(data, getAvatarPath(hash));
78 } 78 }
79 catch (const boost::filesystem::filesystem_error& e) { 79 catch (const boost::filesystem::filesystem_error& e) {
80 SWIFT_LOG(error) << "filesystem error: " << e.what() << std::endl; 80 SWIFT_LOG(error) << "filesystem error: " << e.what();
81 } 81 }
82 return data; 82 return data;
83} 83}
@@ -107,7 +107,7 @@ void AvatarFileStorage::saveJIDAvatars() {
107 file.close(); 107 file.close();
108 } 108 }
109 catch (...) { 109 catch (...) {
110 SWIFT_LOG(error) << "Error writing avatars file" << std::endl; 110 SWIFT_LOG(error) << "Error writing avatars file";
111 } 111 }
112} 112}
113 113
diff --git a/Swift/Controllers/Storages/CertificateFileStorage.cpp b/Swift/Controllers/Storages/CertificateFileStorage.cpp
index 2e1343f..a8661df 100644
--- a/Swift/Controllers/Storages/CertificateFileStorage.cpp
+++ b/Swift/Controllers/Storages/CertificateFileStorage.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -31,7 +31,7 @@ bool CertificateFileStorage::hasCertificate(Certificate::ref certificate) const
31 return true; 31 return true;
32 } 32 }
33 else { 33 else {
34 SWIFT_LOG(warning) << "Stored certificate does not match received certificate" << std::endl; 34 SWIFT_LOG(warning) << "Stored certificate does not match received certificate";
35 return false; 35 return false;
36 } 36 }
37 } 37 }
@@ -57,7 +57,7 @@ void CertificateFileStorage::addCertificate(Certificate::ref certificate) {
57 file.close(); 57 file.close();
58 } 58 }
59 catch (...) { 59 catch (...) {
60 SWIFT_LOG(warning) << "Failed to store certificate to " << certificatePath << std::endl; 60 SWIFT_LOG(warning) << "Failed to store certificate to " << certificatePath;
61 } 61 }
62} 62}
63 63
diff --git a/Swift/QtUI/CAPICertificateSelector.cpp b/Swift/QtUI/CAPICertificateSelector.cpp
index e47121b..7e4bc0b 100644
--- a/Swift/QtUI/CAPICertificateSelector.cpp
+++ b/Swift/QtUI/CAPICertificateSelector.cpp
@@ -80,11 +80,11 @@ std::string selectCAPICertificate() {
80 if (titleLength == 0 || promptLength == 0) { 80 if (titleLength == 0 || promptLength == 0) {
81 int error = GetLastError(); 81 int error = GetLastError();
82 switch (error) { 82 switch (error) {
83 case ERROR_INSUFFICIENT_BUFFER: SWIFT_LOG(error) << "Insufficient buffer for rendering cert dialog" << std::endl;break; 83 case ERROR_INSUFFICIENT_BUFFER: SWIFT_LOG(error) << "Insufficient buffer for rendering cert dialog"; break;
84 case ERROR_INVALID_FLAGS: SWIFT_LOG(error) << "Invalid flags for rendering cert dialog" << std::endl;break; 84 case ERROR_INVALID_FLAGS: SWIFT_LOG(error) << "Invalid flags for rendering cert dialog"; break;
85 case ERROR_INVALID_PARAMETER: SWIFT_LOG(error) << "Invalid parameter for rendering cert dialog" << std::endl;break; 85 case ERROR_INVALID_PARAMETER: SWIFT_LOG(error) << "Invalid parameter for rendering cert dialog"; break;
86 case ERROR_NO_UNICODE_TRANSLATION: SWIFT_LOG(error) << "Invalid unicode for rendering cert dialog" << std::endl;break; 86 case ERROR_NO_UNICODE_TRANSLATION: SWIFT_LOG(error) << "Invalid unicode for rendering cert dialog"; break;
87 default: SWIFT_LOG(error) << "Unexpected multibyte conversion errorcode" << std::endl; 87 default: SWIFT_LOG(error) << "Unexpected multibyte conversion errorcode";
88 88
89 } 89 }
90 } 90 }
@@ -103,7 +103,7 @@ std::string selectCAPICertificate() {
103 103
104 if (hstore) { 104 if (hstore) {
105 if (CertCloseStore(hstore, 0) == FALSE) { 105 if (CertCloseStore(hstore, 0) == FALSE) {
106 SWIFT_LOG(debug) << "Failed to close the certificate store handle." << std::endl; 106 SWIFT_LOG(debug) << "Failed to close the certificate store handle.";
107 } 107 }
108 } 108 }
109 109
diff --git a/Swift/QtUI/QtAboutWidget.cpp b/Swift/QtUI/QtAboutWidget.cpp
index 2db0c9d..0a4e0ba 100644
--- a/Swift/QtUI/QtAboutWidget.cpp
+++ b/Swift/QtUI/QtAboutWidget.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2017 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -150,7 +150,7 @@ void QtAboutWidget::openPlainTextWindow(const QString& path) {
150 text->activateWindow(); 150 text->activateWindow();
151 } 151 }
152 else { 152 else {
153 SWIFT_LOG(error) << "Failed to open " << Q2PSTRING(path) << "." << std::endl; 153 SWIFT_LOG(error) << "Failed to open " << Q2PSTRING(path) << ".";
154 } 154 }
155} 155}
156 156
diff --git a/Swift/QtUI/QtScaledAvatarCache.cpp b/Swift/QtUI/QtScaledAvatarCache.cpp
index 37ea6a9..e3a28d6 100644
--- a/Swift/QtUI/QtScaledAvatarCache.cpp
+++ b/Swift/QtUI/QtScaledAvatarCache.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2016 Isode Limited. 2 * Copyright (c) 2011-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -53,8 +53,8 @@ QString QtScaledAvatarCache::getScaledAvatarPath(const QString& path) {
53 if (avatarFile.exists() && !avatarFile.absolutePath().startsWith(":/")) { 53 if (avatarFile.exists() && !avatarFile.absolutePath().startsWith(":/")) {
54 QString cacheSubPath = QString("ScaledAvatarCacheV%1/%2").arg(QString::number(QT_SCALED_AVATAR_CACHE_VERSION), QString::number(size)); 54 QString cacheSubPath = QString("ScaledAvatarCacheV%1/%2").arg(QString::number(QT_SCALED_AVATAR_CACHE_VERSION), QString::number(size));
55 if (!avatarFile.dir().mkpath(cacheSubPath)) { 55 if (!avatarFile.dir().mkpath(cacheSubPath)) {
56 SWIFT_LOG(error) << "avatarFile.dir(): " << Q2PSTRING(avatarFile.dir().absolutePath()) << std::endl; 56 SWIFT_LOG(error) << "avatarFile.dir(): " << Q2PSTRING(avatarFile.dir().absolutePath());
57 SWIFT_LOG(error) << "Failed creating cache folder: " << Q2PSTRING(cacheSubPath) << std::endl; 57 SWIFT_LOG(error) << "Failed creating cache folder: " << Q2PSTRING(cacheSubPath);
58 return path; 58 return path;
59 } 59 }
60 QDir targetDir(avatarFile.dir().absoluteFilePath(cacheSubPath)); 60 QDir targetDir(avatarFile.dir().absoluteFilePath(cacheSubPath));
@@ -75,7 +75,7 @@ QString QtScaledAvatarCache::getScaledAvatarPath(const QString& path) {
75 return path; 75 return path;
76 } 76 }
77 } else { 77 } else {
78 SWIFT_LOG(warning) << "Failed to load " << Q2PSTRING(path) << std::endl; 78 SWIFT_LOG(warning) << "Failed to load " << Q2PSTRING(path);
79 } 79 }
80 } 80 }
81 return targetFile; 81 return targetFile;
diff --git a/Swift/QtUI/QtSpellCheckerWindow.cpp b/Swift/QtUI/QtSpellCheckerWindow.cpp
index a8178c4..23b0963 100644
--- a/Swift/QtUI/QtSpellCheckerWindow.cpp
+++ b/Swift/QtUI/QtSpellCheckerWindow.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2016 Isode Limited. 8 * Copyright (c) 2016-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -64,7 +64,7 @@ void QtSpellCheckerWindow::setSupportedLanguages(const std::vector<std::string>&
64} 64}
65 65
66void QtSpellCheckerWindow::setActiveLanguage(const std::string& language) { 66void QtSpellCheckerWindow::setActiveLanguage(const std::string& language) {
67 SWIFT_LOG_ASSERT(languageItems_.find(language) != languageItems_.end(), warning) << "Language '" << language << "' is not available." << std::endl; 67 SWIFT_LOG_ASSERT(languageItems_.find(language) != languageItems_.end(), warning) << "Language '" << language << "' is not available.";
68 if (languageItems_.find(language) != languageItems_.end()) { 68 if (languageItems_.find(language) != languageItems_.end()) {
69 languageItems_[language]->setSelected(true); 69 languageItems_[language]->setSelected(true);
70 } 70 }
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index f1ad38e..73fd733 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -191,7 +191,7 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
191 Log::setLogFile(fileName); 191 Log::setLogFile(fileName);
192 } 192 }
193 catch (...) { 193 catch (...) {
194 SWIFT_LOG(error) << "Error while retrieving the specified log file name from the command line" << std::endl; 194 SWIFT_LOG(error) << "Error while retrieving the specified log file name from the command line";
195 } 195 }
196 } 196 }
197 //TODO this old option can be purged 197 //TODO this old option can be purged
@@ -222,13 +222,13 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
222 for (auto&& fontName : fontNames) { 222 for (auto&& fontName : fontNames) {
223 std::string fontPath = std::string(":/") + fontName; 223 std::string fontPath = std::string(":/") + fontName;
224 int error = QFontDatabase::addApplicationFont(P2QSTRING(fontPath)); 224 int error = QFontDatabase::addApplicationFont(P2QSTRING(fontPath));
225 SWIFT_LOG_ASSERT(error != -1, error) << "Failed to load font " << fontPath << std::endl; 225 SWIFT_LOG_ASSERT(error != -1, error) << "Failed to load font " << fontPath;
226 } 226 }
227 227
228#ifdef SWIFTEN_PLATFORM_LINUX 228#ifdef SWIFTEN_PLATFORM_LINUX
229 std::string fontPath = std::string(":/themes/Default/Noto/NotoColorEmoji.ttf"); 229 std::string fontPath = std::string(":/themes/Default/Noto/NotoColorEmoji.ttf");
230 int error = QFontDatabase::addApplicationFont(P2QSTRING(fontPath)); 230 int error = QFontDatabase::addApplicationFont(P2QSTRING(fontPath));
231 SWIFT_LOG_ASSERT(error != -1, error) << "Failed to load font " << fontPath << std::endl; 231 SWIFT_LOG_ASSERT(error != -1, error) << "Failed to load font " << fontPath;
232 QFont::insertSubstitution(QApplication::font().family(),"NotoColorEmoji"); 232 QFont::insertSubstitution(QApplication::font().family(),"NotoColorEmoji");
233#endif 233#endif
234#ifdef SWIFTEN_PLATFORM_WINDOWS 234#ifdef SWIFTEN_PLATFORM_WINDOWS
diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp
index e63cd4f..b3c57a7 100644
--- a/Swift/QtUI/QtTextEdit.cpp
+++ b/Swift/QtUI/QtTextEdit.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2017 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -240,7 +240,7 @@ void QtTextEdit::setUpSpellChecker() {
240 } 240 }
241 else { 241 else {
242 // Spellchecking is not working, as we did not get a valid checker from the factory. Disable spellchecking. 242 // Spellchecking is not working, as we did not get a valid checker from the factory. Disable spellchecking.
243 SWIFT_LOG(warning) << "Spellchecking is currently misconfigured in Swift (e.g. missing dictionary or broken dictionary file). Disable spellchecking." << std::endl; 243 SWIFT_LOG(warning) << "Spellchecking is currently misconfigured in Swift (e.g. missing dictionary or broken dictionary file). Disable spellchecking.";
244 settings_->storeSetting(QtUISettingConstants::SPELL_CHECKER, false); 244 settings_->storeSetting(QtUISettingConstants::SPELL_CHECKER, false);
245 } 245 }
246 246
diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp
index 93fca5f..49f55dd 100644
--- a/Swift/QtUI/QtUIFactory.cpp
+++ b/Swift/QtUI/QtUIFactory.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -49,9 +49,9 @@ QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider*
49} 49}
50 50
51QtUIFactory::~QtUIFactory() { 51QtUIFactory::~QtUIFactory() {
52 SWIFT_LOG(debug) << "Entering QtUIFactory destructor. chatWindows size:" << chatWindows_.size() << std::endl; 52 SWIFT_LOG(debug) << "Entering QtUIFactory destructor. chatWindows size:" << chatWindows_.size();
53 for (auto chat : chatWindows_) { 53 for (auto chat : chatWindows_) {
54 SWIFT_LOG_ASSERT(chat.isNull(), debug) << "QtUIFactory has active chat windows and has not been reset properly" << std::endl; 54 SWIFT_LOG_ASSERT(chat.isNull(), debug) << "QtUIFactory has active chat windows and has not been reset properly";
55 } 55 }
56 delete chatWindowFactory_; 56 delete chatWindowFactory_;
57} 57}
diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp
index bca9e2e..75a23f8 100644
--- a/Swift/QtUI/QtWebKitChatView.cpp
+++ b/Swift/QtUI/QtWebKitChatView.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -141,7 +141,7 @@ void QtWebKitChatView::addMessageBottom(std::shared_ptr<ChatSnippet> snippet) {
141 141
142void QtWebKitChatView::addMessageTop(std::shared_ptr<ChatSnippet> /* snippet */) { 142void QtWebKitChatView::addMessageTop(std::shared_ptr<ChatSnippet> /* snippet */) {
143 // TODO: Implement this in a sensible manner later. 143 // TODO: Implement this in a sensible manner later.
144 SWIFT_LOG(error) << "Not yet implemented!" << std::endl; 144 SWIFT_LOG(error) << "Not yet implemented!";
145} 145}
146 146
147void QtWebKitChatView::addToDOM(std::shared_ptr<ChatSnippet> snippet) { 147void QtWebKitChatView::addToDOM(std::shared_ptr<ChatSnippet> snippet) {
@@ -384,7 +384,7 @@ void QtWebKitChatView::setFileTransferProgress(QString id, const int percentageD
384 rememberScrolledToBottom(); 384 rememberScrolledToBottom();
385 QWebElement ftElement = findElementWithID(document_, "div", id); 385 QWebElement ftElement = findElementWithID(document_, "div", id);
386 if (ftElement.isNull()) { 386 if (ftElement.isNull()) {
387 SWIFT_LOG(debug) << "Tried to access FT UI via invalid id!" << std::endl; 387 SWIFT_LOG(debug) << "Tried to access FT UI via invalid id!";
388 return; 388 return;
389 } 389 }
390 QWebElement progressBar = ftElement.findFirst("div.progressbar"); 390 QWebElement progressBar = ftElement.findFirst("div.progressbar");
@@ -398,7 +398,7 @@ void QtWebKitChatView::setFileTransferStatus(QString id, const ChatWindow::FileT
398 rememberScrolledToBottom(); 398 rememberScrolledToBottom();
399 QWebElement ftElement = findElementWithID(document_, "div", id); 399 QWebElement ftElement = findElementWithID(document_, "div", id);
400 if (ftElement.isNull()) { 400 if (ftElement.isNull()) {
401 SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id) << std::endl; 401 SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id);
402 return; 402 return;
403 } 403 }
404 404
@@ -483,7 +483,7 @@ int QtWebKitChatView::getSnippetPositionByDate(const QDate& date) {
483 483
484void QtWebKitChatView::resetTopInsertPoint() { 484void QtWebKitChatView::resetTopInsertPoint() {
485 // TODO: Implement or refactor later. 485 // TODO: Implement or refactor later.
486 SWIFT_LOG(error) << "Not yet implemented!" << std::endl; 486 SWIFT_LOG(error) << "Not yet implemented!";
487} 487}
488 488
489std::string QtWebKitChatView::addMessage( 489std::string QtWebKitChatView::addMessage(
@@ -624,7 +624,7 @@ void QtWebKitChatView::resizeEvent(QResizeEvent* event) {
624} 624}
625 625
626std::string QtWebKitChatView::addFileTransfer(const std::string& senderName, const std::string& avatarPath, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description) { 626std::string QtWebKitChatView::addFileTransfer(const std::string& senderName, const std::string& avatarPath, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description) {
627 SWIFT_LOG(debug) << "addFileTransfer" << std::endl; 627 SWIFT_LOG(debug) << "addFileTransfer";
628 QString ft_id = QString("ft%1").arg(P2QSTRING(boost::lexical_cast<std::string>(idCounter_++))); 628 QString ft_id = QString("ft%1").arg(P2QSTRING(boost::lexical_cast<std::string>(idCounter_++)));
629 629
630 QString actionText; 630 QString actionText;
@@ -726,7 +726,7 @@ static bool isFilePathWritable(const QString& path) {
726void QtWebKitChatView::setFileTransferWarning(QString id, QString warningText) { 726void QtWebKitChatView::setFileTransferWarning(QString id, QString warningText) {
727 QWebElement ftElement = findElementWithID(document_, "div", id); 727 QWebElement ftElement = findElementWithID(document_, "div", id);
728 if (ftElement.isNull()) { 728 if (ftElement.isNull()) {
729 SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id) << std::endl; 729 SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id);
730 return; 730 return;
731 } 731 }
732 732
@@ -737,7 +737,7 @@ void QtWebKitChatView::setFileTransferWarning(QString id, QString warningText) {
737void QtWebKitChatView::removeFileTransferWarning(QString id) { 737void QtWebKitChatView::removeFileTransferWarning(QString id) {
738 QWebElement ftElement = findElementWithID(document_, "div", id); 738 QWebElement ftElement = findElementWithID(document_, "div", id);
739 if (ftElement.isNull()) { 739 if (ftElement.isNull()) {
740 SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id) << std::endl; 740 SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id);
741 return; 741 return;
742 } 742 }
743 743
@@ -829,7 +829,7 @@ void QtWebKitChatView::handleHTMLButtonClicked(QString id, QString encodedArgume
829 window_->resendMessage(Q2PSTRING(chatID)); 829 window_->resendMessage(Q2PSTRING(chatID));
830 } 830 }
831 else { 831 else {
832 SWIFT_LOG(debug) << "Unknown HTML button! ( " << Q2PSTRING(id) << " )" << std::endl; 832 SWIFT_LOG(debug) << "Unknown HTML button! ( " << Q2PSTRING(id) << " )";
833 } 833 }
834} 834}
835 835
diff --git a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp
index 2402529..53e2733 100644
--- a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp
+++ b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014-2016 Isode Limited. 2 * Copyright (c) 2014-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -514,9 +514,9 @@ void QtDynamicGridLayout::updateTabPositions() {
514 514
515void QtDynamicGridLayout::moveTab(QtTabWidget* tabWidget, int oldIndex, int newIndex) { 515void QtDynamicGridLayout::moveTab(QtTabWidget* tabWidget, int oldIndex, int newIndex) {
516#if QT_VERSION >= 0x040500 516#if QT_VERSION >= 0x040500
517 SWIFT_LOG_ASSERT(movingTab_ == nullptr, error) << std::endl; 517 SWIFT_LOG_ASSERT(movingTab_ == nullptr, error);
518 movingTab_ = qobject_cast<QtTabbable*>(tabWidget->widget(oldIndex)); 518 movingTab_ = qobject_cast<QtTabbable*>(tabWidget->widget(oldIndex));
519 SWIFT_LOG_ASSERT(movingTab_ != nullptr, error) << std::endl; 519 SWIFT_LOG_ASSERT(movingTab_ != nullptr, error);
520 520
521 if (movingTab_) { 521 if (movingTab_) {
522 // Install event filter that filters out events issued during the internal movement of the 522 // Install event filter that filters out events issued during the internal movement of the
@@ -526,7 +526,7 @@ void QtDynamicGridLayout::moveTab(QtTabWidget* tabWidget, int oldIndex, int newI
526 tabWidget->tabBar()->moveTab(oldIndex, newIndex); 526 tabWidget->tabBar()->moveTab(oldIndex, newIndex);
527 527
528 qApp->removeEventFilter(this); 528 qApp->removeEventFilter(this);
529 SWIFT_LOG_ASSERT(movingTab_ == tabWidget->widget(newIndex), error) << std::endl; 529 SWIFT_LOG_ASSERT(movingTab_ == tabWidget->widget(newIndex), error);
530 } 530 }
531 movingTab_ = nullptr; 531 movingTab_ = nullptr;
532 tabWidget->widget(newIndex)->setFocus(); 532 tabWidget->widget(newIndex)->setFocus();
diff --git a/Swiften/Avatars/CombinedAvatarProvider.cpp b/Swiften/Avatars/CombinedAvatarProvider.cpp
index 465512f..ba6e6be 100644
--- a/Swiften/Avatars/CombinedAvatarProvider.cpp
+++ b/Swiften/Avatars/CombinedAvatarProvider.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -39,17 +39,17 @@ void CombinedAvatarProvider::handleAvatarChanged(const JID& jid) {
39 } 39 }
40 boost::optional<std::string> newHash = getCombinedAvatarAndCache(jid); 40 boost::optional<std::string> newHash = getCombinedAvatarAndCache(jid);
41 if (newHash != oldHash) { 41 if (newHash != oldHash) {
42 SWIFT_LOG(debug) << "Avatar changed: " << jid << ": " << oldHash << " -> " << (newHash ? newHash.get() : "NULL") << std::endl; 42 SWIFT_LOG(debug) << "Avatar changed: " << jid << ": " << oldHash << " -> " << (newHash ? newHash.get() : "NULL");
43 onAvatarChanged(jid); 43 onAvatarChanged(jid);
44 } 44 }
45} 45}
46 46
47boost::optional<std::string> CombinedAvatarProvider::getCombinedAvatarAndCache(const JID& jid) const { 47boost::optional<std::string> CombinedAvatarProvider::getCombinedAvatarAndCache(const JID& jid) const {
48 SWIFT_LOG(debug) << "JID: " << jid << std::endl; 48 SWIFT_LOG(debug) << "JID: " << jid;
49 boost::optional<std::string> hash; 49 boost::optional<std::string> hash;
50 for (size_t i = 0; i < providers.size() && !hash; ++i) { 50 for (size_t i = 0; i < providers.size() && !hash; ++i) {
51 hash = providers[i]->getAvatarHash(jid); 51 hash = providers[i]->getAvatarHash(jid);
52 SWIFT_LOG(debug) << "Provider " << providers[i] << ": " << (hash ? hash.get() : "NULL") << std::endl; 52 SWIFT_LOG(debug) << "Provider " << providers[i] << ": " << (hash ? hash.get() : "NULL");
53 } 53 }
54 if (hash) { 54 if (hash) {
55 avatars[jid] = *hash; 55 avatars[jid] = *hash;
diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.cpp b/Swiften/Avatars/VCardUpdateAvatarManager.cpp
index 349af2f..d04c13c 100644
--- a/Swiften/Avatars/VCardUpdateAvatarManager.cpp
+++ b/Swiften/Avatars/VCardUpdateAvatarManager.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -33,13 +33,13 @@ void VCardUpdateAvatarManager::handlePresenceReceived(std::shared_ptr<Presence>
33 } 33 }
34 JID from = getAvatarJID(presence->getFrom()); 34 JID from = getAvatarJID(presence->getFrom());
35 if (update->getPhotoHash().size() != 40) { 35 if (update->getPhotoHash().size() != 40) {
36 SWIFT_LOG(debug) << "Invalid vCard avatar photo hash length. Must be hex-encoded SHA-1, i.e. 40 characters." << std::endl; 36 SWIFT_LOG(debug) << "Invalid vCard avatar photo hash length. Must be hex-encoded SHA-1, i.e. 40 characters.";
37 return; 37 return;
38 } 38 }
39 if (getAvatarHash(from) == update->getPhotoHash()) { 39 if (getAvatarHash(from) == update->getPhotoHash()) {
40 return; 40 return;
41 } 41 }
42 SWIFT_LOG(debug) << "Updated hash: " << from << " -> " << update->getPhotoHash() << std::endl; 42 SWIFT_LOG(debug) << "Updated hash: " << from << " -> " << update->getPhotoHash();
43 if (avatarStorage_->hasAvatar(update->getPhotoHash())) { 43 if (avatarStorage_->hasAvatar(update->getPhotoHash())) {
44 setAvatarHash(from, update->getPhotoHash()); 44 setAvatarHash(from, update->getPhotoHash());
45 } 45 }
@@ -50,7 +50,7 @@ void VCardUpdateAvatarManager::handlePresenceReceived(std::shared_ptr<Presence>
50 50
51void VCardUpdateAvatarManager::handleVCardChanged(const JID& from, VCard::ref vCard) { 51void VCardUpdateAvatarManager::handleVCardChanged(const JID& from, VCard::ref vCard) {
52 if (!vCard) { 52 if (!vCard) {
53 SWIFT_LOG(debug) << "Missing element: " << from << ": null vcard payload" << std::endl; 53 SWIFT_LOG(debug) << "Missing element: " << from << ": null vcard payload";
54 return; 54 return;
55 } 55 }
56 56
@@ -67,7 +67,7 @@ void VCardUpdateAvatarManager::handleVCardChanged(const JID& from, VCard::ref vC
67} 67}
68 68
69void VCardUpdateAvatarManager::setAvatarHash(const JID& from, const std::string& hash) { 69void VCardUpdateAvatarManager::setAvatarHash(const JID& from, const std::string& hash) {
70 SWIFT_LOG(debug) << "Updating hash: " << from << " -> " << hash << std::endl; 70 SWIFT_LOG(debug) << "Updating hash: " << from << " -> " << hash;
71 avatarHashes_[from] = hash; 71 avatarHashes_[from] = hash;
72 onAvatarChanged(from); 72 onAvatarChanged(from);
73} 73}
diff --git a/Swiften/Base/DateTime.cpp b/Swiften/Base/DateTime.cpp
index 4443566..23b3b84 100644
--- a/Swiften/Base/DateTime.cpp
+++ b/Swiften/Base/DateTime.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2016 Isode Limited. 2 * Copyright (c) 2011-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -40,7 +40,7 @@ std::string dateTimeToLocalString(const boost::posix_time::ptime& time) {
40 localString = boost::posix_time::to_simple_string(boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(time)); 40 localString = boost::posix_time::to_simple_string(boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(time));
41 } 41 }
42 catch(std::out_of_range& exception) { 42 catch(std::out_of_range& exception) {
43 SWIFT_LOG(debug) << exception.what() << std::endl; 43 SWIFT_LOG(debug) << exception.what();
44 } 44 }
45 return localString; 45 return localString;
46} 46}
diff --git a/Swiften/Base/Log.cpp b/Swiften/Base/Log.cpp
index abfd2bc..b6f1851 100644
--- a/Swiften/Base/Log.cpp
+++ b/Swiften/Base/Log.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2015 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -30,13 +30,16 @@ Log::~Log() {
30 if (logCallback) { 30 if (logCallback) {
31 logCallback(severity_, std::move(file_), line_, std::move(function_), stream.str()); 31 logCallback(severity_, std::move(file_), line_, std::move(function_), stream.str());
32 } 32 }
33 else if (logfile) {
34 fwrite(stream.str().c_str(), sizeof(char), stream.str().size(), logfile.get());
35 fflush(logfile.get());
36 }
37 else { 33 else {
38 fwrite(stream.str().c_str(), sizeof(char), stream.str().size(), stderr); 34 stream << std::endl;
39 fflush(stderr); 35 if (logfile) {
36 fwrite(stream.str().c_str(), sizeof(char), stream.str().size(), logfile.get());
37 fflush(logfile.get());
38 }
39 else {
40 fwrite(stream.str().c_str(), sizeof(char), stream.str().size(), stderr);
41 fflush(stderr);
42 }
40 } 43 }
41#endif 44#endif
42} 45}
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index 4e34417..1114336 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -88,7 +88,7 @@ ClientSession::ClientSession(
88 authenticationPort(-1) { 88 authenticationPort(-1) {
89#ifdef SWIFTEN_PLATFORM_WIN32 89#ifdef SWIFTEN_PLATFORM_WIN32
90if (WindowsRegistry::isFIPSEnabled()) { 90if (WindowsRegistry::isFIPSEnabled()) {
91 SWIFT_LOG(info) << "Windows is running in FIPS-140 mode. Some authentication methods will be unavailable." << std::endl; 91 SWIFT_LOG(info) << "Windows is running in FIPS-140 mode. Some authentication methods will be unavailable.";
92} 92}
93#endif 93#endif
94} 94}
@@ -531,7 +531,7 @@ void ClientSession::finish() {
531 finishSession(std::shared_ptr<Error>()); 531 finishSession(std::shared_ptr<Error>());
532 } 532 }
533 else { 533 else {
534 SWIFT_LOG(warning) << "Session already finished or finishing." << std::endl; 534 SWIFT_LOG(warning) << "Session already finished or finishing.";
535 } 535 }
536} 536}
537 537
@@ -544,7 +544,7 @@ void ClientSession::finishSession(std::shared_ptr<Swift::Error> error) {
544 error_ = error; 544 error_ = error;
545 } 545 }
546 else { 546 else {
547 SWIFT_LOG(warning) << "Session finished twice" << std::endl; 547 SWIFT_LOG(warning) << "Session finished twice";
548 } 548 }
549 assert(stream->isOpen()); 549 assert(stream->isOpen());
550 if (stanzaAckResponder_) { 550 if (stanzaAckResponder_) {
diff --git a/Swiften/Client/ClientSessionStanzaChannel.cpp b/Swiften/Client/ClientSessionStanzaChannel.cpp
index f48b306..6a5d07d 100644
--- a/Swiften/Client/ClientSessionStanzaChannel.cpp
+++ b/Swiften/Client/ClientSessionStanzaChannel.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -49,7 +49,7 @@ std::string ClientSessionStanzaChannel::getNewIQID() {
49 49
50void ClientSessionStanzaChannel::send(std::shared_ptr<Stanza> stanza) { 50void ClientSessionStanzaChannel::send(std::shared_ptr<Stanza> stanza) {
51 if (!isAvailable()) { 51 if (!isAvailable()) {
52 SWIFT_LOG(warning) << "Client: Trying to send a stanza while disconnected." << std::endl; 52 SWIFT_LOG(warning) << "Client: Trying to send a stanza while disconnected.";
53 return; 53 return;
54 } 54 }
55 session->sendStanza(stanza); 55 session->sendStanza(stanza);
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp
index ccde0c2..7579bca 100644
--- a/Swiften/Client/CoreClient.cpp
+++ b/Swiften/Client/CoreClient.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -69,21 +69,21 @@ void CoreClient::connect(const ClientOptions& o) {
69 HostAddressPort systemHTTPConnectProxy = networkFactories->getProxyProvider()->getHTTPConnectProxy(); 69 HostAddressPort systemHTTPConnectProxy = networkFactories->getProxyProvider()->getHTTPConnectProxy();
70 switch (o.proxyType) { 70 switch (o.proxyType) {
71 case ClientOptions::NoProxy: 71 case ClientOptions::NoProxy:
72 SWIFT_LOG(debug) << " without a proxy" << std::endl; 72 SWIFT_LOG(debug) << " without a proxy";
73 break; 73 break;
74 case ClientOptions::SystemConfiguredProxy: 74 case ClientOptions::SystemConfiguredProxy:
75 SWIFT_LOG(debug) << " with a system configured proxy" << std::endl; 75 SWIFT_LOG(debug) << " with a system configured proxy";
76 if (systemSOCKS5Proxy.isValid()) { 76 if (systemSOCKS5Proxy.isValid()) {
77 SWIFT_LOG(debug) << "Found SOCK5 Proxy: " << systemSOCKS5Proxy.getAddress().toString() << ":" << systemSOCKS5Proxy.getPort() << std::endl; 77 SWIFT_LOG(debug) << "Found SOCK5 Proxy: " << systemSOCKS5Proxy.getAddress().toString() << ":" << systemSOCKS5Proxy.getPort();
78 proxyConnectionFactories.push_back(new SOCKS5ProxiedConnectionFactory(networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory(), systemSOCKS5Proxy.getAddress().toString(), systemSOCKS5Proxy.getPort())); 78 proxyConnectionFactories.push_back(new SOCKS5ProxiedConnectionFactory(networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory(), systemSOCKS5Proxy.getAddress().toString(), systemSOCKS5Proxy.getPort()));
79 } 79 }
80 if (systemHTTPConnectProxy.isValid()) { 80 if (systemHTTPConnectProxy.isValid()) {
81 SWIFT_LOG(debug) << "Found HTTPConnect Proxy: " << systemHTTPConnectProxy.getAddress().toString() << ":" << systemHTTPConnectProxy.getPort() << std::endl; 81 SWIFT_LOG(debug) << "Found HTTPConnect Proxy: " << systemHTTPConnectProxy.getAddress().toString() << ":" << systemHTTPConnectProxy.getPort();
82 proxyConnectionFactories.push_back(new HTTPConnectProxiedConnectionFactory(networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory(), systemHTTPConnectProxy.getAddress().toString(), systemHTTPConnectProxy.getPort())); 82 proxyConnectionFactories.push_back(new HTTPConnectProxiedConnectionFactory(networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory(), systemHTTPConnectProxy.getAddress().toString(), systemHTTPConnectProxy.getPort()));
83 } 83 }
84 break; 84 break;
85 case ClientOptions::SOCKS5Proxy: { 85 case ClientOptions::SOCKS5Proxy: {
86 SWIFT_LOG(debug) << " with manual configured SOCKS5 proxy" << std::endl; 86 SWIFT_LOG(debug) << " with manual configured SOCKS5 proxy";
87 std::string proxyHostname = o.manualProxyHostname.empty() ? systemSOCKS5Proxy.getAddress().toString() : o.manualProxyHostname; 87 std::string proxyHostname = o.manualProxyHostname.empty() ? systemSOCKS5Proxy.getAddress().toString() : o.manualProxyHostname;
88 auto proxyPort = systemSOCKS5Proxy.getPort(); 88 auto proxyPort = systemSOCKS5Proxy.getPort();
89 if (o.manualProxyPort != -1) { 89 if (o.manualProxyPort != -1) {
@@ -91,18 +91,18 @@ void CoreClient::connect(const ClientOptions& o) {
91 proxyPort = boost::numeric_cast<unsigned short>(o.manualProxyPort); 91 proxyPort = boost::numeric_cast<unsigned short>(o.manualProxyPort);
92 } 92 }
93 catch (const boost::numeric::bad_numeric_cast& e) { 93 catch (const boost::numeric::bad_numeric_cast& e) {
94 SWIFT_LOG(warning) << "Manual proxy port " << o.manualProxyPort << " is invalid: " << e.what() << std::endl; 94 SWIFT_LOG(warning) << "Manual proxy port " << o.manualProxyPort << " is invalid: " << e.what();
95 onDisconnected(boost::optional<ClientError>(ClientError::ConnectionError)); 95 onDisconnected(boost::optional<ClientError>(ClientError::ConnectionError));
96 return; 96 return;
97 } 97 }
98 } 98 }
99 SWIFT_LOG(debug) << "Proxy: " << proxyHostname << ":" << proxyPort << std::endl; 99 SWIFT_LOG(debug) << "Proxy: " << proxyHostname << ":" << proxyPort;
100 proxyConnectionFactories.push_back(new SOCKS5ProxiedConnectionFactory(networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory(), proxyHostname, proxyPort)); 100 proxyConnectionFactories.push_back(new SOCKS5ProxiedConnectionFactory(networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory(), proxyHostname, proxyPort));
101 useDirectConnection = false; 101 useDirectConnection = false;
102 break; 102 break;
103 } 103 }
104 case ClientOptions::HTTPConnectProxy: { 104 case ClientOptions::HTTPConnectProxy: {
105 SWIFT_LOG(debug) << " with manual configured HTTPConnect proxy" << std::endl; 105 SWIFT_LOG(debug) << " with manual configured HTTPConnect proxy";
106 std::string proxyHostname = o.manualProxyHostname.empty() ? systemHTTPConnectProxy.getAddress().toString() : o.manualProxyHostname; 106 std::string proxyHostname = o.manualProxyHostname.empty() ? systemHTTPConnectProxy.getAddress().toString() : o.manualProxyHostname;
107 unsigned short proxyPort = systemHTTPConnectProxy.getPort(); 107 unsigned short proxyPort = systemHTTPConnectProxy.getPort();
108 if (o.manualProxyPort != -1) { 108 if (o.manualProxyPort != -1) {
@@ -110,12 +110,12 @@ void CoreClient::connect(const ClientOptions& o) {
110 proxyPort = boost::numeric_cast<unsigned short>(o.manualProxyPort); 110 proxyPort = boost::numeric_cast<unsigned short>(o.manualProxyPort);
111 } 111 }
112 catch (const boost::numeric::bad_numeric_cast& e) { 112 catch (const boost::numeric::bad_numeric_cast& e) {
113 SWIFT_LOG(warning) << "Manual proxy port " << o.manualProxyPort << " is invalid: " << e.what() << std::endl; 113 SWIFT_LOG(warning) << "Manual proxy port " << o.manualProxyPort << " is invalid: " << e.what();
114 onDisconnected(boost::optional<ClientError>(ClientError::ConnectionError)); 114 onDisconnected(boost::optional<ClientError>(ClientError::ConnectionError));
115 return; 115 return;
116 } 116 }
117 } 117 }
118 SWIFT_LOG(debug) << "Proxy: " << proxyHostname << ":" << proxyPort << std::endl; 118 SWIFT_LOG(debug) << "Proxy: " << proxyHostname << ":" << proxyPort;
119 proxyConnectionFactories.push_back(new HTTPConnectProxiedConnectionFactory(networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory(), proxyHostname, proxyPort, o.httpTrafficFilter)); 119 proxyConnectionFactories.push_back(new HTTPConnectProxiedConnectionFactory(networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory(), proxyHostname, proxyPort, o.httpTrafficFilter));
120 useDirectConnection = false; 120 useDirectConnection = false;
121 break; 121 break;
@@ -134,7 +134,7 @@ void CoreClient::connect(const ClientOptions& o) {
134 port = boost::numeric_cast<unsigned short>(o.manualPort); 134 port = boost::numeric_cast<unsigned short>(o.manualPort);
135 } 135 }
136 catch (const boost::numeric::bad_numeric_cast& e) { 136 catch (const boost::numeric::bad_numeric_cast& e) {
137 SWIFT_LOG(warning) << "Invalid manual port " << o.manualPort << ": " << e.what() << std::endl; 137 SWIFT_LOG(warning) << "Invalid manual port " << o.manualPort << ": " << e.what();
138 onDisconnected(boost::optional<ClientError>(ClientError::ConnectionError)); 138 onDisconnected(boost::optional<ClientError>(ClientError::ConnectionError));
139 return; 139 return;
140 } 140 }
@@ -174,7 +174,7 @@ void CoreClient::connect(const ClientOptions& o) {
174 sessionStream_->onDataRead.connect(boost::bind(&CoreClient::handleDataRead, this, _1)); 174 sessionStream_->onDataRead.connect(boost::bind(&CoreClient::handleDataRead, this, _1));
175 sessionStream_->onDataWritten.connect(boost::bind(&CoreClient::handleDataWritten, this, _1)); 175 sessionStream_->onDataWritten.connect(boost::bind(&CoreClient::handleDataWritten, this, _1));
176 if (certificate_ && !certificate_->isNull()) { 176 if (certificate_ && !certificate_->isNull()) {
177 SWIFT_LOG(debug) << "set certificate" << std::endl; 177 SWIFT_LOG(debug) << "set certificate";
178 sessionStream_->setTLSCertificate(certificate_); 178 sessionStream_->setTLSCertificate(certificate_);
179 } 179 }
180 boshSessionStream_->open(); 180 boshSessionStream_->open();
@@ -423,7 +423,7 @@ void CoreClient::sendPresence(std::shared_ptr<Presence> presence) {
423 423
424void CoreClient::sendData(const std::string& data) { 424void CoreClient::sendData(const std::string& data) {
425 if (!sessionStream_) { 425 if (!sessionStream_) {
426 SWIFT_LOG(warning) << "Client: Trying to send data while disconnected." << std::endl; 426 SWIFT_LOG(warning) << "Client: Trying to send data while disconnected.";
427 return; 427 return;
428 } 428 }
429 sessionStream_->writeData(data); 429 sessionStream_->writeData(data);
@@ -507,11 +507,11 @@ void CoreClient::resetSession() {
507 507
508void CoreClient::forceReset() { 508void CoreClient::forceReset() {
509 if (connector_) { 509 if (connector_) {
510 SWIFT_LOG(warning) << "Client not disconnected properly: Connector still active" << std::endl; 510 SWIFT_LOG(warning) << "Client not disconnected properly: Connector still active";
511 resetConnector(); 511 resetConnector();
512 } 512 }
513 if (sessionStream_ || connection_) { 513 if (sessionStream_ || connection_) {
514 SWIFT_LOG(warning) << "Client not disconnected properly: Session still active" << std::endl; 514 SWIFT_LOG(warning) << "Client not disconnected properly: Session still active";
515 resetSession(); 515 resetSession();
516 } 516 }
517} 517}
diff --git a/Swiften/Component/ComponentSessionStanzaChannel.cpp b/Swiften/Component/ComponentSessionStanzaChannel.cpp
index e4bf231..deac8b2 100644
--- a/Swiften/Component/ComponentSessionStanzaChannel.cpp
+++ b/Swiften/Component/ComponentSessionStanzaChannel.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2017 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -47,7 +47,7 @@ std::string ComponentSessionStanzaChannel::getNewIQID() {
47 47
48void ComponentSessionStanzaChannel::send(std::shared_ptr<Stanza> stanza) { 48void ComponentSessionStanzaChannel::send(std::shared_ptr<Stanza> stanza) {
49 if (!isAvailable()) { 49 if (!isAvailable()) {
50 SWIFT_LOG(warning) << "Component: Trying to send a stanza while disconnected." << std::endl; 50 SWIFT_LOG(warning) << "Component: Trying to send a stanza while disconnected.";
51 return; 51 return;
52 } 52 }
53 session->sendStanza(stanza); 53 session->sendStanza(stanza);
diff --git a/Swiften/Component/CoreComponent.cpp b/Swiften/Component/CoreComponent.cpp
index 2d91c9c..ef7d3a4 100644
--- a/Swiften/Component/CoreComponent.cpp
+++ b/Swiften/Component/CoreComponent.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -33,7 +33,7 @@ CoreComponent::CoreComponent(const JID& jid, const std::string& secret, NetworkF
33 33
34CoreComponent::~CoreComponent() { 34CoreComponent::~CoreComponent() {
35 if (session_ || connection_) { 35 if (session_ || connection_) {
36 SWIFT_LOG(warning) << "Component not disconnected properly" << std::endl; 36 SWIFT_LOG(warning) << "Component not disconnected properly";
37 } 37 }
38 delete iqRouter_; 38 delete iqRouter_;
39 39
diff --git a/Swiften/Disco/CapsManager.cpp b/Swiften/Disco/CapsManager.cpp
index 794cf74..2b8fb7d 100644
--- a/Swiften/Disco/CapsManager.cpp
+++ b/Swiften/Disco/CapsManager.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -53,7 +53,7 @@ void CapsManager::handleDiscoInfoReceived(const JID& from, const std::string& ha
53 requestedDiscoInfos.erase(hash); 53 requestedDiscoInfos.erase(hash);
54 if (error || !discoInfo || CapsInfoGenerator("", crypto).generateCapsInfo(*discoInfo.get()).getVersion() != hash) { 54 if (error || !discoInfo || CapsInfoGenerator("", crypto).generateCapsInfo(*discoInfo.get()).getVersion() != hash) {
55 if (warnOnInvalidHash && !error && discoInfo) { 55 if (warnOnInvalidHash && !error && discoInfo) {
56 SWIFT_LOG(warning) << "Caps from " << from.toString() << " do not verify" << std::endl; 56 SWIFT_LOG(warning) << "Caps from " << from.toString() << " do not verify";
57 } 57 }
58 failingCaps.insert(std::make_pair(from, hash)); 58 failingCaps.insert(std::make_pair(from, hash));
59 std::map<std::string, std::set< std::pair<JID, std::string> > >::iterator i = fallbacks.find(hash); 59 std::map<std::string, std::set< std::pair<JID, std::string> > >::iterator i = fallbacks.find(hash);
diff --git a/Swiften/Disco/DiscoServiceWalker.cpp b/Swiften/Disco/DiscoServiceWalker.cpp
index a3f95d2..7332e63 100644
--- a/Swiften/Disco/DiscoServiceWalker.cpp
+++ b/Swiften/Disco/DiscoServiceWalker.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -17,7 +17,7 @@ DiscoServiceWalker::DiscoServiceWalker(const JID& service, IQRouter* iqRouter, s
17} 17}
18 18
19void DiscoServiceWalker::beginWalk() { 19void DiscoServiceWalker::beginWalk() {
20 SWIFT_LOG(debug) << "Starting walk to " << service_ << std::endl; 20 SWIFT_LOG(debug) << "Starting walk to " << service_;
21 assert(!active_); 21 assert(!active_);
22 assert(servicesBeingSearched_.empty()); 22 assert(servicesBeingSearched_.empty());
23 active_ = true; 23 active_ = true;
@@ -26,7 +26,7 @@ void DiscoServiceWalker::beginWalk() {
26 26
27void DiscoServiceWalker::endWalk() { 27void DiscoServiceWalker::endWalk() {
28 if (active_) { 28 if (active_) {
29 SWIFT_LOG(debug) << "Ending walk to " << service_ << std::endl; 29 SWIFT_LOG(debug) << "Ending walk to " << service_;
30 for (auto&& request : pendingDiscoInfoRequests_) { 30 for (auto&& request : pendingDiscoInfoRequests_) {
31 request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request)); 31 request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request));
32 } 32 }
@@ -39,7 +39,7 @@ void DiscoServiceWalker::endWalk() {
39} 39}
40 40
41void DiscoServiceWalker::walkNode(const JID& jid) { 41void DiscoServiceWalker::walkNode(const JID& jid) {
42 SWIFT_LOG(debug) << "Walking node " << jid << std::endl; 42 SWIFT_LOG(debug) << "Walking node " << jid;
43 servicesBeingSearched_.insert(jid); 43 servicesBeingSearched_.insert(jid);
44 searchedServices_.insert(jid); 44 searchedServices_.insert(jid);
45 GetDiscoInfoRequest::ref discoInfoRequest = GetDiscoInfoRequest::create(jid, iqRouter_); 45 GetDiscoInfoRequest::ref discoInfoRequest = GetDiscoInfoRequest::create(jid, iqRouter_);
@@ -54,7 +54,7 @@ void DiscoServiceWalker::handleDiscoInfoResponse(std::shared_ptr<DiscoInfo> info
54 return; 54 return;
55 } 55 }
56 56
57 SWIFT_LOG(debug) << "Disco info response from " << request->getReceiver() << std::endl; 57 SWIFT_LOG(debug) << "Disco info response from " << request->getReceiver();
58 58
59 request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request)); 59 request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request));
60 pendingDiscoInfoRequests_.erase(request); 60 pendingDiscoInfoRequests_.erase(request);
@@ -90,7 +90,7 @@ void DiscoServiceWalker::handleDiscoItemsResponse(std::shared_ptr<DiscoItems> it
90 return; 90 return;
91 } 91 }
92 92
93 SWIFT_LOG(debug) << "Received disco items from " << request->getReceiver() << std::endl; 93 SWIFT_LOG(debug) << "Received disco items from " << request->getReceiver();
94 request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoItemsResponse, this, _1, _2, request)); 94 request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoItemsResponse, this, _1, _2, request));
95 pendingDiscoItemsRequests_.erase(request); 95 pendingDiscoItemsRequests_.erase(request);
96 if (error) { 96 if (error) {
@@ -103,7 +103,7 @@ void DiscoServiceWalker::handleDiscoItemsResponse(std::shared_ptr<DiscoItems> it
103 * but I've never seen one in the wild, and it's an easy fix for not looping. 103 * but I've never seen one in the wild, and it's an easy fix for not looping.
104 */ 104 */
105 if (std::find(searchedServices_.begin(), searchedServices_.end(), item.getJID()) == searchedServices_.end()) { /* Don't recurse infinitely */ 105 if (std::find(searchedServices_.begin(), searchedServices_.end(), item.getJID()) == searchedServices_.end()) { /* Don't recurse infinitely */
106 SWIFT_LOG(debug) << "Received disco item " << item.getJID() << std::endl; 106 SWIFT_LOG(debug) << "Received disco item " << item.getJID();
107 walkNode(item.getJID()); 107 walkNode(item.getJID());
108 } 108 }
109 } 109 }
@@ -112,12 +112,12 @@ void DiscoServiceWalker::handleDiscoItemsResponse(std::shared_ptr<DiscoItems> it
112} 112}
113 113
114void DiscoServiceWalker::handleDiscoError(const JID& jid, ErrorPayload::ref /*error*/) { 114void DiscoServiceWalker::handleDiscoError(const JID& jid, ErrorPayload::ref /*error*/) {
115 SWIFT_LOG(debug) << "Disco error from " << jid << std::endl; 115 SWIFT_LOG(debug) << "Disco error from " << jid;
116 markNodeCompleted(jid); 116 markNodeCompleted(jid);
117} 117}
118 118
119void DiscoServiceWalker::markNodeCompleted(const JID& jid) { 119void DiscoServiceWalker::markNodeCompleted(const JID& jid) {
120 SWIFT_LOG(debug) << "Node completed " << jid << std::endl; 120 SWIFT_LOG(debug) << "Node completed " << jid;
121 servicesBeingSearched_.erase(jid); 121 servicesBeingSearched_.erase(jid);
122 /* All results are in */ 122 /* All results are in */
123 if (servicesBeingSearched_.empty()) { 123 if (servicesBeingSearched_.empty()) {
diff --git a/Swiften/Entity/PayloadPersister.cpp b/Swiften/Entity/PayloadPersister.cpp
index 3fd246c..fe51d86 100644
--- a/Swiften/Entity/PayloadPersister.cpp
+++ b/Swiften/Entity/PayloadPersister.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2016 Isode Limited. 2 * Copyright (c) 2011-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -34,7 +34,7 @@ void PayloadPersister::savePayload(std::shared_ptr<Payload> payload, const boost
34 file.close(); 34 file.close();
35 } 35 }
36 catch (const boost::filesystem::filesystem_error& e) { 36 catch (const boost::filesystem::filesystem_error& e) {
37 SWIFT_LOG(error) << e.what() << std::endl; 37 SWIFT_LOG(error) << e.what();
38 } 38 }
39} 39}
40 40
@@ -50,7 +50,7 @@ std::shared_ptr<Payload> PayloadPersister::loadPayload(const boost::filesystem::
50 } 50 }
51 } 51 }
52 catch (const boost::filesystem::filesystem_error& e) { 52 catch (const boost::filesystem::filesystem_error& e) {
53 SWIFT_LOG(error) << e.what() << std::endl; 53 SWIFT_LOG(error) << e.what();
54 } 54 }
55 return std::shared_ptr<Payload>(); 55 return std::shared_ptr<Payload>();
56} 56}
diff --git a/Swiften/EventLoop/DummyEventLoop.cpp b/Swiften/EventLoop/DummyEventLoop.cpp
index 4712fad..234ba7a 100644
--- a/Swiften/EventLoop/DummyEventLoop.cpp
+++ b/Swiften/EventLoop/DummyEventLoop.cpp
@@ -15,7 +15,7 @@ DummyEventLoop::DummyEventLoop() {
15 15
16DummyEventLoop::~DummyEventLoop() { 16DummyEventLoop::~DummyEventLoop() {
17 if (hasEvents()) { 17 if (hasEvents()) {
18 SWIFT_LOG(warning) << "DummyEventLoop: Unhandled events at destruction time" << std::endl; 18 SWIFT_LOG(warning) << "DummyEventLoop: Unhandled events at destruction time";
19 } 19 }
20} 20}
21 21
diff --git a/Swiften/EventLoop/EventLoop.cpp b/Swiften/EventLoop/EventLoop.cpp
index 31c93e9..1852f3f 100644
--- a/Swiften/EventLoop/EventLoop.cpp
+++ b/Swiften/EventLoop/EventLoop.cpp
@@ -22,10 +22,10 @@ inline void invokeCallback(const Event& event) {
22 event.callback(); 22 event.callback();
23 } 23 }
24 catch (const std::exception& e) { 24 catch (const std::exception& e) {
25 SWIFT_LOG(error) << "Uncaught exception in event loop: " << e.what() << std::endl; 25 SWIFT_LOG(error) << "Uncaught exception in event loop: " << e.what();
26 } 26 }
27 catch (...) { 27 catch (...) {
28 SWIFT_LOG(error) << "Uncaught non-exception in event loop" << std::endl; 28 SWIFT_LOG(error) << "Uncaught non-exception in event loop";
29 } 29 }
30} 30}
31 31
diff --git a/Swiften/Examples/SendFile/ReceiveFile.cpp b/Swiften/Examples/SendFile/ReceiveFile.cpp
index 193c1b7..d641662 100644
--- a/Swiften/Examples/SendFile/ReceiveFile.cpp
+++ b/Swiften/Examples/SendFile/ReceiveFile.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -80,7 +80,7 @@ class FileReceiver {
80 } 80 }
81 81
82 void handleIncomingFileTransfer(IncomingFileTransfer::ref transfer) { 82 void handleIncomingFileTransfer(IncomingFileTransfer::ref transfer) {
83 SWIFT_LOG(debug) << "foo" << std::endl; 83 SWIFT_LOG(debug) << "foo";
84 incomingFileTransfers.push_back(transfer); 84 incomingFileTransfers.push_back(transfer);
85 std::shared_ptr<FileWriteBytestream> out = std::make_shared<FileWriteBytestream>("out"); 85 std::shared_ptr<FileWriteBytestream> out = std::make_shared<FileWriteBytestream>("out");
86 transfer->onFinished.connect(boost::bind(&FileReceiver::handleFileTransferFinished, this, _1, out)); 86 transfer->onFinished.connect(boost::bind(&FileReceiver::handleFileTransferFinished, this, _1, out));
diff --git a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp
index c6987c0..ae3d7e0 100644
--- a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp
+++ b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013-2016 Isode Limited. 2 * Copyright (c) 2013-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -133,7 +133,7 @@ void DefaultFileTransferTransporter::handleActivateProxySessionResult(const std:
133 133
134void DefaultFileTransferTransporter::startActivatingProxy(const JID& proxyServiceJID) { 134void DefaultFileTransferTransporter::startActivatingProxy(const JID& proxyServiceJID) {
135 // activate proxy 135 // activate proxy
136 SWIFT_LOG(debug) << "Start activating proxy " << proxyServiceJID.toString() << " with sid = " << s5bSessionID << "." << std::endl; 136 SWIFT_LOG(debug) << "Start activating proxy " << proxyServiceJID.toString() << " with sid = " << s5bSessionID << ".";
137 S5BProxyRequest::ref proxyRequest = std::make_shared<S5BProxyRequest>(); 137 S5BProxyRequest::ref proxyRequest = std::make_shared<S5BProxyRequest>();
138 proxyRequest->setSID(s5bSessionID); 138 proxyRequest->setSID(s5bSessionID);
139 proxyRequest->setActivate(role == Initiator ? responder : initiator); 139 proxyRequest->setActivate(role == Initiator ? responder : initiator);
@@ -207,7 +207,7 @@ std::shared_ptr<TransportSession> DefaultFileTransferTransporter::createLocalCan
207 transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream); 207 transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream);
208 } 208 }
209 else { 209 else {
210 SWIFT_LOG(error) << "Failed obtaining proxy session with candidate JID " << candidate.jid << " and dstAddr " << getLocalCandidateSOCKS5DstAddr() << "." << std::endl; 210 SWIFT_LOG(error) << "Failed obtaining proxy session with candidate JID " << candidate.jid << " and dstAddr " << getLocalCandidateSOCKS5DstAddr() << ".";
211 } 211 }
212 } 212 }
213 213
@@ -234,7 +234,7 @@ std::shared_ptr<TransportSession> DefaultFileTransferTransporter::createLocalCan
234 transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream); 234 transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream);
235 } 235 }
236 else { 236 else {
237 SWIFT_LOG(error) << "Failed obtaining proxy session with candidate JID " << candidate.jid << " and dstAddr " << getLocalCandidateSOCKS5DstAddr() << "." << std::endl; 237 SWIFT_LOG(error) << "Failed obtaining proxy session with candidate JID " << candidate.jid << " and dstAddr " << getLocalCandidateSOCKS5DstAddr() << ".";
238 } 238 }
239 } 239 }
240 240
@@ -255,11 +255,11 @@ std::string DefaultFileTransferTransporter::getSOCKS5DstAddr() const {
255 std::string result; 255 std::string result;
256 if (role == Initiator) { 256 if (role == Initiator) {
257 result = getInitiatorCandidateSOCKS5DstAddr(); 257 result = getInitiatorCandidateSOCKS5DstAddr();
258 SWIFT_LOG(debug) << "Initiator S5B DST.ADDR = " << s5bSessionID << " + " << initiator.toString() << " + " << responder.toString() << " : " << result << std::endl; 258 SWIFT_LOG(debug) << "Initiator S5B DST.ADDR = " << s5bSessionID << " + " << initiator.toString() << " + " << responder.toString() << " : " << result;
259 } 259 }
260 else { 260 else {
261 result = getResponderCandidateSOCKS5DstAddr(); 261 result = getResponderCandidateSOCKS5DstAddr();
262 SWIFT_LOG(debug) << "Responder S5B DST.ADDR = " << s5bSessionID << " + " << responder.toString() << " + " << initiator.toString() << " : " << result << std::endl; 262 SWIFT_LOG(debug) << "Responder S5B DST.ADDR = " << s5bSessionID << " + " << responder.toString() << " + " << initiator.toString() << " : " << result;
263 } 263 }
264 return result; 264 return result;
265} 265}
diff --git a/Swiften/FileTransfer/FailingTransportSession.cpp b/Swiften/FileTransfer/FailingTransportSession.cpp
index d1eb6a6..b9c79a0 100644
--- a/Swiften/FileTransfer/FailingTransportSession.cpp
+++ b/Swiften/FileTransfer/FailingTransportSession.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016 Isode Limited. 2 * Copyright (c) 2016-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -14,7 +14,7 @@ FailingTransportSession::~FailingTransportSession() {
14} 14}
15 15
16void FailingTransportSession::start() { 16void FailingTransportSession::start() {
17 SWIFT_LOG(error) << "Trying to start failing transport." << std::endl; 17 SWIFT_LOG(error) << "Trying to start failing transport.";
18 onFinished(FileTransferError(FileTransferError::PeerError)); 18 onFinished(FileTransferError(FileTransferError::PeerError));
19} 19}
20 20
diff --git a/Swiften/FileTransfer/FileTransferManagerImpl.cpp b/Swiften/FileTransfer/FileTransferManagerImpl.cpp
index 05dd3bb..98eb50e 100644
--- a/Swiften/FileTransfer/FileTransferManagerImpl.cpp
+++ b/Swiften/FileTransfer/FileTransferManagerImpl.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2013-2016 Isode Limited. 8 * Copyright (c) 2013-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -156,7 +156,7 @@ OutgoingFileTransfer::ref FileTransferManagerImpl::createOutgoingFileTransfer(
156 } 156 }
157 } 157 }
158 else { 158 else {
159 SWIFT_LOG(warning) << "No entity capabilities information for " << receipient.toString() << std::endl; 159 SWIFT_LOG(warning) << "No entity capabilities information for " << receipient.toString();
160 } 160 }
161 161
162 return outgoingFTManager->createOutgoingFileTransfer(iqRouter->getJID(), receipient, bytestream, fileInfo, options); 162 return outgoingFTManager->createOutgoingFileTransfer(iqRouter->getJID(), receipient, bytestream, fileInfo, options);
diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
index d5de5e4..7c46c60 100644
--- a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2016 Isode Limited. 2 * Copyright (c) 2011-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -67,8 +67,8 @@ IncomingJingleFileTransfer::~IncomingJingleFileTransfer() {
67void IncomingJingleFileTransfer::accept( 67void IncomingJingleFileTransfer::accept(
68 std::shared_ptr<WriteBytestream> stream, 68 std::shared_ptr<WriteBytestream> stream,
69 const FileTransferOptions& options) { 69 const FileTransferOptions& options) {
70 SWIFT_LOG(debug) << std::endl; 70 SWIFT_LOG(debug);
71 if (state != Initial) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } 71 if (state != Initial) { SWIFT_LOG(warning) << "Incorrect state"; return; }
72 72
73 assert(!this->stream); 73 assert(!this->stream);
74 this->stream = stream; 74 this->stream = stream;
@@ -85,7 +85,7 @@ void IncomingJingleFileTransfer::accept(
85 JingleS5BTransportPayload::ref s5bTransport = initialContent->getTransport<JingleS5BTransportPayload>(); 85 JingleS5BTransportPayload::ref s5bTransport = initialContent->getTransport<JingleS5BTransportPayload>();
86 JingleIBBTransportPayload::ref ibbTransport = initialContent->getTransport<JingleIBBTransportPayload>(); 86 JingleIBBTransportPayload::ref ibbTransport = initialContent->getTransport<JingleIBBTransportPayload>();
87 if (s5bTransport) { 87 if (s5bTransport) {
88 SWIFT_LOG(debug) << "Got S5B transport as initial payload." << std::endl; 88 SWIFT_LOG(debug) << "Got S5B transport as initial payload.";
89 setTransporter(transporterFactory->createResponderTransporter( 89 setTransporter(transporterFactory->createResponderTransporter(
90 getInitiator(), getResponder(), s5bTransport->getSessionID(), options)); 90 getInitiator(), getResponder(), s5bTransport->getSessionID(), options));
91 transporter->addRemoteCandidates(s5bTransport->getCandidates(), s5bTransport->getDstAddr()); 91 transporter->addRemoteCandidates(s5bTransport->getCandidates(), s5bTransport->getDstAddr());
@@ -93,7 +93,7 @@ void IncomingJingleFileTransfer::accept(
93 transporter->startGeneratingLocalCandidates(); 93 transporter->startGeneratingLocalCandidates();
94 } 94 }
95 else if (ibbTransport && options.isInBandAllowed()) { 95 else if (ibbTransport && options.isInBandAllowed()) {
96 SWIFT_LOG(debug) << "Got IBB transport as initial payload." << std::endl; 96 SWIFT_LOG(debug) << "Got IBB transport as initial payload.";
97 setTransporter(transporterFactory->createResponderTransporter( 97 setTransporter(transporterFactory->createResponderTransporter(
98 getInitiator(), getResponder(), ibbTransport->getSessionID(), options)); 98 getInitiator(), getResponder(), ibbTransport->getSessionID(), options));
99 99
@@ -112,7 +112,7 @@ void IncomingJingleFileTransfer::accept(
112} 112}
113 113
114void IncomingJingleFileTransfer::cancel() { 114void IncomingJingleFileTransfer::cancel() {
115 SWIFT_LOG(debug) << std::endl; 115 SWIFT_LOG(debug);
116 terminate(state == Initial ? JinglePayload::Reason::Decline : JinglePayload::Reason::Cancel); 116 terminate(state == Initial ? JinglePayload::Reason::Decline : JinglePayload::Reason::Cancel);
117} 117}
118 118
@@ -120,8 +120,8 @@ void IncomingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
120 const std::string& s5bSessionID, 120 const std::string& s5bSessionID,
121 const std::vector<JingleS5BTransportPayload::Candidate>& candidates, 121 const std::vector<JingleS5BTransportPayload::Candidate>& candidates,
122 const std::string& dstAddr) { 122 const std::string& dstAddr) {
123 SWIFT_LOG(debug) << std::endl; 123 SWIFT_LOG(debug);
124 if (state != GeneratingInitialLocalCandidates) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } 124 if (state != GeneratingInitialLocalCandidates) { SWIFT_LOG(warning) << "Incorrect state"; return; }
125 125
126 fillCandidateMap(localCandidates, candidates); 126 fillCandidateMap(localCandidates, candidates);
127 127
@@ -140,11 +140,11 @@ void IncomingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
140 140
141 141
142void IncomingJingleFileTransfer::handleSessionInfoReceived(JinglePayload::ref jinglePayload) { 142void IncomingJingleFileTransfer::handleSessionInfoReceived(JinglePayload::ref jinglePayload) {
143 SWIFT_LOG(debug) << std::endl; 143 SWIFT_LOG(debug);
144 144
145 JingleFileTransferHash::ref transferHash = jinglePayload->getPayload<JingleFileTransferHash>(); 145 JingleFileTransferHash::ref transferHash = jinglePayload->getPayload<JingleFileTransferHash>();
146 if (transferHash) { 146 if (transferHash) {
147 SWIFT_LOG(debug) << "Received hash information." << std::endl; 147 SWIFT_LOG(debug) << "Received hash information.";
148 waitOnHashTimer->stop(); 148 waitOnHashTimer->stop();
149 if (transferHash->getFileInfo().getHashes().find("sha-1") != transferHash->getFileInfo().getHashes().end()) { 149 if (transferHash->getFileInfo().getHashes().find("sha-1") != transferHash->getFileInfo().getHashes().end()) {
150 hashes["sha-1"] = transferHash->getFileInfo().getHash("sha-1").get(); 150 hashes["sha-1"] = transferHash->getFileInfo().getHash("sha-1").get();
@@ -157,16 +157,16 @@ void IncomingJingleFileTransfer::handleSessionInfoReceived(JinglePayload::ref ji
157 } 157 }
158 } 158 }
159 else { 159 else {
160 SWIFT_LOG(debug) << "Ignoring unknown session info" << std::endl; 160 SWIFT_LOG(debug) << "Ignoring unknown session info";
161 } 161 }
162} 162}
163 163
164void IncomingJingleFileTransfer::handleSessionTerminateReceived(boost::optional<JinglePayload::Reason> reason) { 164void IncomingJingleFileTransfer::handleSessionTerminateReceived(boost::optional<JinglePayload::Reason> reason) {
165 SWIFT_LOG(debug) << std::endl; 165 SWIFT_LOG(debug);
166 if (state == Finished) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } 166 if (state == Finished) { SWIFT_LOG(warning) << "Incorrect state"; return; }
167 167
168 if (state == Finished) { 168 if (state == Finished) {
169 SWIFT_LOG(debug) << "Already terminated" << std::endl; 169 SWIFT_LOG(debug) << "Already terminated";
170 return; 170 return;
171 } 171 }
172 172
@@ -187,21 +187,21 @@ void IncomingJingleFileTransfer::checkHashAndTerminate() {
187 terminate(JinglePayload::Reason::Success); 187 terminate(JinglePayload::Reason::Success);
188 } 188 }
189 else { 189 else {
190 SWIFT_LOG(warning) << "Hash verification failed" << std::endl; 190 SWIFT_LOG(warning) << "Hash verification failed";
191 terminate(JinglePayload::Reason::MediaError); 191 terminate(JinglePayload::Reason::MediaError);
192 } 192 }
193} 193}
194 194
195void IncomingJingleFileTransfer::checkIfAllDataReceived() { 195void IncomingJingleFileTransfer::checkIfAllDataReceived() {
196 if (receivedBytes == getFileSizeInBytes()) { 196 if (receivedBytes == getFileSizeInBytes()) {
197 SWIFT_LOG(debug) << "All data received." << std::endl; 197 SWIFT_LOG(debug) << "All data received.";
198 bool hashInfoAvailable = false; 198 bool hashInfoAvailable = false;
199 for (const auto& hashElement : hashes) { 199 for (const auto& hashElement : hashes) {
200 hashInfoAvailable |= !hashElement.second.empty(); 200 hashInfoAvailable |= !hashElement.second.empty();
201 } 201 }
202 202
203 if (!hashInfoAvailable) { 203 if (!hashInfoAvailable) {
204 SWIFT_LOG(debug) << "No hash information yet. Waiting a while on hash info." << std::endl; 204 SWIFT_LOG(debug) << "No hash information yet. Waiting a while on hash info.";
205 setState(WaitingForHash); 205 setState(WaitingForHash);
206 waitOnHashTimer->start(); 206 waitOnHashTimer->start();
207 } 207 }
@@ -210,7 +210,7 @@ void IncomingJingleFileTransfer::checkIfAllDataReceived() {
210 } 210 }
211 } 211 }
212 else if (receivedBytes > getFileSizeInBytes()) { 212 else if (receivedBytes > getFileSizeInBytes()) {
213 SWIFT_LOG(debug) << "We got more than we could handle!" << std::endl; 213 SWIFT_LOG(debug) << "We got more than we could handle!";
214 terminate(JinglePayload::Reason::MediaError); 214 terminate(JinglePayload::Reason::MediaError);
215 } 215 }
216} 216}
@@ -225,15 +225,15 @@ void IncomingJingleFileTransfer::handleWriteStreamDataReceived(
225 225
226void IncomingJingleFileTransfer::handleTransportReplaceReceived( 226void IncomingJingleFileTransfer::handleTransportReplaceReceived(
227 const JingleContentID& content, JingleTransportPayload::ref transport) { 227 const JingleContentID& content, JingleTransportPayload::ref transport) {
228 SWIFT_LOG(debug) << std::endl; 228 SWIFT_LOG(debug);
229 if (state != WaitingForFallbackOrTerminate) { 229 if (state != WaitingForFallbackOrTerminate) {
230 SWIFT_LOG(warning) << "Incorrect state" << std::endl; 230 SWIFT_LOG(warning) << "Incorrect state";
231 return; 231 return;
232 } 232 }
233 233
234 JingleIBBTransportPayload::ref ibbTransport; 234 JingleIBBTransportPayload::ref ibbTransport;
235 if (options.isInBandAllowed() && (ibbTransport = std::dynamic_pointer_cast<JingleIBBTransportPayload>(transport))) { 235 if (options.isInBandAllowed() && (ibbTransport = std::dynamic_pointer_cast<JingleIBBTransportPayload>(transport))) {
236 SWIFT_LOG(debug) << "transport replaced with IBB" << std::endl; 236 SWIFT_LOG(debug) << "transport replaced with IBB";
237 237
238 startTransferring(transporter->createIBBReceiveSession( 238 startTransferring(transporter->createIBBReceiveSession(
239 ibbTransport->getSessionID(), 239 ibbTransport->getSessionID(),
@@ -242,7 +242,7 @@ void IncomingJingleFileTransfer::handleTransportReplaceReceived(
242 session->sendTransportAccept(content, ibbTransport); 242 session->sendTransportAccept(content, ibbTransport);
243 } 243 }
244 else { 244 else {
245 SWIFT_LOG(debug) << "Unknown replace transport" << std::endl; 245 SWIFT_LOG(debug) << "Unknown replace transport";
246 session->sendTransportReject(content, transport); 246 session->sendTransportReject(content, transport);
247 } 247 }
248} 248}
@@ -253,25 +253,25 @@ JingleContentID IncomingJingleFileTransfer::getContentID() const {
253 253
254bool IncomingJingleFileTransfer::verifyData() { 254bool IncomingJingleFileTransfer::verifyData() {
255 if (hashes.empty()) { 255 if (hashes.empty()) {
256 SWIFT_LOG(debug) << "no verification possible, skipping" << std::endl; 256 SWIFT_LOG(debug) << "no verification possible, skipping";
257 return true; 257 return true;
258 } 258 }
259 if (hashes.find("sha-1") != hashes.end()) { 259 if (hashes.find("sha-1") != hashes.end()) {
260 SWIFT_LOG(debug) << "Verify SHA-1 hash: " << (hashes["sha-1"] == hashCalculator->getSHA1Hash()) << std::endl; 260 SWIFT_LOG(debug) << "Verify SHA-1 hash: " << (hashes["sha-1"] == hashCalculator->getSHA1Hash());
261 return hashes["sha-1"] == hashCalculator->getSHA1Hash(); 261 return hashes["sha-1"] == hashCalculator->getSHA1Hash();
262 } 262 }
263 else if (hashes.find("md5") != hashes.end()) { 263 else if (hashes.find("md5") != hashes.end()) {
264 SWIFT_LOG(debug) << "Verify MD5 hash: " << (hashes["md5"] == hashCalculator->getMD5Hash()) << std::endl; 264 SWIFT_LOG(debug) << "Verify MD5 hash: " << (hashes["md5"] == hashCalculator->getMD5Hash());
265 return hashes["md5"] == hashCalculator->getMD5Hash(); 265 return hashes["md5"] == hashCalculator->getMD5Hash();
266 } 266 }
267 else { 267 else {
268 SWIFT_LOG(debug) << "Unknown hash, skipping" << std::endl; 268 SWIFT_LOG(debug) << "Unknown hash, skipping";
269 return true; 269 return true;
270 } 270 }
271} 271}
272 272
273void IncomingJingleFileTransfer::handleWaitOnHashTimerTicked() { 273void IncomingJingleFileTransfer::handleWaitOnHashTimerTicked() {
274 SWIFT_LOG(debug) << std::endl; 274 SWIFT_LOG(debug);
275 waitOnHashTimer->stop(); 275 waitOnHashTimer->stop();
276 terminate(JinglePayload::Reason::Success); 276 terminate(JinglePayload::Reason::Success);
277} 277}
@@ -285,14 +285,14 @@ const JID& IncomingJingleFileTransfer::getRecipient() const {
285} 285}
286 286
287void IncomingJingleFileTransfer::setState(State state) { 287void IncomingJingleFileTransfer::setState(State state) {
288 SWIFT_LOG(debug) << state << std::endl; 288 SWIFT_LOG(debug) << state;
289 this->state = state; 289 this->state = state;
290 onStateChanged(FileTransfer::State(getExternalState(state))); 290 onStateChanged(FileTransfer::State(getExternalState(state)));
291} 291}
292 292
293void IncomingJingleFileTransfer::setFinishedState( 293void IncomingJingleFileTransfer::setFinishedState(
294 FileTransfer::State::Type type, const boost::optional<FileTransferError>& error) { 294 FileTransfer::State::Type type, const boost::optional<FileTransferError>& error) {
295 SWIFT_LOG(debug) << std::endl; 295 SWIFT_LOG(debug);
296 this->state = Finished; 296 this->state = Finished;
297 onStateChanged(type); 297 onStateChanged(type);
298 onFinished(error); 298 onFinished(error);
@@ -340,7 +340,7 @@ void IncomingJingleFileTransfer::stopAll() {
340 transportSession->stop(); 340 transportSession->stop();
341 transportSession.reset(); 341 transportSession.reset();
342 break; 342 break;
343 case Finished: SWIFT_LOG(warning) << "Already finished" << std::endl; break; 343 case Finished: SWIFT_LOG(warning) << "Already finished"; break;
344 } 344 }
345 if (state != Initial) { 345 if (state != Initial) {
346 removeTransporter(); 346 removeTransporter();
@@ -356,7 +356,7 @@ void IncomingJingleFileTransfer::fallback() {
356} 356}
357 357
358void IncomingJingleFileTransfer::startTransferViaRemoteCandidate() { 358void IncomingJingleFileTransfer::startTransferViaRemoteCandidate() {
359 SWIFT_LOG(debug) << std::endl; 359 SWIFT_LOG(debug);
360 360
361 if (ourCandidateChoice->type == JingleS5BTransportPayload::Candidate::ProxyType) { 361 if (ourCandidateChoice->type == JingleS5BTransportPayload::Candidate::ProxyType) {
362 setState(WaitingForPeerProxyActivate); 362 setState(WaitingForPeerProxyActivate);
@@ -367,7 +367,7 @@ void IncomingJingleFileTransfer::startTransferViaRemoteCandidate() {
367} 367}
368 368
369void IncomingJingleFileTransfer::startTransferViaLocalCandidate() { 369void IncomingJingleFileTransfer::startTransferViaLocalCandidate() {
370 SWIFT_LOG(debug) << std::endl; 370 SWIFT_LOG(debug);
371 371
372 if (theirCandidateChoice->type == JingleS5BTransportPayload::Candidate::ProxyType) { 372 if (theirCandidateChoice->type == JingleS5BTransportPayload::Candidate::ProxyType) {
373 setState(WaitingForLocalProxyActivate); 373 setState(WaitingForLocalProxyActivate);
@@ -379,7 +379,7 @@ void IncomingJingleFileTransfer::startTransferViaLocalCandidate() {
379} 379}
380 380
381void IncomingJingleFileTransfer::startTransferring(std::shared_ptr<TransportSession> transportSession) { 381void IncomingJingleFileTransfer::startTransferring(std::shared_ptr<TransportSession> transportSession) {
382 SWIFT_LOG(debug) << std::endl; 382 SWIFT_LOG(debug);
383 383
384 this->transportSession = transportSession; 384 this->transportSession = transportSession;
385 transferFinishedConnection = transportSession->onFinished.connect( 385 transferFinishedConnection = transportSession->onFinished.connect(
@@ -409,7 +409,7 @@ std::shared_ptr<TransportSession> IncomingJingleFileTransfer::createRemoteCandid
409} 409}
410 410
411void IncomingJingleFileTransfer::terminate(JinglePayload::Reason::Type reason) { 411void IncomingJingleFileTransfer::terminate(JinglePayload::Reason::Type reason) {
412 SWIFT_LOG(debug) << reason << std::endl; 412 SWIFT_LOG(debug) << reason;
413 413
414 if (state != Finished) { 414 if (state != Finished) {
415 session->sendTerminate(reason); 415 session->sendTerminate(reason);
diff --git a/Swiften/FileTransfer/JingleFileTransfer.cpp b/Swiften/FileTransfer/JingleFileTransfer.cpp
index cc1cd1c..3d05db9 100644
--- a/Swiften/FileTransfer/JingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/JingleFileTransfer.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013-2018 Isode Limited. 2 * Copyright (c) 2013-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -78,7 +78,7 @@ boost::optional<FileTransferError> JingleFileTransfer::getFileTransferError(Jing
78 78
79void JingleFileTransfer::handleRemoteTransportCandidateSelectFinished( 79void JingleFileTransfer::handleRemoteTransportCandidateSelectFinished(
80 const std::string& s5bSessionID, const boost::optional<JingleS5BTransportPayload::Candidate>& candidate) { 80 const std::string& s5bSessionID, const boost::optional<JingleS5BTransportPayload::Candidate>& candidate) {
81 SWIFT_LOG(debug) << std::endl; 81 SWIFT_LOG(debug);
82 82
83 ourCandidateChoice = candidate; 83 ourCandidateChoice = candidate;
84 ourCandidateSelectFinished = true; 84 ourCandidateSelectFinished = true;
@@ -98,42 +98,42 @@ void JingleFileTransfer::handleRemoteTransportCandidateSelectFinished(
98 98
99// decide on candidates according to http://xmpp.org/extensions/xep-0260.html#complete 99// decide on candidates according to http://xmpp.org/extensions/xep-0260.html#complete
100void JingleFileTransfer::decideOnCandidates() { 100void JingleFileTransfer::decideOnCandidates() {
101 SWIFT_LOG(debug) << std::endl; 101 SWIFT_LOG(debug);
102 if (!ourCandidateSelectFinished || !theirCandidateSelectFinished) { 102 if (!ourCandidateSelectFinished || !theirCandidateSelectFinished) {
103 SWIFT_LOG(debug) << "Can't make a decision yet!" << std::endl; 103 SWIFT_LOG(debug) << "Can't make a decision yet!";
104 return; 104 return;
105 } 105 }
106 if (!ourCandidateChoice && !theirCandidateChoice) { 106 if (!ourCandidateChoice && !theirCandidateChoice) {
107 SWIFT_LOG(debug) << "No candidates succeeded." << std::endl; 107 SWIFT_LOG(debug) << "No candidates succeeded.";
108 fallback(); 108 fallback();
109 } 109 }
110 else if (ourCandidateChoice && !theirCandidateChoice) { 110 else if (ourCandidateChoice && !theirCandidateChoice) {
111 SWIFT_LOG(debug) << "Start transfer using remote candidate: " << ourCandidateChoice.get().cid << "." << std::endl; 111 SWIFT_LOG(debug) << "Start transfer using remote candidate: " << ourCandidateChoice.get().cid << ".";
112 startTransferViaRemoteCandidate(); 112 startTransferViaRemoteCandidate();
113 } 113 }
114 else if (theirCandidateChoice && !ourCandidateChoice) { 114 else if (theirCandidateChoice && !ourCandidateChoice) {
115 SWIFT_LOG(debug) << "Start transfer using local candidate: " << theirCandidateChoice.get().cid << "." << std::endl; 115 SWIFT_LOG(debug) << "Start transfer using local candidate: " << theirCandidateChoice.get().cid << ".";
116 startTransferViaLocalCandidate(); 116 startTransferViaLocalCandidate();
117 } 117 }
118 else { 118 else {
119 SWIFT_LOG(debug) << "Choosing between candidates " 119 SWIFT_LOG(debug) << "Choosing between candidates "
120 << ourCandidateChoice->cid << "(" << ourCandidateChoice->priority << ")" << " and " 120 << ourCandidateChoice->cid << "(" << ourCandidateChoice->priority << ")" << " and "
121 << theirCandidateChoice->cid << "(" << theirCandidateChoice->priority << ")" << std::endl; 121 << theirCandidateChoice->cid << "(" << theirCandidateChoice->priority << ")";
122 if (ourCandidateChoice->priority > theirCandidateChoice->priority) { 122 if (ourCandidateChoice->priority > theirCandidateChoice->priority) {
123 SWIFT_LOG(debug) << "Start transfer using remote candidate: " << ourCandidateChoice.get().cid << "." << std::endl; 123 SWIFT_LOG(debug) << "Start transfer using remote candidate: " << ourCandidateChoice.get().cid << ".";
124 startTransferViaRemoteCandidate(); 124 startTransferViaRemoteCandidate();
125 } 125 }
126 else if (ourCandidateChoice->priority < theirCandidateChoice->priority) { 126 else if (ourCandidateChoice->priority < theirCandidateChoice->priority) {
127 SWIFT_LOG(debug) << "Start transfer using local candidate:" << theirCandidateChoice.get().cid << "." << std::endl; 127 SWIFT_LOG(debug) << "Start transfer using local candidate:" << theirCandidateChoice.get().cid << ".";
128 startTransferViaLocalCandidate(); 128 startTransferViaLocalCandidate();
129 } 129 }
130 else { 130 else {
131 if (hasPriorityOnCandidateTie()) { 131 if (hasPriorityOnCandidateTie()) {
132 SWIFT_LOG(debug) << "Start transfer using remote candidate: " << ourCandidateChoice.get().cid << std::endl; 132 SWIFT_LOG(debug) << "Start transfer using remote candidate: " << ourCandidateChoice.get().cid;
133 startTransferViaRemoteCandidate(); 133 startTransferViaRemoteCandidate();
134 } 134 }
135 else { 135 else {
136 SWIFT_LOG(debug) << "Start transfer using local candidate: " << theirCandidateChoice.get().cid << std::endl; 136 SWIFT_LOG(debug) << "Start transfer using local candidate: " << theirCandidateChoice.get().cid;
137 startTransferViaLocalCandidate(); 137 startTransferViaLocalCandidate();
138 } 138 }
139 } 139 }
@@ -142,11 +142,11 @@ void JingleFileTransfer::decideOnCandidates() {
142 142
143void JingleFileTransfer::handleProxyActivateFinished( 143void JingleFileTransfer::handleProxyActivateFinished(
144 const std::string& s5bSessionID, ErrorPayload::ref error) { 144 const std::string& s5bSessionID, ErrorPayload::ref error) {
145 SWIFT_LOG(debug) << std::endl; 145 SWIFT_LOG(debug);
146 if (!isWaitingForLocalProxyActivate()) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } 146 if (!isWaitingForLocalProxyActivate()) { SWIFT_LOG(warning) << "Incorrect state"; return; }
147 147
148 if (error) { 148 if (error) {
149 SWIFT_LOG(debug) << "Error activating proxy" << std::endl; 149 SWIFT_LOG(debug) << "Error activating proxy";
150 JingleS5BTransportPayload::ref proxyError = std::make_shared<JingleS5BTransportPayload>(); 150 JingleS5BTransportPayload::ref proxyError = std::make_shared<JingleS5BTransportPayload>();
151 proxyError->setSessionID(s5bSessionID); 151 proxyError->setSessionID(s5bSessionID);
152 proxyError->setProxyError(true); 152 proxyError->setProxyError(true);
@@ -164,18 +164,18 @@ void JingleFileTransfer::handleProxyActivateFinished(
164 164
165void JingleFileTransfer::handleTransportInfoReceived( 165void JingleFileTransfer::handleTransportInfoReceived(
166 const JingleContentID& /* contentID */, JingleTransportPayload::ref transport) { 166 const JingleContentID& /* contentID */, JingleTransportPayload::ref transport) {
167 SWIFT_LOG(debug) << std::endl; 167 SWIFT_LOG(debug);
168 168
169 if (JingleS5BTransportPayload::ref s5bPayload = std::dynamic_pointer_cast<JingleS5BTransportPayload>(transport)) { 169 if (JingleS5BTransportPayload::ref s5bPayload = std::dynamic_pointer_cast<JingleS5BTransportPayload>(transport)) {
170 if (s5bPayload->hasCandidateError() || !s5bPayload->getCandidateUsed().empty()) { 170 if (s5bPayload->hasCandidateError() || !s5bPayload->getCandidateUsed().empty()) {
171 SWIFT_LOG(debug) << "Received candidate decision from peer" << std::endl; 171 SWIFT_LOG(debug) << "Received candidate decision from peer";
172 if (!isTryingCandidates()) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } 172 if (!isTryingCandidates()) { SWIFT_LOG(warning) << "Incorrect state"; return; }
173 173
174 theirCandidateSelectFinished = true; 174 theirCandidateSelectFinished = true;
175 if (!s5bPayload->hasCandidateError()) { 175 if (!s5bPayload->hasCandidateError()) {
176 auto theirCandidate = localCandidates.find(s5bPayload->getCandidateUsed()); 176 auto theirCandidate = localCandidates.find(s5bPayload->getCandidateUsed());
177 if (theirCandidate == localCandidates.end()) { 177 if (theirCandidate == localCandidates.end()) {
178 SWIFT_LOG(warning) << "Got invalid candidate" << std::endl; 178 SWIFT_LOG(warning) << "Got invalid candidate";
179 terminate(JinglePayload::Reason::GeneralError); 179 terminate(JinglePayload::Reason::GeneralError);
180 return; 180 return;
181 } 181 }
@@ -184,27 +184,27 @@ void JingleFileTransfer::handleTransportInfoReceived(
184 decideOnCandidates(); 184 decideOnCandidates();
185 } 185 }
186 else if (!s5bPayload->getActivated().empty()) { 186 else if (!s5bPayload->getActivated().empty()) {
187 SWIFT_LOG(debug) << "Received peer activate from peer" << std::endl; 187 SWIFT_LOG(debug) << "Received peer activate from peer";
188 if (!isWaitingForPeerProxyActivate()) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } 188 if (!isWaitingForPeerProxyActivate()) { SWIFT_LOG(warning) << "Incorrect state"; return; }
189 189
190 if (ourCandidateChoice->cid == s5bPayload->getActivated()) { 190 if (ourCandidateChoice->cid == s5bPayload->getActivated()) {
191 startTransferring(createRemoteCandidateSession()); 191 startTransferring(createRemoteCandidateSession());
192 } 192 }
193 else { 193 else {
194 SWIFT_LOG(warning) << "ourCandidateChoice doesn't match activated proxy candidate!" << std::endl; 194 SWIFT_LOG(warning) << "ourCandidateChoice doesn't match activated proxy candidate!";
195 terminate(JinglePayload::Reason::GeneralError); 195 terminate(JinglePayload::Reason::GeneralError);
196 } 196 }
197 } 197 }
198 else if (s5bPayload->hasProxyError()) { 198 else if (s5bPayload->hasProxyError()) {
199 SWIFT_LOG(debug) << "Received proxy error. Trying to fall back to IBB." << std::endl; 199 SWIFT_LOG(debug) << "Received proxy error. Trying to fall back to IBB.";
200 fallback(); 200 fallback();
201 } 201 }
202 else { 202 else {
203 SWIFT_LOG(debug) << "Ignoring unknown info" << std::endl; 203 SWIFT_LOG(debug) << "Ignoring unknown info";
204 } 204 }
205 } 205 }
206 else { 206 else {
207 SWIFT_LOG(debug) << "Ignoring unknown info" << std::endl; 207 SWIFT_LOG(debug) << "Ignoring unknown info";
208 } 208 }
209} 209}
210 210
diff --git a/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp b/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp
index 834a401..7cb4cbb 100644
--- a/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp
+++ b/Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2013-2016 Isode Limited. 8 * Copyright (c) 2013-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -45,7 +45,7 @@ LocalJingleTransportCandidateGenerator::LocalJingleTransportCandidateGenerator(
45} 45}
46 46
47LocalJingleTransportCandidateGenerator::~LocalJingleTransportCandidateGenerator() { 47LocalJingleTransportCandidateGenerator::~LocalJingleTransportCandidateGenerator() {
48 SWIFT_LOG_ASSERT(!s5bServerInitializeRequest, warning) << std::endl; 48 SWIFT_LOG_ASSERT(!s5bServerInitializeRequest, warning);
49} 49}
50 50
51void LocalJingleTransportCandidateGenerator::start() { 51void LocalJingleTransportCandidateGenerator::start() {
@@ -98,7 +98,7 @@ void LocalJingleTransportCandidateGenerator::handleS5BServerInitialized(bool suc
98 } 98 }
99 } 99 }
100 else { 100 else {
101 SWIFT_LOG(warning) << "Unable to start SOCKS5 server" << std::endl; 101 SWIFT_LOG(warning) << "Unable to start SOCKS5 server";
102 if (s5bServerResourceUser_) { 102 if (s5bServerResourceUser_) {
103 s5bServerResourceUser_->onSuccessfulInitialized.disconnect(boost::bind(&LocalJingleTransportCandidateGenerator::handleS5BServerInitialized, this, _1)); 103 s5bServerResourceUser_->onSuccessfulInitialized.disconnect(boost::bind(&LocalJingleTransportCandidateGenerator::handleS5BServerInitialized, this, _1));
104 } 104 }
diff --git a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
index 367fc97..57a18a8 100644
--- a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2013-2016 Isode Limited. 8 * Copyright (c) 2013-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -87,9 +87,9 @@ OutgoingJingleFileTransfer::~OutgoingJingleFileTransfer() {
87} 87}
88 88
89void OutgoingJingleFileTransfer::start() { 89void OutgoingJingleFileTransfer::start() {
90 SWIFT_LOG(debug) << std::endl; 90 SWIFT_LOG(debug);
91 if (state != Initial) { 91 if (state != Initial) {
92 SWIFT_LOG(warning) << "Incorrect state" << std::endl; 92 SWIFT_LOG(warning) << "Incorrect state";
93 return; 93 return;
94 } 94 }
95 95
@@ -109,7 +109,7 @@ void OutgoingJingleFileTransfer::cancel() {
109} 109}
110 110
111void OutgoingJingleFileTransfer::terminate(JinglePayload::Reason::Type reason) { 111void OutgoingJingleFileTransfer::terminate(JinglePayload::Reason::Type reason) {
112 SWIFT_LOG(debug) << reason << std::endl; 112 SWIFT_LOG(debug) << reason;
113 113
114 if (state != Initial && state != GeneratingInitialLocalCandidates && state != Finished) { 114 if (state != Initial && state != GeneratingInitialLocalCandidates && state != Finished) {
115 session->sendTerminate(reason); 115 session->sendTerminate(reason);
@@ -122,8 +122,8 @@ void OutgoingJingleFileTransfer::handleSessionAcceptReceived(
122 const JingleContentID&, 122 const JingleContentID&,
123 JingleDescription::ref, 123 JingleDescription::ref,
124 JingleTransportPayload::ref transportPayload) { 124 JingleTransportPayload::ref transportPayload) {
125 SWIFT_LOG(debug) << std::endl; 125 SWIFT_LOG(debug);
126 if (state != WaitingForAccept) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } 126 if (state != WaitingForAccept) { SWIFT_LOG(warning) << "Incorrect state"; return; }
127 127
128 if (JingleS5BTransportPayload::ref s5bPayload = std::dynamic_pointer_cast<JingleS5BTransportPayload>(transportPayload)) { 128 if (JingleS5BTransportPayload::ref s5bPayload = std::dynamic_pointer_cast<JingleS5BTransportPayload>(transportPayload)) {
129 transporter->addRemoteCandidates(s5bPayload->getCandidates(), s5bPayload->getDstAddr()); 129 transporter->addRemoteCandidates(s5bPayload->getCandidates(), s5bPayload->getDstAddr());
@@ -134,14 +134,14 @@ void OutgoingJingleFileTransfer::handleSessionAcceptReceived(
134 startTransferring(transporter->createIBBSendSession(ibbPayload->getSessionID(), ibbPayload->getBlockSize().get_value_or(DEFAULT_BLOCK_SIZE), stream)); 134 startTransferring(transporter->createIBBSendSession(ibbPayload->getSessionID(), ibbPayload->getBlockSize().get_value_or(DEFAULT_BLOCK_SIZE), stream));
135 } 135 }
136 else { 136 else {
137 SWIFT_LOG(debug) << "Unknown transport payload. Falling back." << std::endl; 137 SWIFT_LOG(debug) << "Unknown transport payload. Falling back.";
138 fallback(); 138 fallback();
139 } 139 }
140} 140}
141 141
142void OutgoingJingleFileTransfer::handleSessionTerminateReceived(boost::optional<JinglePayload::Reason> reason) { 142void OutgoingJingleFileTransfer::handleSessionTerminateReceived(boost::optional<JinglePayload::Reason> reason) {
143 SWIFT_LOG(debug) << std::endl; 143 SWIFT_LOG(debug);
144 if (state == Finished) { SWIFT_LOG(warning) << "Incorrect state: " << state << std::endl; return; } 144 if (state == Finished) { SWIFT_LOG(warning) << "Incorrect state: " << state; return; }
145 145
146 stopAll(); 146 stopAll();
147 if (state == WaitForTermination) { 147 if (state == WaitForTermination) {
@@ -162,26 +162,26 @@ void OutgoingJingleFileTransfer::handleSessionTerminateReceived(boost::optional<
162} 162}
163 163
164void OutgoingJingleFileTransfer::handleTransportAcceptReceived(const JingleContentID&, JingleTransportPayload::ref transport) { 164void OutgoingJingleFileTransfer::handleTransportAcceptReceived(const JingleContentID&, JingleTransportPayload::ref transport) {
165 SWIFT_LOG(debug) << std::endl; 165 SWIFT_LOG(debug);
166 if (state != FallbackRequested) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } 166 if (state != FallbackRequested) { SWIFT_LOG(warning) << "Incorrect state"; return; }
167 167
168 if (JingleIBBTransportPayload::ref ibbPayload = std::dynamic_pointer_cast<JingleIBBTransportPayload>(transport)) { 168 if (JingleIBBTransportPayload::ref ibbPayload = std::dynamic_pointer_cast<JingleIBBTransportPayload>(transport)) {
169 startTransferring(transporter->createIBBSendSession(ibbPayload->getSessionID(), ibbPayload->getBlockSize().get_value_or(DEFAULT_BLOCK_SIZE), stream)); 169 startTransferring(transporter->createIBBSendSession(ibbPayload->getSessionID(), ibbPayload->getBlockSize().get_value_or(DEFAULT_BLOCK_SIZE), stream));
170 } 170 }
171 else { 171 else {
172 SWIFT_LOG(debug) << "Unknown transport replacement" << std::endl; 172 SWIFT_LOG(debug) << "Unknown transport replacement";
173 terminate(JinglePayload::Reason::FailedTransport); 173 terminate(JinglePayload::Reason::FailedTransport);
174 } 174 }
175} 175}
176 176
177void OutgoingJingleFileTransfer::handleTransportRejectReceived(const JingleContentID &, std::shared_ptr<JingleTransportPayload>) { 177void OutgoingJingleFileTransfer::handleTransportRejectReceived(const JingleContentID &, std::shared_ptr<JingleTransportPayload>) {
178 SWIFT_LOG(debug) << std::endl; 178 SWIFT_LOG(debug);
179 179
180 terminate(JinglePayload::Reason::UnsupportedTransports); 180 terminate(JinglePayload::Reason::UnsupportedTransports);
181} 181}
182 182
183void OutgoingJingleFileTransfer::sendSessionInfoHash() { 183void OutgoingJingleFileTransfer::sendSessionInfoHash() {
184 SWIFT_LOG(debug) << std::endl; 184 SWIFT_LOG(debug);
185 185
186 JingleFileTransferHash::ref hashElement = std::make_shared<JingleFileTransferHash>(); 186 JingleFileTransferHash::ref hashElement = std::make_shared<JingleFileTransferHash>();
187 hashElement->getFileInfo().addHash(HashElement("sha-1", hashCalculator->getSHA1Hash())); 187 hashElement->getFileInfo().addHash(HashElement("sha-1", hashCalculator->getSHA1Hash()));
@@ -191,8 +191,8 @@ void OutgoingJingleFileTransfer::sendSessionInfoHash() {
191 191
192void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated( 192void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
193 const std::string& s5bSessionID, const std::vector<JingleS5BTransportPayload::Candidate>& candidates, const std::string& dstAddr) { 193 const std::string& s5bSessionID, const std::vector<JingleS5BTransportPayload::Candidate>& candidates, const std::string& dstAddr) {
194 SWIFT_LOG(debug) << std::endl; 194 SWIFT_LOG(debug);
195 if (state != GeneratingInitialLocalCandidates) { SWIFT_LOG(warning) << "Incorrect state: " << state << std::endl; return; } 195 if (state != GeneratingInitialLocalCandidates) { SWIFT_LOG(warning) << "Incorrect state: " << state; return; }
196 196
197 fillCandidateMap(localCandidates, candidates); 197 fillCandidateMap(localCandidates, candidates);
198 198
@@ -203,7 +203,7 @@ void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
203 203
204 JingleTransportPayload::ref transport; 204 JingleTransportPayload::ref transport;
205 if (candidates.empty()) { 205 if (candidates.empty()) {
206 SWIFT_LOG(debug) << "no S5B candidates generated. Send IBB transport candidate." << std::endl; 206 SWIFT_LOG(debug) << "no S5B candidates generated. Send IBB transport candidate.";
207 JingleIBBTransportPayload::ref ibbTransport = std::make_shared<JingleIBBTransportPayload>(); 207 JingleIBBTransportPayload::ref ibbTransport = std::make_shared<JingleIBBTransportPayload>();
208 ibbTransport->setBlockSize(DEFAULT_BLOCK_SIZE); 208 ibbTransport->setBlockSize(DEFAULT_BLOCK_SIZE);
209 ibbTransport->setSessionID(idGenerator->generateID()); 209 ibbTransport->setSessionID(idGenerator->generateID());
@@ -216,7 +216,7 @@ void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
216 s5bTransport->setDstAddr(dstAddr); 216 s5bTransport->setDstAddr(dstAddr);
217 for (auto&& candidate : candidates) { 217 for (auto&& candidate : candidates) {
218 s5bTransport->addCandidate(candidate); 218 s5bTransport->addCandidate(candidate);
219 SWIFT_LOG(debug) << "\t" << "S5B candidate: " << candidate.hostPort.toString() << std::endl; 219 SWIFT_LOG(debug) << "\t" << "S5B candidate: " << candidate.hostPort.toString();
220 } 220 }
221 transport = s5bTransport; 221 transport = s5bTransport;
222 } 222 }
@@ -226,7 +226,7 @@ void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
226 226
227void OutgoingJingleFileTransfer::fallback() { 227void OutgoingJingleFileTransfer::fallback() {
228 if (options.isInBandAllowed()) { 228 if (options.isInBandAllowed()) {
229 SWIFT_LOG(debug) << "Trying to fallback to IBB transport." << std::endl; 229 SWIFT_LOG(debug) << "Trying to fallback to IBB transport.";
230 JingleIBBTransportPayload::ref ibbTransport = std::make_shared<JingleIBBTransportPayload>(); 230 JingleIBBTransportPayload::ref ibbTransport = std::make_shared<JingleIBBTransportPayload>();
231 ibbTransport->setBlockSize(DEFAULT_BLOCK_SIZE); 231 ibbTransport->setBlockSize(DEFAULT_BLOCK_SIZE);
232 ibbTransport->setSessionID(idGenerator->generateID()); 232 ibbTransport->setSessionID(idGenerator->generateID());
@@ -234,14 +234,14 @@ void OutgoingJingleFileTransfer::fallback() {
234 session->sendTransportReplace(contentID, ibbTransport); 234 session->sendTransportReplace(contentID, ibbTransport);
235 } 235 }
236 else { 236 else {
237 SWIFT_LOG(debug) << "Fallback to IBB transport not allowed." << std::endl; 237 SWIFT_LOG(debug) << "Fallback to IBB transport not allowed.";
238 terminate(JinglePayload::Reason::ConnectivityError); 238 terminate(JinglePayload::Reason::ConnectivityError);
239 } 239 }
240} 240}
241 241
242void OutgoingJingleFileTransfer::handleTransferFinished(boost::optional<FileTransferError> error) { 242void OutgoingJingleFileTransfer::handleTransferFinished(boost::optional<FileTransferError> error) {
243 SWIFT_LOG(debug) << std::endl; 243 SWIFT_LOG(debug);
244 if (state != Transferring) { SWIFT_LOG(warning) << "Incorrect state: " << state << std::endl; return; } 244 if (state != Transferring) { SWIFT_LOG(warning) << "Incorrect state: " << state; return; }
245 245
246 if (error) { 246 if (error) {
247 terminate(JinglePayload::Reason::ConnectivityError); 247 terminate(JinglePayload::Reason::ConnectivityError);
@@ -256,7 +256,7 @@ void OutgoingJingleFileTransfer::handleTransferFinished(boost::optional<FileTran
256} 256}
257 257
258void OutgoingJingleFileTransfer::startTransferring(std::shared_ptr<TransportSession> transportSession) { 258void OutgoingJingleFileTransfer::startTransferring(std::shared_ptr<TransportSession> transportSession) {
259 SWIFT_LOG(debug) << std::endl; 259 SWIFT_LOG(debug);
260 260
261 this->transportSession = transportSession; 261 this->transportSession = transportSession;
262 processedBytesConnection = transportSession->onBytesSent.connect( 262 processedBytesConnection = transportSession->onBytesSent.connect(
@@ -269,14 +269,14 @@ void OutgoingJingleFileTransfer::startTransferring(std::shared_ptr<TransportSess
269 269
270 270
271void OutgoingJingleFileTransfer::setInternalState(State state) { 271void OutgoingJingleFileTransfer::setInternalState(State state) {
272 SWIFT_LOG(debug) << state << std::endl; 272 SWIFT_LOG(debug) << state;
273 this->state = state; 273 this->state = state;
274 setState(FileTransfer::State(getExternalState(state))); 274 setState(FileTransfer::State(getExternalState(state)));
275} 275}
276 276
277void OutgoingJingleFileTransfer::setFinishedState( 277void OutgoingJingleFileTransfer::setFinishedState(
278 FileTransfer::State::Type type, const boost::optional<FileTransferError>& error) { 278 FileTransfer::State::Type type, const boost::optional<FileTransferError>& error) {
279 SWIFT_LOG(debug) << std::endl; 279 SWIFT_LOG(debug);
280 this->state = Finished; 280 this->state = Finished;
281 onStateChanged(type); 281 onStateChanged(type);
282 onFinished(error); 282 onFinished(error);
@@ -301,9 +301,9 @@ FileTransfer::State::Type OutgoingJingleFileTransfer::getExternalState(State sta
301} 301}
302 302
303void OutgoingJingleFileTransfer::stopAll() { 303void OutgoingJingleFileTransfer::stopAll() {
304 SWIFT_LOG(debug) << state << std::endl; 304 SWIFT_LOG(debug) << state;
305 switch (state) { 305 switch (state) {
306 case Initial: SWIFT_LOG(warning) << "Not yet started" << std::endl; break; 306 case Initial: SWIFT_LOG(warning) << "Not yet started"; break;
307 case GeneratingInitialLocalCandidates: transporter->stopGeneratingLocalCandidates(); break; 307 case GeneratingInitialLocalCandidates: transporter->stopGeneratingLocalCandidates(); break;
308 case WaitingForAccept: break; 308 case WaitingForAccept: break;
309 case TryingCandidates: transporter->stopTryingRemoteCandidates(); break; 309 case TryingCandidates: transporter->stopTryingRemoteCandidates(); break;
@@ -320,7 +320,7 @@ void OutgoingJingleFileTransfer::stopAll() {
320 break; 320 break;
321 case WaitForTermination: 321 case WaitForTermination:
322 break; 322 break;
323 case Finished: SWIFT_LOG(warning) << "Already finished" << std::endl; break; 323 case Finished: SWIFT_LOG(warning) << "Already finished"; break;
324 } 324 }
325 if (state != Initial) { 325 if (state != Initial) {
326 removeTransporter(); 326 removeTransporter();
@@ -328,7 +328,7 @@ void OutgoingJingleFileTransfer::stopAll() {
328} 328}
329 329
330void OutgoingJingleFileTransfer::startTransferViaRemoteCandidate() { 330void OutgoingJingleFileTransfer::startTransferViaRemoteCandidate() {
331 SWIFT_LOG(debug) << std::endl; 331 SWIFT_LOG(debug);
332 332
333 if (ourCandidateChoice->type == JingleS5BTransportPayload::Candidate::ProxyType) { 333 if (ourCandidateChoice->type == JingleS5BTransportPayload::Candidate::ProxyType) {
334 setInternalState(WaitingForPeerProxyActivate); 334 setInternalState(WaitingForPeerProxyActivate);
@@ -340,7 +340,7 @@ void OutgoingJingleFileTransfer::startTransferViaRemoteCandidate() {
340} 340}
341 341
342void OutgoingJingleFileTransfer::startTransferViaLocalCandidate() { 342void OutgoingJingleFileTransfer::startTransferViaLocalCandidate() {
343 SWIFT_LOG(debug) << std::endl; 343 SWIFT_LOG(debug);
344 344
345 if (theirCandidateChoice->type == JingleS5BTransportPayload::Candidate::ProxyType) { 345 if (theirCandidateChoice->type == JingleS5BTransportPayload::Candidate::ProxyType) {
346 setInternalState(WaitingForLocalProxyActivate); 346 setInternalState(WaitingForLocalProxyActivate);
@@ -400,7 +400,7 @@ std::shared_ptr<TransportSession> OutgoingJingleFileTransfer::createRemoteCandid
400 400
401void OutgoingJingleFileTransfer::handleWaitForRemoteTerminationTimeout() { 401void OutgoingJingleFileTransfer::handleWaitForRemoteTerminationTimeout() {
402 assert(state == WaitForTermination); 402 assert(state == WaitForTermination);
403 SWIFT_LOG(warning) << "Other party did not terminate session. Terminate it now." << std::endl; 403 SWIFT_LOG(warning) << "Other party did not terminate session. Terminate it now.";
404 waitForRemoteTermination->stop(); 404 waitForRemoteTermination->stop();
405 terminate(JinglePayload::Reason::MediaError); 405 terminate(JinglePayload::Reason::MediaError);
406} 406}
diff --git a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp
index 56013ca..4023be3 100644
--- a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp
+++ b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2013-2016 Isode Limited. 8 * Copyright (c) 2013-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -56,14 +56,14 @@ void RemoteJingleTransportCandidateSelector::stopSelectingCandidate() {
56 56
57void RemoteJingleTransportCandidateSelector::tryNextCandidate() { 57void RemoteJingleTransportCandidateSelector::tryNextCandidate() {
58 if (candidates.empty()) { 58 if (candidates.empty()) {
59 SWIFT_LOG(debug) << "No more candidates" << std::endl; 59 SWIFT_LOG(debug) << "No more candidates";
60 onCandidateSelectFinished( 60 onCandidateSelectFinished(
61 boost::optional<JingleS5BTransportPayload::Candidate>(), std::shared_ptr<SOCKS5BytestreamClientSession>()); 61 boost::optional<JingleS5BTransportPayload::Candidate>(), std::shared_ptr<SOCKS5BytestreamClientSession>());
62 } 62 }
63 else { 63 else {
64 lastCandidate = candidates.top(); 64 lastCandidate = candidates.top();
65 candidates.pop(); 65 candidates.pop();
66 SWIFT_LOG(debug) << "Trying candidate " << lastCandidate.cid << std::endl; 66 SWIFT_LOG(debug) << "Trying candidate " << lastCandidate.cid;
67 if ((lastCandidate.type == JingleS5BTransportPayload::Candidate::DirectType && options.isDirectAllowed()) || 67 if ((lastCandidate.type == JingleS5BTransportPayload::Candidate::DirectType && options.isDirectAllowed()) ||
68 (lastCandidate.type == JingleS5BTransportPayload::Candidate::AssistedType && options.isAssistedAllowed()) || 68 (lastCandidate.type == JingleS5BTransportPayload::Candidate::AssistedType && options.isAssistedAllowed()) ||
69 (lastCandidate.type == JingleS5BTransportPayload::Candidate::ProxyType && options.isProxiedAllowed())) { 69 (lastCandidate.type == JingleS5BTransportPayload::Candidate::ProxyType && options.isProxiedAllowed())) {
@@ -75,7 +75,7 @@ void RemoteJingleTransportCandidateSelector::tryNextCandidate() {
75 s5bSession->start(); 75 s5bSession->start();
76 } 76 }
77 else { 77 else {
78 SWIFT_LOG(debug) << "Can't handle this type of candidate" << std::endl; 78 SWIFT_LOG(debug) << "Can't handle this type of candidate";
79 tryNextCandidate(); 79 tryNextCandidate();
80 } 80 }
81 } 81 }
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp
index 5ddd32b..a3f0dab 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2013-2016 Isode Limited. 8 * Copyright (c) 2013-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -49,7 +49,7 @@ SOCKS5BytestreamClientSession::~SOCKS5BytestreamClientSession() {
49 49
50void SOCKS5BytestreamClientSession::start() { 50void SOCKS5BytestreamClientSession::start() {
51 assert(state == Initial); 51 assert(state == Initial);
52 SWIFT_LOG(debug) << "Trying to connect via TCP to " << addressPort.toString() << "." << std::endl; 52 SWIFT_LOG(debug) << "Trying to connect via TCP to " << addressPort.toString() << ".";
53 weFailedTimeout->start(); 53 weFailedTimeout->start();
54 connectFinishedConnection = connection->onConnectFinished.connect( 54 connectFinishedConnection = connection->onConnectFinished.connect(
55 boost::bind(&SOCKS5BytestreamClientSession::handleConnectFinished, this, _1)); 55 boost::bind(&SOCKS5BytestreamClientSession::handleConnectFinished, this, _1));
@@ -57,7 +57,7 @@ void SOCKS5BytestreamClientSession::start() {
57} 57}
58 58
59void SOCKS5BytestreamClientSession::stop() { 59void SOCKS5BytestreamClientSession::stop() {
60 SWIFT_LOG(debug) << std::endl; 60 SWIFT_LOG(debug);
61 if (state < Ready) { 61 if (state < Ready) {
62 weFailedTimeout->stop(); 62 weFailedTimeout->stop();
63 } 63 }
@@ -70,7 +70,7 @@ void SOCKS5BytestreamClientSession::stop() {
70} 70}
71 71
72void SOCKS5BytestreamClientSession::process() { 72void SOCKS5BytestreamClientSession::process() {
73 SWIFT_LOG(debug) << "unprocessedData.size(): " << unprocessedData.size() << std::endl; 73 SWIFT_LOG(debug) << "unprocessedData.size(): " << unprocessedData.size();
74 ByteArray bndAddress; 74 ByteArray bndAddress;
75 switch(state) { 75 switch(state) {
76 case Initial: 76 case Initial:
@@ -124,19 +124,19 @@ void SOCKS5BytestreamClientSession::process() {
124 } 124 }
125 unprocessedData.clear(); 125 unprocessedData.clear();
126 state = Ready; 126 state = Ready;
127 SWIFT_LOG(debug) << "session ready" << std::endl; 127 SWIFT_LOG(debug) << "session ready";
128 // issue ready signal so the bytestream can be used for reading or writing 128 // issue ready signal so the bytestream can be used for reading or writing
129 weFailedTimeout->stop(); 129 weFailedTimeout->stop();
130 onSessionReady(false); 130 onSessionReady(false);
131 break; 131 break;
132 case Ready: 132 case Ready:
133 SWIFT_LOG(debug) << "Received further data in Ready state." << std::endl; 133 SWIFT_LOG(debug) << "Received further data in Ready state.";
134 break; 134 break;
135 case Reading: 135 case Reading:
136 case Writing: 136 case Writing:
137 case Finished: 137 case Finished:
138 SWIFT_LOG(debug) << "Unexpected receive of data. Current state: " << state << std::endl; 138 SWIFT_LOG(debug) << "Unexpected receive of data. Current state: " << state;
139 SWIFT_LOG(debug) << "Data: " << Hexify::hexify(unprocessedData) << std::endl; 139 SWIFT_LOG(debug) << "Data: " << Hexify::hexify(unprocessedData);
140 unprocessedData.clear(); 140 unprocessedData.clear();
141 //assert(false); 141 //assert(false);
142 } 142 }
@@ -150,7 +150,7 @@ void SOCKS5BytestreamClientSession::hello() {
150} 150}
151 151
152void SOCKS5BytestreamClientSession::authenticate() { 152void SOCKS5BytestreamClientSession::authenticate() {
153 SWIFT_LOG(debug) << std::endl; 153 SWIFT_LOG(debug);
154 SafeByteArray header = createSafeByteArray("\x05\x01\x00\x03", 4); 154 SafeByteArray header = createSafeByteArray("\x05\x01\x00\x03", 4);
155 SafeByteArray message = header; 155 SafeByteArray message = header;
156 append(message, createSafeByteArray(boost::numeric_cast<char>(destination.size()))); 156 append(message, createSafeByteArray(boost::numeric_cast<char>(destination.size())));
@@ -168,7 +168,7 @@ void SOCKS5BytestreamClientSession::startReceiving(std::shared_ptr<WriteBytestre
168 writeBytestream->write(unprocessedData); 168 writeBytestream->write(unprocessedData);
169 unprocessedData.clear(); 169 unprocessedData.clear();
170 } else { 170 } else {
171 SWIFT_LOG(debug) << "Session isn't ready for transfer yet!" << std::endl; 171 SWIFT_LOG(debug) << "Session isn't ready for transfer yet!";
172 } 172 }
173} 173}
174 174
@@ -180,7 +180,7 @@ void SOCKS5BytestreamClientSession::startSending(std::shared_ptr<ReadBytestream>
180 boost::bind(&SOCKS5BytestreamClientSession::sendData, this)); 180 boost::bind(&SOCKS5BytestreamClientSession::sendData, this));
181 sendData(); 181 sendData();
182 } else { 182 } else {
183 SWIFT_LOG(debug) << "Session isn't ready for transfer yet!" << std::endl; 183 SWIFT_LOG(debug) << "Session isn't ready for transfer yet!";
184 } 184 }
185} 185}
186 186
@@ -205,7 +205,7 @@ void SOCKS5BytestreamClientSession::sendData() {
205} 205}
206 206
207void SOCKS5BytestreamClientSession::finish(bool error) { 207void SOCKS5BytestreamClientSession::finish(bool error) {
208 SWIFT_LOG(debug) << std::endl; 208 SWIFT_LOG(debug);
209 if (state < Ready) { 209 if (state < Ready) {
210 weFailedTimeout->stop(); 210 weFailedTimeout->stop();
211 } 211 }
@@ -227,10 +227,10 @@ void SOCKS5BytestreamClientSession::finish(bool error) {
227void SOCKS5BytestreamClientSession::handleConnectFinished(bool error) { 227void SOCKS5BytestreamClientSession::handleConnectFinished(bool error) {
228 connectFinishedConnection.disconnect(); 228 connectFinishedConnection.disconnect();
229 if (error) { 229 if (error) {
230 SWIFT_LOG(debug) << "Failed to connect via TCP to " << addressPort.toString() << "." << std::endl; 230 SWIFT_LOG(debug) << "Failed to connect via TCP to " << addressPort.toString() << ".";
231 finish(true); 231 finish(true);
232 } else { 232 } else {
233 SWIFT_LOG(debug) << "Successfully connected via TCP" << addressPort.toString() << "." << std::endl; 233 SWIFT_LOG(debug) << "Successfully connected via TCP" << addressPort.toString() << ".";
234 disconnectedConnection = connection->onDisconnected.connect( 234 disconnectedConnection = connection->onDisconnected.connect(
235 boost::bind(&SOCKS5BytestreamClientSession::handleDisconnected, this, _1)); 235 boost::bind(&SOCKS5BytestreamClientSession::handleDisconnected, this, _1));
236 dataReadConnection = connection->onDataRead.connect( 236 dataReadConnection = connection->onDataRead.connect(
@@ -242,7 +242,7 @@ void SOCKS5BytestreamClientSession::handleConnectFinished(bool error) {
242} 242}
243 243
244void SOCKS5BytestreamClientSession::handleDataRead(std::shared_ptr<SafeByteArray> data) { 244void SOCKS5BytestreamClientSession::handleDataRead(std::shared_ptr<SafeByteArray> data) {
245 SWIFT_LOG(debug) << "state: " << state << " data.size() = " << data->size() << std::endl; 245 SWIFT_LOG(debug) << "state: " << state << " data.size() = " << data->size();
246 if (state != Reading) { 246 if (state != Reading) {
247 append(unprocessedData, *data); 247 append(unprocessedData, *data);
248 process(); 248 process();
@@ -254,14 +254,14 @@ void SOCKS5BytestreamClientSession::handleDataRead(std::shared_ptr<SafeByteArray
254} 254}
255 255
256void SOCKS5BytestreamClientSession::handleDisconnected(const boost::optional<Connection::Error>& error) { 256void SOCKS5BytestreamClientSession::handleDisconnected(const boost::optional<Connection::Error>& error) {
257 SWIFT_LOG(debug) << (error ? (error == Connection::ReadError ? "Read Error" : "Write Error") : "No Error") << std::endl; 257 SWIFT_LOG(debug) << (error ? (error == Connection::ReadError ? "Read Error" : "Write Error") : "No Error");
258 if (error) { 258 if (error) {
259 finish(true); 259 finish(true);
260 } 260 }
261} 261}
262 262
263void SOCKS5BytestreamClientSession::handleWeFailedTimeout() { 263void SOCKS5BytestreamClientSession::handleWeFailedTimeout() {
264 SWIFT_LOG(debug) << "Failed due to timeout!" << std::endl; 264 SWIFT_LOG(debug) << "Failed due to timeout!";
265 finish(true); 265 finish(true);
266} 266}
267 267
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp b/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp
index cd4cfaa..72c4d41 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2015-2016 Isode Limited. 8 * Copyright (c) 2015-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -46,7 +46,7 @@ SOCKS5BytestreamProxiesManager::~SOCKS5BytestreamProxiesManager() {
46 46
47void SOCKS5BytestreamProxiesManager::addS5BProxy(S5BProxyRequest::ref proxy) { 47void SOCKS5BytestreamProxiesManager::addS5BProxy(S5BProxyRequest::ref proxy) {
48 if (proxy) { 48 if (proxy) {
49 SWIFT_LOG_ASSERT(HostAddress::fromString(proxy->getStreamHost().get().host), warning) << std::endl; 49 SWIFT_LOG_ASSERT(HostAddress::fromString(proxy->getStreamHost().get().host), warning);
50 if (!localS5BProxies_) { 50 if (!localS5BProxies_) {
51 localS5BProxies_ = std::vector<S5BProxyRequest::ref>(); 51 localS5BProxies_ = std::vector<S5BProxyRequest::ref>();
52 } 52 }
@@ -62,7 +62,7 @@ const boost::optional<std::vector<S5BProxyRequest::ref> >& SOCKS5BytestreamProxi
62} 62}
63 63
64void SOCKS5BytestreamProxiesManager::connectToProxies(const std::string& sessionID) { 64void SOCKS5BytestreamProxiesManager::connectToProxies(const std::string& sessionID) {
65 SWIFT_LOG(debug) << "session ID: " << sessionID << std::endl; 65 SWIFT_LOG(debug) << "session ID: " << sessionID;
66 ProxyJIDClientSessionVector clientSessions; 66 ProxyJIDClientSessionVector clientSessions;
67 67
68 if (localS5BProxies_) { 68 if (localS5BProxies_) {
@@ -71,7 +71,7 @@ void SOCKS5BytestreamProxiesManager::connectToProxies(const std::string& session
71 if (proxyHostAddress) { 71 if (proxyHostAddress) {
72 std::shared_ptr<Connection> conn = connectionFactory_->createConnection(); 72 std::shared_ptr<Connection> conn = connectionFactory_->createConnection();
73 HostAddressPort addressPort = HostAddressPort(proxyHostAddress.get(), proxy->getStreamHost().get().port); 73 HostAddressPort addressPort = HostAddressPort(proxyHostAddress.get(), proxy->getStreamHost().get().port);
74 SWIFT_LOG_ASSERT(addressPort.isValid(), warning) << std::endl; 74 SWIFT_LOG_ASSERT(addressPort.isValid(), warning);
75 std::shared_ptr<SOCKS5BytestreamClientSession> session = std::make_shared<SOCKS5BytestreamClientSession>(conn, addressPort, sessionID, timerFactory_); 75 std::shared_ptr<SOCKS5BytestreamClientSession> session = std::make_shared<SOCKS5BytestreamClientSession>(conn, addressPort, sessionID, timerFactory_);
76 JID proxyJid = proxy->getStreamHost().get().jid; 76 JID proxyJid = proxy->getStreamHost().get().jid;
77 clientSessions.push_back(std::pair<JID, std::shared_ptr<SOCKS5BytestreamClientSession> >(proxyJid, session)); 77 clientSessions.push_back(std::pair<JID, std::shared_ptr<SOCKS5BytestreamClientSession> >(proxyJid, session));
@@ -103,7 +103,7 @@ std::shared_ptr<SOCKS5BytestreamClientSession> SOCKS5BytestreamProxiesManager::g
103 i->second->stop(); 103 i->second->stop();
104 } 104 }
105 } 105 }
106 SWIFT_LOG_ASSERT(activeSession, warning) << "No active session with matching ID found." << std::endl; 106 SWIFT_LOG_ASSERT(activeSession, warning) << "No active session with matching ID found.";
107 107
108 proxySessions_.erase(sessionID); 108 proxySessions_.erase(sessionID);
109 109
@@ -144,7 +144,7 @@ void SOCKS5BytestreamProxiesManager::handleNameLookupResult(const std::vector<Ho
144 } 144 }
145 else { 145 else {
146 if (addresses.empty()) { 146 if (addresses.empty()) {
147 SWIFT_LOG(warning) << "S5B proxy hostname does not resolve." << std::endl; 147 SWIFT_LOG(warning) << "S5B proxy hostname does not resolve.";
148 } 148 }
149 else { 149 else {
150 // generate proxy per returned address 150 // generate proxy per returned address
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp b/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp
index 90c42dd..1efc54a 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2015-2016 Isode Limited. 8 * Copyright (c) 2015-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -71,10 +71,10 @@ void SOCKS5BytestreamProxyFinder::handleProxyResponse(std::shared_ptr<GenericReq
71 requester->onResponse.disconnect(boost::bind(&SOCKS5BytestreamProxyFinder::handleProxyResponse, this, requester, _1, _2)); 71 requester->onResponse.disconnect(boost::bind(&SOCKS5BytestreamProxyFinder::handleProxyResponse, this, requester, _1, _2));
72 pendingRequests.erase(requester); 72 pendingRequests.erase(requester);
73 if (error) { 73 if (error) {
74 SWIFT_LOG(debug) << "ERROR" << std::endl; 74 SWIFT_LOG(debug) << "ERROR";
75 } else { 75 } else {
76 if (request) { 76 if (request) {
77 SWIFT_LOG(debug) << "add request" << std::endl; 77 SWIFT_LOG(debug) << "add request";
78 proxyHosts.push_back(request); 78 proxyHosts.push_back(request);
79 } 79 }
80 } 80 }
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
index a6b75da..7fc1388 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012-2018 Isode Limited. 2 * Copyright (c) 2012-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -48,12 +48,12 @@ SOCKS5BytestreamServerManager::SOCKS5BytestreamServerManager(
48} 48}
49 49
50SOCKS5BytestreamServerManager::~SOCKS5BytestreamServerManager() { 50SOCKS5BytestreamServerManager::~SOCKS5BytestreamServerManager() {
51 SWIFT_LOG_ASSERT(!connectionServer, warning) << std::endl; 51 SWIFT_LOG_ASSERT(!connectionServer, warning);
52 SWIFT_LOG_ASSERT(!getPublicIPRequest, warning) << std::endl; 52 SWIFT_LOG_ASSERT(!getPublicIPRequest, warning);
53 SWIFT_LOG_ASSERT(!forwardPortRequest, warning) << std::endl; 53 SWIFT_LOG_ASSERT(!forwardPortRequest, warning);
54 SWIFT_LOG_ASSERT(state == Start, warning) << std::endl; 54 SWIFT_LOG_ASSERT(state == Start, warning);
55 if (portMapping && !unforwardPortRequest) { 55 if (portMapping && !unforwardPortRequest) {
56 SWIFT_LOG(warning) << "Port forwarding still alive. Trying to remove it now." << std::endl; 56 SWIFT_LOG(warning) << "Port forwarding still alive. Trying to remove it now.";
57 unforwardPortRequest = natTraverser->createRemovePortForwardingRequest(portMapping.get().getLocalPort(), portMapping.get().getPublicPort()); 57 unforwardPortRequest = natTraverser->createRemovePortForwardingRequest(portMapping.get().getLocalPort(), portMapping.get().getPublicPort());
58 unforwardPortRequest->start(); 58 unforwardPortRequest->start();
59 } 59 }
@@ -116,25 +116,25 @@ void SOCKS5BytestreamServerManager::initialize() {
116 assert(!connectionServer); 116 assert(!connectionServer);
117 unsigned short port; 117 unsigned short port;
118 for (port = LISTEN_PORTS_BEGIN; port < LISTEN_PORTS_END; ++port) { 118 for (port = LISTEN_PORTS_BEGIN; port < LISTEN_PORTS_END; ++port) {
119 SWIFT_LOG(debug) << "Trying to start server on port " << port << std::endl; 119 SWIFT_LOG(debug) << "Trying to start server on port " << port;
120 connectionServer = connectionServerFactory->createConnectionServer(HostAddress::fromString("::").get(), port); 120 connectionServer = connectionServerFactory->createConnectionServer(HostAddress::fromString("::").get(), port);
121 boost::optional<ConnectionServer::Error> error = connectionServer->tryStart(); 121 boost::optional<ConnectionServer::Error> error = connectionServer->tryStart();
122 if (!error) { 122 if (!error) {
123 break; 123 break;
124 } 124 }
125 else if (*error != ConnectionServer::Conflict) { 125 else if (*error != ConnectionServer::Conflict) {
126 SWIFT_LOG(debug) << "Error starting server" << std::endl; 126 SWIFT_LOG(debug) << "Error starting server";
127 onInitialized(false); 127 onInitialized(false);
128 return; 128 return;
129 } 129 }
130 connectionServer.reset(); 130 connectionServer.reset();
131 } 131 }
132 if (!connectionServer) { 132 if (!connectionServer) {
133 SWIFT_LOG(debug) << "Unable to find an open port" << std::endl; 133 SWIFT_LOG(debug) << "Unable to find an open port";
134 onInitialized(false); 134 onInitialized(false);
135 return; 135 return;
136 } 136 }
137 SWIFT_LOG(debug) << "Server started succesfully" << std::endl; 137 SWIFT_LOG(debug) << "Server started succesfully";
138 connectionServerPort = port; 138 connectionServerPort = port;
139 139
140 // Start bytestream server. Should actually happen before the connectionserver is started 140 // Start bytestream server. Should actually happen before the connectionserver is started
@@ -211,10 +211,10 @@ void SOCKS5BytestreamServerManager::stop() {
211 211
212void SOCKS5BytestreamServerManager::handleGetPublicIPResult(boost::optional<HostAddress> address) { 212void SOCKS5BytestreamServerManager::handleGetPublicIPResult(boost::optional<HostAddress> address) {
213 if (address) { 213 if (address) {
214 SWIFT_LOG(debug) << "Public IP discovered as " << address.get().toString() << "." << std::endl; 214 SWIFT_LOG(debug) << "Public IP discovered as " << address.get().toString() << ".";
215 } 215 }
216 else { 216 else {
217 SWIFT_LOG(debug) << "No public IP discoverable." << std::endl; 217 SWIFT_LOG(debug) << "No public IP discoverable.";
218 } 218 }
219 219
220 publicAddress = address; 220 publicAddress = address;
@@ -225,10 +225,10 @@ void SOCKS5BytestreamServerManager::handleGetPublicIPResult(boost::optional<Host
225 225
226void SOCKS5BytestreamServerManager::handleForwardPortResult(boost::optional<NATPortMapping> mapping) { 226void SOCKS5BytestreamServerManager::handleForwardPortResult(boost::optional<NATPortMapping> mapping) {
227 if (mapping) { 227 if (mapping) {
228 SWIFT_LOG(debug) << "Mapping port was successful." << std::endl; 228 SWIFT_LOG(debug) << "Mapping port was successful.";
229 } 229 }
230 else { 230 else {
231 SWIFT_LOG(debug) << "Mapping port has failed." << std::endl; 231 SWIFT_LOG(debug) << "Mapping port has failed.";
232 } 232 }
233 233
234 portMapping = mapping; 234 portMapping = mapping;
@@ -243,7 +243,7 @@ void SOCKS5BytestreamServerManager::handleUnforwardPortResult(boost::optional<bo
243 portMapping.reset(); 243 portMapping.reset();
244 } 244 }
245 else { 245 else {
246 SWIFT_LOG(warning) << "Failed to remove port forwarding." << std::endl; 246 SWIFT_LOG(warning) << "Failed to remove port forwarding.";
247 } 247 }
248 attemptedPortMapping_ = false; 248 attemptedPortMapping_ = false;
249 unforwardPortRequest.reset(); 249 unforwardPortRequest.reset();
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
index 0fd40bf..a4ab751 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -33,13 +33,13 @@ SOCKS5BytestreamServerSession::SOCKS5BytestreamServerSession(
33 33
34SOCKS5BytestreamServerSession::~SOCKS5BytestreamServerSession() { 34SOCKS5BytestreamServerSession::~SOCKS5BytestreamServerSession() {
35 if (state != Finished && state != Initial) { 35 if (state != Finished && state != Initial) {
36 SWIFT_LOG(warning) << "SOCKS5BytestreamServerSession unfinished" << std::endl; 36 SWIFT_LOG(warning) << "SOCKS5BytestreamServerSession unfinished";
37 finish(); 37 finish();
38 } 38 }
39} 39}
40 40
41void SOCKS5BytestreamServerSession::start() { 41void SOCKS5BytestreamServerSession::start() {
42 SWIFT_LOG(debug) << std::endl; 42 SWIFT_LOG(debug);
43 dataReadConnection = connection->onDataRead.connect( 43 dataReadConnection = connection->onDataRead.connect(
44 boost::bind(&SOCKS5BytestreamServerSession::handleDataRead, this, _1)); 44 boost::bind(&SOCKS5BytestreamServerSession::handleDataRead, this, _1));
45 state = WaitingForAuthentication; 45 state = WaitingForAuthentication;
@@ -50,7 +50,7 @@ void SOCKS5BytestreamServerSession::stop() {
50} 50}
51 51
52void SOCKS5BytestreamServerSession::startSending(std::shared_ptr<ReadBytestream> stream) { 52void SOCKS5BytestreamServerSession::startSending(std::shared_ptr<ReadBytestream> stream) {
53 if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!" << std::endl; return; } 53 if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!"; return; }
54 54
55 readBytestream = stream; 55 readBytestream = stream;
56 state = WritingData; 56 state = WritingData;
@@ -62,7 +62,7 @@ void SOCKS5BytestreamServerSession::startSending(std::shared_ptr<ReadBytestream>
62} 62}
63 63
64void SOCKS5BytestreamServerSession::startReceiving(std::shared_ptr<WriteBytestream> stream) { 64void SOCKS5BytestreamServerSession::startReceiving(std::shared_ptr<WriteBytestream> stream) {
65 if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!" << std::endl; return; } 65 if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!"; return; }
66 66
67 writeBytestream = stream; 67 writeBytestream = stream;
68 state = ReadingData; 68 state = ReadingData;
@@ -93,7 +93,7 @@ void SOCKS5BytestreamServerSession::handleDataAvailable() {
93} 93}
94 94
95void SOCKS5BytestreamServerSession::handleDisconnected(const boost::optional<Connection::Error>& error) { 95void SOCKS5BytestreamServerSession::handleDisconnected(const boost::optional<Connection::Error>& error) {
96 SWIFT_LOG(debug) << (error ? (error == Connection::ReadError ? "Read Error" : "Write Error") : "No Error") << std::endl; 96 SWIFT_LOG(debug) << (error ? (error == Connection::ReadError ? "Read Error" : "Write Error") : "No Error");
97 finish(error ? boost::optional<FileTransferError>(FileTransferError::PeerError) : boost::optional<FileTransferError>()); 97 finish(error ? boost::optional<FileTransferError>(FileTransferError::PeerError) : boost::optional<FileTransferError>());
98} 98}
99 99
@@ -109,7 +109,7 @@ void SOCKS5BytestreamServerSession::process() {
109 if (i == 2 + authCount) { 109 if (i == 2 + authCount) {
110 // Authentication message is complete 110 // Authentication message is complete
111 if (i != unprocessedData.size()) { 111 if (i != unprocessedData.size()) {
112 SWIFT_LOG(debug) << "Junk after authentication mechanism" << std::endl; 112 SWIFT_LOG(debug) << "Junk after authentication mechanism";
113 } 113 }
114 unprocessedData.clear(); 114 unprocessedData.clear();
115 connection->write(createSafeByteArray("\x05\x00", 2)); 115 connection->write(createSafeByteArray("\x05\x00", 2));
@@ -130,7 +130,7 @@ void SOCKS5BytestreamServerSession::process() {
130 i += 2; 130 i += 2;
131 if (i <= unprocessedData.size()) { 131 if (i <= unprocessedData.size()) {
132 if (i != unprocessedData.size()) { 132 if (i != unprocessedData.size()) {
133 SWIFT_LOG(debug) << "Junk after authentication mechanism" << std::endl; 133 SWIFT_LOG(debug) << "Junk after authentication mechanism";
134 } 134 }
135 unprocessedData.clear(); 135 unprocessedData.clear();
136 streamID = byteArrayToString(requestID); 136 streamID = byteArrayToString(requestID);
@@ -142,18 +142,18 @@ void SOCKS5BytestreamServerSession::process() {
142 result.push_back(boost::numeric_cast<unsigned char>(requestID.size())); 142 result.push_back(boost::numeric_cast<unsigned char>(requestID.size()));
143 } 143 }
144 catch (const boost::numeric::bad_numeric_cast& e) { 144 catch (const boost::numeric::bad_numeric_cast& e) {
145 SWIFT_LOG(warning) << "SOCKS5 request ID is too long (" << requestID.size() << "): " << e.what() << std::endl; 145 SWIFT_LOG(warning) << "SOCKS5 request ID is too long (" << requestID.size() << "): " << e.what();
146 finish(); 146 finish();
147 return; 147 return;
148 } 148 }
149 append(result, concat(requestID, createByteArray("\x00\x00", 2))); 149 append(result, concat(requestID, createByteArray("\x00\x00", 2)));
150 if (!hasBytestream) { 150 if (!hasBytestream) {
151 SWIFT_LOG(debug) << "Readstream or Wrtiestream with ID " << streamID << " not found!" << std::endl; 151 SWIFT_LOG(debug) << "Readstream or Wrtiestream with ID " << streamID << " not found!";
152 connection->write(result); 152 connection->write(result);
153 finish(boost::optional<FileTransferError>(FileTransferError::PeerError)); 153 finish(boost::optional<FileTransferError>(FileTransferError::PeerError));
154 } 154 }
155 else { 155 else {
156 SWIFT_LOG(debug) << "Found stream. Sent OK." << std::endl; 156 SWIFT_LOG(debug) << "Found stream. Sent OK.";
157 connection->write(result); 157 connection->write(result);
158 state = ReadyForTransfer; 158 state = ReadyForTransfer;
159 } 159 }
@@ -185,7 +185,7 @@ void SOCKS5BytestreamServerSession::sendData() {
185} 185}
186 186
187void SOCKS5BytestreamServerSession::finish(const boost::optional<FileTransferError>& error) { 187void SOCKS5BytestreamServerSession::finish(const boost::optional<FileTransferError>& error) {
188 SWIFT_LOG(debug) << "state: " << state << std::endl; 188 SWIFT_LOG(debug) << "state: " << state;
189 if (state == Finished) { 189 if (state == Finished) {
190 return; 190 return;
191 } 191 }
diff --git a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
index 80667b6..fad02da 100644
--- a/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
+++ b/Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2015-2016 Isode Limited. 8 * Copyright (c) 2015-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -238,7 +238,7 @@ private:
238 std::shared_ptr<SafeByteArray> dataToSend; 238 std::shared_ptr<SafeByteArray> dataToSend;
239 //ByteArray failingData = Hexify::unhexify("8417947d1d305c72c11520ea7d2c6e787396705e72c312c6ccc3f66613d7cae1b91b7ab48e8b59a17d559c15fb51"); 239 //ByteArray failingData = Hexify::unhexify("8417947d1d305c72c11520ea7d2c6e787396705e72c312c6ccc3f66613d7cae1b91b7ab48e8b59a17d559c15fb51");
240 //append(dataToSend, failingData); 240 //append(dataToSend, failingData);
241 //SWIFT_LOG(debug) << "hexed: " << Hexify::hexify(failingData) << std::endl; 241 //SWIFT_LOG(debug) << "hexed: " << Hexify::hexify(failingData);
242 do { 242 do {
243 ByteArray rndArray = generateRandomByteArray(correctData->size()); 243 ByteArray rndArray = generateRandomByteArray(correctData->size());
244 dataToSend = createSafeByteArrayRef(vecptr(rndArray), rndArray.size()); 244 dataToSend = createSafeByteArrayRef(vecptr(rndArray), rndArray.size());
@@ -255,7 +255,7 @@ private:
255 255
256 void handleConnectionDataWritten(const SafeByteArray& data) { 256 void handleConnectionDataWritten(const SafeByteArray& data) {
257 append(unprocessedInput, data); 257 append(unprocessedInput, data);
258 //SWIFT_LOG(debug) << "unprocessedInput (" << unprocessedInput.size() << "): " << Hexify::hexify(unprocessedInput) << std::endl; 258 //SWIFT_LOG(debug) << "unprocessedInput (" << unprocessedInput.size() << "): " << Hexify::hexify(unprocessedInput);
259 } 259 }
260 260
261 void handleSessionReady(bool error) { 261 void handleSessionReady(bool error) {
diff --git a/Swiften/Jingle/AbstractJingleSessionListener.cpp b/Swiften/Jingle/AbstractJingleSessionListener.cpp
index 20edf15..56d2e92 100644
--- a/Swiften/Jingle/AbstractJingleSessionListener.cpp
+++ b/Swiften/Jingle/AbstractJingleSessionListener.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013-2016 Isode Limited. 2 * Copyright (c) 2013-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -11,31 +11,31 @@
11using namespace Swift; 11using namespace Swift;
12 12
13void AbstractJingleSessionListener::handleSessionAcceptReceived(const JingleContentID&, std::shared_ptr<JingleDescription>, std::shared_ptr<JingleTransportPayload>) { 13void AbstractJingleSessionListener::handleSessionAcceptReceived(const JingleContentID&, std::shared_ptr<JingleDescription>, std::shared_ptr<JingleTransportPayload>) {
14 SWIFT_LOG(warning) << "Unimplemented" << std::endl; 14 SWIFT_LOG(warning) << "Unimplemented";
15} 15}
16 16
17void AbstractJingleSessionListener::handleSessionInfoReceived(std::shared_ptr<JinglePayload>) { 17void AbstractJingleSessionListener::handleSessionInfoReceived(std::shared_ptr<JinglePayload>) {
18 SWIFT_LOG(warning) << "Unimplemented" << std::endl; 18 SWIFT_LOG(warning) << "Unimplemented";
19} 19}
20 20
21void AbstractJingleSessionListener::handleSessionTerminateReceived(boost::optional<JinglePayload::Reason>) { 21void AbstractJingleSessionListener::handleSessionTerminateReceived(boost::optional<JinglePayload::Reason>) {
22 SWIFT_LOG(warning) << "Unimplemented" << std::endl; 22 SWIFT_LOG(warning) << "Unimplemented";
23} 23}
24 24
25void AbstractJingleSessionListener::handleTransportAcceptReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) { 25void AbstractJingleSessionListener::handleTransportAcceptReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) {
26 SWIFT_LOG(warning) << "Unimplemented" << std::endl; 26 SWIFT_LOG(warning) << "Unimplemented";
27} 27}
28 28
29void AbstractJingleSessionListener::handleTransportInfoReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) { 29void AbstractJingleSessionListener::handleTransportInfoReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) {
30 SWIFT_LOG(warning) << "Unimplemented" << std::endl; 30 SWIFT_LOG(warning) << "Unimplemented";
31} 31}
32 32
33void AbstractJingleSessionListener::handleTransportRejectReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) { 33void AbstractJingleSessionListener::handleTransportRejectReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) {
34 SWIFT_LOG(warning) << "Unimplemented" << std::endl; 34 SWIFT_LOG(warning) << "Unimplemented";
35} 35}
36 36
37void AbstractJingleSessionListener::handleTransportReplaceReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) { 37void AbstractJingleSessionListener::handleTransportReplaceReceived(const JingleContentID&, std::shared_ptr<JingleTransportPayload>) {
38 SWIFT_LOG(warning) << "Unimplemented" << std::endl; 38 SWIFT_LOG(warning) << "Unimplemented";
39} 39}
40 40
41void AbstractJingleSessionListener::handleTransportInfoAcknowledged(const std::string&) { 41void AbstractJingleSessionListener::handleTransportInfoAcknowledged(const std::string&) {
diff --git a/Swiften/Jingle/JingleResponder.cpp b/Swiften/Jingle/JingleResponder.cpp
index 09bb234..af9808e 100644
--- a/Swiften/Jingle/JingleResponder.cpp
+++ b/Swiften/Jingle/JingleResponder.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2016 Isode Limited. 2 * Copyright (c) 2011-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -32,17 +32,17 @@ bool JingleResponder::handleSetRequest(const JID& from, const JID& to, const std
32 JingleSessionImpl::ref session = std::make_shared<JingleSessionImpl>(payload->getInitiator(), from, payload->getSessionID(), router); 32 JingleSessionImpl::ref session = std::make_shared<JingleSessionImpl>(payload->getInitiator(), from, payload->getSessionID(), router);
33 sessionManager->handleIncomingSession(from, to, session, payload->getContents()); 33 sessionManager->handleIncomingSession(from, to, session, payload->getContents());
34 } else { 34 } else {
35 SWIFT_LOG(debug) << "Unable to create Jingle session due to initiator not being a full JID." << std::endl; 35 SWIFT_LOG(debug) << "Unable to create Jingle session due to initiator not being a full JID.";
36 } 36 }
37 } 37 }
38 } 38 }
39 else { 39 else {
40 JingleSessionImpl::ref session; 40 JingleSessionImpl::ref session;
41 if (payload->getInitiator().isValid()) { 41 if (payload->getInitiator().isValid()) {
42 SWIFT_LOG(debug) << "Lookup session by initiator." << std::endl; 42 SWIFT_LOG(debug) << "Lookup session by initiator.";
43 session = sessionManager->getSession(payload->getInitiator(), payload->getSessionID()); 43 session = sessionManager->getSession(payload->getInitiator(), payload->getSessionID());
44 } else { 44 } else {
45 SWIFT_LOG(debug) << "Lookup session by from attribute." << std::endl; 45 SWIFT_LOG(debug) << "Lookup session by from attribute.";
46 session = sessionManager->getSession(from, payload->getSessionID()); 46 session = sessionManager->getSession(from, payload->getSessionID());
47 } 47 }
48 if (session) { 48 if (session) {
diff --git a/Swiften/Jingle/JingleSessionImpl.cpp b/Swiften/Jingle/JingleSessionImpl.cpp
index 06aa039..b4c5d03 100644
--- a/Swiften/Jingle/JingleSessionImpl.cpp
+++ b/Swiften/Jingle/JingleSessionImpl.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -23,7 +23,7 @@
23namespace Swift { 23namespace Swift {
24 24
25JingleSessionImpl::JingleSessionImpl(const JID& initiator, const JID& peerJID, const std::string& id, IQRouter* router) : JingleSession(initiator, id), iqRouter(router), peerJID(peerJID) { 25JingleSessionImpl::JingleSessionImpl(const JID& initiator, const JID& peerJID, const std::string& id, IQRouter* router) : JingleSession(initiator, id), iqRouter(router), peerJID(peerJID) {
26 SWIFT_LOG(debug) << "initiator: " << initiator << ", peerJID: " << peerJID << std::endl; 26 SWIFT_LOG(debug) << "initiator: " << initiator << ", peerJID: " << peerJID;
27} 27}
28 28
29void JingleSessionImpl::handleIncomingAction(JinglePayload::ref action) { 29void JingleSessionImpl::handleIncomingAction(JinglePayload::ref action) {
@@ -38,7 +38,7 @@ void JingleSessionImpl::handleIncomingAction(JinglePayload::ref action) {
38 38
39 JingleContentPayload::ref content = action->getPayload<JingleContentPayload>(); 39 JingleContentPayload::ref content = action->getPayload<JingleContentPayload>();
40 if (!content) { 40 if (!content) {
41 SWIFT_LOG(debug) << "no content payload!" << std::endl; 41 SWIFT_LOG(debug) << "no content payload!";
42 return; 42 return;
43 } 43 }
44 JingleContentID contentID(content->getName(), content->getCreator()); 44 JingleContentID contentID(content->getName(), content->getCreator());
diff --git a/Swiften/Jingle/JingleSessionManager.cpp b/Swiften/Jingle/JingleSessionManager.cpp
index f7ed58e..083554a 100644
--- a/Swiften/Jingle/JingleSessionManager.cpp
+++ b/Swiften/Jingle/JingleSessionManager.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2016 Isode Limited. 2 * Copyright (c) 2011-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -38,7 +38,7 @@ void JingleSessionManager::removeIncomingSessionHandler(IncomingJingleSessionHan
38 38
39void JingleSessionManager::registerOutgoingSession(const JID& initiator, JingleSessionImpl::ref session) { 39void JingleSessionManager::registerOutgoingSession(const JID& initiator, JingleSessionImpl::ref session) {
40 sessions.insert(std::make_pair(JIDSession(initiator, session->getID()), session)); 40 sessions.insert(std::make_pair(JIDSession(initiator, session->getID()), session));
41 SWIFT_LOG(debug) << "Added session " << session->getID() << " for initiator " << initiator.toString() << std::endl; 41 SWIFT_LOG(debug) << "Added session " << session->getID() << " for initiator " << initiator.toString();
42} 42}
43 43
44void JingleSessionManager::handleIncomingSession(const JID& initiator, const JID& recipient, JingleSessionImpl::ref session, const std::vector<JingleContentPayload::ref>& contents) { 44void JingleSessionManager::handleIncomingSession(const JID& initiator, const JID& recipient, JingleSessionImpl::ref session, const std::vector<JingleContentPayload::ref>& contents) {
diff --git a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp
index 08de722..262add3 100644
--- a/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp
+++ b/Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -15,7 +15,7 @@
15namespace Swift { 15namespace Swift {
16 16
17AvahiResolveHostnameQuery::AvahiResolveHostnameQuery(const std::string& hostname, int, std::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), hostname(hostname) { 17AvahiResolveHostnameQuery::AvahiResolveHostnameQuery(const std::string& hostname, int, std::shared_ptr<AvahiQuerier> querier, EventLoop* eventLoop) : AvahiQuery(querier, eventLoop), hostname(hostname) {
18 SWIFT_LOG(debug) << "Resolving hostname " << hostname << std::endl; 18 SWIFT_LOG(debug) << "Resolving hostname " << hostname;
19} 19}
20 20
21void AvahiResolveHostnameQuery::run() { 21void AvahiResolveHostnameQuery::run() {
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
index 9eb8cd9..cc95d64 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -26,7 +26,7 @@ namespace Swift {
26 recordSize = boost::numeric_cast<unsigned short>(txtRecord.size()); 26 recordSize = boost::numeric_cast<unsigned short>(txtRecord.size());
27 } 27 }
28 catch (const boost::numeric::bad_numeric_cast&) { 28 catch (const boost::numeric::bad_numeric_cast&) {
29 SWIFT_LOG(warning) << "Bonjour TXT record is too long (" << txtRecord.size() << " bytes), not registring service" << std::endl; 29 SWIFT_LOG(warning) << "Bonjour TXT record is too long (" << txtRecord.size() << " bytes), not registring service";
30 return; 30 return;
31 } 31 }
32 DNSServiceErrorType result = DNSServiceRegister( 32 DNSServiceErrorType result = DNSServiceRegister(
@@ -34,7 +34,7 @@ namespace Swift {
34 recordSize, vecptr(txtRecord), 34 recordSize, vecptr(txtRecord),
35 &BonjourRegisterQuery::handleServiceRegisteredStatic, this); 35 &BonjourRegisterQuery::handleServiceRegisteredStatic, this);
36 if (result != kDNSServiceErr_NoError) { 36 if (result != kDNSServiceErr_NoError) {
37 SWIFT_LOG(warning) << "Failed to register Bonjour service" << std::endl; 37 SWIFT_LOG(warning) << "Failed to register Bonjour service";
38 sdRef = nullptr; 38 sdRef = nullptr;
39 } 39 }
40 } 40 }
@@ -58,7 +58,7 @@ namespace Swift {
58 DNSServiceUpdateRecord(sdRef, nullptr, 0, boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord), 0); 58 DNSServiceUpdateRecord(sdRef, nullptr, 0, boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord), 0);
59 } 59 }
60 catch (const boost::numeric::bad_numeric_cast&) { 60 catch (const boost::numeric::bad_numeric_cast&) {
61 SWIFT_LOG(warning) << "Bonjour TXT record is too long (" << txtRecord.size() << " bytes), not updating service record" << std::endl; 61 SWIFT_LOG(warning) << "Bonjour TXT record is too long (" << txtRecord.size() << " bytes), not updating service record";
62 } 62 }
63 } 63 }
64 64
diff --git a/Swiften/LinkLocal/LinkLocalServiceInfo.cpp b/Swiften/LinkLocal/LinkLocalServiceInfo.cpp
index 914fab4..5e529fd 100644
--- a/Swiften/LinkLocal/LinkLocalServiceInfo.cpp
+++ b/Swiften/LinkLocal/LinkLocalServiceInfo.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -49,7 +49,7 @@ boost::optional<ByteArray> LinkLocalServiceInfo::toTXTRecord() const {
49 return result; 49 return result;
50 } 50 }
51 catch (const std::exception& e) { 51 catch (const std::exception& e) {
52 SWIFT_LOG(warning) << "Failed to create TXT record for link local service info: " << e.what() << std::endl; 52 SWIFT_LOG(warning) << "Failed to create TXT record for link local service info: " << e.what();
53 return boost::none; 53 return boost::none;
54 } 54 }
55} 55}
diff --git a/Swiften/Network/BOSHConnection.cpp b/Swiften/Network/BOSHConnection.cpp
index aaec9f2..1312a3e 100644
--- a/Swiften/Network/BOSHConnection.cpp
+++ b/Swiften/Network/BOSHConnection.cpp
@@ -74,27 +74,27 @@ void BOSHConnection::cancelConnector() {
74} 74}
75 75
76void BOSHConnection::handleTLSConnected() { 76void BOSHConnection::handleTLSConnected() {
77 SWIFT_LOG(debug) << std::endl; 77 SWIFT_LOG(debug);
78 onConnectFinished(false); 78 onConnectFinished(false);
79} 79}
80 80
81void BOSHConnection::handleTLSApplicationDataRead(const SafeByteArray& data) { 81void BOSHConnection::handleTLSApplicationDataRead(const SafeByteArray& data) {
82 SWIFT_LOG(debug) << std::endl; 82 SWIFT_LOG(debug);
83 handleDataRead(std::make_shared<SafeByteArray>(data)); 83 handleDataRead(std::make_shared<SafeByteArray>(data));
84} 84}
85 85
86void BOSHConnection::handleTLSNetowrkDataWriteRequest(const SafeByteArray& data) { 86void BOSHConnection::handleTLSNetowrkDataWriteRequest(const SafeByteArray& data) {
87 SWIFT_LOG(debug) << std::endl; 87 SWIFT_LOG(debug);
88 connection_->write(data); 88 connection_->write(data);
89} 89}
90 90
91void BOSHConnection::handleRawDataRead(std::shared_ptr<SafeByteArray> data) { 91void BOSHConnection::handleRawDataRead(std::shared_ptr<SafeByteArray> data) {
92 SWIFT_LOG(debug) << std::endl; 92 SWIFT_LOG(debug);
93 tlsLayer_->handleDataRead(*data.get()); 93 tlsLayer_->handleDataRead(*data.get());
94} 94}
95 95
96void BOSHConnection::handleTLSError(std::shared_ptr<TLSError> error) { 96void BOSHConnection::handleTLSError(std::shared_ptr<TLSError> error) {
97 SWIFT_LOG(debug) << (error ? error->getMessage() : "Unknown TLS error") << std::endl; 97 SWIFT_LOG(debug) << (error ? error->getMessage() : "Unknown TLS error");
98} 98}
99 99
100void BOSHConnection::writeData(const SafeByteArray& data) { 100void BOSHConnection::writeData(const SafeByteArray& data) {
@@ -123,7 +123,7 @@ void BOSHConnection::restartStream() {
123 123
124bool BOSHConnection::setClientCertificate(CertificateWithKey::ref cert) { 124bool BOSHConnection::setClientCertificate(CertificateWithKey::ref cert) {
125 if (tlsLayer_) { 125 if (tlsLayer_) {
126 SWIFT_LOG(debug) << "set client certificate" << std::endl; 126 SWIFT_LOG(debug) << "set client certificate";
127 return tlsLayer_->setClientCertificate(cert); 127 return tlsLayer_->setClientCertificate(cert);
128 } 128 }
129 else { 129 else {
@@ -211,7 +211,7 @@ void BOSHConnection::write(const SafeByteArray& data, bool streamRestart, bool t
211 writeData(safeHeader); 211 writeData(safeHeader);
212 pending_ = true; 212 pending_ = true;
213 213
214 SWIFT_LOG(debug) << "write data: " << safeByteArrayToString(safeHeader) << std::endl; 214 SWIFT_LOG(debug) << "write data: " << safeByteArrayToString(safeHeader);
215} 215}
216 216
217void BOSHConnection::handleConnectFinished(Connection::ref connection) { 217void BOSHConnection::handleConnectFinished(Connection::ref connection) {
@@ -275,7 +275,7 @@ void BOSHConnection::startStream(const std::string& to, unsigned long long rid)
275 SafeByteArray safeHeader = createSafeByteArray(header.str()); 275 SafeByteArray safeHeader = createSafeByteArray(header.str());
276 onBOSHDataWritten(safeHeader); 276 onBOSHDataWritten(safeHeader);
277 writeData(safeHeader); 277 writeData(safeHeader);
278 SWIFT_LOG(debug) << "write stream header: " << safeByteArrayToString(safeHeader) << std::endl; 278 SWIFT_LOG(debug) << "write stream header: " << safeByteArrayToString(safeHeader);
279} 279}
280 280
281void BOSHConnection::handleDataRead(std::shared_ptr<SafeByteArray> data) { 281void BOSHConnection::handleDataRead(std::shared_ptr<SafeByteArray> data) {
diff --git a/Swiften/Network/BOSHConnectionPool.cpp b/Swiften/Network/BOSHConnectionPool.cpp
index 8a75e81..3a79a16 100644
--- a/Swiften/Network/BOSHConnectionPool.cpp
+++ b/Swiften/Network/BOSHConnectionPool.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2016 Isode Limited. 2 * Copyright (c) 2011-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -266,7 +266,7 @@ std::shared_ptr<BOSHConnection> BOSHConnectionPool::createConnection() {
266 266
267 if (boshURL.getScheme() == "https") { 267 if (boshURL.getScheme() == "https") {
268 bool success = connection->setClientCertificate(clientCertificate); 268 bool success = connection->setClientCertificate(clientCertificate);
269 SWIFT_LOG(debug) << "setClientCertificate, success: " << success << std::endl; 269 SWIFT_LOG(debug) << "setClientCertificate, success: " << success;
270 } 270 }
271 271
272 connection->connect(); 272 connection->connect();
diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp
index 551363d..6ae6bf6 100644
--- a/Swiften/Network/BoostConnection.cpp
+++ b/Swiften/Network/BoostConnection.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -107,7 +107,7 @@ void BoostConnection::doWrite(const SafeByteArray& data) {
107} 107}
108 108
109void BoostConnection::handleConnectFinished(const boost::system::error_code& error) { 109void BoostConnection::handleConnectFinished(const boost::system::error_code& error) {
110 SWIFT_LOG(debug) << "Connect finished: " << error << std::endl; 110 SWIFT_LOG(debug) << "Connect finished: " << error;
111 if (!error) { 111 if (!error) {
112 eventLoop->postEvent(boost::bind(boost::ref(onConnectFinished), false), shared_from_this()); 112 eventLoop->postEvent(boost::bind(boost::ref(onConnectFinished), false), shared_from_this());
113 doRead(); 113 doRead();
@@ -126,7 +126,7 @@ void BoostConnection::doRead() {
126} 126}
127 127
128void BoostConnection::handleSocketRead(const boost::system::error_code& error, size_t bytesTransferred) { 128void BoostConnection::handleSocketRead(const boost::system::error_code& error, size_t bytesTransferred) {
129 SWIFT_LOG(debug) << "Socket read " << error << std::endl; 129 SWIFT_LOG(debug) << "Socket read " << error;
130 if (!error) { 130 if (!error) {
131 readBuffer_->resize(bytesTransferred); 131 readBuffer_->resize(bytesTransferred);
132 eventLoop->postEvent(boost::bind(boost::ref(onDataRead), readBuffer_), shared_from_this()); 132 eventLoop->postEvent(boost::bind(boost::ref(onDataRead), readBuffer_), shared_from_this());
@@ -141,7 +141,7 @@ void BoostConnection::handleSocketRead(const boost::system::error_code& error, s
141} 141}
142 142
143void BoostConnection::handleDataWritten(const boost::system::error_code& error) { 143void BoostConnection::handleDataWritten(const boost::system::error_code& error) {
144 SWIFT_LOG(debug) << "Data written " << error << std::endl; 144 SWIFT_LOG(debug) << "Data written " << error;
145 if (!error) { 145 if (!error) {
146 eventLoop->postEvent(boost::ref(onDataWritten), shared_from_this()); 146 eventLoop->postEvent(boost::ref(onDataWritten), shared_from_this());
147 } 147 }
diff --git a/Swiften/Network/BoostConnectionServer.cpp b/Swiften/Network/BoostConnectionServer.cpp
index 8db9656..dc05172 100644
--- a/Swiften/Network/BoostConnectionServer.cpp
+++ b/Swiften/Network/BoostConnectionServer.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -46,7 +46,7 @@ boost::optional<BoostConnectionServer::Error> BoostConnectionServer::tryStart()
46 if (endpoint.protocol() == boost::asio::ip::tcp::v6()) { 46 if (endpoint.protocol() == boost::asio::ip::tcp::v6()) {
47 boost::system::error_code ec; 47 boost::system::error_code ec;
48 acceptor_->set_option(boost::asio::ip::v6_only(false), ec); 48 acceptor_->set_option(boost::asio::ip::v6_only(false), ec);
49 SWIFT_LOG_ASSERT(ec, warning) << "IPv4/IPv6 dual-stack support is not supported on this platform." << std::endl; 49 SWIFT_LOG_ASSERT(ec, warning) << "IPv4/IPv6 dual-stack support is not supported on this platform.";
50 } 50 }
51 acceptNextConnection(); 51 acceptNextConnection();
52 } 52 }
diff --git a/Swiften/Network/ChainedConnector.cpp b/Swiften/Network/ChainedConnector.cpp
index 94899ad..a9210ba 100644
--- a/Swiften/Network/ChainedConnector.cpp
+++ b/Swiften/Network/ChainedConnector.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2018 Isode Limited. 2 * Copyright (c) 2011-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -45,7 +45,7 @@ void ChainedConnector::setTimeoutMilliseconds(int milliseconds) {
45} 45}
46 46
47void ChainedConnector::start() { 47void ChainedConnector::start() {
48 SWIFT_LOG(debug) << "Starting queued connector for " << hostname << std::endl; 48 SWIFT_LOG(debug) << "Starting queued connector for " << hostname;
49 49
50 connectionFactoryQueue = std::deque<ConnectionFactory*>(connectionFactories.begin(), connectionFactories.end()); 50 connectionFactoryQueue = std::deque<ConnectionFactory*>(connectionFactories.begin(), connectionFactories.end());
51 tryNextConnectionFactory(); 51 tryNextConnectionFactory();
@@ -63,12 +63,12 @@ void ChainedConnector::stop() {
63void ChainedConnector::tryNextConnectionFactory() { 63void ChainedConnector::tryNextConnectionFactory() {
64 assert(!currentConnector); 64 assert(!currentConnector);
65 if (connectionFactoryQueue.empty()) { 65 if (connectionFactoryQueue.empty()) {
66 SWIFT_LOG(debug) << "No more connection factories" << std::endl; 66 SWIFT_LOG(debug) << "No more connection factories";
67 finish(std::shared_ptr<Connection>(), lastError); 67 finish(std::shared_ptr<Connection>(), lastError);
68 } 68 }
69 else { 69 else {
70 ConnectionFactory* connectionFactory = connectionFactoryQueue.front(); 70 ConnectionFactory* connectionFactory = connectionFactoryQueue.front();
71 SWIFT_LOG(debug) << "Trying next connection factory: " << typeid(*connectionFactory).name() << std::endl; 71 SWIFT_LOG(debug) << "Trying next connection factory: " << typeid(*connectionFactory).name();
72 connectionFactoryQueue.pop_front(); 72 connectionFactoryQueue.pop_front();
73 currentConnector = Connector::create(hostname, port, serviceLookupPrefix, resolver, connectionFactory, timerFactory); 73 currentConnector = Connector::create(hostname, port, serviceLookupPrefix, resolver, connectionFactory, timerFactory);
74 currentConnector->setTimeoutMilliseconds(timeoutMilliseconds); 74 currentConnector->setTimeoutMilliseconds(timeoutMilliseconds);
@@ -78,7 +78,7 @@ void ChainedConnector::tryNextConnectionFactory() {
78} 78}
79 79
80void ChainedConnector::handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> error) { 80void ChainedConnector::handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> error) {
81 SWIFT_LOG(debug) << "Connector finished" << std::endl; 81 SWIFT_LOG(debug) << "Connector finished";
82 currentConnector->onConnectFinished.disconnect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1, _2)); 82 currentConnector->onConnectFinished.disconnect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1, _2));
83 lastError = error; 83 lastError = error;
84 currentConnector.reset(); 84 currentConnector.reset();
diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp
index a0e6b23..e27b95d 100644
--- a/Swiften/Network/Connector.cpp
+++ b/Swiften/Network/Connector.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -25,7 +25,7 @@ void Connector::setTimeoutMilliseconds(int milliseconds) {
25} 25}
26 26
27void Connector::start() { 27void Connector::start() {
28 SWIFT_LOG(debug) << "Starting connector for " << hostname << std::endl; 28 SWIFT_LOG(debug) << "Starting connector for " << hostname;
29 assert(!currentConnection); 29 assert(!currentConnection);
30 assert(!serviceQuery); 30 assert(!serviceQuery);
31 assert(!timer); 31 assert(!timer);
@@ -66,7 +66,7 @@ void Connector::queryAddress(const std::string& hostname) {
66} 66}
67 67
68void Connector::handleServiceQueryResult(const std::vector<DomainNameServiceQuery::Result>& result) { 68void Connector::handleServiceQueryResult(const std::vector<DomainNameServiceQuery::Result>& result) {
69 SWIFT_LOG(debug) << result.size() << " SRV result(s)" << std::endl; 69 SWIFT_LOG(debug) << result.size() << " SRV result(s)";
70 serviceQueryResults = std::deque<DomainNameServiceQuery::Result>(result.begin(), result.end()); 70 serviceQueryResults = std::deque<DomainNameServiceQuery::Result>(result.begin(), result.end());
71 serviceQuery.reset(); 71 serviceQuery.reset();
72 if (!serviceQueryResults.empty()) { 72 if (!serviceQueryResults.empty()) {
@@ -77,23 +77,23 @@ void Connector::handleServiceQueryResult(const std::vector<DomainNameServiceQuer
77 77
78void Connector::tryNextServiceOrFallback() { 78void Connector::tryNextServiceOrFallback() {
79 if (queriedAllServices) { 79 if (queriedAllServices) {
80 SWIFT_LOG(debug) << "Queried all services" << std::endl; 80 SWIFT_LOG(debug) << "Queried all services";
81 finish(std::shared_ptr<Connection>()); 81 finish(std::shared_ptr<Connection>());
82 } 82 }
83 else if (serviceQueryResults.empty()) { 83 else if (serviceQueryResults.empty()) {
84 SWIFT_LOG(debug) << "Falling back on A resolution" << std::endl; 84 SWIFT_LOG(debug) << "Falling back on A resolution";
85 // Fall back on simple address resolving 85 // Fall back on simple address resolving
86 queriedAllServices = true; 86 queriedAllServices = true;
87 queryAddress(hostname); 87 queryAddress(hostname);
88 } 88 }
89 else { 89 else {
90 SWIFT_LOG(debug) << "Querying next address" << std::endl; 90 SWIFT_LOG(debug) << "Querying next address";
91 queryAddress(serviceQueryResults.front().hostname); 91 queryAddress(serviceQueryResults.front().hostname);
92 } 92 }
93} 93}
94 94
95void Connector::handleAddressQueryResult(const std::vector<HostAddress>& addresses, boost::optional<DomainNameResolveError> error) { 95void Connector::handleAddressQueryResult(const std::vector<HostAddress>& addresses, boost::optional<DomainNameResolveError> error) {
96 SWIFT_LOG(debug) << addresses.size() << " addresses" << std::endl; 96 SWIFT_LOG(debug) << addresses.size() << " addresses";
97 addressQuery.reset(); 97 addressQuery.reset();
98 if (error || addresses.empty()) { 98 if (error || addresses.empty()) {
99 if (!serviceQueryResults.empty()) { 99 if (!serviceQueryResults.empty()) {
@@ -110,7 +110,7 @@ void Connector::handleAddressQueryResult(const std::vector<HostAddress>& address
110 110
111void Connector::tryNextAddress() { 111void Connector::tryNextAddress() {
112 if (addressQueryResults.empty()) { 112 if (addressQueryResults.empty()) {
113 SWIFT_LOG(debug) << "Done trying addresses. Moving on." << std::endl; 113 SWIFT_LOG(debug) << "Done trying addresses. Moving on.";
114 // Done trying all addresses. Move on to the next host. 114 // Done trying all addresses. Move on to the next host.
115 if (!serviceQueryResults.empty()) { 115 if (!serviceQueryResults.empty()) {
116 serviceQueryResults.pop_front(); 116 serviceQueryResults.pop_front();
@@ -118,7 +118,7 @@ void Connector::tryNextAddress() {
118 tryNextServiceOrFallback(); 118 tryNextServiceOrFallback();
119 } 119 }
120 else { 120 else {
121 SWIFT_LOG(debug) << "Trying next address" << std::endl; 121 SWIFT_LOG(debug) << "Trying next address";
122 HostAddress address = addressQueryResults.front(); 122 HostAddress address = addressQueryResults.front();
123 addressQueryResults.pop_front(); 123 addressQueryResults.pop_front();
124 124
@@ -133,7 +133,7 @@ void Connector::tryNextAddress() {
133 133
134void Connector::tryConnect(const HostAddressPort& target) { 134void Connector::tryConnect(const HostAddressPort& target) {
135 assert(!currentConnection); 135 assert(!currentConnection);
136 SWIFT_LOG(debug) << "Trying to connect to " << target.getAddress().toString() << ":" << target.getPort() << std::endl; 136 SWIFT_LOG(debug) << "Trying to connect to " << target.getAddress().toString() << ":" << target.getPort();
137 currentConnection = connectionFactory->createConnection(); 137 currentConnection = connectionFactory->createConnection();
138 currentConnection->onConnectFinished.connect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1)); 138 currentConnection->onConnectFinished.connect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1));
139 currentConnection->connect(target); 139 currentConnection->connect(target);
@@ -143,7 +143,7 @@ void Connector::tryConnect(const HostAddressPort& target) {
143} 143}
144 144
145void Connector::handleConnectionConnectFinished(bool error) { 145void Connector::handleConnectionConnectFinished(bool error) {
146 SWIFT_LOG(debug) << "ConnectFinished: " << (error ? "error" : "success") << std::endl; 146 SWIFT_LOG(debug) << "ConnectFinished: " << (error ? "error" : "success");
147 if (timer) { 147 if (timer) {
148 timer->stop(); 148 timer->stop();
149 timer.reset(); 149 timer.reset();
@@ -195,8 +195,8 @@ void Connector::finish(std::shared_ptr<Connection> connection) {
195} 195}
196 196
197void Connector::handleTimeout() { 197void Connector::handleTimeout() {
198 SWIFT_LOG(debug) << "Timeout" << std::endl; 198 SWIFT_LOG(debug) << "Timeout";
199 SWIFT_LOG_ASSERT(currentConnection, error) << "Connection not valid but triggered a timeout" <<std::endl; 199 SWIFT_LOG_ASSERT(currentConnection, error) << "Connection not valid but triggered a timeout";
200 handleConnectionConnectFinished(true); 200 handleConnectionConnectFinished(true);
201} 201}
202 202
diff --git a/Swiften/Network/EnvironmentProxyProvider.cpp b/Swiften/Network/EnvironmentProxyProvider.cpp
index 65cf4ff..6fbf373 100644
--- a/Swiften/Network/EnvironmentProxyProvider.cpp
+++ b/Swiften/Network/EnvironmentProxyProvider.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2016 Isode Limited. 8 * Copyright (c) 2016-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -26,7 +26,7 @@ namespace Swift {
26EnvironmentProxyProvider::EnvironmentProxyProvider() { 26EnvironmentProxyProvider::EnvironmentProxyProvider() {
27 socksProxy = getFromEnv("all_proxy", "socks"); 27 socksProxy = getFromEnv("all_proxy", "socks");
28 httpProxy = getFromEnv("http_proxy", "http"); 28 httpProxy = getFromEnv("http_proxy", "http");
29 SWIFT_LOG(debug) << "Environment: SOCKS5 => " << socksProxy.toString() << "; HTTP Connect => " << httpProxy.toString() << std::endl; 29 SWIFT_LOG(debug) << "Environment: SOCKS5 => " << socksProxy.toString() << "; HTTP Connect => " << httpProxy.toString();
30} 30}
31 31
32HostAddressPort EnvironmentProxyProvider::getHTTPConnectProxy() const { 32HostAddressPort EnvironmentProxyProvider::getHTTPConnectProxy() const {
diff --git a/Swiften/Network/GConfProxyProvider.cpp b/Swiften/Network/GConfProxyProvider.cpp
index 7c31868..a2f8adc 100644
--- a/Swiften/Network/GConfProxyProvider.cpp
+++ b/Swiften/Network/GConfProxyProvider.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2016-2018 Isode Limited. 8 * Copyright (c) 2016-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -39,7 +39,7 @@ GConfProxyProvider::GConfProxyProvider() {
39 39
40 socksProxy = getFromGConf("/system/proxy/socks_host", "/system/proxy/socks_port"); 40 socksProxy = getFromGConf("/system/proxy/socks_host", "/system/proxy/socks_port");
41 httpProxy = getFromGConf("/system/http_proxy/host", "/system/http_proxy/port"); 41 httpProxy = getFromGConf("/system/http_proxy/host", "/system/http_proxy/port");
42 SWIFT_LOG(debug) << "GConf: SOCKS5 => " << socksProxy.toString() << "; HTTP Connect => " << httpProxy.toString() << std::endl; 42 SWIFT_LOG(debug) << "GConf: SOCKS5 => " << socksProxy.toString() << "; HTTP Connect => " << httpProxy.toString();
43} 43}
44 44
45HostAddressPort GConfProxyProvider::getHTTPConnectProxy() const { 45HostAddressPort GConfProxyProvider::getHTTPConnectProxy() const {
diff --git a/Swiften/Network/HTTPConnectProxiedConnection.cpp b/Swiften/Network/HTTPConnectProxiedConnection.cpp
index 8eba49e..e63b8e2 100644
--- a/Swiften/Network/HTTPConnectProxiedConnection.cpp
+++ b/Swiften/Network/HTTPConnectProxiedConnection.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2011-2018 Isode Limited. 8 * Copyright (c) 2011-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -77,7 +77,7 @@ void HTTPConnectProxiedConnection::initializeProxy() {
77 nextHTTPRequestHeaders_.clear(); 77 nextHTTPRequestHeaders_.clear();
78 } 78 }
79 append(data, createSafeByteArray("\r\n")); 79 append(data, createSafeByteArray("\r\n"));
80 SWIFT_LOG(debug) << "HTTP Proxy send headers: " << byteArrayToString(ByteArray(data.begin(), data.end())) << std::endl; 80 SWIFT_LOG(debug) << "HTTP Proxy send headers: " << byteArrayToString(ByteArray(data.begin(), data.end()));
81 write(data); 81 write(data);
82} 82}
83 83
@@ -111,7 +111,7 @@ void HTTPConnectProxiedConnection::sendHTTPRequest(const std::string& statusLine
111 111
112void HTTPConnectProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) { 112void HTTPConnectProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) {
113 std::string dataString = byteArrayToString(ByteArray(data->begin(), data->end())); 113 std::string dataString = byteArrayToString(ByteArray(data->begin(), data->end()));
114 SWIFT_LOG(debug) << data << std::endl; 114 SWIFT_LOG(debug) << data;
115 httpResponseBuffer_.append(dataString); 115 httpResponseBuffer_.append(dataString);
116 116
117 std::string statusLine; 117 std::string statusLine;
@@ -141,17 +141,17 @@ void HTTPConnectProxiedConnection::handleProxyInitializeData(std::shared_ptr<Saf
141 if (tmp.size() > 1) { 141 if (tmp.size() > 1) {
142 try { 142 try {
143 int status = boost::lexical_cast<int>(tmp[1]); 143 int status = boost::lexical_cast<int>(tmp[1]);
144 SWIFT_LOG(debug) << "Proxy Status: " << status << std::endl; 144 SWIFT_LOG(debug) << "Proxy Status: " << status;
145 if (status / 100 == 2) { // all 2XX states are OK 145 if (status / 100 == 2) { // all 2XX states are OK
146 setProxyInitializeFinished(true); 146 setProxyInitializeFinished(true);
147 } 147 }
148 else { 148 else {
149 SWIFT_LOG(debug) << "HTTP Proxy returned an error: " << httpResponseBuffer_ << std::endl; 149 SWIFT_LOG(debug) << "HTTP Proxy returned an error: " << httpResponseBuffer_;
150 setProxyInitializeFinished(false); 150 setProxyInitializeFinished(false);
151 } 151 }
152 } 152 }
153 catch (boost::bad_lexical_cast&) { 153 catch (boost::bad_lexical_cast&) {
154 SWIFT_LOG(warning) << "Unexpected response: " << tmp[1] << std::endl; 154 SWIFT_LOG(warning) << "Unexpected response: " << tmp[1];
155 setProxyInitializeFinished(false); 155 setProxyInitializeFinished(false);
156 } 156 }
157 } 157 }
diff --git a/Swiften/Network/HostAddress.cpp b/Swiften/Network/HostAddress.cpp
index 6eca80b..e82f433 100644
--- a/Swiften/Network/HostAddress.cpp
+++ b/Swiften/Network/HostAddress.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -43,7 +43,7 @@ std::string HostAddress::toString() const {
43 43
44 addressString = address_.to_string(errorCode); 44 addressString = address_.to_string(errorCode);
45 if (errorCode) { 45 if (errorCode) {
46 SWIFT_LOG(debug) << "error: " << errorCode.message() << std::endl; 46 SWIFT_LOG(debug) << "error: " << errorCode.message();
47 } 47 }
48 48
49 return addressString; 49 return addressString;
diff --git a/Swiften/Network/NATPMPInterface.cpp b/Swiften/Network/NATPMPInterface.cpp
index 0c33c1f..e20fecd 100644
--- a/Swiften/Network/NATPMPInterface.cpp
+++ b/Swiften/Network/NATPMPInterface.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2014-2018 Isode Limited. 8 * Copyright (c) 2014-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -42,7 +42,7 @@ bool NATPMPInterface::isAvailable() {
42 42
43boost::optional<HostAddress> NATPMPInterface::getPublicIP() { 43boost::optional<HostAddress> NATPMPInterface::getPublicIP() {
44 if (sendpublicaddressrequest(&p->natpmp) < 0) { 44 if (sendpublicaddressrequest(&p->natpmp) < 0) {
45 SWIFT_LOG(debug) << "Failed to send NAT-PMP public address request!" << std::endl; 45 SWIFT_LOG(debug) << "Failed to send NAT-PMP public address request!";
46 return boost::optional<HostAddress>(); 46 return boost::optional<HostAddress>();
47 } 47 }
48 48
@@ -67,7 +67,7 @@ boost::optional<HostAddress> NATPMPInterface::getPublicIP() {
67 return boost::optional<HostAddress>(HostAddress(reinterpret_cast<const unsigned char*>(&(response.pnu.publicaddress.addr)), 4)); 67 return boost::optional<HostAddress>(HostAddress(reinterpret_cast<const unsigned char*>(&(response.pnu.publicaddress.addr)), 4));
68 } 68 }
69 else { 69 else {
70 SWIFT_LOG(debug) << "Inavlid NAT-PMP response." << std::endl; 70 SWIFT_LOG(debug) << "Inavlid NAT-PMP response.";
71 return boost::optional<HostAddress>(); 71 return boost::optional<HostAddress>();
72 } 72 }
73} 73}
@@ -80,7 +80,7 @@ boost::optional<NATPortMapping> NATPMPInterface::addPortForward(unsigned short l
80 mapping.getLocalPort(), 80 mapping.getLocalPort(),
81 mapping.getPublicPort(), 81 mapping.getPublicPort(),
82 mapping.getLeaseInSeconds()) < 0) { 82 mapping.getLeaseInSeconds()) < 0) {
83 SWIFT_LOG(debug) << "Failed to send NAT-PMP port forwarding request!" << std::endl; 83 SWIFT_LOG(debug) << "Failed to send NAT-PMP port forwarding request!";
84 return boost::optional<NATPortMapping>(); 84 return boost::optional<NATPortMapping>();
85 } 85 }
86 86
@@ -106,14 +106,14 @@ boost::optional<NATPortMapping> NATPMPInterface::addPortForward(unsigned short l
106 return result; 106 return result;
107 } 107 }
108 else { 108 else {
109 SWIFT_LOG(debug) << "Invalid NAT-PMP response." << std::endl; 109 SWIFT_LOG(debug) << "Invalid NAT-PMP response.";
110 return boost::optional<NATPortMapping>(); 110 return boost::optional<NATPortMapping>();
111 } 111 }
112} 112}
113 113
114bool NATPMPInterface::removePortForward(const NATPortMapping& mapping) { 114bool NATPMPInterface::removePortForward(const NATPortMapping& mapping) {
115 if (sendnewportmappingrequest(&p->natpmp, mapping.getProtocol() == NATPortMapping::TCP ? NATPMP_PROTOCOL_TCP : NATPMP_PROTOCOL_UDP, mapping.getLocalPort(), 0, 0) < 0) { 115 if (sendnewportmappingrequest(&p->natpmp, mapping.getProtocol() == NATPortMapping::TCP ? NATPMP_PROTOCOL_TCP : NATPMP_PROTOCOL_UDP, mapping.getLocalPort(), 0, 0) < 0) {
116 SWIFT_LOG(debug) << "Failed to send NAT-PMP remove forwarding request!" << std::endl; 116 SWIFT_LOG(debug) << "Failed to send NAT-PMP remove forwarding request!";
117 return false; 117 return false;
118 } 118 }
119 119
@@ -133,7 +133,7 @@ bool NATPMPInterface::removePortForward(const NATPortMapping& mapping) {
133 return true; 133 return true;
134 } 134 }
135 else { 135 else {
136 SWIFT_LOG(debug) << "Invalid NAT-PMP response." << std::endl; 136 SWIFT_LOG(debug) << "Invalid NAT-PMP response.";
137 return false; 137 return false;
138 } 138 }
139} 139}
diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.cpp b/Swiften/Network/PlatformDomainNameServiceQuery.cpp
index f884500..2ff14e1 100644
--- a/Swiften/Network/PlatformDomainNameServiceQuery.cpp
+++ b/Swiften/Network/PlatformDomainNameServiceQuery.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -58,7 +58,7 @@ void PlatformDomainNameServiceQuery::runBlocking() {
58 return; 58 return;
59 } 59 }
60 60
61 SWIFT_LOG(debug) << "Querying " << service << std::endl; 61 SWIFT_LOG(debug) << "Querying " << service;
62 62
63 std::vector<DomainNameServiceQuery::Result> records; 63 std::vector<DomainNameServiceQuery::Result> records;
64 64
@@ -97,7 +97,7 @@ void PlatformDomainNameServiceQuery::runBlocking() {
97 response.resize(NS_PACKETSZ); 97 response.resize(NS_PACKETSZ);
98 int responseLength = res_query(const_cast<char*>(service.c_str()), ns_c_in, ns_t_srv, reinterpret_cast<u_char*>(vecptr(response)), response.size()); 98 int responseLength = res_query(const_cast<char*>(service.c_str()), ns_c_in, ns_t_srv, reinterpret_cast<u_char*>(vecptr(response)), response.size());
99 if (responseLength == -1) { 99 if (responseLength == -1) {
100 SWIFT_LOG(debug) << "Error" << std::endl; 100 SWIFT_LOG(debug) << "Error";
101 emitError(); 101 emitError();
102 return; 102 return;
103 } 103 }
diff --git a/Swiften/Network/PlatformNATTraversalWorker.cpp b/Swiften/Network/PlatformNATTraversalWorker.cpp
index 041ad2d..5431379 100644
--- a/Swiften/Network/PlatformNATTraversalWorker.cpp
+++ b/Swiften/Network/PlatformNATTraversalWorker.cpp
@@ -157,7 +157,7 @@ NATTraversalInterface* PlatformNATTraversalWorker::getNATTraversalInterface() co
157 miniUPnPInterface = new MiniUPnPInterface(); 157 miniUPnPInterface = new MiniUPnPInterface();
158 miniUPnPSupported = miniUPnPInterface->isAvailable(); 158 miniUPnPSupported = miniUPnPInterface->isAvailable();
159 } 159 }
160 SWIFT_LOG(debug) << "UPnP NAT traversal supported: " << static_cast<bool>(miniUPnPSupported) << std::endl; 160 SWIFT_LOG(debug) << "UPnP NAT traversal supported: " << static_cast<bool>(miniUPnPSupported);
161 if (miniUPnPSupported) { 161 if (miniUPnPSupported) {
162 return miniUPnPInterface; 162 return miniUPnPInterface;
163 } 163 }
@@ -168,7 +168,7 @@ NATTraversalInterface* PlatformNATTraversalWorker::getNATTraversalInterface() co
168 natPMPInterface = new NATPMPInterface(); 168 natPMPInterface = new NATPMPInterface();
169 natPMPSupported = natPMPInterface->isAvailable(); 169 natPMPSupported = natPMPInterface->isAvailable();
170 } 170 }
171 SWIFT_LOG(debug) << "NAT-PMP NAT traversal supported: " << static_cast<bool>(natPMPSupported) << std::endl; 171 SWIFT_LOG(debug) << "NAT-PMP NAT traversal supported: " << static_cast<bool>(natPMPSupported);
172 if (natPMPSupported) { 172 if (natPMPSupported) {
173 return natPMPInterface; 173 return natPMPInterface;
174 } 174 }
diff --git a/Swiften/Network/ProxiedConnection.cpp b/Swiften/Network/ProxiedConnection.cpp
index 4c97e31..0c5cda6 100644
--- a/Swiften/Network/ProxiedConnection.cpp
+++ b/Swiften/Network/ProxiedConnection.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012-2018 Isode Limited. 2 * Copyright (c) 2012-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -37,7 +37,7 @@ ProxiedConnection::~ProxiedConnection() {
37 connection_->onDisconnected.disconnect(boost::bind(&ProxiedConnection::handleDisconnected, shared_from_this(), _1)); 37 connection_->onDisconnected.disconnect(boost::bind(&ProxiedConnection::handleDisconnected, shared_from_this(), _1));
38 } 38 }
39 if (connected_) { 39 if (connected_) {
40 SWIFT_LOG(warning) << "Connection was still established." << std::endl; 40 SWIFT_LOG(warning) << "Connection was still established.";
41 } 41 }
42} 42}
43 43
diff --git a/Swiften/Network/SOCKS5ProxiedConnection.cpp b/Swiften/Network/SOCKS5ProxiedConnection.cpp
index d7036f2..c76b6e6 100644
--- a/Swiften/Network/SOCKS5ProxiedConnection.cpp
+++ b/Swiften/Network/SOCKS5ProxiedConnection.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2014-2018 Isode Limited. 8 * Copyright (c) 2014-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -50,7 +50,7 @@ void SOCKS5ProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByte
50 assert(rawAddress.is_v4() || rawAddress.is_v6()); 50 assert(rawAddress.is_v4() || rawAddress.is_v6());
51 51
52 if (proxyState_ == ProxyAuthenticating) { 52 if (proxyState_ == ProxyAuthenticating) {
53 SWIFT_LOG(debug) << "ProxyAuthenticating response received, reply with the connect BYTEs" << std::endl; 53 SWIFT_LOG(debug) << "ProxyAuthenticating response received, reply with the connect BYTEs";
54 unsigned char choosenMethod = static_cast<unsigned char> ((*data)[1]); 54 unsigned char choosenMethod = static_cast<unsigned char> ((*data)[1]);
55 if ((*data)[0] == 0x05 && choosenMethod != 0xFF) { 55 if ((*data)[0] == 0x05 && choosenMethod != 0xFF) {
56 switch(choosenMethod) { // use the correct Method 56 switch(choosenMethod) { // use the correct Method
@@ -79,7 +79,7 @@ void SOCKS5ProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByte
79 return; 79 return;
80 } 80 }
81 catch(...) { 81 catch(...) {
82 SWIFT_LOG(error) << "exception caught" << std::endl; 82 SWIFT_LOG(error) << "exception caught";
83 } 83 }
84 write(socksConnect); 84 write(socksConnect);
85 break; 85 break;
@@ -92,8 +92,8 @@ void SOCKS5ProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByte
92 setProxyInitializeFinished(false); 92 setProxyInitializeFinished(false);
93 } 93 }
94 else if (proxyState_ == ProxyConnecting) { 94 else if (proxyState_ == ProxyConnecting) {
95 SWIFT_LOG(debug) << "Connect response received, check if successfully." << std::endl; 95 SWIFT_LOG(debug) << "Connect response received, check if successfully.";
96 SWIFT_LOG(debug) << "Errorbyte: 0x" << std::hex << static_cast<int> ((*data)[1]) << std::dec << std::endl; 96 SWIFT_LOG(debug) << "Errorbyte: 0x" << std::hex << static_cast<int> ((*data)[1]) << std::dec;
97 /* 97 /*
98 98
99 data.at(1) can be one of the following: 99 data.at(1) can be one of the following:
@@ -109,11 +109,11 @@ void SOCKS5ProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByte
109 0x09 bis 0xFF unassigned 109 0x09 bis 0xFF unassigned
110 */ 110 */
111 if ((*data)[0] == 0x05 && (*data)[1] == 0x0) { 111 if ((*data)[0] == 0x05 && (*data)[1] == 0x0) {
112 SWIFT_LOG(debug) << "Successfully connected the server via the proxy." << std::endl; 112 SWIFT_LOG(debug) << "Successfully connected the server via the proxy.";
113 setProxyInitializeFinished(true); 113 setProxyInitializeFinished(true);
114 } 114 }
115 else { 115 else {
116 SWIFT_LOG(error) << "SOCKS Proxy returned an error: " << std::hex << (*data)[1] << std::endl; 116 SWIFT_LOG(error) << "SOCKS Proxy returned an error: " << std::hex << (*data)[1];
117 setProxyInitializeFinished(false); 117 setProxyInitializeFinished(false);
118 } 118 }
119 } 119 }
diff --git a/Swiften/Network/UnboundDomainNameResolver.cpp b/Swiften/Network/UnboundDomainNameResolver.cpp
index 1df6b8f..21bc697 100644
--- a/Swiften/Network/UnboundDomainNameResolver.cpp
+++ b/Swiften/Network/UnboundDomainNameResolver.cpp
@@ -64,7 +64,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo
64 1 /* CLASS IN (internet) */, 64 1 /* CLASS IN (internet) */,
65 helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL); 65 helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL);
66 if(retval != 0) { 66 if(retval != 0) {
67 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval) << std::endl; 67 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval);
68 delete helper; 68 delete helper;
69 } 69 }
70 } 70 }
@@ -73,7 +73,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo
73 std::vector<DomainNameServiceQuery::Result> serviceRecords; 73 std::vector<DomainNameServiceQuery::Result> serviceRecords;
74 74
75 if(err != 0) { 75 if(err != 0) {
76 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err) << std::endl; 76 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err);
77 } else { 77 } else {
78 if(result->havedata) { 78 if(result->havedata) {
79 ldns_pkt* replyPacket = 0; 79 ldns_pkt* replyPacket = 0;
@@ -105,7 +105,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo
105 105
106 serviceRecord.hostname = std::string(reinterpret_cast<char*>(ldns_buffer_at(buffer, 0))); 106 serviceRecord.hostname = std::string(reinterpret_cast<char*>(ldns_buffer_at(buffer, 0)));
107 serviceRecords.push_back(serviceRecord); 107 serviceRecords.push_back(serviceRecord);
108 SWIFT_LOG(debug) << "hostname " << serviceRecord.hostname << " added" << std::endl; 108 SWIFT_LOG(debug) << "hostname " << serviceRecord.hostname << " added";
109 } 109 }
110 } 110 }
111 if (replyPacket) ldns_pkt_free(replyPacket); 111 if (replyPacket) ldns_pkt_free(replyPacket);
@@ -137,7 +137,7 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
137 1 /* CLASS IN (internet) */, 137 1 /* CLASS IN (internet) */,
138 helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL); 138 helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL);
139 if(retval != 0) { 139 if(retval != 0) {
140 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval) << std::endl; 140 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval);
141 delete helper; 141 delete helper;
142 } 142 }
143 } 143 }
@@ -145,10 +145,10 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
145 void handleResult(int err, struct ub_result* result) { 145 void handleResult(int err, struct ub_result* result) {
146 std::vector<HostAddress> addresses; 146 std::vector<HostAddress> addresses;
147 boost::optional<DomainNameResolveError> error; 147 boost::optional<DomainNameResolveError> error;
148 SWIFT_LOG(debug) << "Result for: " << name << std::endl; 148 SWIFT_LOG(debug) << "Result for: " << name;
149 149
150 if(err != 0) { 150 if(err != 0) {
151 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err) << std::endl; 151 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err);
152 error = DomainNameResolveError(); 152 error = DomainNameResolveError();
153 } else { 153 } else {
154 if(result->havedata) { 154 if(result->havedata) {
@@ -156,13 +156,13 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
156 char address[100]; 156 char address[100];
157 const char* addressStr = 0; 157 const char* addressStr = 0;
158 if ((addressStr = inet_ntop(AF_INET, result->data[i], address, 100))) { 158 if ((addressStr = inet_ntop(AF_INET, result->data[i], address, 100))) {
159 SWIFT_LOG(debug) << "IPv4 address: " << addressStr << std::endl; 159 SWIFT_LOG(debug) << "IPv4 address: " << addressStr;
160 addresses.push_back(HostAddress(std::string(addressStr))); 160 addresses.push_back(HostAddress(std::string(addressStr)));
161 } else if ((addressStr = inet_ntop(AF_INET6, result->data[i], address, 100))) { 161 } else if ((addressStr = inet_ntop(AF_INET6, result->data[i], address, 100))) {
162 SWIFT_LOG(debug) << "IPv6 address: " << addressStr << std::endl; 162 SWIFT_LOG(debug) << "IPv6 address: " << addressStr;
163 addresses.push_back(HostAddress(std::string(addressStr))); 163 addresses.push_back(HostAddress(std::string(addressStr)));
164 } else { 164 } else {
165 SWIFT_LOG(debug) << "inet_ntop() failed" << std::endl; 165 SWIFT_LOG(debug) << "inet_ntop() failed";
166 error = DomainNameResolveError(); 166 error = DomainNameResolveError();
167 } 167 }
168 } 168 }
@@ -182,7 +182,7 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo
182UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) { 182UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) {
183 ubContext = ub_ctx_create(); 183 ubContext = ub_ctx_create();
184 if(!ubContext) { 184 if(!ubContext) {
185 SWIFT_LOG(debug) << "could not create unbound context" << std::endl; 185 SWIFT_LOG(debug) << "could not create unbound context";
186 } 186 }
187 eventOwner = std::make_shared<EventOwner>(); 187 eventOwner = std::make_shared<EventOwner>();
188 188
@@ -192,11 +192,11 @@ UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter,
192 192
193 /* read /etc/resolv.conf for DNS proxy settings (from DHCP) */ 193 /* read /etc/resolv.conf for DNS proxy settings (from DHCP) */
194 if( (ret=ub_ctx_resolvconf(ubContext, const_cast<char*>("/etc/resolv.conf"))) != 0) { 194 if( (ret=ub_ctx_resolvconf(ubContext, const_cast<char*>("/etc/resolv.conf"))) != 0) {
195 SWIFT_LOG(error) << "error reading resolv.conf: " << ub_strerror(ret) << ". errno says: " << strerror(errno) << std::endl; 195 SWIFT_LOG(error) << "error reading resolv.conf: " << ub_strerror(ret) << ". errno says: " << strerror(errno);
196 } 196 }
197 /* read /etc/hosts for locally supplied host addresses */ 197 /* read /etc/hosts for locally supplied host addresses */
198 if( (ret=ub_ctx_hosts(ubContext, const_cast<char*>("/etc/hosts"))) != 0) { 198 if( (ret=ub_ctx_hosts(ubContext, const_cast<char*>("/etc/hosts"))) != 0) {
199 SWIFT_LOG(error) << "error reading hosts: " << ub_strerror(ret) << ". errno says: " << strerror(errno) << std::endl; 199 SWIFT_LOG(error) << "error reading hosts: " << ub_strerror(ret) << ". errno says: " << strerror(errno);
200 } 200 }
201 201
202 ubDescriptior.assign(ub_fd(ubContext)); 202 ubDescriptior.assign(ub_fd(ubContext));
@@ -231,7 +231,7 @@ void UnboundDomainNameResolver::processData() {
231 if (ub_poll(ubContext)) { 231 if (ub_poll(ubContext)) {
232 int ret = ub_process(ubContext); 232 int ret = ub_process(ubContext);
233 if(ret != 0) { 233 if(ret != 0) {
234 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(ret) << std::endl; 234 SWIFT_LOG(debug) << "resolve error: " << ub_strerror(ret);
235 } 235 }
236 } 236 }
237} 237}
diff --git a/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp b/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp
index 065d015..e9268b0 100644
--- a/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp
+++ b/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -37,7 +37,7 @@ namespace {
37 37
38 virtual std::vector<std::pair<std::string, std::string> > filterHTTPResponseHeader(const std::string& /* statusLine */, const std::vector<std::pair<std::string, std::string> >& response) { 38 virtual std::vector<std::pair<std::string, std::string> > filterHTTPResponseHeader(const std::string& /* statusLine */, const std::vector<std::pair<std::string, std::string> >& response) {
39 filterResponses.push_back(response); 39 filterResponses.push_back(response);
40 SWIFT_LOG(debug) << std::endl; 40 SWIFT_LOG(debug);
41 return filterResponseReturn; 41 return filterResponseReturn;
42 } 42 }
43 43
@@ -409,7 +409,7 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture {
409 std::shared_ptr<Connection> createConnection() { 409 std::shared_ptr<Connection> createConnection() {
410 std::shared_ptr<MockConnection> connection = std::make_shared<MockConnection>(failingPorts, eventLoop); 410 std::shared_ptr<MockConnection> connection = std::make_shared<MockConnection>(failingPorts, eventLoop);
411 connections.push_back(connection); 411 connections.push_back(connection);
412 SWIFT_LOG(debug) << "new connection created" << std::endl; 412 SWIFT_LOG(debug) << "new connection created";
413 return connection; 413 return connection;
414 } 414 }
415 415
diff --git a/Swiften/Network/WindowsProxyProvider.cpp b/Swiften/Network/WindowsProxyProvider.cpp
index 9a60bb4..13fdb25 100644
--- a/Swiften/Network/WindowsProxyProvider.cpp
+++ b/Swiften/Network/WindowsProxyProvider.cpp
@@ -52,7 +52,7 @@ WindowsProxyProvider::WindowsProxyProvider()
52 for(auto&& proxy : proxies) { 52 for(auto&& proxy : proxies) {
53 if(proxy.find('=') != std::string::npos) { 53 if(proxy.find('=') != std::string::npos) {
54 protocolAndProxy = String::getSplittedAtFirst(proxy, '='); 54 protocolAndProxy = String::getSplittedAtFirst(proxy, '=');
55 SWIFT_LOG(debug) << "Found proxy: " << protocolAndProxy.first << " => " << protocolAndProxy.second << std::endl; 55 SWIFT_LOG(debug) << "Found proxy: " << protocolAndProxy.first << " => " << protocolAndProxy.second;
56 if(protocolAndProxy.first.compare("socks") == 0) { 56 if(protocolAndProxy.first.compare("socks") == 0) {
57 socksProxy = getAsHostAddressPort(protocolAndProxy.second); 57 socksProxy = getAsHostAddressPort(protocolAndProxy.second);
58 } 58 }
@@ -86,7 +86,7 @@ HostAddressPort WindowsProxyProvider::getAsHostAddressPort(std::string proxy) {
86 ret = HostAddressPort(HostAddress::fromString(tmp.first).get(), port); 86 ret = HostAddressPort(HostAddress::fromString(tmp.first).get(), port);
87 } 87 }
88 catch(...) { 88 catch(...) {
89 SWIFT_LOG(error) << "Exception occured while parsing windows proxy \"getHostAddressPort\"." << std::endl; 89 SWIFT_LOG(error) << "Exception occured while parsing windows proxy \"getHostAddressPort\".";
90 } 90 }
91 91
92 return ret; 92 return ret;
diff --git a/Swiften/Parser/IQParser.cpp b/Swiften/Parser/IQParser.cpp
index 5cfae34..363f7ec 100644
--- a/Swiften/Parser/IQParser.cpp
+++ b/Swiften/Parser/IQParser.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -32,7 +32,7 @@ void IQParser::handleStanzaAttributes(const AttributeMap& attributes) {
32 getStanzaGeneric()->setType(IQ::Error); 32 getStanzaGeneric()->setType(IQ::Error);
33 } 33 }
34 else { 34 else {
35 SWIFT_LOG(warning) << "Unknown IQ type: " << *type << std::endl; 35 SWIFT_LOG(warning) << "Unknown IQ type: " << *type;
36 getStanzaGeneric()->setType(IQ::Get); 36 getStanzaGeneric()->setType(IQ::Get);
37 } 37 }
38 } 38 }
diff --git a/Swiften/Parser/LibXMLParser.cpp b/Swiften/Parser/LibXMLParser.cpp
index 158958b..32b91a1 100644
--- a/Swiften/Parser/LibXMLParser.cpp
+++ b/Swiften/Parser/LibXMLParser.cpp
@@ -34,7 +34,7 @@ static void handleStartElement(void* parser, const xmlChar* name, const xmlChar*
34 AttributeMap attributeValues; 34 AttributeMap attributeValues;
35 if (nbDefaulted != 0) { 35 if (nbDefaulted != 0) {
36 // Just because i don't understand what this means yet :-) 36 // Just because i don't understand what this means yet :-)
37 SWIFT_LOG(error) << "Unexpected nbDefaulted on XML element" << std::endl; 37 SWIFT_LOG(error) << "Unexpected nbDefaulted on XML element";
38 } 38 }
39 for (int i = 0; i < nbAttributes*5; i += 5) { 39 for (int i = 0; i < nbAttributes*5; i += 5) {
40 std::string attributeName = asString(attributes[i]); 40 std::string attributeName = asString(attributes[i]);
diff --git a/Swiften/Parser/PresenceParser.cpp b/Swiften/Parser/PresenceParser.cpp
index 0235a12..f73e9d8 100644
--- a/Swiften/Parser/PresenceParser.cpp
+++ b/Swiften/Parser/PresenceParser.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -41,7 +41,7 @@ void PresenceParser::handleStanzaAttributes(const AttributeMap& attributes) {
41 getStanzaGeneric()->setType(Presence::Error); 41 getStanzaGeneric()->setType(Presence::Error);
42 } 42 }
43 else { 43 else {
44 SWIFT_LOG(error) << "Unknown Presence type: " << *type << std::endl; 44 SWIFT_LOG(error) << "Unknown Presence type: " << *type;
45 getStanzaGeneric()->setType(Presence::Available); 45 getStanzaGeneric()->setType(Presence::Available);
46 } 46 }
47 } 47 }
diff --git a/Swiften/Roster/XMPPRosterController.cpp b/Swiften/Roster/XMPPRosterController.cpp
index 8ee9755..2b98b53 100644
--- a/Swiften/Roster/XMPPRosterController.cpp
+++ b/Swiften/Roster/XMPPRosterController.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -66,7 +66,7 @@ void XMPPRosterController::handleRosterReceived(std::shared_ptr<RosterPayload> r
66 xmppRoster_->addContact(item.getJID(), item.getName(), item.getGroups(), item.getSubscription()); 66 xmppRoster_->addContact(item.getJID(), item.getName(), item.getGroups(), item.getSubscription());
67 } 67 }
68 else { 68 else {
69 SWIFT_LOG(error) << "Stored invalid roster item" << std::endl; 69 SWIFT_LOG(error) << "Stored invalid roster item";
70 } 70 }
71 } 71 }
72 } 72 }
diff --git a/Swiften/SASL/WindowsAuthentication.cpp b/Swiften/SASL/WindowsAuthentication.cpp
index b86381b..f951fac 100644
--- a/Swiften/SASL/WindowsAuthentication.cpp
+++ b/Swiften/SASL/WindowsAuthentication.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2016 Isode Limited. 2 * Copyright (c) 2015-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -16,14 +16,14 @@
16#define ASSIGN_ERROR(status, errorCode) \ 16#define ASSIGN_ERROR(status, errorCode) \
17{ \ 17{ \
18 errorCode = std::make_shared<boost::system::error_code>(status, boost::system::system_category()); \ 18 errorCode = std::make_shared<boost::system::error_code>(status, boost::system::system_category()); \
19 SWIFT_LOG(debug) << std::hex << "status: 0x" << status << ": " << errorCode->message() << std::endl; \ 19 SWIFT_LOG(debug) << std::hex << "status: 0x" << status << ": " << errorCode->message(); \
20} 20}
21 21
22#define ASSIGN_SEC_ERROR(status, errorCode) \ 22#define ASSIGN_SEC_ERROR(status, errorCode) \
23{ \ 23{ \
24 if (status == SEC_E_OK) \ 24 if (status == SEC_E_OK) \
25 { \ 25 { \
26 SWIFT_LOG(debug) << "success" << std::endl; \ 26 SWIFT_LOG(debug) << "success"; \
27 } \ 27 } \
28 else { \ 28 else { \
29 ASSIGN_ERROR(status, errorCode); \ 29 ASSIGN_ERROR(status, errorCode); \
@@ -46,14 +46,14 @@ std::shared_ptr<boost::system::error_code> getUserNameEx(std::string& userName,
46 std::size_t position; 46 std::size_t position;
47 47
48 userName = convertWStringToString(std::wstring(vecptr(value), length)); 48 userName = convertWStringToString(std::wstring(vecptr(value), length));
49 SWIFT_LOG(debug) << "User Name: " << userName << std::endl; 49 SWIFT_LOG(debug) << "User Name: " << userName;
50 50
51 position = userName.find("\\"); 51 position = userName.find("\\");
52 clientName = userName.substr(position + 1); 52 clientName = userName.substr(position + 1);
53 SWIFT_LOG(debug) << "Client name: " << clientName << std::endl; 53 SWIFT_LOG(debug) << "Client name: " << clientName;
54 54
55 serverName = userName.substr(0, position); 55 serverName = userName.substr(0, position);
56 SWIFT_LOG(debug) << "Server name: " << serverName << std::endl; 56 SWIFT_LOG(debug) << "Server name: " << serverName;
57 57
58 break; 58 break;
59 } 59 }
@@ -161,7 +161,7 @@ std::shared_ptr<boost::system::error_code> initializeSecurityContext(const boost
161 } 161 }
162 if ((status == SEC_E_OK) || (status == SEC_I_COMPLETE_AND_CONTINUE) || (status == SEC_I_COMPLETE_NEEDED) || (status == SEC_I_CONTINUE_NEEDED)) { 162 if ((status == SEC_E_OK) || (status == SEC_I_COMPLETE_AND_CONTINUE) || (status == SEC_I_COMPLETE_NEEDED) || (status == SEC_I_CONTINUE_NEEDED)) {
163 outputToken = createSafeByteArray (static_cast<unsigned char *>(outputTokenBuffer.pvBuffer), outputTokenBuffer.cbBuffer); 163 outputToken = createSafeByteArray (static_cast<unsigned char *>(outputTokenBuffer.pvBuffer), outputTokenBuffer.cbBuffer);
164 SWIFT_LOG(debug) << "outputToken.size(): " << outputToken.size() << std::endl; 164 SWIFT_LOG(debug) << "outputToken.size(): " << outputToken.size();
165 freeContextBuffer(outputTokenBuffer.pvBuffer); 165 freeContextBuffer(outputTokenBuffer.pvBuffer);
166 166
167 return std::shared_ptr<boost::system::error_code>(); /* success */ 167 return std::shared_ptr<boost::system::error_code>(); /* success */
@@ -229,7 +229,7 @@ std::shared_ptr<boost::system::error_code> decryptMessage(const PCtxtHandle cont
229 messageBuffer[1].cbBuffer = 0; 229 messageBuffer[1].cbBuffer = 0;
230 messageBuffer[1].pvBuffer = NULL; 230 messageBuffer[1].pvBuffer = NULL;
231 231
232 SWIFT_LOG(debug) << "inputMessage.size(): " << inputMessage.size() << std::endl; 232 SWIFT_LOG(debug) << "inputMessage.size(): " << inputMessage.size();
233 233
234 status = DecryptMessage( 234 status = DecryptMessage(
235 contextHandle, 235 contextHandle,
@@ -239,13 +239,13 @@ std::shared_ptr<boost::system::error_code> decryptMessage(const PCtxtHandle cont
239 ASSIGN_SEC_ERROR(status, errorCode); 239 ASSIGN_SEC_ERROR(status, errorCode);
240 if (status == SEC_E_OK) { 240 if (status == SEC_E_OK) {
241 if (qualityOfProtection == SECQOP_WRAP_NO_ENCRYPT) { 241 if (qualityOfProtection == SECQOP_WRAP_NO_ENCRYPT) {
242 SWIFT_LOG(debug) << "Message was signed only" << std::endl; 242 SWIFT_LOG(debug) << "Message was signed only";
243 } 243 }
244 else { 244 else {
245 SWIFT_LOG(debug) << "Message was encrypted" << std::endl; 245 SWIFT_LOG(debug) << "Message was encrypted";
246 } 246 }
247 247
248 SWIFT_LOG(debug) << "messageBuffer[1].cbBuffer: " << messageBuffer[1].cbBuffer << std::endl; 248 SWIFT_LOG(debug) << "messageBuffer[1].cbBuffer: " << messageBuffer[1].cbBuffer;
249 249
250 decrypted = createSafeByteArray (static_cast<unsigned char *>(messageBuffer[1].pvBuffer), messageBuffer[1].cbBuffer); 250 decrypted = createSafeByteArray (static_cast<unsigned char *>(messageBuffer[1].pvBuffer), messageBuffer[1].cbBuffer);
251 } 251 }
@@ -281,9 +281,9 @@ std::shared_ptr<boost::system::error_code> encryptMessage(const PCtxtHandle cont
281 messageBuffer[2].cbBuffer = sizes.cbBlockSize; 281 messageBuffer[2].cbBuffer = sizes.cbBlockSize;
282 messageBuffer[2].pvBuffer = vecptr(blockSize); 282 messageBuffer[2].pvBuffer = vecptr(blockSize);
283 283
284 SWIFT_LOG(debug) << "sizes.cbSecurityTrailer: " << sizes.cbSecurityTrailer << std::endl; 284 SWIFT_LOG(debug) << "sizes.cbSecurityTrailer: " << sizes.cbSecurityTrailer;
285 SWIFT_LOG(debug) << "inputMessage.size(): " << inputMessage.size() << std::endl; 285 SWIFT_LOG(debug) << "inputMessage.size(): " << inputMessage.size();
286 SWIFT_LOG(debug) << "sizes.cbBlockSize: " << sizes.cbBlockSize << std::endl; 286 SWIFT_LOG(debug) << "sizes.cbBlockSize: " << sizes.cbBlockSize;
287 287
288 status = EncryptMessage( 288 status = EncryptMessage(
289 contextHandle, 289 contextHandle,
@@ -294,9 +294,9 @@ std::shared_ptr<boost::system::error_code> encryptMessage(const PCtxtHandle cont
294 if (status == SEC_E_OK) { 294 if (status == SEC_E_OK) {
295 unsigned char* pointer; 295 unsigned char* pointer;
296 296
297 SWIFT_LOG(debug) << "messageBuffer[0].cbBuffer: " << messageBuffer[0].cbBuffer << std::endl; 297 SWIFT_LOG(debug) << "messageBuffer[0].cbBuffer: " << messageBuffer[0].cbBuffer;
298 SWIFT_LOG(debug) << "messageBuffer[1].cbBuffer: " << messageBuffer[1].cbBuffer << std::endl; 298 SWIFT_LOG(debug) << "messageBuffer[1].cbBuffer: " << messageBuffer[1].cbBuffer;
299 SWIFT_LOG(debug) << "messageBuffer[2].cbBuffer: " << messageBuffer[2].cbBuffer << std::endl; 299 SWIFT_LOG(debug) << "messageBuffer[2].cbBuffer: " << messageBuffer[2].cbBuffer;
300 300
301 output.resize(messageBuffer[0].cbBuffer + messageBuffer[1].cbBuffer + messageBuffer[2].cbBuffer); 301 output.resize(messageBuffer[0].cbBuffer + messageBuffer[1].cbBuffer + messageBuffer[2].cbBuffer);
302 pointer = vecptr(output); 302 pointer = vecptr(output);
diff --git a/Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp b/Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp
index aae437f..10e8c89 100644
--- a/Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp
+++ b/Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2016 Isode Limited. 2 * Copyright (c) 2015-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -44,7 +44,7 @@ WindowsGSSAPIClientAuthenticator::~WindowsGSSAPIClientAuthenticator() {
44} 44}
45 45
46boost::optional<SafeByteArray> WindowsGSSAPIClientAuthenticator::getResponse() const { 46boost::optional<SafeByteArray> WindowsGSSAPIClientAuthenticator::getResponse() const {
47 SWIFT_LOG(debug) << "response_.size(): " << response_.size() << std::endl; 47 SWIFT_LOG(debug) << "response_.size(): " << response_.size();
48 return response_; 48 return response_;
49} 49}
50 50
@@ -56,7 +56,7 @@ bool WindowsGSSAPIClientAuthenticator::setChallenge(const boost::optional<ByteAr
56 } 56 }
57 else if (step_ == SecurityLayerNegotiation) { 57 else if (step_ == SecurityLayerNegotiation) {
58 if (!challengeData) { 58 if (!challengeData) {
59 SWIFT_LOG(debug) << "Empty message received from the server" << std::endl; 59 SWIFT_LOG(debug) << "Empty message received from the server";
60 error_ = true; 60 error_ = true;
61 return false; 61 return false;
62 } 62 }
@@ -68,7 +68,7 @@ bool WindowsGSSAPIClientAuthenticator::setChallenge(const boost::optional<ByteAr
68 } 68 }
69 69
70 if (challenge.size() != 4) { 70 if (challenge.size() != 4) {
71 SWIFT_LOG(debug) << "Token received from the server of incorrect length: " << challenge.size() << std::endl; 71 SWIFT_LOG(debug) << "Token received from the server of incorrect length: " << challenge.size();
72 error_ = true; 72 error_ = true;
73 return false; 73 return false;
74 } 74 }
@@ -77,14 +77,14 @@ bool WindowsGSSAPIClientAuthenticator::setChallenge(const boost::optional<ByteAr
77 77
78 unsigned char serverSecurityLayer = challengePointer[0]; 78 unsigned char serverSecurityLayer = challengePointer[0];
79 if (serverSecurityLayer == 0) { 79 if (serverSecurityLayer == 0) {
80 SWIFT_LOG(debug) << "Server supports unknown security layer, assuming no security layer" << std::endl; 80 SWIFT_LOG(debug) << "Server supports unknown security layer, assuming no security layer";
81 serverSecurityLayer = SECURITY_LAYER_NONE; 81 serverSecurityLayer = SECURITY_LAYER_NONE;
82 } 82 }
83 else if (serverSecurityLayer == SECURITY_LAYER_NONE) { 83 else if (serverSecurityLayer == SECURITY_LAYER_NONE) {
84 SWIFT_LOG(debug) << "Server supports no security layer" << std::endl; 84 SWIFT_LOG(debug) << "Server supports no security layer";
85 } 85 }
86 else { 86 else {
87 SWIFT_LOG(debug) << "Server supports security layer" << std::endl; 87 SWIFT_LOG(debug) << "Server supports security layer";
88 } 88 }
89 89
90 unsigned int serverMaximumBuffer = (challengePointer[1] << 16) | 90 unsigned int serverMaximumBuffer = (challengePointer[1] << 16) |
@@ -92,7 +92,7 @@ bool WindowsGSSAPIClientAuthenticator::setChallenge(const boost::optional<ByteAr
92 (challengePointer[3] << 0); 92 (challengePointer[3] << 0);
93 93
94 if ((serverSecurityLayer == SECURITY_LAYER_NONE) && (serverMaximumBuffer != 0)) { 94 if ((serverSecurityLayer == SECURITY_LAYER_NONE) && (serverMaximumBuffer != 0)) {
95 SWIFT_LOG(debug) << "Server supports no security layer but has maximum buffer size" << serverMaximumBuffer << std::endl; 95 SWIFT_LOG(debug) << "Server supports no security layer but has maximum buffer size" << serverMaximumBuffer;
96 error_ = true; 96 error_ = true;
97 return false; 97 return false;
98 } 98 }
@@ -158,7 +158,7 @@ void WindowsGSSAPIClientAuthenticator::buildSecurityContext(const boost::optiona
158 } 158 }
159 159
160 if (contextSupported & ISC_REQ_MUTUAL_AUTH == 0) { 160 if (contextSupported & ISC_REQ_MUTUAL_AUTH == 0) {
161 SWIFT_LOG(debug) << "Mutual authentication not supported" << std::endl; 161 SWIFT_LOG(debug) << "Mutual authentication not supported";
162 error_ = true; 162 error_ = true;
163 return; 163 return;
164 } 164 }
@@ -181,14 +181,14 @@ void WindowsGSSAPIClientAuthenticator::buildSecurityContext(const boost::optiona
181 } 181 }
182 182
183 userName_ = names.sUserName; 183 userName_ = names.sUserName;
184 SWIFT_LOG(debug) << "User name: " << userName_ << std::endl; 184 SWIFT_LOG(debug) << "User name: " << userName_;
185 185
186 std::size_t position = userName_.find("\\"); 186 std::size_t position = userName_.find("\\");
187 clientName_ = userName_.substr(position + 1); 187 clientName_ = userName_.substr(position + 1);
188 SWIFT_LOG(debug) << "Client name: " << clientName_ << std::endl; 188 SWIFT_LOG(debug) << "Client name: " << clientName_;
189 189
190 serverName_ = userName_.substr(0, position); 190 serverName_ = userName_.substr(0, position);
191 SWIFT_LOG(debug) << "Server name: " << serverName_ << std::endl; 191 SWIFT_LOG(debug) << "Server name: " << serverName_;
192 192
193 freeContextBuffer(names.sUserName); 193 freeContextBuffer(names.sUserName);
194 step_ = SecurityLayerNegotiation; 194 step_ = SecurityLayerNegotiation;
diff --git a/Swiften/SASL/WindowsServicePrincipalName.cpp b/Swiften/SASL/WindowsServicePrincipalName.cpp
index 419395c..6c87925 100644
--- a/Swiften/SASL/WindowsServicePrincipalName.cpp
+++ b/Swiften/SASL/WindowsServicePrincipalName.cpp
@@ -64,7 +64,7 @@ std::string WindowsServicePrincipalName::toString() {
64 firstCall = false; 64 firstCall = false;
65 } 65 }
66 66
67 SWIFT_LOG(debug) << "SPN: " << str << std::endl; 67 SWIFT_LOG(debug) << "SPN: " << str;
68 return str; 68 return str;
69} 69}
70 70
@@ -72,17 +72,17 @@ DWORD WindowsServicePrincipalName::dsMakeSpn(DWORD* length, wchar_t* value) {
72 DWORD status; 72 DWORD status;
73 73
74#ifdef UNICODE 74#ifdef UNICODE
75 SWIFT_LOG(debug) << "UNICODE is defined" << std::endl; 75 SWIFT_LOG(debug) << "UNICODE is defined";
76#else 76#else
77 SWIFT_LOG(debug) << "UNICODE is not defined" << std::endl; 77 SWIFT_LOG(debug) << "UNICODE is not defined";
78#endif 78#endif
79 79
80 SWIFT_LOG(debug) << "serviceClass_: " << convertWStringToString(serviceClass_.c_str()) << std::endl; 80 SWIFT_LOG(debug) << "serviceClass_: " << convertWStringToString(serviceClass_.c_str());
81 SWIFT_LOG(debug) << "serviceName_: " << convertWStringToString(serviceName_.c_str()) << std::endl; 81 SWIFT_LOG(debug) << "serviceName_: " << convertWStringToString(serviceName_.c_str());
82 SWIFT_LOG(debug) << "instanceName_: " << convertWStringToString(instanceName_.c_str()) << std::endl; 82 SWIFT_LOG(debug) << "instanceName_: " << convertWStringToString(instanceName_.c_str());
83 SWIFT_LOG(debug) << "referrer_: " << convertWStringToString(referrer_.c_str()) << std::endl; 83 SWIFT_LOG(debug) << "referrer_: " << convertWStringToString(referrer_.c_str());
84 SWIFT_LOG(debug) << "instancePort_: " << instancePort_ << std::endl; 84 SWIFT_LOG(debug) << "instancePort_: " << instancePort_;
85 SWIFT_LOG(debug) << "length: " << *length << std::endl; 85 SWIFT_LOG(debug) << "length: " << *length;
86 86
87 /* Call the Unicode function because that is recommended: 87 /* Call the Unicode function because that is recommended:
88https://msdn.microsoft.com/en-us/library/windows/desktop/ff381407%28v=vs.85%29.aspx */ 88https://msdn.microsoft.com/en-us/library/windows/desktop/ff381407%28v=vs.85%29.aspx */
@@ -97,7 +97,7 @@ https://msdn.microsoft.com/en-us/library/windows/desktop/ff381407%28v=vs.85%29.a
97 if (status != ERROR_SUCCESS) { 97 if (status != ERROR_SUCCESS) {
98 boost::system::error_code errorCode(status, boost::system::system_category()); 98 boost::system::error_code errorCode(status, boost::system::system_category());
99 99
100 SWIFT_LOG(debug) << std::hex << "status: 0x" << status << ": " << errorCode.message() << std::endl; 100 SWIFT_LOG(debug) << std::hex << "status: 0x" << status << ": " << errorCode.message();
101 } 101 }
102 102
103 return status; 103 return status;
diff --git a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp
index aaac757..566d556 100644
--- a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2015-2016 Isode Limited. 8 * Copyright (c) 2015-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -93,7 +93,7 @@ std::string JinglePayloadSerializer::actionToString(JinglePayload::Action action
93 case JinglePayload::TransportReplace: 93 case JinglePayload::TransportReplace:
94 return "transport-replace"; 94 return "transport-replace";
95 case JinglePayload::UnknownAction: 95 case JinglePayload::UnknownAction:
96 SWIFT_LOG(warning) << "Serializing unknown action value." << std::endl; 96 SWIFT_LOG(warning) << "Serializing unknown action value.";
97 return ""; 97 return "";
98 } 98 }
99 assert(false); 99 assert(false);
@@ -103,7 +103,7 @@ std::string JinglePayloadSerializer::actionToString(JinglePayload::Action action
103std::string JinglePayloadSerializer::reasonTypeToString(JinglePayload::Reason::Type type) const { 103std::string JinglePayloadSerializer::reasonTypeToString(JinglePayload::Reason::Type type) const {
104 switch(type) { 104 switch(type) {
105 case JinglePayload::Reason::UnknownType: 105 case JinglePayload::Reason::UnknownType:
106 SWIFT_LOG(warning) << "Unknown jingle reason type!" << std::endl; 106 SWIFT_LOG(warning) << "Unknown jingle reason type!";
107 return ""; 107 return "";
108 case JinglePayload::Reason::AlternativeSession: 108 case JinglePayload::Reason::AlternativeSession:
109 return "alternative-session"; 109 return "alternative-session";
diff --git a/Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.cpp
index 6e78a8d..128aac7 100644
--- a/Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2018 Isode Limited. 2 * Copyright (c) 2018-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -44,7 +44,7 @@ std::string ReferencePayloadSerializer::serializePayload(ReferencePayload::ref r
44 element.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(payload))); 44 element.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(payload)));
45 } 45 }
46 else { 46 else {
47 SWIFT_LOG(warning) << "Could not find serializer for " << typeid(*(payload.get())).name() << std::endl; 47 SWIFT_LOG(warning) << "Could not find serializer for " << typeid(*(payload.get())).name();
48 } 48 }
49 } 49 }
50 } 50 }
diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
index 8c05c6f..f38f5b7 100644
--- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2016 Isode Limited. 8 * Copyright (c) 2016-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -199,7 +199,7 @@ namespace Swift {
199 case WhiteboardPayload::SessionTerminate: 199 case WhiteboardPayload::SessionTerminate:
200 return "session-terminate"; 200 return "session-terminate";
201 case WhiteboardPayload::UnknownType: 201 case WhiteboardPayload::UnknownType:
202 SWIFT_LOG(warning) << "Serializing unknown action value." << std::endl; 202 SWIFT_LOG(warning) << "Serializing unknown action value.";
203 return ""; 203 return "";
204 } 204 }
205 assert(false); 205 assert(false);
diff --git a/Swiften/Serializer/StanzaSerializer.cpp b/Swiften/Serializer/StanzaSerializer.cpp
index 3de706d..d4231c5 100644
--- a/Swiften/Serializer/StanzaSerializer.cpp
+++ b/Swiften/Serializer/StanzaSerializer.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -53,7 +53,7 @@ SafeByteArray StanzaSerializer::serialize(std::shared_ptr<ToplevelElement> eleme
53 serializedPayloads += serializer->serialize(payload); 53 serializedPayloads += serializer->serialize(payload);
54 } 54 }
55 else { 55 else {
56 SWIFT_LOG(warning) << "Could not find serializer for " << typeid(*(payload.get())).name() << std::endl; 56 SWIFT_LOG(warning) << "Could not find serializer for " << typeid(*(payload.get())).name();
57 } 57 }
58 } 58 }
59 serializedPayloads = String::sanitizeXMPPString(serializedPayloads); 59 serializedPayloads = String::sanitizeXMPPString(serializedPayloads);
diff --git a/Swiften/Serializer/XMPPSerializer.cpp b/Swiften/Serializer/XMPPSerializer.cpp
index 9cde777..7a003fb 100644
--- a/Swiften/Serializer/XMPPSerializer.cpp
+++ b/Swiften/Serializer/XMPPSerializer.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -89,7 +89,7 @@ SafeByteArray XMPPSerializer::serializeElement(std::shared_ptr<ToplevelElement>
89 return (*i)->serialize(element); 89 return (*i)->serialize(element);
90 } 90 }
91 else { 91 else {
92 SWIFT_LOG(warning) << "Could not find serializer for " << typeid(*(element.get())).name() << std::endl; 92 SWIFT_LOG(warning) << "Could not find serializer for " << typeid(*(element.get())).name();
93 return createSafeByteArray(""); 93 return createSafeByteArray("");
94 } 94 }
95} 95}
diff --git a/Swiften/StreamManagement/StanzaAckRequester.cpp b/Swiften/StreamManagement/StanzaAckRequester.cpp
index a0f5b70..c71803a 100644
--- a/Swiften/StreamManagement/StanzaAckRequester.cpp
+++ b/Swiften/StreamManagement/StanzaAckRequester.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2018 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -28,7 +28,7 @@ void StanzaAckRequester::handleAckReceived(unsigned int handledStanzasCount) {
28 unsigned int i = lastHandledStanzasCount; 28 unsigned int i = lastHandledStanzasCount;
29 while (i != handledStanzasCount) { 29 while (i != handledStanzasCount) {
30 if (unackedStanzas.empty()) { 30 if (unackedStanzas.empty()) {
31 SWIFT_LOG(warning) << "Server acked more stanzas than we sent" << std::endl; 31 SWIFT_LOG(warning) << "Server acked more stanzas than we sent";
32 break; 32 break;
33 } 33 }
34 std::shared_ptr<Stanza> ackedStanza = unackedStanzas.front(); 34 std::shared_ptr<Stanza> ackedStanza = unackedStanzas.front();
diff --git a/Swiften/StreamStack/WhitespacePingLayer.cpp b/Swiften/StreamStack/WhitespacePingLayer.cpp
index 9a473f3..7c8301e 100644
--- a/Swiften/StreamStack/WhitespacePingLayer.cpp
+++ b/Swiften/StreamStack/WhitespacePingLayer.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -22,7 +22,7 @@ WhitespacePingLayer::WhitespacePingLayer(TimerFactory* timerFactory) : isActive(
22} 22}
23 23
24WhitespacePingLayer::~WhitespacePingLayer() { 24WhitespacePingLayer::~WhitespacePingLayer() {
25 SWIFT_LOG_ASSERT(!isActive, debug) << "WhitespacePingLayer still active at destruction." << std::endl; 25 SWIFT_LOG_ASSERT(!isActive, debug) << "WhitespacePingLayer still active at destruction.";
26 if (isActive) { 26 if (isActive) {
27 timer->stop(); 27 timer->stop();
28 } 28 }
diff --git a/Swiften/TLS/CAPICertificate.cpp b/Swiften/TLS/CAPICertificate.cpp
index f10ad47..526b535 100644
--- a/Swiften/TLS/CAPICertificate.cpp
+++ b/Swiften/TLS/CAPICertificate.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012-2016 Isode Limited. 2 * Copyright (c) 2012-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -22,7 +22,7 @@
22#define DEBUG_SCARD_STATUS(function, status) \ 22#define DEBUG_SCARD_STATUS(function, status) \
23{ \ 23{ \
24 std::shared_ptr<boost::system::error_code> errorCode = std::make_shared<boost::system::error_code>(status, boost::system::system_category()); \ 24 std::shared_ptr<boost::system::error_code> errorCode = std::make_shared<boost::system::error_code>(status, boost::system::system_category()); \
25 SWIFT_LOG(debug) << std::hex << function << ": status: 0x" << status << ": " << errorCode->message() << std::endl; \ 25 SWIFT_LOG(debug) << std::hex << function << ": status: 0x" << status << ": " << errorCode->message(); \
26} 26}
27 27
28namespace Swift { 28namespace Swift {
@@ -44,7 +44,7 @@ CAPICertificate::CAPICertificate(const std::string& capiUri, TimerFactory* timer
44} 44}
45 45
46CAPICertificate::~CAPICertificate() { 46CAPICertificate::~CAPICertificate() {
47 SWIFT_LOG(debug) << "Destroying the CAPICertificate" << std::endl; 47 SWIFT_LOG(debug) << "Destroying the CAPICertificate";
48 if (smartCardTimer_) { 48 if (smartCardTimer_) {
49 smartCardTimer_->stop(); 49 smartCardTimer_->stop();
50 smartCardTimer_->onTick.disconnect(boost::bind(&CAPICertificate::handleSmartCardTimerTick, this)); 50 smartCardTimer_->onTick.disconnect(boost::bind(&CAPICertificate::handleSmartCardTimerTick, this));
@@ -53,7 +53,7 @@ CAPICertificate::~CAPICertificate() {
53 53
54 if (certStoreHandle_) { 54 if (certStoreHandle_) {
55 if (CertCloseStore(certStoreHandle_, 0) == FALSE) { 55 if (CertCloseStore(certStoreHandle_, 0) == FALSE) {
56 SWIFT_LOG(debug) << "Failed to close the certificate store handle" << std::endl; 56 SWIFT_LOG(debug) << "Failed to close the certificate store handle";
57 } 57 }
58 } 58 }
59 59
@@ -161,7 +161,7 @@ void CAPICertificate::setUri(const std::string& capiUri) {
161 CERT_KEY_PROV_INFO_PROP_ID, 161 CERT_KEY_PROV_INFO_PROP_ID,
162 NULL, 162 NULL,
163 &len)) { 163 &len)) {
164 SWIFT_LOG(error) << "Error while retrieving context properties" << std::endl; 164 SWIFT_LOG(error) << "Error while retrieving context properties";
165 return; 165 return;
166 } 166 }
167 167
@@ -287,25 +287,25 @@ bool CAPICertificate::checkIfSmartCardPresent() {
287 287
288 switch (dwState) { 288 switch (dwState) {
289 case SCARD_ABSENT: 289 case SCARD_ABSENT:
290 SWIFT_LOG(debug) << "Card absent." << std::endl; 290 SWIFT_LOG(debug) << "Card absent.";
291 break; 291 break;
292 case SCARD_PRESENT: 292 case SCARD_PRESENT:
293 SWIFT_LOG(debug) << "Card present." << std::endl; 293 SWIFT_LOG(debug) << "Card present.";
294 break; 294 break;
295 case SCARD_SWALLOWED: 295 case SCARD_SWALLOWED:
296 SWIFT_LOG(debug) << "Card swallowed." << std::endl; 296 SWIFT_LOG(debug) << "Card swallowed.";
297 break; 297 break;
298 case SCARD_POWERED: 298 case SCARD_POWERED:
299 SWIFT_LOG(debug) << "Card has power." << std::endl; 299 SWIFT_LOG(debug) << "Card has power.";
300 break; 300 break;
301 case SCARD_NEGOTIABLE: 301 case SCARD_NEGOTIABLE:
302 SWIFT_LOG(debug) << "Card reset and waiting PTS negotiation." << std::endl; 302 SWIFT_LOG(debug) << "Card reset and waiting PTS negotiation.";
303 break; 303 break;
304 case SCARD_SPECIFIC: 304 case SCARD_SPECIFIC:
305 SWIFT_LOG(debug) << "Card has specific communication protocols set." << std::endl; 305 SWIFT_LOG(debug) << "Card has specific communication protocols set.";
306 break; 306 break;
307 default: 307 default:
308 SWIFT_LOG(debug) << "Unknown or unexpected card state." << std::endl; 308 SWIFT_LOG(debug) << "Unknown or unexpected card state.";
309 break; 309 break;
310 } 310 }
311 311
@@ -332,7 +332,7 @@ bool CAPICertificate::checkIfSmartCardPresent() {
332void CAPICertificate::handleSmartCardTimerTick() { 332void CAPICertificate::handleSmartCardTimerTick() {
333 bool poll = checkIfSmartCardPresent(); 333 bool poll = checkIfSmartCardPresent();
334 if (lastPollingResult_ && !poll) { 334 if (lastPollingResult_ && !poll) {
335 SWIFT_LOG(debug) << "CAPI Certificate detected that the certificate card was removed" << std::endl; 335 SWIFT_LOG(debug) << "CAPI Certificate detected that the certificate card was removed";
336 onCertificateCardRemoved(); 336 onCertificateCardRemoved();
337 } 337 }
338 lastPollingResult_ = poll; 338 lastPollingResult_ = poll;
diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
index 16b0b2b..66b650d 100644
--- a/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
+++ b/Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2016 Isode Limited. 2 * Copyright (c) 2010-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -32,7 +32,7 @@ OpenSSLCertificate::OpenSSLCertificate(const ByteArray& der) {
32#endif 32#endif
33 cert = std::shared_ptr<X509>(d2i_X509(nullptr, &p, der.size()), X509_free); 33 cert = std::shared_ptr<X509>(d2i_X509(nullptr, &p, der.size()), X509_free);
34 if (!cert) { 34 if (!cert) {
35// SWIFT_LOG(warning) << "Error creating certificate from DER data" << std::endl; 35// SWIFT_LOG(warning) << "Error creating certificate from DER data";
36 } 36 }
37 parse(); 37 parse();
38} 38}
diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
index a183a75..86b0504 100644
--- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
+++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp
@@ -207,7 +207,7 @@ static int certVerifyCallback(X509_STORE_CTX* store_ctx, void* arg)
207 if (cb != nullptr) { 207 if (cb != nullptr) {
208 ret = cb(static_cast<const OpenSSLContext*>(context)); 208 ret = cb(static_cast<const OpenSSLContext*>(context));
209 } else { 209 } else {
210 SWIFT_LOG(debug) << "certVerifyCallback called but context.verifyCertCallback is unset" << std::endl; 210 SWIFT_LOG(debug) << "certVerifyCallback called but context.verifyCertCallback is unset";
211 ret = 0; 211 ret = 0;
212 } 212 }
213 213
@@ -250,12 +250,12 @@ static int verifyCallback(int preverifyOk, X509_STORE_CTX* ctx)
250 SSL* ssl = static_cast<SSL*>(X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx())); 250 SSL* ssl = static_cast<SSL*>(X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()));
251 SSL_CTX* sslctx = ssl ? SSL_get_SSL_CTX(ssl) : nullptr; 251 SSL_CTX* sslctx = ssl ? SSL_get_SSL_CTX(ssl) : nullptr;
252 if (!sslctx) { 252 if (!sslctx) {
253 SWIFT_LOG(debug) << "verifyCallback: internal error" << std::endl; 253 SWIFT_LOG(debug) << "verifyCallback: internal error";
254 return preverifyOk; 254 return preverifyOk;
255 } 255 }
256 256
257 if (SSL_CTX_get_verify_mode(sslctx) == SSL_VERIFY_NONE) { 257 if (SSL_CTX_get_verify_mode(sslctx) == SSL_VERIFY_NONE) {
258 SWIFT_LOG(debug) << "verifyCallback: no verification required" << std::endl; 258 SWIFT_LOG(debug) << "verifyCallback: no verification required";
259 // No verification requested 259 // No verification requested
260 return 1; 260 return 1;
261 } 261 }
@@ -288,10 +288,10 @@ static int verifyCallback(int preverifyOk, X509_STORE_CTX* ctx)
288 } 288 }
289 SWIFT_LOG(debug) << "verifyCallback: verification error " << 289 SWIFT_LOG(debug) << "verifyCallback: verification error " <<
290 X509_verify_cert_error_string(err) << " depth: " << 290 X509_verify_cert_error_string(err) << " depth: " <<
291 depth << " issuer: " << ((issuerString.length() > 0) ? issuerString : "<unknown>") << std::endl; 291 depth << " issuer: " << ((issuerString.length() > 0) ? issuerString : "<unknown>");
292 } else { 292 } else {
293 SWIFT_LOG(debug) << "verifyCallback: SSL depth: " << depth << " Subject: " << 293 SWIFT_LOG(debug) << "verifyCallback: SSL depth: " << depth << " Subject: " <<
294 ((subjectString.length() > 0) ? subjectString : "<>") << std::endl; 294 ((subjectString.length() > 0) ? subjectString : "<>");
295 } 295 }
296 // Always return "OK", as check on verification status 296 // Always return "OK", as check on verification status
297 // will be performed once TLS handshake has completed, 297 // will be performed once TLS handshake has completed,
@@ -305,7 +305,7 @@ bool OpenSSLContext::configure(const TLSOptions &options)
305 if (options.cipherSuites) { 305 if (options.cipherSuites) {
306 std::string cipherSuites = *(options.cipherSuites); 306 std::string cipherSuites = *(options.cipherSuites);
307 if (SSL_CTX_set_cipher_list(context_.get(), cipherSuites.c_str()) != 1 ) { 307 if (SSL_CTX_set_cipher_list(context_.get(), cipherSuites.c_str()) != 1 ) {
308 SWIFT_LOG(debug) << "Failed to set cipher-suites" << std::endl; 308 SWIFT_LOG(debug) << "Failed to set cipher-suites";
309 return false; 309 return false;
310 } 310 }
311 } 311 }
@@ -316,7 +316,7 @@ bool OpenSSLContext::configure(const TLSOptions &options)
316 if (SSL_CTX_set_session_id_context(context_.get(), 316 if (SSL_CTX_set_session_id_context(context_.get(),
317 reinterpret_cast<const unsigned char *>(contextId.c_str()), 317 reinterpret_cast<const unsigned char *>(contextId.c_str()),
318 contextId.length()) != 1) { 318 contextId.length()) != 1) {
319 SWIFT_LOG(debug) << "Failed to set context-id" << std::endl; 319 SWIFT_LOG(debug) << "Failed to set context-id";
320 return false; 320 return false;
321 } 321 }
322 } 322 }
@@ -324,12 +324,12 @@ bool OpenSSLContext::configure(const TLSOptions &options)
324 if (options.sessionCacheTimeout) { 324 if (options.sessionCacheTimeout) {
325 int scto = *options.sessionCacheTimeout; 325 int scto = *options.sessionCacheTimeout;
326 if (scto <= 0) { 326 if (scto <= 0) {
327 SWIFT_LOG(debug) << "Invalid value for session-cache-timeout" << std::endl; 327 SWIFT_LOG(debug) << "Invalid value for session-cache-timeout";
328 return false; 328 return false;
329 } 329 }
330 (void)SSL_CTX_set_timeout(context_.get(), scto); 330 (void)SSL_CTX_set_timeout(context_.get(), scto);
331 if (SSL_CTX_get_timeout(context_.get()) != scto) { 331 if (SSL_CTX_get_timeout(context_.get()) != scto) {
332 SWIFT_LOG(debug) << "Failed to set session-cache-timeout" << std::endl; 332 SWIFT_LOG(debug) << "Failed to set session-cache-timeout";
333 return false; 333 return false;
334 } 334 }
335 } 335 }
@@ -371,7 +371,7 @@ bool OpenSSLContext::configure(const TLSOptions &options)
371 if (options.verifyDepth) { 371 if (options.verifyDepth) {
372 int depth = *options.verifyDepth; 372 int depth = *options.verifyDepth;
373 if (depth <= 0) { 373 if (depth <= 0) {
374 SWIFT_LOG(debug) << "Invalid value for verify-depth" << std::endl; 374 SWIFT_LOG(debug) << "Invalid value for verify-depth";
375 return false; 375 return false;
376 } 376 }
377 377
@@ -593,7 +593,7 @@ void OpenSSLContext::sendPendingDataToApplication() {
593 593
594bool OpenSSLContext::setCertificateChain(const std::vector<std::shared_ptr<Certificate>>& certificateChain) { 594bool OpenSSLContext::setCertificateChain(const std::vector<std::shared_ptr<Certificate>>& certificateChain) {
595 if (certificateChain.size() == 0) { 595 if (certificateChain.size() == 0) {
596 SWIFT_LOG(debug) << "Trying to load empty certificate chain." << std::endl; 596 SWIFT_LOG(debug) << "Trying to load empty certificate chain.";
597 return false; 597 return false;
598 } 598 }
599 599
@@ -616,7 +616,7 @@ bool OpenSSLContext::setCertificateChain(const std::vector<std::shared_ptr<Certi
616 } 616 }
617 617
618 if (SSL_CTX_add_extra_chain_cert(context_.get(), openSSLCert->getInternalX509().get()) != 1) { 618 if (SSL_CTX_add_extra_chain_cert(context_.get(), openSSLCert->getInternalX509().get()) != 1) {
619 SWIFT_LOG(debug) << "Trying to load empty certificate chain." << std::endl; 619 SWIFT_LOG(debug) << "Trying to load empty certificate chain.";
620 return false; 620 return false;
621 } 621 }
622 // Have to manually increment reference count as SSL_CTX_add_extra_chain_cert does not do so 622 // Have to manually increment reference count as SSL_CTX_add_extra_chain_cert does not do so
diff --git a/Swiften/TLS/OpenSSL/OpenSSLContextFactory.cpp b/Swiften/TLS/OpenSSL/OpenSSLContextFactory.cpp
index 12445fd..e332ca8 100644
--- a/Swiften/TLS/OpenSSL/OpenSSLContextFactory.cpp
+++ b/Swiften/TLS/OpenSSL/OpenSSLContextFactory.cpp
@@ -47,14 +47,14 @@ ByteArray OpenSSLContextFactory::convertDHParametersFromPEMToDER(const std::stri
47 47
48void OpenSSLContextFactory::setCheckCertificateRevocation(bool check) { 48void OpenSSLContextFactory::setCheckCertificateRevocation(bool check) {
49 if (check) { 49 if (check) {
50 SWIFT_LOG(warning) << "CRL Checking not supported for OpenSSL" << std::endl; 50 SWIFT_LOG(warning) << "CRL Checking not supported for OpenSSL";
51 assert(false); 51 assert(false);
52 } 52 }
53} 53}
54 54
55void OpenSSLContextFactory::setDisconnectOnCardRemoval(bool check) { 55void OpenSSLContextFactory::setDisconnectOnCardRemoval(bool check) {
56 if (check) { 56 if (check) {
57 SWIFT_LOG(warning) << "Smart cards not supported for OpenSSL" << std::endl; 57 SWIFT_LOG(warning) << "Smart cards not supported for OpenSSL";
58 } 58 }
59} 59}
60 60
diff --git a/Swiften/TLS/Schannel/SchannelContext.cpp b/Swiften/TLS/Schannel/SchannelContext.cpp
index c07d009..722fb4a 100644
--- a/Swiften/TLS/Schannel/SchannelContext.cpp
+++ b/Swiften/TLS/Schannel/SchannelContext.cpp
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * Copyright (c) 2012-2016 Isode Limited. 8 * Copyright (c) 2012-2019 Isode Limited.
9 * All rights reserved. 9 * All rights reserved.
10 * See the COPYING file for more information. 10 * See the COPYING file for more information.
11 */ 11 */
@@ -40,10 +40,10 @@ SchannelContext::SchannelContext(bool tls1_0Workaround) : state_(Start), secCont
40//------------------------------------------------------------------------ 40//------------------------------------------------------------------------
41 41
42SchannelContext::~SchannelContext() { 42SchannelContext::~SchannelContext() {
43 SWIFT_LOG(debug) << "Destroying SchannelContext" << std::endl; 43 SWIFT_LOG(debug) << "Destroying SchannelContext";
44 if (myCertStore_) { 44 if (myCertStore_) {
45 if (CertCloseStore(myCertStore_, 0) == FALSE) { 45 if (CertCloseStore(myCertStore_, 0) == FALSE) {
46 SWIFT_LOG(debug) << "Failed to close the certificate store" << std::endl; 46 SWIFT_LOG(debug) << "Failed to close the certificate store";
47 } 47 }
48 } 48 }
49} 49}
@@ -52,7 +52,7 @@ SchannelContext::~SchannelContext() {
52 52
53void SchannelContext::determineStreamSizes() { 53void SchannelContext::determineStreamSizes() {
54 if (QueryContextAttributes(contextHandle_, SECPKG_ATTR_STREAM_SIZES, &streamSizes_) != SEC_E_OK) { 54 if (QueryContextAttributes(contextHandle_, SECPKG_ATTR_STREAM_SIZES, &streamSizes_) != SEC_E_OK) {
55 SWIFT_LOG(debug) << "QueryContextAttributes failed to determinate the stream size" << std::endl; 55 SWIFT_LOG(debug) << "QueryContextAttributes failed to determinate the stream size";
56 } 56 }
57} 57}
58 58
@@ -653,7 +653,7 @@ std::vector<Certificate::ref> SchannelContext::getPeerCertificateChain() const {
653 SECURITY_STATUS status = QueryContextAttributes(contextHandle_, SECPKG_ATTR_REMOTE_CERT_CONTEXT, pServerCert.Reset()); 653 SECURITY_STATUS status = QueryContextAttributes(contextHandle_, SECPKG_ATTR_REMOTE_CERT_CONTEXT, pServerCert.Reset());
654 654
655 if (status != SEC_E_OK) { 655 if (status != SEC_E_OK) {
656 SWIFT_LOG(debug) << "Error while Querying the Certificate Chain" << std::endl; 656 SWIFT_LOG(debug) << "Error while Querying the Certificate Chain";
657 return certificateChain; 657 return certificateChain;
658 } 658 }
659 certificateChain.push_back(std::make_shared<SchannelCertificate>(pServerCert)); 659 certificateChain.push_back(std::make_shared<SchannelCertificate>(pServerCert));
@@ -688,7 +688,7 @@ ByteArray SchannelContext::getFinishMessage() const {
688 return createByteArray(((unsigned char*) bindings.Bindings) + bindings.Bindings->dwApplicationDataOffset + 11 /* tls-unique:*/, bindings.Bindings->cbApplicationDataLength - 11); 688 return createByteArray(((unsigned char*) bindings.Bindings) + bindings.Bindings->dwApplicationDataOffset + 11 /* tls-unique:*/, bindings.Bindings->cbApplicationDataLength - 11);
689 } 689 }
690 else { 690 else {
691 SWIFT_LOG(debug) << "Error while retrieving Finish Message" << std::endl; 691 SWIFT_LOG(debug) << "Error while retrieving Finish Message";
692 } 692 }
693 693
694 return ByteArray(); 694 return ByteArray();
diff --git a/Swiften/TLS/SecureTransport/SecureTransportContext.mm b/Swiften/TLS/SecureTransport/SecureTransportContext.mm
index 25f476f..b4f7842 100644
--- a/Swiften/TLS/SecureTransport/SecureTransportContext.mm
+++ b/Swiften/TLS/SecureTransport/SecureTransportContext.mm
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2016 Isode Limited. 2 * Copyright (c) 2015-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -72,14 +72,14 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key)
72 break; 72 break;
73 case errSecAuthFailed: 73 case errSecAuthFailed:
74 // Password did not work for decoding the certificate. 74 // Password did not work for decoding the certificate.
75 SWIFT_LOG(warning) << "Invalid password." << std::endl; 75 SWIFT_LOG(warning) << "Invalid password.";
76 break; 76 break;
77 case errSecDecode: 77 case errSecDecode:
78 // Other decoding error. 78 // Other decoding error.
79 SWIFT_LOG(warning) << "PKCS12 decoding error." << std::endl; 79 SWIFT_LOG(warning) << "PKCS12 decoding error.";
80 break; 80 break;
81 default: 81 default:
82 SWIFT_LOG(warning) << "Unknown error." << std::endl; 82 SWIFT_LOG(warning) << "Unknown error.";
83 } 83 }
84 84
85 if (securityError != errSecSuccess) { 85 if (securityError != errSecSuccess) {
@@ -110,20 +110,20 @@ SecureTransportContext::SecureTransportContext(bool checkCertificateRevocation)
110 // set IO callbacks 110 // set IO callbacks
111 error = SSLSetIOFuncs(sslContext_.get(), &SecureTransportContext::SSLSocketReadCallback, &SecureTransportContext::SSLSocketWriteCallback); 111 error = SSLSetIOFuncs(sslContext_.get(), &SecureTransportContext::SSLSocketReadCallback, &SecureTransportContext::SSLSocketWriteCallback);
112 if (error != noErr) { 112 if (error != noErr) {
113 SWIFT_LOG(error) << "Unable to set IO functions to SSL context." << std::endl; 113 SWIFT_LOG(error) << "Unable to set IO functions to SSL context.";
114 sslContext_.reset(); 114 sslContext_.reset();
115 } 115 }
116 116
117 error = SSLSetConnection(sslContext_.get(), this); 117 error = SSLSetConnection(sslContext_.get(), this);
118 if (error != noErr) { 118 if (error != noErr) {
119 SWIFT_LOG(error) << "Unable to set connection to SSL context." << std::endl; 119 SWIFT_LOG(error) << "Unable to set connection to SSL context.";
120 sslContext_.reset(); 120 sslContext_.reset();
121 } 121 }
122 122
123 123
124 error = SSLSetSessionOption(sslContext_.get(), kSSLSessionOptionBreakOnServerAuth, true); 124 error = SSLSetSessionOption(sslContext_.get(), kSSLSessionOptionBreakOnServerAuth, true);
125 if (error != noErr) { 125 if (error != noErr) {
126 SWIFT_LOG(error) << "Unable to set kSSLSessionOptionBreakOnServerAuth on session." << std::endl; 126 SWIFT_LOG(error) << "Unable to set kSSLSessionOptionBreakOnServerAuth on session.";
127 sslContext_.reset(); 127 sslContext_.reset();
128 } 128 }
129} 129}
@@ -154,19 +154,19 @@ std::string SecureTransportContext::stateToString(State state) {
154} 154}
155 155
156void SecureTransportContext::setState(State newState) { 156void SecureTransportContext::setState(State newState) {
157 SWIFT_LOG(debug) << "Switch state from " << stateToString(state_) << " to " << stateToString(newState) << "." << std::endl; 157 SWIFT_LOG(debug) << "Switch state from " << stateToString(state_) << " to " << stateToString(newState) << ".";
158 state_ = newState; 158 state_ = newState;
159} 159}
160 160
161void SecureTransportContext::connect() { 161void SecureTransportContext::connect() {
162 SWIFT_LOG_ASSERT(state_ == None, error) << "current state '" << stateToString(state_) << " invalid." << std::endl; 162 SWIFT_LOG_ASSERT(state_ == None, error) << "current state '" << stateToString(state_) << " invalid.";
163 if (clientCertificate_) { 163 if (clientCertificate_) {
164 CFArrayRef certs = CreateClientCertificateChainAsCFArrayRef(clientCertificate_); 164 CFArrayRef certs = CreateClientCertificateChainAsCFArrayRef(clientCertificate_);
165 if (certs) { 165 if (certs) {
166 std::shared_ptr<CFArray> certRefs(certs, CFRelease); 166 std::shared_ptr<CFArray> certRefs(certs, CFRelease);
167 OSStatus result = SSLSetCertificate(sslContext_.get(), certRefs.get()); 167 OSStatus result = SSLSetCertificate(sslContext_.get(), certRefs.get());
168 if (result != noErr) { 168 if (result != noErr) {
169 SWIFT_LOG(error) << "SSLSetCertificate failed with error " << result << "." << std::endl; 169 SWIFT_LOG(error) << "SSLSetCertificate failed with error " << result << ".";
170 } 170 }
171 } 171 }
172 } 172 }
@@ -174,23 +174,23 @@ void SecureTransportContext::connect() {
174} 174}
175 175
176void SecureTransportContext::processHandshake() { 176void SecureTransportContext::processHandshake() {
177 SWIFT_LOG_ASSERT(state_ == None || state_ == Handshake, error) << "current state '" << stateToString(state_) << " invalid." << std::endl; 177 SWIFT_LOG_ASSERT(state_ == None || state_ == Handshake, error) << "current state '" << stateToString(state_) << " invalid.";
178 OSStatus error = SSLHandshake(sslContext_.get()); 178 OSStatus error = SSLHandshake(sslContext_.get());
179 if (error == errSSLWouldBlock) { 179 if (error == errSSLWouldBlock) {
180 setState(Handshake); 180 setState(Handshake);
181 } 181 }
182 else if (error == noErr) { 182 else if (error == noErr) {
183 SWIFT_LOG(debug) << "TLS handshake successful." << std::endl; 183 SWIFT_LOG(debug) << "TLS handshake successful.";
184 setState(HandshakeDone); 184 setState(HandshakeDone);
185 onConnected(); 185 onConnected();
186 } 186 }
187 else if (error == errSSLPeerAuthCompleted) { 187 else if (error == errSSLPeerAuthCompleted) {
188 SWIFT_LOG(debug) << "Received server certificate. Start verification." << std::endl; 188 SWIFT_LOG(debug) << "Received server certificate. Start verification.";
189 setState(Handshake); 189 setState(Handshake);
190 verifyServerCertificate(); 190 verifyServerCertificate();
191 } 191 }
192 else { 192 else {
193 SWIFT_LOG(debug) << "Error returned from SSLHandshake call is " << error << "." << std::endl; 193 SWIFT_LOG(debug) << "Error returned from SSLHandshake call is " << error << ".";
194 fatalError(nativeToTLSError(error), std::make_shared<CertificateVerificationError>()); 194 fatalError(nativeToTLSError(error), std::make_shared<CertificateVerificationError>());
195 } 195 }
196} 196}
@@ -226,13 +226,13 @@ void SecureTransportContext::verifyServerCertificate() {
226 OSStatus cssmResult = 0; 226 OSStatus cssmResult = 0;
227 switch(trustResult) { 227 switch(trustResult) {
228 case kSecTrustResultUnspecified: 228 case kSecTrustResultUnspecified:
229 SWIFT_LOG(warning) << "Successful implicit validation. Result unspecified." << std::endl; 229 SWIFT_LOG(warning) << "Successful implicit validation. Result unspecified.";
230 break; 230 break;
231 case kSecTrustResultProceed: 231 case kSecTrustResultProceed:
232 SWIFT_LOG(warning) << "Validation resulted in explicitly trusted." << std::endl; 232 SWIFT_LOG(warning) << "Validation resulted in explicitly trusted.";
233 break; 233 break;
234 case kSecTrustResultRecoverableTrustFailure: 234 case kSecTrustResultRecoverableTrustFailure:
235 SWIFT_LOG(warning) << "recoverable trust failure" << std::endl; 235 SWIFT_LOG(warning) << "recoverable trust failure";
236 error = SecTrustGetCssmResultCode(trust, &cssmResult); 236 error = SecTrustGetCssmResultCode(trust, &cssmResult);
237 if (error == errSecSuccess) { 237 if (error == errSecSuccess) {
238 verificationError_ = CSSMErrorToVerificationError(cssmResult); 238 verificationError_ = CSSMErrorToVerificationError(cssmResult);
@@ -304,8 +304,8 @@ bool SecureTransportContext::setClientCertificate(CertificateWithKey::ref cert)
304} 304}
305 305
306void SecureTransportContext::handleDataFromNetwork(const SafeByteArray& data) { 306void SecureTransportContext::handleDataFromNetwork(const SafeByteArray& data) {
307 SWIFT_LOG(debug) << std::endl; 307 SWIFT_LOG(debug);
308 SWIFT_LOG_ASSERT(state_ == HandshakeDone || state_ == Handshake, error) << "current state '" << stateToString(state_) << " invalid." << std::endl; 308 SWIFT_LOG_ASSERT(state_ == HandshakeDone || state_ == Handshake, error) << "current state '" << stateToString(state_) << " invalid.";
309 309
310 append(readingBuffer_, data); 310 append(readingBuffer_, data);
311 311
@@ -332,7 +332,7 @@ void SecureTransportContext::handleDataFromNetwork(const SafeByteArray& data) {
332 break; 332 break;
333 } 333 }
334 else { 334 else {
335 SWIFT_LOG(error) << "SSLRead failed with error " << error << ", read bytes: " << bytesRead << "." << std::endl; 335 SWIFT_LOG(error) << "SSLRead failed with error " << error << ", read bytes: " << bytesRead << ".";
336 fatalError(std::make_shared<TLSError>(), std::make_shared<CertificateVerificationError>()); 336 fatalError(std::make_shared<TLSError>(), std::make_shared<CertificateVerificationError>());
337 return; 337 return;
338 } 338 }
@@ -347,7 +347,7 @@ void SecureTransportContext::handleDataFromNetwork(const SafeByteArray& data) {
347 } 347 }
348 break; 348 break;
349 case Error: 349 case Error:
350 SWIFT_LOG(debug) << "Igoring received data in error state." << std::endl; 350 SWIFT_LOG(debug) << "Igoring received data in error state.";
351 break; 351 break;
352 } 352 }
353} 353}
@@ -358,13 +358,13 @@ void SecureTransportContext::handleDataFromApplication(const SafeByteArray& data
358 OSStatus error = SSLWrite(sslContext_.get(), data.data(), data.size(), &processedBytes); 358 OSStatus error = SSLWrite(sslContext_.get(), data.data(), data.size(), &processedBytes);
359 switch(error) { 359 switch(error) {
360 case errSSLWouldBlock: 360 case errSSLWouldBlock:
361 SWIFT_LOG(warning) << "Unexpected because the write callback does not block." << std::endl; 361 SWIFT_LOG(warning) << "Unexpected because the write callback does not block.";
362 return; 362 return;
363 case errSSLClosedGraceful: 363 case errSSLClosedGraceful:
364 case noErr: 364 case noErr:
365 return; 365 return;
366 default: 366 default:
367 SWIFT_LOG(warning) << "SSLWrite returned error code: " << error << ", processed bytes: " << processedBytes << std::endl; 367 SWIFT_LOG(warning) << "SSLWrite returned error code: " << error << ", processed bytes: " << processedBytes;
368 fatalError(std::make_shared<TLSError>(), std::shared_ptr<CertificateVerificationError>()); 368 fatalError(std::make_shared<TLSError>(), std::shared_ptr<CertificateVerificationError>());
369 } 369 }
370} 370}
@@ -390,7 +390,7 @@ std::vector<Certificate::ref> SecureTransportContext::getPeerCertificateChain()
390 } 390 }
391 } 391 }
392 else { 392 else {
393 SWIFT_LOG(warning) << "Failed to obtain peer trust structure; error = " << error << "." << std::endl; 393 SWIFT_LOG(warning) << "Failed to obtain peer trust structure; error = " << error << ".";
394 } 394 }
395 } 395 }
396 396
@@ -402,7 +402,7 @@ CertificateVerificationError::ref SecureTransportContext::getPeerCertificateVeri
402} 402}
403 403
404ByteArray SecureTransportContext::getFinishMessage() const { 404ByteArray SecureTransportContext::getFinishMessage() const {
405 SWIFT_LOG(warning) << "Access to TLS handshake finish message is not part of OS X Secure Transport APIs." << std::endl; 405 SWIFT_LOG(warning) << "Access to TLS handshake finish message is not part of OS X Secure Transport APIs.";
406 return ByteArray(); 406 return ByteArray();
407} 407}
408 408
@@ -453,42 +453,42 @@ std::shared_ptr<CertificateVerificationError> SecureTransportContext::CSSMErrorT
453 std::shared_ptr<CertificateVerificationError> error; 453 std::shared_ptr<CertificateVerificationError> error;
454 switch(resultCode) { 454 switch(resultCode) {
455 case CSSMERR_TP_NOT_TRUSTED: 455 case CSSMERR_TP_NOT_TRUSTED:
456 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_NOT_TRUSTED" << std::endl; 456 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_NOT_TRUSTED";
457 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::Untrusted); 457 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::Untrusted);
458 break; 458 break;
459 case CSSMERR_TP_CERT_NOT_VALID_YET: 459 case CSSMERR_TP_CERT_NOT_VALID_YET:
460 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_NOT_VALID_YET" << std::endl; 460 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_NOT_VALID_YET";
461 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::NotYetValid); 461 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::NotYetValid);
462 break; 462 break;
463 case CSSMERR_TP_CERT_EXPIRED: 463 case CSSMERR_TP_CERT_EXPIRED:
464 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_EXPIRED" << std::endl; 464 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_EXPIRED";
465 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::Expired); 465 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::Expired);
466 break; 466 break;
467 case CSSMERR_TP_CERT_REVOKED: 467 case CSSMERR_TP_CERT_REVOKED:
468 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_REVOKED" << std::endl; 468 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_REVOKED";
469 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::Revoked); 469 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::Revoked);
470 break; 470 break;
471 case CSSMERR_TP_VERIFY_ACTION_FAILED: 471 case CSSMERR_TP_VERIFY_ACTION_FAILED:
472 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_VERIFY_ACTION_FAILED" << std::endl; 472 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_VERIFY_ACTION_FAILED";
473 break; 473 break;
474 case CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK: 474 case CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK:
475 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK" << std::endl; 475 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK";
476 if (checkCertificateRevocation_) { 476 if (checkCertificateRevocation_) {
477 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed); 477 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed);
478 } 478 }
479 break; 479 break;
480 case CSSMERR_APPLETP_OCSP_UNAVAILABLE: 480 case CSSMERR_APPLETP_OCSP_UNAVAILABLE:
481 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_OCSP_UNAVAILABLE" << std::endl; 481 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_OCSP_UNAVAILABLE";
482 if (checkCertificateRevocation_) { 482 if (checkCertificateRevocation_) {
483 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed); 483 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed);
484 } 484 }
485 break; 485 break;
486 case CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE: 486 case CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE:
487 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE" << std::endl; 487 SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE";
488 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::InvalidPurpose); 488 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::InvalidPurpose);
489 break; 489 break;
490 default: 490 default:
491 SWIFT_LOG(warning) << "unhandled CSSM error: " << resultCode << ", CSSM_TP_BASE_TP_ERROR: " << CSSM_TP_BASE_TP_ERROR << std::endl; 491 SWIFT_LOG(warning) << "unhandled CSSM error: " << resultCode << ", CSSM_TP_BASE_TP_ERROR: " << CSSM_TP_BASE_TP_ERROR;
492 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); 492 error = std::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError);
493 break; 493 break;
494 } 494 }
diff --git a/Swiften/TLS/SecureTransport/SecureTransportContextFactory.cpp b/Swiften/TLS/SecureTransport/SecureTransportContextFactory.cpp
index cc10987..ac399e1 100644
--- a/Swiften/TLS/SecureTransport/SecureTransportContextFactory.cpp
+++ b/Swiften/TLS/SecureTransport/SecureTransportContextFactory.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2015-2018 Isode Limited. 2 * Copyright (c) 2015-2019 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -39,7 +39,7 @@ void SecureTransportContextFactory::setCheckCertificateRevocation(bool b) {
39void SecureTransportContextFactory::setDisconnectOnCardRemoval(bool b) { 39void SecureTransportContextFactory::setDisconnectOnCardRemoval(bool b) {
40 disconnectOnCardRemoval_ = b; 40 disconnectOnCardRemoval_ = b;
41 if (disconnectOnCardRemoval_) { 41 if (disconnectOnCardRemoval_) {
42 SWIFT_LOG(warning) << "Smart cards have not been tested yet" << std::endl; 42 SWIFT_LOG(warning) << "Smart cards have not been tested yet";
43 } 43 }
44} 44}
45 45