Commit Graph

108 Commits

Author SHA1 Message Date
Florian Schmaus fc51f3df48 Add support for XEP-0198: Stream Management
- De-duplicate code by moving it into AbstractXMPPConnection
- Introduce TopLevelStreamElement as superclass for all XMPP stream elements.
- Add SynchronizationPoint, ParserUtils
- Add ParserUtils

Fixes SMACK-333 and SMACK-521
2014-09-11 09:49:16 +02:00
Florian Schmaus 34bc13bec7 Merge branch '4.0'
Conflicts:
	build.gradle
	smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
	smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java
	smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
	smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java
2014-09-05 22:11:35 +02:00
Florian Schmaus af9b9a8769 Split SmackConfiguration into Configuration and Initalization
also add SmackConfiguration.addDisabledSmackClass()
2014-09-05 15:56:00 +02:00
Florian Schmaus afd7c67bf9 Add support for multiple status codes to MUCUser
Fixes SMACK-604
2014-09-05 11:45:06 +02:00
Florian Schmaus 5d4aa76d19 Create smack.util.stringencoder for Base64, Base32,…
Use Android's Base64 implementation when on Android, otherwise, when on
Java7, use the existing one.
2014-09-04 11:07:55 +02:00
Florian Schmaus 90c0064394 Add XmlLangStanza, to share the language field
between Message and Presence.
2014-09-03 18:11:32 +02:00
Florian Schmaus 67011fc322 Remove xmlns field from Packet
Stanzas do not have a xmlns attribute in their top level element.
2014-09-03 17:56:51 +02:00
Florian Schmaus 644ddf3d4c Presence class cleanup 2014-09-03 17:50:12 +02:00
Florian Schmaus 66be759ce6 Add support for presence probes 2014-09-03 17:32:41 +02:00
Florian Schmaus 5342aaf137 Make XMPPError.Condition.equals null-safe
also make Condition implement CharSequence.

SMACK-603
2014-09-01 10:13:23 +02:00
Florian Schmaus 72557dd354 Make PacketCollector handle InterruptedException
Fixes SMACK-602
2014-08-29 18:09:45 +02:00
Florian Schmaus b5b134f569 Process all XML namespaces in PubSub ItemProvider
Fixes SMACK-601
2014-08-29 14:59:54 +02:00
Florian Schmaus 5a5524623c Make presence parsing more robust
by allowing 'show' to be an empty element: '<show />'
2014-08-28 14:14:18 +02:00
Florian Schmaus 191c4429da Fix FileTransferManager invoking request listeners
those need to be called asynchronously.

Also add a small API for that.
2014-08-26 13:50:42 +02:00
Florian Schmaus 02228702da Make XmlStringBuilder equals() CharSequence aware
The minimal condition in order to check equality in XmlStringBuilder is
that 'other' implements the CharSequence interface. Not as it was
previously, that it's also a XmlStringBuilder.

This allows junit's assertEquals() to be used (to a certain extend).
2014-08-25 13:46:05 +02:00
Luke GB 659714c2be Set jid to passed parameter, not null
Setting `jid` to `null` was probably not the intended behaviour of this constructor and means that the `IQReplyFilter` will later reject responses that it shouldn't, because the `AbstractXmppConnection` will automatically construct a JID based on the authenticated username.

In particular, this breaks attempting to connect to the PVP.net XMPP server.
2014-08-23 18:41:35 +02:00
Florian Schmaus 28629e0e7f Fix wrong boolean condition in async API
inverse boolean condition, correct is: "if packetListener has been
removed, then we received no response" and add check for
exceptionCallback being null.
2014-08-21 12:02:32 +02:00
Florian Schmaus bbf89c65bf Fix typo in XmlStringBuilder, it's not an Angel
s/rightAngelBracket/rightAngleBracket/
2014-08-20 21:25:14 +02:00
Florian Schmaus 47ffcd8b6d Merge branch '4.0' 2014-08-20 15:29:29 +02:00
Florian Schmaus 1e5f0eb749 Make parseElementText handle empty string elements
ie. elements which only content is the empty string, for example
<body></body>.

