Commit Graph

367 Commits

Author SHA1 Message Date
Florian Schmaus 059ee99ba0 Move TLS Required check at the end of connect()
It was a *very* bad idea to perform the SecurityMode.Required check in
the connection's reader thread and not at the end of
AbstractXMPPConnectin's connect(). :/

This behavior dates back to 8e750912a7

Fixes SMACK-739
2016-11-14 20:31:13 +01:00
Florian Schmaus fca2f59e08 Fix SCRAM-SHA1 mechanism creating invalid c-nonce
Because of the condition "c >= 32", Smack would possible return a
c-nonce containing ASCII whitespace characters (32d, 0x20), which are
not allowed in the c-nonce as per RFC 5802.

This commit applies the correct condition: "c > 32".

Fixes SMACK-735.
2016-10-20 17:00:52 +02:00
Florian Schmaus 45b04800a4 Handle AlreadyConnectedException in ReconnectionManager
Fixes SMACK-725.
2016-07-04 08:27:18 +02:00
Florian Schmaus e943bbbd91 Handle AlreadyLoggedInException in ReconnectionManager
Fixes SMACK-725.
2016-07-04 08:27:06 +02:00
Florian Schmaus 1f87185ee8 Do not base64 twice in SASL X-OAUTH2
Fixes SMACK-722.
2016-07-04 08:25:01 +02:00
Florian Schmaus 58d9f4e749 Use Locale.US in XMPPError.Type ↔ String conversion
Fixes SMACK-719
2016-04-12 15:05:56 +02:00
Florian Schmaus 8235e8417d Use simple name in StanzaTypeFilter 2016-04-12 15:05:56 +02:00
Florian Schmaus 81fb1ed93c Make executorService blocking in AbstractXMPPConnection
Otherwise AbstractXMPPConnection.processPacket() will throw a
RejectedExecutionException if the underlying queue is full.

Fixes SMACK-702.
2015-11-21 17:31:39 +01:00
Florian Schmaus b1e4884fbb Remove erroneous next() from AbstractJsonExtensionProvider
Fixes SMACK-695.
2015-08-24 11:09:59 +02:00
Florian Schmaus 9884eee85d Provide a hint in NotConnectedException
that connect() needs to be called prior login().

SMACK-686
2015-07-29 08:20:46 +02:00
Florian Schmaus e6a403fb1c Re-escape XML text in parseContentDepth()
SMACK-680.
2015-07-02 16:10:50 +02:00
Florian Schmaus 65788389ea Reset ReconnectionManager's 'attempts' to 0
on successful reconnects. Fixes SMACK-668.
2015-06-27 14:25:19 +02:00
Florian Schmaus a997283304 Make AbstractXMPPConnection.getConfiguration public 2015-06-26 14:04:46 +02:00
Florian Schmaus 385798f9ba Only add Entity Capabilities extension to available presences
Also don't override eventually send presences on
updateLocalEntityCaps(), instead save the last sent Presence stanza and
re-send that stanza.

SMACK-669.
2015-05-22 08:45:53 +02:00
Florian Schmaus c120bc1cbc Handle empty array in SASLMechanism.authenticate()
like null array.

Thanks to Anthony Sorvari for reporting.

Fixes SMACK-670.
2015-05-22 08:24:54 +02:00
Florian Schmaus 236dfb009d Improve logging of parsing errors 2015-05-07 22:40:38 +02:00
Florian Schmaus 4eb322608e Add ConnectionConfiguration.setProxyInfo(ProxyInfo)
Fixes SMACK-661.
2015-04-27 17:51:18 +02:00
Florian Schmaus a4be67ff5d Fix ReconnectionManager RANDOM_INCREASING_DELAY policy
which was using the same value. Fixes SMACK-660.
2015-04-27 17:35:00 +02:00
Florian Schmaus f579fb2c77 Throw exception if smack-java7 is loaded on Android 2015-04-25 22:53:46 +02:00
Florian Schmaus 9a69f992c4 Deprecate SynchronizationPoint.reportFailure()
assert and document that an exception must be set when calling
reportFailure(E).
2015-04-07 08:52:48 +02:00
Florian Schmaus cca34fd872 First check condition, then remaining wait in SynchronizationPoint
as otherwhise SynchronizationPoint may report NoResponseException when
there was in fact a success or failure reported in case there are
multiple threads waiting for the condition.
2015-04-07 08:51:03 +02:00
Florian Schmaus 83aa6838d9 Use signalAll in SynchronizationPoint
to prevent a thread from not being notified about a change of the state
of the SynchronizationPoint.

If two threads are waiting for a change, which could happen e.g. because
of a connectivity change and one thread does instantShutdown() while the
other handles connectionClosedOnError(), then only one thread, usually
the one handling connectionClosedOnError(), would be notified and
resumed.

