summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-11-19Remove std::endl from SWIFT_LOG callsEdwin Mons
The std::endl is now added by ~Log, but only for output to stderr or a log file. Calls to the Android logging system or manually set callbacks will not include the newline in the logging output. JIRA: SWIFT-430 Test-Information: Unit tests pass on Debian 9 Checked that running Swift with logging to stderr still had a newline. Change-Id: I096fdba78a3b8f87db2097951c28c528592183e8
2019-10-30Bring StreamError enum to specEdwin Mons
RFC 6120 no longer defines invalid-id, and adds unsupported-feature. The StreamError enum was derived from the schema in section A.2, which erroneously had these two deviations from 4.9.3. Test-Information: Unit tests pass on Debian 9 Change-Id: I2bb3d0b09448877bbd4618fa852baab87bfa1abc
2019-10-30Fix libxml2 crash on certain invalid inputEdwin Mons
When the libxml2 parser is fed data with an odd combination of invalid input (triggering the parser to assume 2 or 4 byte encodings were in play), I/O errors might occur. In that case, the parser context will not have its internal error set, but the call to xmlParseChunk will return the right error. The parse() method now uses the output of xmlParseChunk directly instead of trying to obtain the error from the parser context afterwards. Encoding errors during parsing were emitted to stderr because the default error handlers were still in place. These have been replaced with custom handlers that suppress the output. Test-Information: Unit tests pass on Debian 9 Change-Id: Ie01db4be467e5197203c9d07d3356f5d44d8b9b4
2019-09-25Remove duplicated argumentsJoanna Hulboj
Test-information: Unit tests pass on Windows 10 and Ubuntu 18.04.1 LTS. Change-Id: Icea837d91f28f47f7b0a90bc620b26c5567c8421
2019-09-24Process attribute and element prefixesJoanna Hulboj
XML (Expat/LibXML) parsing modified to process prefix information. Prefixes for attributes stored within attributes. Prefixes for elements passed in additional callback (only if prefix present). Test-information: Unit tests pass on Windows 10 and Ubuntu 18.04.1 LTS. Change-Id: Ib6b5087feed758c31895f426df6a3c7ea975f248
2019-09-16Close the stream for disallowed XML featuresJoanna Hulboj
According to RFC 6120 if any disallowed XML feature is encountered, we should close the stream with a <restricted-xml/>. The following features of XML are prohibited in XMPP: - processing instructions - internal or external DTD subsets - internal or external entity references - comments Test-information: Unit tests pass on Windows 10 and Ubuntu 18.04.1 LTS Change-Id: I475920c91b7f9da51ab37c106a4783a52f6e3cae
2019-07-22Signal namespace declarations to ParserClientsEdwin Mons
Prior to calling handleStartElement, the ParserClient handleNamespaceDeclaration will fire for each namespace declared on the element. Test-Information: Unit tests pass on Debian 9 for both expat and libxml2 Change-Id: Ic42e83aee83edfbb2aa5c971997808eb6e133223
2019-05-13Add flag to signal final XML dataEdwin Mons
XML parse now takes an optional boolean that will signal that with the data that is fed into the parser, the document should now be complete. This will allow the parser to reject partial documents. Test-Information: Updated unit tests pass. Checked that default behaviour wasn't changed. Tested with various partial and complete documents. Change-Id: Ide7c2e47c49d5667f1febcb23da366e96d0dbc21
2018-11-14Address bad_numeric_casts for filetransfersEdwin Mons
The filetransfer blockSize is now an unsigned integer, as 0 could be used to denote an invalid block size as well (and indeed, already indicated that better than -1 did). All use of numeric_cast in filetransfer code has been fixed to deal with the possibility of thrown exceptions. Test-Information: Unit tests pass on macOS and Debian Change-Id: I1833d553bae071238be20ebc386ef602effb78b0
2018-11-14Remove numeric_casts from BOSH parserEdwin Mons
The two uses of numeric_casts have been rewritten as static casts, with asserts to guarantee (and inform the developer) that the number is never negative (code inspection showed that this should never be the case). Test-Information: Unit tests pass on macOS and Debian Change-Id: I3ca63724721ecd8e351d9017e0975b6ae326f85f
2018-11-14Fix Stanza Ack maximum and testsEdwin Mons
The stanza ack code now uses a constexpr without numeric cast to calculate the maximum, and test code uses the constant UINT32_MAX from limits, both of which should result in the same number. Test-Information: Unit tests pass on macOS 10.14 Change-Id: Iba8fc779e52699d480d1ce458df0c6581a16ad06
2018-11-09Remove numeric_casts from XML parsersEdwin Mons
The code has been updated to use asserts where a sensible recovery path was deemed impossible, and a conditional return for parse. In general, our XML parsing will fail for any single parse of a document over roughly 2 2GiB, which is probably not going to be a practical issue soon. Test-Information: Unit tests pass on macOS 10.13 using Expat and Debian 9 using LibXML Change-Id: I3a8da802860028ea278b322af081c2b22b55a442
2018-11-08Consistently use unsigned short for network portsEdwin Mons
Network ports are now consistently stored as unsigned shorts, apart from the options and user interface, where -1 is still used to denote the use of default ports. Test-Information: Unit tests pass on macOS 10.13 and Debian 9 On macOS: tested the UI with various proxy and manual ports, behaviour as expected. Change-Id: I7a65f40083022887aa30ed7b21eadc56d0c52be1
2018-05-07Replace boost::lambda with C++11 lambdasTobias Markmann
Test-Information: Builds on macOS 10.13.4 with clang trunk. All unit and integration tests pass. Produces fewer warnings with clang trunk (previously reported marked-unused-but-used warnings). Change-Id: I849d764537cfbc380155e87b033dc5e517b3c342
2018-04-28Fix compiler warnings for SwiftenKevin Smith
Test-Information: ./scons allow_warnings=0 Swiften now builds on latest macOS Change-Id: Ic2095d5d112093d021f7f4695fbce73f315377cf
2018-03-27Add new ReferencePayload element class, parser and serializerPeter Burgess
Added a new element object ReferencePayload, and created the parser and serializer to handle this element. Currently no functionality to send references directly in swift, nor to render their contents. Test-Information: Unit tests written and passed for serializer and parser, testing various types of valid and invalid references, and testing references with embedded payloads. Change-Id: I81fd5d9e020fac1729640f297705806af97f6388
2017-07-18Add MIXUpdateSubscription Element, its Parser and SerializerTarun Gupta
Updates MIXJoin Element list of subscriptions to an unordered_set. Remove redundant MIXSubscribe Element. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for MIXUpdateSubscription Parser and Serializer based on examples in XEP 0369, which passes. Tested on Ubuntu 16.04 LTS. Change-Id: Ied06269cf329b4fdffdde4ace67ebffa4089fbde
2017-07-14Add MIXRegisterNick Element, its Parser and SerializerTarun Gupta
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for MIXRegisterNick Parser and Serializer based on examples in XEP 0369, which passes. Tested on Ubuntu 16.04 LTS. Change-Id: I80796db9d540c58296afa3454f29e1fb81d04615
2017-07-13Remove Swiften/Base/Override.hTobias Markmann
Replaced SWIFTEN_OVERRIDE with C++11 standard override keyword. Test-Information: Tested on macOS 10.12.5 with clang trunk. Change-Id: If89c6cc2a648662522a320834c314496c943a55a
2017-07-12Add MIXSetNick Element, its Parser and SerializerTarun Gupta
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for MIXSetNick Parser and Serializer based on examples in XEP 0369, which passes. Tested on Ubuntu 16.04 LTS. Change-Id: I23081637f2aecf9fc5abc63147d01bfd4d2bb2f1
2017-07-11Add missing SWIFTEN_OVERRIDE statements to dtorsTobias Markmann
Also removes -Winconsistent-missing-destructor-override from the list of ignored clang warnings. Test-Information: Tested on macOS 10.12.5 with clang trunk. Change-Id: Iad951879e01eb951a2a393399f55e4e37437c6a2
2017-07-11Add MIXPayload, its Parser and SerializerTarun Gupta
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for MIXPayload Parser and Serializer based on examples in XEP 0369, which passes. Tested on Ubuntu 16.04 LTS. Change-Id: I45da05d6fe57b4be7ed8534dd84cbf0fd31ced1a
2017-07-07Make std:: make_unique available in gcc with c++11Joanna Hulboj
Test-Information: Unit tests pass OK on Windows 10 and CentOS 7.3. Change-Id: I33c9eb6b3e6409727350a44e6d5c88c5e8907275
2017-07-07Update namespace for MIX ElementsTarun Gupta
Namespace update from urn:xmpp:mix:1 to urn:xmpp:mix:0 for MIX elements for checking against server implementation License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Change-Id: I1bbd06d83f54fcde81ae0ed06dda90aec0ef1aeb
2017-07-06Adds MIXLeave Element, its Parser and Serializerswift-5.0alphaTarun Gupta
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for MIXLeave Parser and Serializer based on examples in XEP 0369, which passes. Tested on Ubuntu 16.04 LTS. Change-Id: Ie9eb3341b23099de4dda2b9915d28115dbfe5837
2017-07-05Adds MIXUserPreference Element, its Parser and SerializerTarun Gupta
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for MIXUserPreference Parser and Serializer based on examples in XEP 0369, which passes. Change-Id: I06595325f4cc2b34d5ab5a93a6caa00330fe0737
2017-07-03Adds MIX Create Element, its Parser and SerializerTarun Gupta
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for MIX Create Parser and Serializer based on examples in XEP 0369, which passes. Change-Id: I33b85c8243d55cd293c886f2607bdd9dec6c7bdb
2017-06-26Adds MIX Join Element, its Parser and Serializer.Tarun Gupta
Add MIXDestroySerializer to FullPayloadSerializerCollection. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for MIX Join Parser and Serializer based on examples in XEP 0369, which passes. Tested on Ubuntu 16.04 LTS. Change-Id: Ibf7446dd65714dccdd39c485549fd9fb9faba40c
2017-06-26Remove unneeded forward declarations from Swiften headersTobias Markmann
Found by cppclean. Test-Information: Still builds on macOS 10.12.5 with clang trunk. Change-Id: Ie8a154e12b196587c956c8b333abf529a36f6bb3
2017-06-25Adds MIX Destroy Element, its Parser and Serializer.Tarun Gupta
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for MIX Destroy Parser and Serializer based on examples in XEP 0369, which passes. Change-Id: I56810eb2fc26cc6aeb5e1cfb2a32e312f0607ba9
2017-06-22Handle badly-formed labels catalogueThanos Doukoudakis
Updated the code to ignore labels that belong to a catalog item that is malformed and not added as a valid item. Test-Information: Added unit tests for badly formed catalog items and labels. Tested on Windows 10 (Qt 5.7.1) and Ubuntu 16.04 (Qt 5.5.1) Change-Id: I11fbd3b54faa3ee225a08a87ad8ed59977b7ff20
2017-06-21Fix compiler warningsKevin Smith
Both catching polymorphic base classes by value and explicitly moving things preventing return value optimization. Test-Information: Compiles on macOS with latest xcode with allow_warnings=False and unit tests pass Change-Id: Ibdc67f4f2019f85f14635df2a3ff06bddbb8e2b6
2017-06-18Adds MIX Participant Element, its Parsers and Serializers.Tarun Gupta
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Adds tests for MIX Participant Parser and Serializer from XEP-0369, which passes. Tested on Ubuntu 16.04 LTS. Change-Id: Iee2d96c8ebdf9461c28518f8f8c28c11d2a94524
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
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-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-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-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-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-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-06-14Fix handling of notify attribute in PubSub retract elementsTobias Markmann
Test-Information: Added serializer and parser unit tests. All tests pass on Mac OS X 10.11.4. Change-Id: I8550c76ba182a67613d55634c72c0f2979f8b80a
2016-06-10Fix remaining compiler warnings on OS X with clangTobias Markmann
This changes HippoMocks include to -isystem include so it will not cause compiler warnings. This changes UserLocation floating point values to double and remove remaining numerical casts. Change C++11 compiler test to not cause warnings. Test-Information: Builds with allow_warnings=0 on OS X 10.11.5 with Xcode clang. Change-Id: I26c60265a86c9be656089ade63fe9ad63851580f
2016-05-25Remove unnecessary include of iostream headerTobias Markmann
Move std::cout/cerr logging to SWIFT_LOG. Test-Information: Builds and all tests pass on OS X 10.11.5. Change-Id: I0a0c24654a8b3abf3244a79fd6d970eee90559d0
2016-04-25Convert hard tabs to four spaces in all our SConscript/*.py filesTobias Markmann
Test-Information: Test that it still builds and unit test pass on OS X 10.11.4. Change-Id: I2eb4a0b707991aee553db36a8cd1ae28b813acab
2016-04-05Migrate to Boost.Signals2 from Boost.SignalsTobias Markmann
Boost.Signals was deprecated and is not improved further. This patch removes Boost.Signals from 3rdParty and adds Boost.Signals2 and its dependencies. Also removed the Qt signals compatibility file Swiften/Base/boost_bsignals.h. Test-Information: Build and ran unit tests on OS X 10.11.4. Confirmed successful login using Swift client. Change-Id: Ie6e3b2d15aac2462cda95401582f5287a479fb54