summaryrefslogtreecommitdiffstats
path: root/Sluift
AgeCommit message (Collapse)Author
2019-01-25Allow Sluift to set stanza IDsKevin Smith
Test-Information: Compiles Change-Id: I5bfbf270524a1a31c9105f108f47f64eb95276d1
2018-11-27Sluift: Added handling of roster push eventRoger Planas
Swiften handles roster push event notifications, but those were not passed to Sluift, so a Sluift client, when querying events, would not be aware if an XMPP server roster pushes. This patch adds extra events types to Sluift so that method for_each_event reports roster pushes notifications. Test-information: Used sluift client to retrieve all items after adding, removing and updating roster items, and now Sluift clients can see these events. Change-Id: Ide5597bf2b39e3cc20014c66ba9153c551eec670
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-10-12Fix Component's disconnect to run event loop while isActiveRoger Planas
The Component::disconnect() was controlling the running of the event loop with the isAvailable flag, but it turns out that depending on timing, a re-connect could be attempted and the component erroneously claim that the "Component is already connecting or connected", which could not possibly the case if the first attempt to connect the component failed (hence, not possible it was connected). By updating the event loop to use the correct isActive flag, this issue is fixed. This error was highlighted as a result of the previous commit "Prevent connect on active sluift clients and components". Also, the getNextEvent is fixed to do not suffer from the same problem, and use isActive instead of isAvailable. Test-information: Before the patch, a test that would attempt a second component connect after a failed one would randomly fail. After the patch, a test that would attempt a second component connect after a failed one has passed hundreds of time without failure. Change-Id: I20be6b1c8aec485ded3330c143dedd2161c4c66e
2018-10-04Prevent connect on active sluift clients and componentsEdwin Mons
Connect should not be called twice on clients or compoments without disconnecting first. While this worked in some cases, mixing connect options, specifically first trying without, and then with a bosh_url, would lead to asserts being triggered. The connect logic now checks whether there's already a connection in progress or established, and raises a Lua exception early if there is. Test-Information: Tested on macOS 10.13 Connected components and clients with invalid and valid hosts, and with valid and invalid bosh_urls, all with and without disconnecting in between attempts. No asserts were triggered, and appropriate Lua exceptions were thrown. Change-Id: I6b91b57945844bce7fce0073e5d0fe199ab815d5
2018-07-12Fix Python 3 compatibility of our SCons and tooling Python codeTobias Markmann
For the upcoming update to Scons 3, which works with Python 2 and Python 3, this change makes our code compatible with Python 3 so that it still works with Python 2. Test-Information: Tested these changes with SCons 3.0.1 on macOS 10.13.6 with Python 2.7.15 and Python 3.7.0. Change-Id: Idb5207b179a79a0dbe89d7e620d182a7d2f1ca6c
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 SluiftKevin Smith
Test-Information: ./scons allow_warnings=0 Sluift now builds on latest macOS Change-Id: I7aca1c733dd86c772fc3a55f76d4915ad3c76e8d
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
2018-02-21Add a Sluift example of sending a custom reference payloadEdwin Mons
The example will send a message with a data reference as an example of creating and sending custom children of a message. Test-Information: Reference received on macOS 10.12 Change-Id: If670db0c2ded426e8502a4d331026cf56f6df8df
2017-10-30Sluift: Add support for Lua 5.3Roger Planas
This patch adds support for Lua 5.3, while keeping support for Lua 5.1 (a build with the bundled Lua succeeds) Test-information: Builds cleanly on Lua 5.1, 5.2 and Lua 5.3. Tests that make use of Sluift work with both Lua 5.2 and Lua 5.3 Change-Id: I4cbe2eb09ec8c753d8624047f5456be1de72c679
2017-10-26Sluift: Add shortcut for get disco_info to componentsRoger Planas
disco_info shortcut was available to clients but not to components. This patch addresses this. Test-information: Used component:get_disco_info and data is retrieved successfully. Change-Id: Ie8d80e3180ca400e5694fd581f60f08511e36ca4
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-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-04Sluift: Add extensions support to disco#info queriesRoger Planas
Only identities and features were reported. Now extensions, if any, will also be reported Test-information: Sent disco#info to a muc room, and got the following extensions back (along with identities and features, so no regression) Change-Id: Ib4ab17114df4da5de51945df9e53c12bd42716d1
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-05-15Add pointer checks in some CoreClient members.Thanos Doukoudakis
This patch adds some checks in the CoreClient class to avoid accessing stanza and session channels to send data when they are not available. The Sluift lua wrapper functions will throw an exception in these cases. Test-Information All unit test pass. Timlx: Test Suite ‘basic’: All tests Pass. Test Suite ‘fmuc’: All tests except FmucChain Pass (Not related with the changes) Change-Id: I3d5894b3cfdafd0ea28c0fb33b6db8588f2a5c8f
2017-05-05Sluift: Enable more options to be passed to connect()Roger Planas
There are many connection options that Sluift enables (bosh_url, tls, etc..) but only host/port were understood by connect(), the rest were meant to be set by using set_options(). This can be sometimes annoying, so to make things uniform, now connect() should accept the same options settable in set_options() Test-information: Run test to check you can pass values to connect() rather than set_options() and things worked. Change-Id: Ic79aa5c6b232ddc2ffcfc3c14aa6f31233242314
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-02-14Sluift: Add shortcut for get disco_infoRoger Planas
So instead of doing something like this local features = client:get({ to = to, query = "<query xmlns='"..sluift.disco.features.DISCO_INFO.."'"..node.."/>" })['features'] we can now do something like this local features = client:get_disco_info({ to = to })['features'] That is, avoid raw calls. Test-information: Updated test calls to use new API and noticed no different behaviour to old code. Change-Id: I0d9a7c25c0f56499487f8aa0e67e30e9fa1b56ac
2017-01-31Sluift: Add client methods for adding and removing JIDs from blocklistRoger Planas
A previous commit added a get_block_list() client method to retrieve the list of blocked items. This patch extends that and adds capabilities to add and remove items to such list. Test-information: Tested with client and was able to successfully add items to list, delete and delete all Also tried to delete a non existing item and it rightly complained. Change-Id: Iabbfdbd9e74ddc9740db5c9871b8355210aa0727
2017-01-27Sluift: Add handling of block/unblock eventsRoger Planas
Swiften handles blocklist event notifications, but those were not passed to Sluift, so a Sluift client, when querying events, would not be aware if an XMPP server pushes block/unblock. This patch adds an extra event type to Sluift so that method for_each_event reports block/unblock notifications, in addition to a new API 'get_block_list' to retrieve the blocklist from the server. Test-information: Used Sluift client to retrieve blocklist and it is as expected. Also used client to retrieve all items after adding, removing and removing all items in the blocklist, and Sluift clients can now see these events. Change-Id: I0b76289ebd9e63505ff8a99cd9c0aa0e93af0c22
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-07Sluift: Added Carbons element convertorsRoger Planas
Sluift was showing payloads coming from a carbon copied message as a series of dom payloads, which was not really usable. With these ElementConvertors, the payload is translated into a much more sensible table Also a minor update to both presence/message events, which now will report the 'to' as well. Seemed handy to have. Test-information: Carbons sent/received messages are formated into a meaningful table now. Change-Id: I5b8943636e09e5377bde76d16970c01df29164d6
2016-10-19Always add a fields table member in FormConvertorEdwin Mons
The fields member of the forms generated by FormConvertor is used for lookups in the __index metafunction. If a form is parsed with no fields (and possibly no items), there wouldn't be a member 'fields', causing another __index lookup, triggering infinite recursion. There will now always be a fields array, which may be empty. Sluift/Tests/FormTest.lua has been updated to test against an empty form. Test-Information: Updated FormTest.lua works without issues. Change-Id: Idee98f23bf42e1213ca3d03707f908ed5317dad6
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 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-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-09-21Fix crash in Sluift CommandConvertorEdwin Mons
If a command table contained actions or notes, an extraneous lua_pushnil happened, leading to a crash. Test-Information: Rendering a command using to_xml with actions or notes now works as expected on OS X 10.11 Change-Id: Ic99b2546ac261edf6b52b92e63701f397fc6201a
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-12Use C++11 threading library instead of Boost.ThreadTobias Markmann
This cuts down our dependency on Boost further. Another benefit is that mutex classes of C++11 standard library are recognized by TSAN. Test-Information: Unit and integration tests pass on OS X 10.11.4. Change-Id: Id4dcdb42e3d5155e107ce1d7618acbf26f913b6f
2016-04-07Fix building with system boost on Debian 8.4Tobias Markmann
The signals library is still called signals and not signals2. Test-Information: Builds and unit tests pass on Debian 8.4 with system GCC. Change-Id: I1d1b3f6bade979bc8a181915176b84be0ddf6597
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
2016-04-04Modernize code to use range based for loops using clang-tidyTobias Markmann
Run 'clang-tidy -fix -checks=modernize-loop-convert' on all source code files on OS X. This does not modernize platform specific code on Linux and Windows Test-Information: Code builds and unit tests pass on OS X 10.11.4. Change-Id: I65b99e0978cfab8ca6de2a3e5342e7a81416c12c
2016-04-04Modernize code to use C++11 shared_ptr instead of Boost'sTobias Markmann
This change was done by applying the following 'gsed' replacement calls to all source files: 's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g' 's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g' 's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g' 's/boost::make_shared/std::make_shared/g' 's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g' 's/boost::shared_ptr/std::shared_ptr/g' 's/boost::weak_ptr/std::weak_ptr/g' 's/boost::enable_shared_from_this/std::enable_shared_from_this/g' The remaining issues have been fixed manually. Test-Information: Code builds on OS X 10.11.4 and unit tests pass. Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
2016-04-01Modernize code to use C++11 nullptr using clang-tidyTobias Markmann
Run 'clang-tidy -fix -checks=modernize-use-nullptr' on all source code files on OS X. This does not modernize platform specific code on Linux and Windows Test-Information: Code builds and unit tests pass on OS X 10.11.4. Change-Id: Ic43ffeb1b76c1a933a55af03db3c54977f5f60dd
2016-03-31Convert tabs to 4 spaces for all source filesTobias Markmann
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
2016-03-30Apply consistent #include grouping and sorting styleTobias Markmann
Changed "" style includes to <> style. Test-Information: Build with Clang 3.9.0 and ran all tests on OS X 10.11.4. Change-Id: Ic05e53f2e5dba39cc1307b116fc5f17b62ab9eb8
2016-03-17Cleanup #pragma pollution in Sluift element convertorsTobias Markmann
There were a lot #pramas to ignore unused private field warnings. The pragmas and the unused fields have been removed. Test-Information: Build on OS X 10.11.3 with XCode Clang. Change-Id: Ie2f5398771088f93631c0f2c03d3cfdcca94cee6
2016-03-15Explicitly convert between nullable and non-nullable on OS XTobias Markmann
Clang was complaining about implicit conversions between nullable and non-nullable NSString pointers. Adjusted our std::string -> NSString* conversion utilities to check for nil and return an empty std::string in that case. Replaced uses of [NSString stringWithUTF8String] with our STD2NSSTRING macro. Turned std::string <-> NSString* conversion macros into functions. Test-Information: Builds without the warning on OS X 10.11.3 and Swift runs without issues. Change-Id: I949f2f3332018391aead58ef362764f4b7955b01
2016-02-10Sluift: Add timeout to roster receiving operationsRoger Planas
This avoids Sluift indefinitely waiting if the server does not respond Test-Information: Before the patch, a sluift client would wait indefinitely if a buggy XMPP server does not respond. With this patch, sluift clients now timeout and through an exception after SLUIFT_TIMEOUT when the server does not respond. Change-Id: I9d36f53a8f4d5b3d594cef68c42de38fd5a1c296
2016-02-10Sluift: Ensure that message event body is retrieved correctlyRoger Planas
As a result of commit "Change stanza body to boost::optional<std::string> type" (commit 1b9ccc1fef6104eaf951153ddccdc6bb15899e9a), Sluift was not populating the 'body' part of the message event, casting it to a bool instead. By adding get_value_or("") to that body part, the actual body value is retrieved, and the message event ends up containing the right information. Test-Information: Without the patch, Sluift's message event body is 'true'. With the patch, Sluift's message event body contains the actual message. Component messages also tested and event body as expected. Change-Id: I366202aa5bf28a3315a81d909ea08f0933aa06d7
2015-11-11Fix sluift API for clearing certificateGurmeen Bindra
Before this patch it was calling the constructor and creating certificate object with empty string. This was causing tests to fail when client was set with null certificate. This object fixes it by setting the certificate object to Null if the certificate file is empty. Test-information: Test cases using sluift with this API that set null certificate now pass Change-Id: Id75e22b58afebb2db463a7a23a4ca0686ef6eb12
2015-11-04Fix swiften handling when client certificate is missingGurmeen Bindra
This patch prevents SWIFTEN from logging in if provided with a missing PKCS12 file. Before this patch, swiften would attempt a password based login using operator JID and pwd of the P12 file when the P12 file was missing. This patch fixes it by checking the certificate and not initialising session stream and connection if the certificate is empty. It emits a disconnect with client certificate load error. The string for certificate load error has been modified to indicate a file or password invalid. Test-information: Tested by doing a certificate based bind to an XMPP server. Removed the PKCS#12 file and checked that swift gave a certificate error instead of doing pwd connect Change-Id: I1869a13f1f7135b6606f7383cd4a0356ffd6931b
2015-10-30Fix code in response to unused macro and private field warningsTobias Markmann
Test-Information: Build and tests pass successfully on OS X 10.10.5. Change-Id: I614586660796f9ef043156d09d998d39934a6eca
2015-09-18Specify OS X framework version for script interface extractionTobias Markmann
The iTunes support in Sluift requires extraction of the iTunes scripting interface. Clang version Apple LLVM version 7.0.0 will error with "error: type arguments cannot be applied to non-parameterized class 'NSArray'" and similar on the extracted scripting interface. With this change the sdp tool will generate scripting interfaces compatible to OS X 10.10. The generated interface files do not cause the error. Test-Information: Tested the build on OS X 10.10.5 and OS X 10.9.5 and verified that the Sluift command "sluift.itunes.get_current_track()" still works on both systems. Change-Id: If70c797aea69e95c7be3cda4c50b64da45028aac