Commit Graph

262 Commits

Author SHA1 Message Date
Florian Schmaus a997283304 Make AbstractXMPPConnection.getConfiguration public 2015-06-26 14:04:46 +02:00
Florian Schmaus 13224a9662 More information in closed on error log 2015-06-09 22:25:19 +02:00
Florian Schmaus 4a857fe67a Assert that a Stanza is a Stanza in sendStanza 2015-06-06 11:16:12 +02:00
Florian Schmaus 2f219c7317 Rename processPacket to processStanza
and assert that 'stanza' is a Stanza.
2015-06-05 14:04:17 +02:00
Florian Schmaus 9a00e09c0a Improve NoResponseException messages 2015-06-02 17:30:57 +02:00
Florian Schmaus c125a3b055 Bump jxmpp to 0.5.0-alpha4 2015-05-27 19:29:51 +02:00
Florian Schmaus 3c2ba0ec43 Add AbstractXMPPConnection.getUsedSaslMechanism()
and improve isAnonymous(). Also some minor changes to
SASLAuthentication.
2015-05-19 09:26:59 +02:00
Florian Schmaus f369a009ac Rename 'serviceName' to 'xmppServiceDomain'
Also use 'null' as default value for the resource, to enforce server
generated resources.

Fixes Smack-665
2015-05-19 09:26:59 +02:00
Florian Schmaus 0c8199650b Improve parsing exception callback.
Fixes SMACK-631.
2015-05-18 12:38:25 +02:00
Florian Schmaus 36cc05a507 Use Resourcepart as type for the resource 2015-05-04 20:53:00 +02:00
Florian Schmaus 9354e4fb74 Rework and improve authentication API and internals
Add

- performSaslAnonymousAuthentication()
- performSaslExternalAuthentication(SSLContext)
- addEnabledSaslMechanism(String)
- addEnabledSaslMechanisms(Collection<String>)

to ConnectionConfiguration.Builder.

Instead of providing a special API call for anonymous authentication,
Smack now has a configuration builder method to set anonymous/external
authentication. This also removes a lot of duplicate code within
Smack.

Also move SASLAnonymous into o.j.smack.sasl.core.

Fixes SMACK-629.
2015-05-03 22:00:41 +02:00
Florian Schmaus 17103def0b Change SmackExecutorthreadFactory constructor parameter to XMPPConnection 2015-04-22 09:45:02 +02:00
Florian Schmaus 7c3f4b7129 Add AbstractXMPPConnection.toString() 2015-04-22 09:28:30 +02:00
Florian Schmaus 6c637d5784 Don't automatically login() on connect()
if the connection was authenticated before.

Fixes SMACK-647.
2015-04-06 13:51:47 +02:00
Florian Schmaus 64d134052d Enable javadoc checkstyle
and fix violations.
2015-03-29 12:29:32 +02:00
Florian Schmaus 72f41e20b1 Don't rethrow RuntimeExceptions in parseAndProcessStanza 2015-03-25 10:29:43 +01:00
Florian Schmaus c6594aec2f Lint fixes: Remove dead code, etc.
- make method static when possible
- remove never thrown Exception declarations
- other fixes
2015-03-24 18:33:47 +01:00
Florian Schmaus 83b84c5bd3 Merge branch '4.1'
Conflicts:
	smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java
	smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
	smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java
	smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
	version.gradle
2015-03-24 17:16:18 +01:00
Florian Schmaus 451eb4c826 Add missing break statements 2015-03-23 09:52:01 +01:00
Florian Schmaus f546d28ad8 Xlint all the things
and fix all warnings.
2015-03-23 09:28:49 +01:00
Florian Schmaus 5e86db4f80 Substitute 'packet' with 'stanza(/packet)' in javadoc 2015-03-21 09:36:28 +01:00
Tomáš Havlas fae9d129a9 Added support for pre-approved subscription requests (RFC 6121 § 3.4)
SMACK-639
2015-03-19 11:31:05 +01:00
Florian Schmaus f410ece468 Call connection created listeners in constructor
Fixes SMACK-638.
2015-03-19 08:21:47 +01:00
Florian Schmaus b8f046706b Add Integration Test Framework
and resurrect a few integration tests.
2015-03-18 11:09:56 +01:00
Florian Schmaus 0fde39fa45 's;^\s+$;;' on all source files
And add checkstyle test for lines containing only whitespace characters.
2015-03-17 11:33:02 +01:00
Florian Schmaus bc093b620d Make Provider.parse() just throw Exception
instead of throwing XmlPullParserException, IOException and
SmackException.

