summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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-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-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-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-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-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-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-07-21Sluift: Add set_certificate for sluift clientsRoger Planas
This patch introduces a 'set_certificate' API for Sluift clients, which it is just a wrapper around Swiften's Core client setCertificate. Test-Information: Generated different user certificates for a user (trusted, untrusted, invalid, expired...) and set M-Link to enable flag 'tls_require_client_cert'. Calling 'set_certificate' with these certificates behaved as expected, either letting the Sluift client to authenticate or not. Also tested caling 'set_certificate' with no parameter, and the certificate was successfully cleared (that is, client would no longer be able to connect) Change-Id: Ieb56d59f7f7c1c7027f0fe56905fb83ac3b25298
2015-04-30Honour global sluift timeout setting in add/remove contactEdwin Mons
The add_contact and remove_contact calls used a fixed timeout of -1, which could cause the operation to hang forever, even when a timeout was set. Test-Information: add_contact and remove_contact properly honour global timeout on a broken connection. Change-Id: I6bd877a8123ddab87b1f653c0cfda7a6b101dae7
2014-12-15Update Copyright In SluiftKevin Smith
Change-Id: I19f8ae342e028a6a7b4b13758f2e8c170a1db80c
2014-12-10Sluift: Add a get_options to retrieve connection settingsRoger Planas
Change-Id: I3767f479609bf64cc6d64932e125c2e66e5f75eb
2014-07-18Sluift: Add 'show' parameter option to send_presence methodsRoger Planas
Change-Id: I9fbd4514f6bc0d46738154abce495519e43ad46b
2014-05-27Added Sluift MAM examples. send_mam_query becomes set_mam_query.Richard Maudsley
Change-Id: I5d81e2476c83a16a8e478656d11d91137b009f3a
2014-05-12Fix to Sluift MAM query parametersEdwin Mons
Change-Id: Ieefb87795316ffa4f513cf1d19d20730596db6d9
2014-05-09Fix MAM Sluift.Richard Maudsley
Change-Id: I75e87e9c1a0f12f6c56dcb63f0a06f715277b99b
2014-05-02Added Sluift MAM convertors.Richard Maudsley
Change-Id: I472023726e84fbdd14af1fd9f57de411a20eb584
2014-04-30Update LuaElementConvertor interface to work with Element instead of Payload.Richard Maudsley
Change-Id: I4f8b69b1a13fff21c605011f45763e01f03259cf
2014-03-20Sluift: Initialize client tracing at creation timeRemko Tronçon
This avoids all calls to set_trace_enabled prior to connect() being ignored. Change-Id: Ib4f2bc9815aae2bd456f2ececcb2a37ac460eebc
2014-01-28Sluift: Add shortcut for 'subject' to send_messageRoger Planas
Change-Id: I4343c98d34a70998f25852f05cf1d95458882541
2014-01-22Sluift: Support arbitrary payloads in messages & presence.Remko Tronçon
- Add 'payloads' option to send_message and send_presence - Add 'payloads' table to message event Change-Id: I43079d519322abe8c4710ddaec5de22c48edd1ef
2014-01-18Sluift: Ensure all events have been processed before disconnectingRemko Tronçon
This avoids errors when disconnecting the client while there are still elements waiting. Change-Id: I005ec3f14c138b76f6381f1a89b3ee250a40777f
2014-01-18Sluift: Fix send_messageRemko Tronçon
Change-Id: I96b35a905553f5b25272179eaaf6c1b12ba2cd41
2014-01-18Sluift: Refactor global debug & timeout options.Remko Tronçon
Use regular table values on the sluift table. Enable enabling tracing on a client after the fact. Change-Id: Iaa2bea61bdadf0b8dec4951654c402b7133c1151
2014-01-18Sluift: Allow blocking calls to be interrupted.Remko Tronçon
Change-Id: I3755e796fbddc038022bbf543c7b1c0529a9b0f9
2014-01-03Sluift: Add help supportRemko Tronçon
Provide a 'help' function that takes a table/function, and prints help for it. A structured representation can be retrieved through 'get_help'. Change-Id: I2b3ce8992943ef30cee2604fba9200feed263fa5
2013-12-27Sluift: RefactoringRemko Tronçon
- Rename boot.lua to core.lua - Support Lua 5.2 - Support version prefixes for sluift module - Add Client:process_events Change-Id: I3fa6d06d1dbdf86f65b9f4203bd2ec5b5526b104
2013-12-27Sluift: Add message_type to message eventRoger Planas
Change-Id: I156b4cbec401918377af5fd8f21c9845f665b4cb
2013-12-15Sluift: Fix default values for port and host for connectRoger Planas
Change-Id: Ia19e0a3763005df7fb7db6b57841d6559f74ef46
2013-11-27Add presence_type to presence eventEdwin Mons
Change-Id: I3de5cd5ce1d84d6ce6a4b02af939ed5e0eb721f0
2013-11-19Sluift: add allow_plain_without_tls client optionEdwin Mons
Change-Id: Ieef0e455bb13e9ee38d583bee87ebb7e506bd00c
2013-11-18Sluift: add bosh_url client optionEdwin Mons
Change-Id: I42b14f411531f8814bbb85f3941772a4149c4171
2013-10-28Add port option to Sluift client connectRoger
Provide a mechanism to allow setting both the port and hostname for a Sluift client connection. By default Sluift leave port to -1 to use the port discovered by SRV lookups, with 5222 as a fallback. With this change, the port is now manually configurable as well. Change-Id: Idef5457e95127cfa86181b462d9ef42aa4f096ff
2013-09-01Sluift: More PubSub convenience methods & use cases.Remko Tronçon
- Convenience iterators to PubSub and PubSubNode. - Retrieving X most recent items - Retrieving a single item - Fixed GeoLocation serializer Change-Id: Ib4ecde225fb274b21163fcc9b52e19b0d3431860
2013-08-27PubSub implementation & Sluift refactoring.Remko Tronçon
Change-Id: I04ff7111b73565c00bff6db183451774a633344f