Fixes SMACK-598
2014-08-20 15:23:52 +02:00
Florian Schmaus 64e49cb934 Add getLastStanzaReceived() to XMPPConnection
also remove faulty PongFilter from PingManager. It never matched any
stanzas, since a Pong is just a plain result IQ that is not qualified by
any XMPP Ping namespace.

Fixes SMACK-597
2014-08-20 10:35:17 +02:00
Florian Schmaus 6ab2bf9fe0 Also log the exception in parsePresence()
when parsing packet extensions.
2014-08-19 22:14:47 +02:00
Vyacheslav Blinov 342ab65138 SmackDebugger initialization moved to dedicated factory.
You can set your custom debugger class as before, by using clear api
method ReflectionDebuggerFactory.setDebuggerClass, or you can set custom
debugger factory using SmackConfiguration.setDebuggerFactory if it's not
enough flexible for your needs
2014-08-18 12:03:54 +02:00
Florian Schmaus c84419a55e Create org.jivesoftware.smack.rosterstore package
and move RosterStore and DirectoryRosterStore into it.
2014-08-16 15:37:16 +02:00
Vyacheslav Blinov 52673bad3c SLF4J Smack Debugging Logger 2014-08-16 08:22:57 +02:00
Florian Schmaus aeda0e4660 Add an API to send and wait async for a response
SMACK-595

Also remove the unused AbstractXMPPConnection.getPacketListeners()
method.
2014-08-16 00:08:53 +02:00
Florian Schmaus 7277eb553a Enable more 'checkstyle' checks
AvoidStarImport
IllegalImport
RedundantImport
UpperEll
ArrayTypeStyle
GenericWhitespace
EmptyStatement
PackageDelcaration
2014-08-15 23:17:45 +02:00
Vyacheslav Blinov 522d0f30ff Generify Packet class returned by PackageCollector everywhere
This will help to get rid of repetitive class casts, and make
PacketCollector api more inline with itself (since some methods
are already generic return methods).
2014-08-15 12:14:19 +02:00
Florian Schmaus 47a59ad7b3 Move toBytes() into SASLMechanism
as it's a often needed transformation in the SASL world.
2014-08-12 22:00:09 +02:00
Florian Schmaus f37682d980 Make SASLMechanism.getAuthenticationText() return byte[]
every SASL Mechanism is designed as a byte array based protocol. XMPP
adds the constraint that the challenges and responses are send base64
encoded. It's therefore better API design to let getAuthenticationText()
return byte[] instead of String.
2014-08-12 21:52:56 +02:00
Florian Schmaus c5b7f14527 Don't use IQReplyFilter in AccountManager
This is a follow up on 6caf2cbdb5 where IQReplyFilter was changed so
that getUser() must not return null. But this is the case in
AccountManager where no resource binding has taken place and the user is
therefore not set.

The fix is the same as in 6caf2cbdb5, instead of IQReplyFilter we
simply use a PacketIDFilter.
2014-08-11 21:09:26 +02:00
Florian Schmaus 7caf413637 Put the AccountManager in getInstance() in the map
thereby following the code guidelines.
2014-08-11 21:08:02 +02:00
Florian Schmaus 0c0737942c Make resolver-dnsjava, -minidns initializer
and OSGi components.

There is really no need to treat them different then
resolver-javax. This also allows the removal of the DNSUtil.init() method.
2014-08-11 19:39:31 +02:00
Florian Schmaus 92a6d01507 Merge branch '4.0'
Also slightly improve OfflineMessageManager.getMessages()

Conflicts:
	build.gradle
	smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java