Add a guard to AbstractXMPPConnection.processPacket() to always re-throw
RuntimeExceptions.
2015-03-13 09:27:18 +01:00
Florian Schmaus 701aa7d9c4 Merge branch '4.1'
Conflicts:
	smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
	smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
	smack-core/src/main/java/org/jivesoftware/smack/PacketListener.java
	smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java
	smack-core/src/main/java/org/jivesoftware/smack/debugger/SmackDebugger.java
	smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java
	smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
	smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/address/provider/MultipleAddressesProvider.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IBBTransferNegotiator.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/Socks5TransferNegotiator.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/packet/PubSub.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/VCardManager.java
	smack-extensions/src/test/java/org/jivesoftware/smackx/receipts/DeliveryReceiptTest.java
	smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java
	smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java
	smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleProvider.java
	smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/UserID.java
	smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/provider/RosterExchangeProvider.java
	smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
	version.gradle
2015-03-04 22:42:36 +01:00
Florian Schmaus ed4fa3390f Add XMPPConnection.sendStanza(Stanza)
and deprecate sendPacket().
2015-03-04 21:46:44 +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 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 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 fbf0ba13ce Merge Smack 4.1.0-rc2
Conflicts:
	smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java
	smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java
	version.gradle
2015-02-21 18:07:45 +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 5bb4727c57 Use Jid (and subclasses) from jxmpp-jid
Fixes SMACK-634
2015-02-17 16:07:16 +01:00
Florian Schmaus bc61527bd2 Expose InterruptedException
SMACK-632
2015-02-14 14:57:33 +01:00
Florian Schmaus 57c1b57b7c s/ a XMPP/ an XMPP/ 2015-02-12 12:13:19 +01:00
Florian Schmaus a0cf121d7a Make cached executor service use linked blocking queue
Since e6045c6593 the cached executor
services maximum pool size is limited to concurrencyLevel (was
previously Integer.MAX_VALUE). In order to prevent
RejectExecutionException we need to use an queue which max size is
greater than 1 (i.e. nont an SynchronousQueue).

Connection closed with error java.util.concurrent.RejectedExecutionException: Task org.jivesoftware.smack.tcp.XMPPTCPConnection$2@41dce200 rejected from java.util.concurrent.ThreadPoolExecutor@41d59150[Running, pool size = 3, active threads = 3, queued tasks = 0, completed tasks = 4]
 	at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2011)
 	at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:793)
 	at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339)
 	at org.jivesoftware.smack.AbstractXMPPConnection.asyncGo(AbstractXMPPConnection.java:1583)
 	at org.jivesoftware.smack.tcp.XMPPTCPConnection.processHandledCount(XMPPTCPConnection.java:1655)
 	at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$2300(XMPPTCPConnection.java:137)
 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1083)
 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:896)
 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:911)
 	at java.lang.Thread.run(Thread.java:841)
2015-02-09 07:35:15 +01:00
Florian Schmaus 4698805a34 Rename 'Packet' class to 'Stanza'
Smack still uses the term 'Packet' in some places. This is just the
first step towards using correct XMPP terms in Smack.
2015-02-06 09:34:51 +01:00
Florian Schmaus 5a56ff011b Add XMPPConnection.getStreamId()
and remove getConnectionID().

