summaryrefslogtreecommitdiffstats
path: root/src/com
AgeCommit message (Collapse)Author
2015-09-11Improve efficiency of JavaConnection reads.Alan Young
Given that doRead() ends up populating a SafeByteArray as part of the result is is more efficient to pass an empty SafeByteArray to doRead() and push each chunk of data read directly to the it rather than use an intermediate ByteArrayOutputStream. SafeByteArray.getData() will do any concatenation necessary. It is unnecessarily inefficient to use a class instance to return the connection status from doRead. Remove JavaConnection.ReadResult. Change-Id: I6c8dc000d9030d3929c71444eb5b489df93f1987
2015-09-11Make JavaConnection fully event driven - no 100ms spinAlan Young
Refactor JavaConnection to make it fully event-driven via select for both reads and writes. Remove the 100ms spin when there are pending writes. Encapslate all the management of the select mask and the write queue within Worker and protect via a common lock. Change-Id: I1a709f9b12a949448923f51c2d434746c9190c9d
2015-08-26Add the missing initialisation for authenticator for SASL ExternalGurmeen Bindra
Missing initialisation for client authenticator for SASL external was causing null pointer exceptions. This patch corrects it by initialising the authenticator as is done in swiften. Test-information: tested using an XMPP admin client that does SASL External Change-Id: I321b425c1c28e0424effd9cb974980c392e48b68
2015-08-21Fix code to not throw StringPrepParseException that was part of ICU jarGurmeen Bindra
The IDNConverter interface now throws java strandard IllegalArg exception instead of the ICU specific StringPrepParseException. Users of stroke that are not using ICU will now be able to use it without the icu jar. Test-information: Sanity tested by connecting to an XMPP server using an XMPP client Change-Id: I6999ae0c690b70bc748f131908a758a01dac20b9
2015-08-21Correct ClientSession.finish()Alan Young
The default, clean finish() method needs to set up no error, not a null instance of Error.Type (with type field == null). Change-Id: I6912392b226dd84c411e2369844b9aee656d2e6f
2015-08-20Fix NPE in Stanza.getTimestampFrom() when Delay.getFrom() returns nullAlan Young
Change-Id: I2ccf6ae1293859dc8bd49731ee55a90b383d30a8
2015-08-19Handle case SessionStream.getTLSFinishMessage() returns null.Alan Young
Change-Id: I41924cdd6d32deb9d47b47a3fc7ffb3b55947029
2015-08-17Remove unnecessary Crypto functions from StringCodecs.Tarun Gupta
Remove SHA1 and HMACSHA1 from StringCodecs as they are already provided by CryptoProvider, and is equivalent to Swiften. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Add tests for Base64 and PBKDF2, which passes. Change-Id: Ife05f185a10a79c9d69a12235f1b0397d022d992
2015-08-17Update Client.Tarun Gupta
Updates all bits of Client to be in parity with Swiften. Some part of code which depends on Network is commented. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for: ClientBlockListManager, ClientSession and NickResolver. All tests pass. Change-Id: I5b9b0e5ae5b2df58202e2349ba24e4544d9a4614
2015-08-17Updates Presence in accordance with Swiften.Tarun Gupta
Updates DirectedPresenceSender, PayloadAddingPresenceSender, PresenceOracle and SubscriptionManager. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for: DirectedPresenceSenderTest, PayloadAddingPresenceSenderTest and PresenceOracle. All tests pass. Change-Id: I9ad899965f5ac32c6f21805b530c234e391be6ba
2015-08-14Completes TLS & Session.Tarun Gupta
Adds TLSError and TLSOptions. Updates BasicSessionStream, SessionStream and Session. Updates Client and Components to accomodate changes in TLS. Also completes TLSLayer in StreamStack which was pending due to TLS port. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for Certificate and ServerIdentityVerifier. Test updated for ComponentSession. All tests pass. Change-Id: I34a8fe068c1e8af5348cc4ab49d3d1ed118ae833
2015-08-13Revert pessimistic allocation of collection members in VCard.Alan Young
The way a VCard is used, pessimistic allocation puts an undue load on the Java GC. Change-Id: Ifced03a759783db2de911fc22dd40f6e475e5596
2015-08-13Add default-parameter versions of invitePerson() to MUC.Alan Young
Clean up imports. Add @Override annotations as appropraiate to MUCImpl and MockMUC. Change-Id: Id34849364fe1e4cdd7709b2cc7b397d007c2868c
2015-08-13Rework ByteArray implementationAlan Young
Use and ArrayList<byte[]> as the internal storage, instead of Vector<Byte>. Constructors and methods that supply a byte[] to add to the instance will have that value copied, rather than just taking ownership of the byte[]. There is an argument, on efficiency grounds, for providing methods that take ownership of the supplied argument. The earlier discussions about use of synchronization in the class are revisited. This is a low-level container that should be thread-safe or take precautions against non-thread-safe use. It is anticipated that the vast majority of uses will be thread-safe. Use of synchronization permits occasional deviations from this without imposing any significant overhead for the normal case - uncontended synchronization is close to free. Change-Id: Ifb7b2915d5c96345c53aec8e33673d892c430431
2015-08-13VCard.getPhoto() to return null for absent photo.Alan Young
Most of the time when VCard.getPhoto() is called it is only used to determine presence or absence of a photo. Thus, it makes no sense to allocate an empty ByteArray() just for this purpose. Return null instead, if absent. Change-Id: I3bae02ffbece5589c74c950bbb4c0db6c0376c76
2015-08-03Make SASL equivalent with Swiften.Tarun Gupta
Adds DIGESTMD5ClientAuthenticator, DIGESTMD5Properties, ExternalClientAuthenticator, PLAINMessage. Updates Client, ClientSession, CoreClient, ConnectDisconnect, StrokeGUI to reflect changes made in SASL. Updates ClientAuthenticator, SCRAMSHA1ClientAuthenticator, PBKDF2. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for DIGESTMD5ClientAuthenticator, DIGESTMD5Properties, PLAINClientAuthenticator, PLAINMessage. Update test for SCRAMSHA1ClientAuthenticatorTest. All tests pass. Change-Id: I4fd38f922cab7e4c4548d9706f6ad3b9e1506e81
2015-08-03Add tests for EventLoop.Tarun Gupta
Adds SingleThreadedEventLoop. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests for EventLoop and SimpleEventLoop passes. Change-Id: Ifda63a328e0adfb2da0eb2a1038805042ed0f6fb
2015-07-29Reinstate "disconnect()" method for MUC classNick Hudson
A recent change (9ead0fdcca595df9dc3f4143122776b398dbe405) made MUC an abstract class, and moved all functionality into MUCImpl (to correspond with Swiften). The "disconnect()" method was moved to MUCImpl, which means that any existing application which used it would break. The disconnect() method is required in java (although it's not in Swiften) because it provides a way to disconnect signals that are connected in the MUC constructor (or MUCImpl constructor now). While the signals are connected, the MUC object will not be eligible to be garbage collected, and this can lead to growing memory usage for an application which creates lots of MUC objects for a given connection. Adding a call to "disconnect()" in the finalizer for the MUC would not be effective because the finalizer only gets called when the MUC is gc'd, and the MUC can't be gc'd until the disconnect() has happened. Test-information: Unit tests pass. Before this change, an application calling "MUC.disconnect()" fails to compile. After this change, the application compiles. Tested an app that creates lots of MUC objects, and checked, using the debugger, to see if the objects were being garbage collected when the application dropped its reference to the objects. When not calling "disconnect()", the MUC objects are not garbage collected until the owning StanzaChannel is closed. When a call to "disconnect()" was added, the MUC objects are garbage collected soon after the application finishes using them, even though the StanzaChannel is still in use. Change-Id: Icd6c354e34d2124c292ae5d44bc47725a6e73df5
2015-07-28Fixed CancelledKeyException in JavaConnectionPeter Ballard
If synchroniseReads was enabled then if was possible for CancelledKeyExceptions to occur if the channel closed, whilst data was being procsessed on the event loop. I have also made the selectorKey_ reference volatile as this is used by both threads since my previous change 1afab8c1f2c417b08371bc12569e03171851d785 Change-Id: I48edcab9ef090b8a4561331d6aecc7f95cb8924d
2015-07-28Completes Components and AdHoc.Tarun Gupta
Adds Component, ComponentConnector, ComponentError, ComponentSession, ComponentXMLTracer, CoreComponent, ComponentSessionStanzaChannel, ComponentXMTracer, CoreComponent. Updates CoreClient, StrokeGUI, BasicSessionStream and SessionStream and Client, so that signal definition can be changed. Updates ComponentHandshake element, Entity. Updates OutgoingAdHocCommandSession to have feature parity with Swiften. This patch does not port Client or Session fully, which will be done in separate future patches. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test added for ComponentSession, which passes. Test for ComponentConnector cannot be ported right now and will be done in future patches, as it requires some bits of Network to be ported. Change-Id: I7138a2041fe28a2be7ac57cb47b15365f9334b24
2015-07-28Complete StreamStack and add tests.Tarun Gupta
TLSLayer could not be updated because it requires TLS to be ported first. Updates other classes, only for having compatibility with SafeByteArray because of updates in Stream Stack. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for StreamStack and XMPPLayer, which passes. Change-Id: I8707fc1f16d622d2a90f6f39f671b7e7c46aa170
2015-07-28Update Serializers and Parsers.Tarun Gupta
Updates Serializers and Parsers along with one minor change in XMPPlayer. Update Non Payload Serializers to return SafeByteArray. Updates SafeByteArray to return SafeByteArray on append and plus method. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: None. Change-Id: I6fe665a26b10cac37b3e3acd9ec15c211ac9b8ab
2015-07-22Completes MUC in accordance with Swiften.Tarun Gupta
Updates MUC to be an abstract class. Updates MUCBookmark, MUCManager, DirectedPresenceSender. Adds MUCImpl. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test updated for MUC, in accordance with Swiften, which passes. Added MockMUC too. Change-Id: If5aa672e8adc093162d3c9890c8437d3edadea68
2015-07-22Complete VCard functionalities.Tarun Gupta
Updates VCardManager, VCardMemoryStorage and VCardStorage. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test added for VCardManager, which passes. Change-Id: I0d4f1dbb647f262ff2a8967807fb798a8181b0b5
2015-07-22Update Queries.Tarun Gupta
Updates RawXMLPayload Element, SoftwareVersion Element. Updates IQRouter, Request, Responder, SoftwareVersionResponder. Updates ErrorSerilaizer access. Adds RawRequest, GetInBandRegistrationFormRequest, GetSoftwareVersionRequest, and SetInBandRegistrationRequest. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for: IQRouter, Request and Responder. Rest, all tests passes. Change-Id: I22308cc05bd1a6c28f3937a44d997e1da47e2891
2015-07-22Update Roster functionalities.Tarun Gupta
Updates RosterPushResponder, XMPPRoster, XMPPRosterController. Also adds XMPPRosterSignalHandler. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Adds tests for XMPPRosterController, XMPPRosterImpl. All tests passes. Change-Id: Iee3530510342ea5977022237aaa6dfbffa390408
2015-07-22Tidy up finalize method in SimpleEventLoopNick Hudson
If the finalize() ever gets called, it should, by convention, invoke the superclass finalize() method. This change makes it do that. Test-information: Unit tests still pass Change-Id: I0171cb1b6e1cce61a4c3140f669585f14e797dbd
2015-07-21Adds Disco Features.Tarun Gupta
Adds DiscoServiceWalker, FeatureOracle, JIDDiscoInfoResponder. Updates CapsInfoGenerator, ClientDiscoManager, EntityCapsManager, EntityCapsProvider, IQ Element, Request. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for: CapsInfoGenerator, CapsManager, DiscoInfoResponder, EntityCapsManager, JIDDiscoInfoResponder. All tests pass. Change-Id: Ib7cd08ff6f72b7649e4819943b627459c69a1397
2015-07-20Add StringIndexOutOfBounds catch to IDNAAlex Clayton
When run with java 7 class IDNA.getEncoded was throwing a StringIndexOutOfBounds exception if it was passed a String begining with '.isode'. This has the knock on effect of some of one of the isode MLC tests failing. This was caused by IDN.toAscii throwing the exception, when it should only thrown IllegalArgumentException. Java 7 is no longer supported so I can't raise a bug for this, a fix for stroke is easy though, just add the StringIndexOutOfBoundException to the catch block. Test-information: Ran the tests that were failing in eclipse on my machine (which runs java 7) tests now all passed correctly. Sanity test that tests still passed when run on command line against java 8. Ran the Stroke JUnit test against the code. Tests all passed when using latest version of java 7 (7_79) and when using java 8. Change-Id: Ifc9c830be7a0e5c9e5f2330a6782eff2401f18cb
2015-07-20Fix ClientSession class bug due to recent stroke changesGurmeen Bindra
Stroke was brought in line with swiften as a result of which strong (certificate based bind) authentication between client and xmpp server stopped working. This was happening because of missing "=" in the <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='EXTERNAL'>=</auth> The AuthRequestSerialiser was not adding "=" because the ByteArray object that was passed was null. This patch fixes the ClientSession class to pass empty ByteArray object as is done in existing swiften code. Test-information: strong bind works using java client to xmpp server Change-Id: Ide2d61723d92df19a251db7f1eb9f1581329f782
2015-07-08Add option to only read from TCP socket when previous read has been processedPeter Ballard
By default this option is disabled, existing usages will function as normal. This option stops the JavaConnection from reading data if the previous read has not been processed by the event loop. Previously constrained devices were seeing OutOfMemoryErrors, if they were not able to process the incoming data quick enough. This change does not affect the write behavour. Change-Id: I47bc0eafba32336f5bf250ccb1fea530f51d328e
2015-07-07Add GenericPayloadLoader & GenericPayloadPersister classes.Alan Young
Implemented as separate classes for Stroke, rather than as single combined class in Swiften because of type-erasure. Make VCardSerializer & DiscoInfoSerializer generally visible (public). Change-Id: I9e93c71377c417949da1c70e4219d3813a066087
2015-07-07Update Avatar access model.Alan Young
Use the String avatar hash as the general handle for an avatar. AvatarManager.getAvatar(JID jid) will return null if no avatar is available. AvatarManager.getAvatarPath() and AvatarStorage.getAvatarPath() are deleted. Make AvatarProvider & AvatarManager abstract classes instead of interfaces so that their onAvatarChanged Signals are not static fields. Implement delete() for AvatarManagerImpl and AvatarProvider & subclasses so that signal connections can be released. Add @Override annotations as appropriate. Change-Id: Ia7c9d7607b642bb42c373f81dc6be9a60f0f2134
2015-07-07Update JingleFileTransferFileInfo in light of recent discussions related to ↵Tarun Gupta
Date. Updates VCard Element, JingleFileTransferFileInfo to allow dates to be null, as a indicator for not a valid date time. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Corresponding tests changed, which passes. Change-Id: I9c9b4a84b7bebc18e8ef8ba5050e45ac2f13aa65
2015-07-07Adds tests for Parser and Serializers.Tarun Gupta
Adds PubSubEvent Element. Adds StreamFeaturesSerializer. Adds ParserTester, ElementParserTester, StanzaParserTester, PayloadParserTester, PayloadsSerializer and EnumParser. Updates Error Payload, JingleFIleTransferHash Elements/ Updates StreamFeaturesParser, ParserElement. Updates Delay Serializer, Error Serializer. Updates AuthChallenge and AuthRequest Element. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test are added for: AuthChallenge Serializer, AuthRequest Serializer, AuthResponse Serializer, AuthSuccess Serializer. GenericPayloadTreeParserTest. IQ Parser. Message Parser. Presence Parser. StanzaAck Parser. Stanza Parser. StreamFeatures Parser and Serializer. StreamManagementEnabled Parser. Private Storage Parser and Serializer. RawXMLPayload Parser. Storage Parser and Serializer. Error Serializer. Jingle Serializer. PubSubItem Serializer and PubSubItems Serializer. Serializing Parser. All tests passes. Change-Id: I79e00dc5b5c4f85e659bf88b1547dd7c17825805
2015-07-06Completes JID functionalities.Tarun Gupta
Completes JID by providing all features Swiften provides including Escaped and Unescaped Node. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test added for JID, which passes. Change-Id: Ia61dad0ed93a153186b9f78e2669f675f51e3734
2015-07-06Add Internationalized Domain Name Features.Tarun Gupta
Adds IDNConverter interface, ICUConverter using ICU for Stringprep. Also updates Makefile and build.xml by adding path to icu4j to compile tests classpath, so that icu4j.jar can be used in the tests. IDNConverter tests need StringPrepParseException from icu4j jar. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added test for IDNConverter, which passes. Change-Id: I56aacf080a10216a2455cf561de567f5666cd0c9
2015-07-06Minor Fixes for Elements.Tarun Gupta
Adds Block Element, BlockList, and Unblock Element. Updates some Elements just for consistency. Updates Last Element, its Parser and Serializer for consistency with Swiften. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: None. Change-Id: If40c2516b944b1939db08721bb4de4554c3264f6
2015-07-06Add Base Functionalities.Tarun Gupta
Adds FileSize, SafeString, StartStoppable, StartStopper and TriState. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: None. Change-Id: I94020700a77bb33dab39fb838eefc96c07b73868
2015-07-06Add ChatStateNotifier.Tarun Gupta
Adds ChatStateNotifier, DummyEntityCapsProvider. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test added for Chate State Notifier, which passes. Change-Id: Ie596d9c226526ab5ace334b7926389b61ca5540a
2015-07-03Make AvatarStorage available for client.Alan Young
Change-Id: I03fa68c567250d938112ea9a0c236be100ac82e3
2015-07-03VCard: Ensure jids_ is allocated in addJID()Alan Young
Change-Id: Ibfea910e72ed4cdd21b19bf60d0ab5af1fdb0a92
2015-06-30Add tests for Payloads Parsers and Payloads Serializers.Tarun Gupta
Updates DiscoInfoParser, DiscoItemsParser and VCard Element. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test are added for: DeliveryReceipt Parser and Serializer. DiscoInfo Parser and Serializer, DiscoItemsParser. Replace Parser and Serializer. ResourceBind Parser and Serializer. SecurityLabel Parser and Serializer. SecurityLabelsCatalog Parser and Serializer. Status Parser and Serializer. StatusShow Parser and Serializer. SoftwareVersion Parser and Serializer. VCard Parser and Serializer. All tests passes. Change-Id: I8023372273e63813e1c8fe708fa6cdf39614e1f7
2015-06-30Adds Parser and Serializer for Priority Element.Tarun Gupta
Adds Priority Parser and Serializer. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests passes for Priority Parser and Serializer. Change-Id: I0077cd0a3d179590b6ea78fa445e91358ff8b623
2015-06-30Add StreamInitiation Elements.Tarun Gupta
Adds StreamInitiationFileInfo Element, its Parser and Serializer. Adds StreamInitiation Element, its Parser and Serializer. Adds StreamError Parser and Serializer. Updates StreamManagementEnabled Element. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for StreamInitiation Parser and Serializer, which passes. Change-Id: I21a7de3f6a5ac0955b6e5aaae3c2607a30eae002
2015-06-27Adds Form Elements and Version Element.Tarun Gupta
Adds FormPage, FormReportedRef, FormSection, FormText and Version Elements. Updates Form Elements, its Parser And Serializer. Updates SearchPayload Element, its Parser And Serializer. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Adds Search Payload Parser and Serializer Test. Updates tests for Form Parser and Serializer. Updates InBandRegistrationPayloadSerializer Test and MAMQuerySerializerTest. All tests passes. Change-Id: I8c620a3db39fe433bc9a5478b98d5caeaf9ed40b
2015-06-23Adds Carbons Element.Tarun Gupta
Adds: CarbonsDisable Element, its Parser and Serializer. CarbonsEnable Element, its Parser and Serializer. CarbonsPrivate Element, its Parser and Serializer. CarbonsReceived Element, its Parser and Serializer. CarbonsSent Element, its Parser and Serializer. Thread Element, its Parser and Serializer. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for CarbonsParser and CarbonsSerializers, which tests all the above functionalities and passes. Change-Id: I101b1b34c24515d5ba19a995254755af77c4e6e1
2015-06-23Add ComponentHandshake Element.Tarun Gupta
Adds ComponentHandshake Element, its parser and Serializer. Adds ComponentHandshake Generator. Adds TopLevelElement. Updates SafeByteArray. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Test added for ComponentHandshakeGenerator, which passes. Change-Id: If3026a3db2207e6c65aa2306fee56d8dd5dee86f
2015-06-23Add Roster Elements.Tarun Gupta
Adds RosterItemExchangePayload Element, its Parser and Serializer. Updates RosterItemPayload, its Parser and Serializer. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for: RosterItemPayload Parser and Serializer. RosterItemExchangePayload Parser and Serializer. All tests passes. Change-Id: I8d16a18290d9820cea6839af1f075da00a25db09
2015-06-22Add Nickname Element.Tarun Gupta
Adds Nickname Element, its Parser and Serializer. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: None. Change-Id: I62affc8ef482f3e04a7c337f25b068b6d602c5bb