Fixes SMACK-652.
2015-04-07 08:51:03 +02:00
Florian Schmaus 57fa631480 Add javadoc to SynchronizationPoint 2015-04-07 08:50:52 +02:00
Florian Schmaus 9ac3633612 javadoc: s/packet/stanza/ 2015-03-24 17:15:50 +01:00
Florian Schmaus 451eb4c826 Add missing break statements 2015-03-23 09:52:01 +01:00
Florian Schmaus 5e86db4f80 Substitute 'packet' with 'stanza(/packet)' in javadoc 2015-03-21 09:36:28 +01:00
lucastucchi a7616f2a03 Add the possibility to choose reconnection policy
Until now the reconnection used a fixed policy using random
increasing delay as the number of attempts grows. Even if
that policy is still the default one, it is now possible to
select a fixed delay policy that always waits a fixed amount
of time before trying to reconnect
2015-03-18 21:16:32 +01:00
Florian Schmaus e85c1881d7 Add TypedCloneable 2015-03-10 22:50:48 +01:00
Florian Schmaus 9c5b7d263e Include conditionText in XMPPError.toXML() 2015-03-06 09:10:49 +01:00
Florian Schmaus ed4fa3390f Add XMPPConnection.sendStanza(Stanza)
and deprecate sendPacket().
2015-03-04 21:46:44 +01:00
Florian Schmaus 18d9be0099 Add CapsExtensionProviderTest 2015-03-04 13:08:35 +01:00
Florian Schmaus dde0cfd7f6 Fix incoming file transfers
With bb8dcc9874 the concept if IQ request
handlers was introduced in Smack. This doesn't allow packet/stanza
collectors/listeners to filter for incoming IQ requests. Unfortunately
the file transfer code relied on this being able, so it broke with the
change.

There were two places where the file transfer code was listening for
incoming IQ requests:
- InitationListener(s)
- Negotiator(s)

With this change, we let the InitiationListener signal the existence of
an incoming initation request, send by an IQ of type 'set', using the
newly created EventManager utility.

The negotiator waits for those events to arrive and proceedes as it would
have done when the packet collector was used.
2015-03-02 15:56:26 +01:00
Florian Schmaus 21c0be5e2a Fixed AbstractXMPPConnection.cachedExecutorService
the combination with concurrencyLevel and LinkedBlockingQueue never
worked as intented. The idea was that the cachedExecutorService would
spawn new threads until maximumPoolSize (=concurrencyLevel) is reached,
and then start queing the Runnables.

But this was not the case, since ThreadPoolExecutor does not take into
consideration if the worker threads is busy, i.e. executing a Runnable,
or idle, i.e. waiting for a Runnable.

This means that if a busy Worker would execute a Runnable, which would
block, because it's waiting for an event (e.g. an incoming IQ
request), then the handling of those incoming IQ request would be
queued by ThreadPoolExecutor, because no fewer threads then corePoolSize
are running and the task can be queued (since the LinkedBlockingQueue is
unbounded).
2015-03-02 15:50:13 +01:00
Florian Schmaus caa7b9acb8 Improve message of StreamErrorException 2015-03-02 15:50:12 +01:00
Florian Schmaus 75ec271c6c Rename PacketListener to StanzaListener
and add the PacketListener as deprecated interface.
2015-03-02 15:49:56 +01:00
Florian Schmaus d4a6d8e653 Rename PacketFilter (and implementing classes) and PacketExtension
to StanzaFilter and ExtensionElement.
2015-02-28 13:49:38 +01:00
Florian Schmaus 49e1c837b2 Adjust AbstractListFilter.toString()
to produce a similar styled output like the other toString() methods and
add unit-test for the method.
2015-02-26 08:47:43 +01:00
Florian Schmaus 404b90054b Use Executors.newSingleThreadScheduledExecutor
and remove the calls to setMaximumPoolSize() and steKeepAliveTime()
since they are ineffective on Android.
2015-02-25 16:17:09 +01:00
Florian Schmaus 39382b8b38 Shorten Smack's executor service names
instead of

"Smack Executor - Foo 42 (2)"

use

"Smack-Foo 42 (2)"

since sometimes the space for the name is limited (e.g. busybox's 'ps
-t').
2015-02-25 16:09:41 +01:00
Florian Schmaus e9dd3e2fa6 Add copy constructor to Message and Presence
and also implement Cloneable and add clone() methods.
2015-02-23 22:15:59 +01:00
Florian Schmaus afba123ba3 Javadoc improvements in MultiMap and Stanza 2015-02-23 10:49:33 +01:00
Florian Schmaus b74b8c5757 Make Stanza constructors 'protected' 2015-02-23 10:48:43 +01:00
Florian Schmaus 180a3bb4ca Fix SASL X-OAUTH2: Use Base64.encode() instead of decode() 2015-02-23 08:49:30 +01:00
Florian Schmaus 8b0ccd7420 Minor javadoc fixes and improvements 2015-02-22 10:41:53 +01:00
Florian Schmaus 7ebea7ce94 Add StanzaIdFilter, deprecate PacketIDFilter 2015-02-19 16:07:42 +01:00
Florian Schmaus 887c6114b7 Add filter information to NoResponseException
in order to aid debugging errors. This made it necessary to override
'toString()' for all filters in Smack.
2015-02-19 12:14:16 +01:00
Florian Schmaus b910d026cd Remove toString form XMPPException subclasses
and getMessage(), to use the implementations in Exception instead.
2015-02-16 14:51:37 +01:00
Florian Schmaus 26f4528698 Rename SecurityMode.enabled to 'ifpossible'
Using the term 'enabled' was a terriable choice from a security
perspective, as it gives the user the impression that the security is
"enabled". In fact this setting is only slightly better then
"disabled".

Make that fact clear in the javadoc too.
2015-02-13 17:01:09 +01:00
Florian Schmaus 0d19b56fbb Support all primitive types in IntrospectionProvider
Fixes SMACK-453
2015-02-12 14:01:01 +01:00
Florian Schmaus 90ccd6c40e Use string switch/case in IntrospectionProvider 2015-02-12 13:36:14 +01:00