Also make streamId a field of AbstractXMPPConnection. Most XMPP
connection types have a streamId, it appears to be optional when BOSH
is used though.
2015-01-28 17:14:33 +01:00
Florian Schmaus 86ea027301 Add StringUtils.requireNotNullOrEmpty and Objects.requireNonNull
and use this in a few places.
2015-01-26 20:47:09 +01:00
Florian Schmaus 1407f10f7f Make connect() return a self-reference 2015-01-26 07:54:13 +01:00
Florian Schmaus 4b10f36e9e Report failed DNS SRV lookup in ConnectionException
instead of just logging a warning if the XMPP domain has no DNS SRV
lookups, create the failedAddresses list now within DNSUtil and add the
information that the SRV lookup failed.
2015-01-26 07:54:12 +01:00
Florian Schmaus d9c97fabfb Make connectUsingConfiguration more robust
If 'return' is not reached, then always throw a
ConnectionException.

Also make it clear that populateHostAddresses adds at least one address.
2015-01-26 07:54:11 +01:00
Florian Schmaus e6045c6593 Add AbstractXMPPConnection.setConcurrencyLevel(int)
Also limit the max pool size of the remove callbacks service and use the
same keep alive time for idle threads as the cached executor service
uses.

Note that it would be possible to merge those two. But this could lead
to tasks from the cached executor service blocking the removal of
callbacks, which we don't want.
2015-01-26 07:54:11 +01:00
Florian Schmaus cbb477ebeb Add AbstractXMPPConnection.setReplyToUnkownIq(boolean)
and some javadoc related to IQ request handlers.
2015-01-26 07:54:11 +01:00
Florian Schmaus d5b8647d9d Create smack-im subproject for XMPP-IM
Move Roster and Chat(Manager) code into their own packages within the
new smack-im subproject.

Apply Manager pattern to Roster.

Fixes SMACK-637.
2015-01-26 07:54:05 +01:00
Florian Schmaus 440af7675a Rename SmackConfiguration.DEBUG_ENABLED to DEBUG 2015-01-19 08:26:42 +01:00
Florian Schmaus 672d131280 Fix AbstractXMPPConnection.login() javadoc
non-SASL auth is no longer supported by Smack.
2015-01-19 08:26:41 +01:00
Florian Schmaus cb67f1d5c3 Switch 'username' paramater to CharSequence
instead of String. So that jxmpp-jids Localpart class can also be used
as argument.
Note that the username is not always the localpart!
2015-01-19 08:26:38 +01:00
Florian Schmaus ed67ed8e11 SASL, username and password related javadoc improvements 2015-01-18 20:42:27 +01:00
Florian Schmaus 0bcd3d9356 Synchronize connect() and login()
Those methods being not synchronized was never an issue, but they should
mutally exclusive and not be called multiple times concurrently.
2015-01-18 11:16:12 +01:00
Florian Schmaus 6d7f3904d9 Throw NotConnectedException on login()
if connect() was not previously called. Previously calling login() with
arguments would not check for the preconditions.

The check to throw needs to be performed in AbstractXMPPConnection
before every 'abstract login(Non)Anonymously()' call. That's the two
lines that check the preconditions are duplicated.

Also fix NPE in
XMPPTCPConnection.throwNotConnectedExceptionIfAppropriate() when
packetWrite is null (i.e. if the connection was never connected before).
2015-01-17 17:53:36 +01:00
Florian Schmaus 25bcb6b891 Deprecate setLegacySessionDisabled(boolean) 2015-01-17 12:36:35 +01:00
Florian Schmaus 2e23a6f150 Allows PacketCollector's to cancel each other
This is useful for cases where a result set is requested, as it's the
case in XEP-13 and XEP-313.

Also adds
XMPPConnection.createPacketCollector(PacketCollector.Configuration).
2015-01-16 20:55:32 +01:00
Florian Schmaus 106512d8d4 Assure stanzaIdAcknowledgedListeners are removed
after at most 12 hours.