2014-08-07 16:51:03 +02:00
Florian Schmaus c3f6c51d0e Add a setting for the used flush mode when compressing data
Fixes SMACK-593
2014-08-07 16:18:44 +02:00
Florian Schmaus 70f1c22bb2 Prevent PacketCollector leaking
in AbstractXMPPConnection.createPacketCollectorAndSend(IQ) in case there
is a NoResponseException.
2014-08-04 18:15:42 +02:00
Florian Schmaus 6caf2cbdb5 Don't use IQReplyFilter for resource binding
as the local username is only available after binding (and legacy
session establishment). This makes Smack compatible again with XMPP
services that use the user's JID as from attribute in the result IQ
after the bind set IQ, e.g. Facebook:

SENT:
<iq id='sqvTK-1' type='set'>
  <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
    <resource>Smack</resource>
  </bind>
</iq>

RCV:
<iq from='user.name.1@chat.facebook.com' id='sqvTK-1' type='result'>
  <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
    <jid>user.name.1@chat.facebook.com/Smack</jid>
  </bind>
</iq>

Fixes SMACK-590
2014-08-04 18:01:05 +02:00
Florian Schmaus 076c7d0b81 Configure default Hostname Verifiers 2014-08-03 21:15:41 +02:00
Florian Schmaus a574e1d56d Verify ConnectionConfiguration parameters
also fix javadoc error for StringUtils.isNullOrEmpty()

Fixes SMACK-539
2014-08-01 23:23:11 +02:00
Florian Schmaus 89dc3a0e85 Add smack-android and redesign SASL authentication
This commit marks an important milestone with the addition of the
smack-android subproject. Smack is now able to run native on Android
without requiring any modifications, which makes the aSmack build
environment obsolete.

It was necessary to redesign the code for SASL authentication to achieve
this. Smack now comes with smack-sasl-provided for SASL implementations
that do not rely on additional APIs like javax for platforms where those
APIs are not available like Android.
2014-08-01 10:34:47 +02:00
Florian Schmaus 057d00c9de Add support for HostnameVerifier
SMACK-586

Conflicts:
	smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java
	smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
2014-07-27 23:28:11 +02:00
Georg Lukas 2a05c3b707 Roster: merge the two registered ConnectionListeners 2014-07-23 08:29:46 +02:00
Florian Schmaus d35fd16a21 Add support for HostnameVerifier 2014-07-23 08:29:46 +02:00
Florian Schmaus fe258fe110 Fix XMPPTCPConnection to set 'host' and 'port'
Fixes SMACK-585
2014-07-23 08:29:35 +02:00
Florian Schmaus d06d5b7c69 Merge branch '4.0'
Conflicts:
	build.gradle
2014-07-20 14:19:59 +02:00
Florian Schmaus 59527d320d Add SmackAndOsgiInitializer
OSGi ServiceComponents need the activate method, make sure it exists for
every SmackInitializer by using this class.
2014-07-20 12:58:50 +02:00
Florian Schmaus 49ee058c38 Cleanup carbons, forwarded and a few others API
Adopt to common design patterns in Smack:

- getFrom(Packet) in Packetextensions
- INSTANCES.put() in getInstanceFor()
- ELEMENT instead of ELEMENT_NAME
- Use XmlStringBuilder
2014-07-16 11:46:30 +02:00
Florian Schmaus 1ed5c48bcc Merge branch '4.0'
Conflicts:
	smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
2014-07-16 10:52:58 +02:00
Florian Schmaus cea79d1bb8 Use single threaded ExecutorService
for PacketListeners. Fixes SMACK-583.
2014-07-16 10:50:35 +02:00
Florian Schmaus e6aa2416e4 Improve MUC code
Removes a ton of duplicate code, mostly related to MUCItem being
duplicated in MUCOwner and MUCAdmin, but also some other duplicate code.

Make MUC code use XmlStringBuilder.

Add ELEMENT and NAMESPACE constants to the appropriate places. Also add
"static <MUCPacketExtension> getFrom(Packet)" methods.

Make some MUC classes implement Element.
2014-07-14 19:22:02 +02:00