summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2017-03-31Use std::random instead of boost::randomJoanna Hulboj
Test-Infotmation: Unit tests pass OK. Change-Id: I1b6d3711d97daa86cccbb44aecb1b4025f2fcc8a
2017-03-28Modified XMLBeautifier to handle split payloadsJoanna Hulboj
When receiving network data we were processing it in chunks. Sometimes one XML message got split across multiple chunks. XMLBeautifier was stateless and would create a new parser for every single chunk. This was causing multi-chunk messages to be truncated in the beautified output. The change I made in XMLBeautifier allows it to maintain the state. Test-Information: Tested unger Windows 10 and CentOS. Unit tests pass OK. Change-Id: Idad2a8e0248ed3cbe2b47a12718b909e56ac1279
2017-03-23Add Client State Indication Element, its Parser and SerializerTarun Gupta
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Adds tests for Client State Parser and Serializer, which passes. Tests performed on Ubuntu 16.04 LTS. Change-Id: I60c63f63e1c0fdd55600ef42faa95989ca5ab75b
2017-03-15Do no emit onXMPPDataRead when the session is terminatedTobias Markmann
On a bosh error BOSHSessionStream, posts an event to the event loop that closes the XMPP stream. If onXMPPDataRead is emitted, that data is handled before the close of the stream though, which can cause another BOSH request to be sent. Test-Information: Added a unit test verifying the behaviour. Wrote a custom python script replicating the original error and verified that Swift does not stay connected on a BOSH error with additional text data. Tested on macOS 10.12.3 with recent clang trunk. Change-Id: Ie90099afa0934707a6758b00706a65227ceb48b8
2017-03-13Add LogSerializer for BOSHErrorTobias Markmann
Test-Information: Tested and used it during a recent debugging session on macOS 10.12.3 with recent clang. Change-Id: Ia4883a69a94f962006a39b294d6b9b67e0990541
2017-02-27Handle boost::bad_lexical_cast exception in HostAddressPort::toString()Tobias Markmann
Test-Information: Builds and unit tests pass on macOS 10.12.3 with Qt 5.7.1. Change-Id: I258ea7a70a025bc0ebf61eea7acd636e90fc8b1e
2017-02-23Change the logic of displaying chat room subjectJoanna Hulboj
Test-Information: Run Swift and join any MUC room, on join there is no information displayed regarding room subject. Choose "Change subject", the following information is displayed in the chat window: "The room subject has been removed" after the subject was removed, or "The room subject is now: some subject" after the room subject was set to "some subject". Run Swift join any MUC room, disconnect from server (using another Swift client change subject to "Test") after reconnecting the following information is displayed in chat window: "The room subject is now: Test" Change-Id: Ice901697a6a381464d694147b17830b4e62c8198
2017-02-23Disconnect signals in ComponentSessionStanzaChannel dtorTobias Markmann
This is similar to what is currently already done in the dtor of ClientSessionStanzaChannel. This should fix potential crashes that have been reported in Sluift with ASAN enabled, showing a heap-use-after-free in ComponentSessionStanzaChannel::handleSessionFinished. Test-Information: All unit tests pass successfully on macOS 10.12.3 with clang-5.0. Change-Id: Id1e95894f9d5fe85922c0e11d18a38d46bd08e3c
2017-02-22Cache some recently used entity capability lookups in memoryTobias Markmann
Previously any entity capability lookup was only cached on the disk. This meant that even for a cache hit, you would read from disk and parse the disco info XML in the cache, to return the result. This commit adds an addition LRUCache based in-memory cache. This extends the EntityCapsProvider API with a non-const method, i.e. getCapsCached, which allows active caching of results from the disk cache. Test-Information: All unit tests pass on macOS 10.12.3. This noticeably speeds up the duration of a join of a large MUC room, i.e. about 160 occupants, to about half of the previous duration. Change-Id: I0fc254cda962860416713822ddcad15ae13085f1
2017-02-22Add LRUCache utility class to SwiftenTobias Markmann
This implements a simple lookup cache with least recently used replacement strategy. This also adds Boost.MultiIndex from version 1.56 to 3rdParty. Test-Information: Added some unit tests for LRUCache, which pass on macOS 10.12.3 with clang-5.0 Change-Id: I0567945b1197d3fe786bf9d82fdb5e755743b975
2017-02-21Add checks to verify if the input data is a valid XML/XMPPJoanna Hulboj
Test-Information: Unit tests pass OK. Change-Id: Ibd7897c1c1249af7ac60a6549afd4c2362fcf0c0
2017-02-10Display error message in profile window if vCard request failedTobias Markmann
Also fixed an typo error in GConfProxyProvider.cpp that prevented compilation on Linux. Test-Information: Tested with an XMPP server with vCard support disabled and also with vCard support enabled. Tested profile window and profile editor window. The profile window will show cached vCard data if present and the error message. The profile editor window will only show the error message in case of an error. Tested profile window and profile editor window in a scenario where vCard support is first enabled in the server, then disabled, and finally enabled again, and opening the editors in between. Potential error messages were always correctly cleared before showing the dialog. Tested on macOS 10.12.3 with Qt 5.7.1. Change-Id: I3958c35286f6f0096d1605c29816f666530aae03
2017-02-09Update GConfProxyProvider to new string to HostAddress functionTobias Markmann
This change was missing in commit 43479ef. glib is automatically initialised nowadays and g_type_init() is a deprecated function. Surrounded the relevant code with a GLIB_CHECK_VERSION macro. Test-Information: Tested build on Ubuntu 16.04.1 LTS. Change-Id: Iea7242f6366d827b2cc6ce355cb923872f774a6c
2017-01-11Integrate googletest and googlemock libraries to 3rdPartyTobias Markmann
googletest and googlemock from release 1.8.0 have been copied to the 3rdParty folder. With this commit tests for Swift project can also written using googletest and googlemock APIs. The test runners will execute test suites written to either test library. Passing —-xml to a test runner will now create two test report XML files, namely $programName-report.cppunit.xml and $programName-report.gtest.xml. The ByteArrayTest has been converted to use googletest instead of googlemock to serve as an example and test the integration. Test-Information: Build all tests via ‘./scons test=all’ and verified all tests are run. Build all tests via ‘./scons test=all checker_report=1’ and verified that two report XML files are generated per test runner executed. Change-Id: I81a9fb2c7ea5612fc1b34eef70ed7e711bfeea81
2016-12-15Merge branch 'swift-3.x’Tobias Markmann
* swift-3.x: - Fix building Swift on 32-bit Linux distributions - Remove optional_fwd.hpp use; workaround for Boost Bug #12179 - Split COPYING.thirdparty in contributions/dependencies - Fixes for building packages on Debian Conflicts: BuildTools/SCons/SConstruct Sluift/Console.h Sluift/ITunesInterface.h Sluift/Terminal.h Swift/Packaging/Debian/debian/control.in Swift/QtUI/SConscript Swiften/Elements/Stanza.h Swiften/FileTransfer/FileTransferTransporter.h Swiften/FileTransfer/IBBReceiveSession.h Swiften/JID/JID.h Swiften/Network/BoostConnectionServer.h Swiften/Network/ConnectionServer.h Swiften/Parser/AttributeMap.h Test-Information: Builds on macOS 10.12.1 with clang trunk. Change-Id: I9f41ab199f227bc106721627ea994313c68e5cfe
2016-11-30Show MUC PM item-not-found error in MUC PM windowTobias Markmann
Previously, if one would send a MUC PM to a user that has left a room the error response from the MUC would be shown in the MUC room. Now the error will show in the MUC PM window, if the MUC PM full JID has a ChatController. Test-Information: Added unit test verifying new behaviour. Manually verified that the error is shown in the MUC PM window instead of the MUC room window. Change-Id: I1b259d5eee9e22217bbe7e5c09294d2166a77895
2016-11-28Correctly handle server initiated closing of streamTobias Markmann
If a server closes the XMPP stream, it sends a </stream:stream> tag. The client is supposed to respond with the same tag and then both parties can close the TLS/TCP socket. Previously Swift(-en) would simply ignore </stream:stream> tag if it was not directly followed by a shutdown of the TCP connection. In addition there is now a timeout timer started as soon as Swiften or the server initiates a shutdown. It will close the socket and cleanup the ClientSession if the server does not respond in time or the network is faulty. Refactored some code in ClientSession in the process. Moved ClientSession::State to a C++11 strongly typed enum class. This also fixes issues where duplicated </stream:stream> tags would be send by Swift. Test-Information: Tested against Prosody ba782a093b14 and M-Link 16.3v6-0, which provide ad-hoc commands to end a user session. Previously this was ignored by Swift. Now it correctly responds to the server, detects it as a disconnect and tries to reconnect afterwards. Added unit test for the case where the server closes the session stream. Change-Id: I59dfde3aa6b50dc117f340e5db6b9e58b54b3c60
2016-11-23Fix building with Avahi support on LinuxTobias Markmann
This was broken in commit 43479ef. Test-Information: Build with Avahi support on Ubuntu 16.04.1. Unit tests passed. Change-Id: If7ee5f740510956d89f6c406e68b92ddeb61cf85
2016-11-23Migrate remaining Swiften/Base/foreach.h use to range-based for loopTobias Markmann
Test-Information: Build on macOS 10.12.1 and all tests pass. Change-Id: Iedaa3fa7e7672c77909fd0568bf30e9393cb87e0
2016-11-18Improve string to HostAddress conversion APITobias Markmann
Previously HostAddress had a constructor which allowed initialisation via a std::string. This initialisation can fail and this is heavily used for checking whether a string is a valid IP address. This constructor is removed in this commit and replaced by a static method HostAddress::fromString, taking a string and returning an optional HostAddress. This clearly communicates that the conversion can fail. Test-Information: ./scons test=all passes on macOS 10.12.1. Change-Id: Idaafee6f84010ce541c55f267ac77ad6ac8f02b4
2016-11-10Use FeatureOracle to detect file-transfer support in rosterTobias Markmann
The FeatureOracle provides tri-state feature lookup functionality for bare JIDs. It returns Yes if a feature is supported by all resources of the bare JID, Maybe if some support it, and No if none of the resources support it. If passed a full JID, it returns the specific features supported by that end-point. Sending a file to a bare JID, will send a file to the resource of the bare JID with the highest availability by presence, show status and priority and which supports the features required for a Jingle file-transfer. Test-Information: Added unit test verifying new behavior. All tests pass on OS X 10.11.6. Added new unit tests for FeatureOracle. Manually verified that the roster and chat window both use the same mechanism to detect support for file-transfers. Manually verified that file-transfers via the contact list goes to already bound full JIDs if there is an existing ChatController. Change-Id: I0175ac42ecb73f1d54f9c96ffbba773eb5e24296
2016-11-07Log address when failing to initialise HostAddress from stringTobias Markmann
Test-Information: Builds on macOS 10.12.1. Change-Id: Id06e66171cbc5b6417701a8de57b901b0d80f17c
2016-11-04Change logging output to use SWIFT_LOGTobias Markmann
Test-Information: Builds on macOS 10.12 and unit tests pass. Change-Id: Icc1bce9a0e0e85377eef0c8b87bf82d37943d3a5
2016-11-04Cleanup headers in Base64(.h, .cpp)Tobias Markmann
Test-Information: Builds on macOS 10.12.1. Change-Id: Ifbaf78c4b95a4baac767667c7df367c6508a3e85
2016-10-21Fix version number for libminiupnpc version switchTobias Markmann
Test-Information: Without this building failed under Gentoo Linux distribution. Verified this on Sabayon, a desktop Linux distribution based on Gentoo, by adding it to our cross distribution test. With this fix it builds on all platforms, including Sabayon. Change-Id: I23aec19b9755244dd3dbe6f581cf170eaf334dfc
2016-10-21Fix data-race in DummyEventLoop::processEvents()Tobias Markmann
Previously DummyEventLoop::processEvents() wrote to the hasEvents_ member without having locked the corresponding mutex. Changed code to use C++11 atomics instead. Test-Information: All unit tests pass on macOS 10.12. Change-Id: I13aa1566d55b7c0098f927e9c8061547f7056f5d
2016-10-05Add missing sensible asserts to testing and QtMainWindowTobias Markmann
Test-Information: Unit tests pass in ASAN-enabled build on macOS 10.12. Change-Id: I7a8dae7d06e5e1d3dc9391f9c9a342df384d90fc
2016-10-04Remove optional_fwd.hpp use; workaround for Boost Ticket #12179Tobias Markmann
Test-Information: Builds on macOS 10.12 and unit tests pass. Change-Id: Ia979e7dbd6f6c84085b1b951d81b925dffbed262
2016-09-30Change custom memory copy loop to std::memcpyTobias Markmann
Test-Information: Swift builds with test=all on macOS 10.12 and all tests pass. Change-Id: I9d7e8c49e65ac272a7ee672a95da5e24609d0a22
2016-09-30Add missing error check in HostAddress::toStringTobias Markmann
In the process converted try/catch use to Boost's error code for more explicit error checking and added log output. Test-Information: Swift builds with test=all on macOS 10.12 and all tests pass. Change-Id: I6e465354dbb38c7178b0406b9a544ebd3be62ddd
2016-09-29Fix uninitialised class membersTobias Markmann
Initialised previously uninitialised class members. Changed some raw pointers to std::unique_ptr for clearer and automatically initialised code. Test-Information: Builds on macOS 10.12 and unit tests pass in ASAN-enabled build. Change-Id: I7900fe6131119c228ca92c79c0ee8125137f2e48
2016-09-29Explicitly handle all possible SecTrustResultType enum valuesTobias Markmann
Test-Information: Unit tests pass on macOS 10.12. Change-Id: I32f884e2525b6200e5fb3f04d58f77304d16daa0
2016-09-29Fix potential resource leaksTobias Markmann
IDGenerator was missing the virtual keyword on its method which is reimplemented by SimpleIDGenerator. Some other classes were missing destructors or virtual destructors. Test-Information: Builds on macOS 10.12 with Qt 5.5.1, all unit tests pass. Change-Id: I482bc249578d38a922256d1fa5241515ce45d0c0
2016-09-26Use const std::unique_ptr for pimpl idiom usageTobias Markmann
All our pimpl idiom usage used std::shared_ptr due to being written in C++03. Now we use C++11 and const std::unique_ptr is more sensible. Test-Information: Builds on macOS 10.12 and unit tests pass. Change-Id: I1b9b3fbb22e337d53ae71e5a5e03118998cc3376
2016-08-24Use SSL_CTX_set_default_verify_paths to set trusted CAs for OpenSSLTobias Markmann
This fixes setup of trusted CAs on Fedora. Test-Information: Tested successful login to two different hosts with different CAs. Previously the there was no certificate warning on Debian 8 and a certificate warning on Fedora 24. With this patch there is no certificate warning anymore on Debian 8 and Fedora 24. Change-Id: I70e71eb9734f2012bcd5c4b784bab47917b44234
2016-08-10Add missing includeKevin Smith
Test-Information: After this patch, experimental=1 builds on OS X (didn't previously) Change-Id: Ibaba190212f22332d776f3ecc00f692621da0815
2016-08-05Add a debugging helper for serializing Swiften types to ostreamTobias Markmann
Test-Information: Tested on OS X 10.11.6. Change-Id: I9ecb60f5c3956d52fd42acd1b0d85725277efc51
2016-07-27Fix Doxygen warningsTobias Markmann
This fixes Doxygen warnings about missing parameter documentation or documentation of non-existing parameters. Test-Information: Ran ./scons doc=1 without warnings with Doxygen 1.8.11. Change-Id: I360d042e5c80f418e7574a26fa1283a82fc504d4
2016-07-27Include missing cassertMichael Vetter
Test-Information: Build successfully on openSUSE Leap 41.2 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Change-Id: I9bd96e99e166ae02e1c2f1a8481d61c57edbbe71
2016-07-22Remove pragmas to ignore unused private fieldsTobias Markmann
They were introduced a while back through automatically generated code. Removal of those #pragma statements reduces the code and further improves maintainability. Test-Information: Builds on OS X 10.11.5 without any warnings. Change-Id: Idc2989663d39e351bedf9e1355eb5c7d163f11c2
2016-07-22Add support for libminiupnpc version 2Tobias Markmann
Test-Information: Build successfully on openSUSE Tumbleweed which only has libminiupnpc 2.0 as package. Unit tests passed. Change-Id: I650e1224014162b55cdf64df7e72466b52dc3ade
2016-07-20Add release dates to Swift and Swiften ChangeLog.mdTobias Markmann
The added dates are the author dates of the tagged commit corresponding to the release. Test-Information: None. Change-Id: I35c72a8fb017c48a99c5b655d7857498cba790b3
2016-07-15Add missing includes for assert()swift-4.0beta1Tobias Markmann
This fixes building via ./Swift/Packaging/Debian/package_all_platforms.sh . Removed #pragma statements and did minimal associated cleanup. Test-Information: ./Swift/Packaging/Debian/package_all_platforms.sh passes successfully. ./scons test=all passes on OS X 10.11.5. Change-Id: I1688da31ca6081eddfcda83d473b15c3f711b420
2016-07-14Close Swift and Swiften changelogs for 4.0-beta1Tobias Markmann
Test-Information: None. Change-Id: I04e12ee197e45ec47a8f93bf97248adbbe12f649
2016-07-14Add in progress changelog for SwiftenTobias Markmann
Test-Information: None. Change-Id: Iab2023d176c4b49f5cccc82968ea45b80e0b7e78
2016-07-11Fix handling of incorrect MUC component behaviorTobias Markmann
Swift used to crash when a MUC component returned multiple unavailable presences on rejoin of a room hosted on a restarting buggy MUC component. Test-Information: Added test case that used to crash Swift. Tests pass without crash on OS X 10.11.4 Change-Id: I52280976944170c6e143197d4b3dc517dc13ecbb
2016-07-01Implement Message Carbons in Swift and Swift/ControllersTobias Markmann
If the server supports message carbons, Swift will try to enable it. Carbon copied messages will open a chat window in the background if no chat window exists for the conversation. Test-Information: Tested with a XMPP server Swift and a mobile Android client all supporting message carbons. Tested direct messages and MUC PM messages. All working as expected. Added unit tests for message carbons of sent messages and message carbons of received messages. All unit tests pass on OS X 10.11.5 Change-Id: I8d5b5d9975651a2353909dea976f58e4bf12e014
2016-06-29Fail file-transfer if proxy session of candidate does not existTobias Markmann
Test-Information: Tested with a buggy XMPP client that calculates S5B DSTADDR in a non-standard way. Previously this lead to Swift crashing on an assert. Now Swift just indicates file-transfer failure to the other party. Change-Id: I4ed47f9647a1851f2a5101657bcd569c106d638f
2016-06-22Treat JIDs with empty resources as invalidTobias Markmann
Cleaned up JID.cpp in process. Test-Information: Adjusted tests accordingly. All tests pass pass on OS X 10.11.5. Change-Id: I774344c8f7378dafe9249217503c082f46890457
2016-06-22Temporarily disable CertificateErrorTestTobias Markmann
The tests are based on the http://www.tls-o-matic.com/ service, which is currently dysfunctional. Disabling the test so running all system tests does not fail anymore. Test-Information: ./scons test=all passes on OS X 10.11.5. Change-Id: I8df2e15efa6787e01dfebd78b61e07d1d1eed5c0