Also set a keep alive time for the removeCallbacksService to 30 seconds
and add AbstractXMPPConnection.schedule(Runnable, long, TimeUnit).
2015-01-15 21:36:23 +01:00
Florian Schmaus 9950f4d5de Mark (add|remove)PacketListener deprecated
in AbstractXMPPConnection. It was previously only marked deprecated in
the XMPPConnection interface definition.
2015-01-14 17:32:52 +01:00
Florian Schmaus fc14962445 Make disconnect() not throw NotConnectedException
while disconnect(Presence) still does to notify the user that the
unavailable presence was not send.
2015-01-13 23:20:37 +01:00
Florian Schmaus c682091a47 Fix SASL EXTERNAL with client cert provided JID
isAnonymous() is now a bit weakened since it also considers
allowNullorEmptyUsername.

SaslExternalMechanism of smack-sasl-provided now also doesn't throw an
UnsupportedOperationException.

Follow up on 7e4e3699a1
2015-01-13 13:31:30 +01:00
Florian Schmaus 7e4e3699a1 Add allowEmptyOrNullUsername()
to ConnectionConfiguration.Builder().

And prepare SASL EXTERNAL for empty or null usernames.

Also clarify some parts regarding the user field.

Fixes SMACK-627
2015-01-10 11:26:15 +01:00
Florian Schmaus 6a43bab4f5 Remove protected getConnectionListeners()
Also remove reconnectionFailed() from XMPPBOSHConnection, only
ReconnectionManager should call it.

Add and fix javadoc of ConnectionListener.
2015-01-10 11:26:10 +01:00
Florian Schmaus 8c8ac546a9 Align thread names 2015-01-10 00:57:10 +01:00
Florian Schmaus bb8dcc9874 Add IQ request handler API
This also moves the logic to send error IQ replies from "when there is
no IQ provider registerd" to "when there is no IQ request handler
registered". Which has for example the advantage that IQ parsing no
longer asks for a connection instance.
2015-01-08 23:15:24 +01:00
Florian Schmaus e380872a41 Add 'resumed' bool ConnectionListener's authenticated()
It's important to know if the stream was resumed. authenticated() is the
ideal callback for Managers to reset their state (e.g. cached values of
the connection state). But if the stream was resumed, the cached values
don't have to be reset.
2015-01-07 21:11:09 +01:00
Florian Schmaus 3dd1365a5a Improve Privacy List code
notably add a cache for the active and default privacy list to avoid
IQ get/response round-trips.

Also add a few methods to PrivacyListManager to get the privacy list
names. The already existing methods always returned the whole list
together with the name, which caused two round-trips.

Simplified some code.

Properly escape Privacy XML.
2015-01-07 20:54:23 +01:00
Florian Schmaus 67c0a7089b Move notifyReconnection in AbstractXMPPConnection 2015-01-07 20:11:01 +01:00
Florian Schmaus 717090d272 Rework incoming packet listeners and Roster
Differentiate between asynchronous and synchronous ones. Asynchronous
are the ones where the invocation order may not be the same as the order
in which the stanzas arrived.

Since it's no longer guaranteed that when a unit test calls

processPacket(stanza)

the stanza will be completely processed when the call returns, it was
necessary to extend the unit tests (mostly Roster and ChatManager) with
a packet listener that waits for his invocation. Since we now also use
LinkedHashMaps as Map for the packet listeners (SMACK-531, SMACK-424),
adding a packet listeners as last also means that it will be called as
last. We exploit this behavior change now in the unit tests.

Rename 'recvListeners' to 'syncRecvListeners' in AbstractXMPPConnection.

Rename 'rosterInitialized' to 'loaded' in Roster.

Add Roster.isLoaded().

Reset 'loaded' to false in
Roster.setOfflinePresencesAndResetLoaded() (was setOfflinePresences()).

Fixes SMACK-583, SMACK-532, SMACK-424
2015-01-07 14:35:23 +01:00
Florian Schmaus f029b576a5 Add XMPPConnection.addAsyncPacketListener(PacketListener, PacketFilter)
and use this method in packet listeners that previously used Async.go().
2014-12-30 20:45:17 +01:00
Florian Schmaus c5d0fb3c7b Add support for *optional* session establishment
Don't perform XMPP session binding if the server announced the feature
as optional.

Fixes SMACK-622
2014-12-30 14:34:04 +01:00
Florian Schmaus 5d5e3c05c5 Assert that processPacket is not called with null 2014-12-28 18:05:04 +01:00
Florian Schmaus 08c1f2c850 Add AbstractXMPPConnection.parseAndProcessStanza()
and remove BOSHPacketReader.

Reduces the duplicate code in smack-tcp and smack-bosh. Also moves
ParsingExceptionCallback into AbstractXMPPConnection.
2014-12-28 17:43:39 +01:00
Florian Schmaus 54706e3918 Move lastStanzaReceived in processPacket
of AbstractXMPPConnection.

In worst case we loose a timestamp because handleUnparsablePacket threw
an Exception.
2014-12-28 00:47:31 +01:00
Florian Schmaus efb9a5f517 Improve logging of finalize() methods 2014-12-19 12:55:31 +01:00
Florian Schmaus 18ac83cf8c Move SmackExecutorThreadFactory out of
AbstractXMPPConnection. And use it in PingManager.
2014-12-19 12:53:16 +01:00
Florian Schmaus 4b77d00e91 Re-add the login(String, String, String) method 2014-12-18 14:07:54 +01:00
Florian Schmaus d081055312 Use cached executor in AbstractXMPPConnection 2014-12-18 10:15:38 +01:00
Florian Schmaus a87227c531 Rename ConnectionConfigurationBuilder to Builder 2014-12-18 10:15:35 +01:00
Florian Schmaus 05870e6a22 s/Unkown/Unknown/g 2014-12-09 13:23:01 +01:00
Florian Schmaus 0db76f4eb1 Throw a NotConnectedException on disconnect()
if not connected. For consistent behavior, so that it is always
thrown. Previously it may be thrown or not.
2014-11-15 09:46:39 +01:00
Florian Schmaus def8fea05f Add reply timeout to NoResponseException message 2014-11-15 09:46:38 +01:00
Florian Schmaus c81cd34561 Apply builder pattern to ConnectionConfiguration
Introducing a clean split between the constant connection configuration
parameters, which are now all in ConnectionConfiguration and the dynamic
connection state (e.g. hostAddresses) which are now in
AbstractXMPPConnection.

Also removed all arguments of login() since the username, password,
resource and callback handler need now to be configured via
ConnectionConfiguration.

Also remove documentation/extensions/messageevents.md, as it's already
in documentation/legacy
2014-11-15 09:46:31 +01:00
Florian Schmaus a9c798f3bb Remove empty statements 2014-11-09 18:31:07 +01:00
Florian Schmaus 5647cac39c Move is(Connected|Authenticated) and getUser()
into AbstractXMPPConnection.

Also remove wasAuthenticated field from XMPPBOSHConnection, it is
already in AbstractXMPPConnection.
2014-11-01 12:42:53 +01:00
Florian Schmaus 0408d075b7 Merge invokePacketCollectors() and notifiyReceivedListeners()
into invokePacketCollectorsAndNotifyRecvListeners()
2014-10-30 23:36:40 +01:00
Florian Schmaus ed66c838e1 Invoke PacketCollectors in ListenerNotification
Also make executorService a non-ScheduledExecutorService. This was an
artifact from times where executorService as used to schedule
Runnables. But now it's just used to queue the receive packets in
Runnables and call the packet collectors and listeners.
2014-10-29 19:38:45 +01:00
Florian Schmaus 9f56842ee4 Notify packet sending listeners in new thread
sendListeners are now invoked *after* the packet has been put on the
wire.

Also sending listener exceptions are not catched and not only
NotConnectedExceptions. And a exception does not cause a 'break' but a
'continue' now. Log level is WARNING now.
2014-10-25 16:35:58 +02:00
Florian Schmaus 5ad4e85ed5 Setup Roster before sending initial presence
Thanks to Phil Winder for reporting the issue.
2014-10-20 21:58:20 +02:00
Florian Schmaus 98a3c46e9a Add XMPPConnection.createPacketcollectorAndSend(PacketFilter, Packet)
Using

createPacketCollector(filter);
sendPacket(packet);

was error prone, i.e. the PacketCollector could leak if sendPacket()
would throw an exception and the user forgot to call
PacketCollector.cancel(). For cases where
createPacketCollectorAndSend(IQ) is not sufficient (because we don't
send IQs), createPacketCollectorAndSend(PacketFilter, Packet) is now
used, which does take care that the PacketCollector does not leak if
sendPacket() throws an Exception.
2014-10-13 10:45:00 +02:00
Florian Schmaus 63d52f6eaa Replace PacketInterceptor with PacketListener
both serve the same purpose: As callback for Packets. There is no need
to have both, so remace PacketInterceptor and let PacketListener take
its place. Some classes like ChatStateManager can now use
MessageListener as interceptor callback, which is more convenient.
2014-10-12 19:19:44 +02:00
Florian Schmaus 36da216b4a Reworked Interceptor and InterceptorWrapper
Allows interceptor to remove themselves in the interceptPacket() method.

Same change for Interceptors as was done in
15d59299a2 for (send|recv)Listeners.
2014-10-10 12:22:23 +02:00
Florian Schmaus c3528d082e Add invokePacketCollectors, remove duplicate code
Add javadoc about why we use CocurrentLinkedQueue for collectors.
2014-10-10 02:41:37 +02:00
Florian Schmaus 15d59299a2 Reworked (send|recv)Listeners, ListenerWrapper
instead of rely on ListenerWrapper checking the PacketFilter *and*
invoking the PacketListener we now use two for-each loops, where the
first filters the PacketListeners that should get invoked and use the
second for-each loop to actually invoke the PacketListener.

Before, the code was not thread safe if a PacketListener would remove
itself from the (send|recv)Listeners.

Also make packet(Listener|Filter) in ListenerWrapper final.
2014-10-10 00:44:51 +02:00
Florian Schmaus 03686fbaaf Use CopyOnWriteArraySet for connectionListener 2014-10-09 23:55:02 +02:00
Florian Schmaus 6980c8e63d Rework Smack Provider design
this is the first stop towards fixing "SMACK-65: parsing should look for
depth", by providing the initial parsing depth to the provider. Some
methods (.e.g parseMessage) now use the depth as abort condition,
instead of a unclean String equals check.

parseIQ() and parseExtension() where both renamed to parse.

This also restricts the Exceptions thrown by the parse method, to just
XmlPullParserException, IOException and SmackException (not really a big
victory, but nevertheless a slight improvement).

StreamFeatureProvider is now gone, we simply use PacketExtensionProvider
for stream features.
2014-10-08 16:01:14 +02:00
Florian Schmaus 46a4402a69 Add StreamFeatureProvider
so that AccountManager and the CapsExtension can be moved to
smack-extensions, where they belong.
2014-09-11 23:58:07 +02:00
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 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 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
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
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 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 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 fe258fe110 Fix XMPPTCPConnection to set 'host' and 'port'
Fixes SMACK-585
2014-07-23 08:29:35 +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
Júlio Cesar Bueno Cotta 944ac37fc3 Remove getConfiguration() from XMPPConnection
interface definition.
2014-06-05 11:42:26 +02:00
Florian Schmaus 12b9e9d507 Add AndroidDebugger as possible debugger
Create AbstractXMPPConnection.DEBUGGERS with possible debugger classes.
2014-06-01 12:24:50 +02:00
Florian Schmaus 8977f5b3f0 Improve TLS/SSL support
Add TLSUtils. Make it possible to set the enabled SSL/TLS protocols and
ciphers and provide sane error reporting.
2014-05-30 12:28:19 +02:00
Florian Schmaus 6fd4bb850e Remove schedule() from XMPPConnection interface
The idea that we abstract the scheduling of tasks on Android over this
method turned out to be unnecessary. schedule() was also not really part
of the *public* XMPPConnection API, so it's good that it's gone.
2014-05-28 08:18:45 +02:00
Florian Schmaus beecb8a675 Make XMPPConnection an interface
create AbstractXMPPConnection.
2014-05-28 08:18:41 +02:00