Commit Graph

29 Commits

Author SHA1 Message Date
Florian Schmaus 91fd15ad86 Prefix subprojects with 'smack-'
instead of using the old baseName=smack appendix=project.name approach,
we are now going convention over configuration and renaming the
subprojects directories to the proper name.

Having a prefix is actually very helpful, because the resulting
libraries will be named like the subproject. And a core-4.0.0-rc1.jar is
not as explicit about what it actually *is* as a
smack-core-4.0.0-rc1.jar.

SMACK-265
2014-04-28 19:44:14 +02:00
Florian Schmaus bc176d72a3 Throw exceptions of SSLSocket.startHandshake() in connect()
instead of throwing a NoResponseException in case startHandshake()
throws an Exception. The NoResponseException was then thrown when
performing SASL auth, which usually directly followes securing the
connection via TLS (if enabled and provided by the server).
2014-04-28 17:36:10 +02:00
Florian Schmaus 854489e785 No need to synchronize bindingRequired
If binding is required or not is told the client by the server within
the features stanzas. Smacks guarantees that connect() blocks until the
features stanzas has been received and processed.
2014-04-28 07:58:39 +02:00
Florian Schmaus 874a22489e Remove resource binding out of sasl auth
Follow XEP-170 recommendations: Resource binding *after* compression.

Fixes also a bunch of race conditions related to the wait()/notify()
pattern used in the early stages of a Connection where
createPacketCollectorAndSend(Packet).nextResultOrThrow() can not be
used. Those wait()/notify() patterns are currently
- SASL authentication
- compression
- resource binding

Fixes SMACK-454
2014-04-28 07:58:34 +02:00
Florian Schmaus 86ad192bea Log connectionClosedOnError exceptions 2014-04-27 10:49:58 +02:00
Florian Schmaus 069e7d7e60 Use connection specific reply timeout value
instead of the global default one.
2014-04-23 10:08:51 +02:00
Florian Schmaus 3de8af6865 callConnectionAuthenticatedListener() should call authenticated()
not connected().
2014-04-22 21:36:05 +02:00
Florian Schmaus b4eb8ad182 Javadoc fixes
- Add hint to reconnection configuration
- s/connection.getChatManager/ChatManager.getInstanceFor(connection)
- typos
2014-04-15 11:31:47 +02:00
Florian Schmaus 61fd3c9dd0 Add FromMode regarding 'from' attribute of outgoing stanzas
XMPP Servers should ignore the 'from' attribute of outgoing
stanzas. Makes the behavior how Smack populates the 'from' attribute of
outgoing stanzas configurable. Fixes SMACK-547
2014-04-14 11:01:26 +02:00
Georg Lukas ab70cfec24 Refactoring: All connection classes begin with XMPP now
This commit renames classes as follows:
 * TCPConnection --> XMPPTCPConnection
 * BOSHConnection --> XMPPBOSHConnection

There are two reasons for this rename. First, it is there to indicate
that the classes actually _are_ XMPP connections, using different
transport mechanisms. Second, it makes auto-completion in IDEs easier,
the developer can type XMPP<complete> and choose the right backend.
2014-04-09 20:03:07 +02:00
Florian Schmaus 4a60a68802 Move DEBUG_ENABLED from XMPPConnection to SmackConfiguration 2014-04-03 13:10:30 +02:00
Florian Schmaus bd96816102 Add setter and javadoc for packet reply timeout 2014-04-03 10:59:00 +02:00
Florian Schmaus fcc8414a92 "not connected" is now a checked Exception thrown by sendPacket()
There is a unsolveable race condition between the connection state and
sendPacket(), i.e. the connection could go down, right after the
method calling sendPacket is called, but before sendPacket() is
invoked. Before this change, sendPacket() has thrown an unchecked
IllegalStateException, which could be ignored by the Smack user, who
would also not notice the race condition. We have decided to throw a
checked Exception in this case now, to make the Smack user aware of
this situation.

SMACK-426
2014-03-19 15:56:41 +01:00
Florian Schmaus 44a5408bc0 Move host/port from ConnectionConfiguration to XMPPConnection
There semantic is that they now report the host used to establish the
connection. Therefore BOSHConfiguration needs to hostAddresses for
getURI().
2014-03-19 09:00:10 +01:00
Florian Schmaus 4db967079f getInstanceFor() for ChatManager and AccountManager 2014-03-19 08:59:45 +01:00
Florian Schmaus 6197f6200f Move duplicate sendPacket() code into XMPPConnection 2014-03-17 19:52:52 +01:00
Florian Schmaus 364cbd81da Add getter for connectionCounter to XMPPConnection 2014-03-15 11:39:38 +01:00
Florian Schmaus 64e7b8a868 Move getRoster() to XMPPConnection
Also remove the Exceptions from the signature of getRoster().

Extend ConnectionListener with connected() and authenticated()
callbacks, required by Roster to be notified so that the Roster can be
loaded *after* login.
2014-03-15 11:21:49 +01:00
Florian Schmaus 4b56446e40 Introduce SmackException
SmackException (and it's subclasses) is for all errors/exceptions not
defined by any XMPP specification. XMPPException is now an abstract
class for all errors defined by the XMPP specifications.

Methods that involve an IQ exchange now either return the result, which
is obtained by IQ response, or they throw an XMPPErrorException if an IQ
error was the result of the IQ set/get. If there was no response from
the server within the default packet timeout, a NoResponseException will
be thrown.

XMPP SASL errors are now also reported accordingly.

SMACK-426
2014-03-14 01:46:42 +01:00
Florian Schmaus 4b6f09f962 Move processPacket() method to XMPPConnection
This removes code duplication in BOSHConnection and TCPConnection's
PacketReader, by moving the common code to the superclass
XMPPConnection.
2014-03-14 00:25:22 +01:00
Florian Schmaus b8a5437b28 Fix all javadoc warnings 2014-03-10 21:58:12 +01:00
Florian Schmaus a3ab886896 Reworked compression-jzlib and compressionHandlers
- There is now no longer the need to use reflection for
compression-jzlib.
- compressionHandlers are a global configuration property and therefore
belong in SmackConfiguration.
2014-03-10 10:20:52 +01:00
Florian Schmaus 489816c61f Renamed Connection to XMPPConnection 2014-03-10 09:45:50 +01:00
Florian Schmaus a3e64bab18 Created 'tcp' subproject for TCPConnection
Renamed XMPPConnection to TCPConnection, since the other connection type
is also called BOSHConnection.
2014-03-01 14:31:34 +01:00
Florian Schmaus 790343867a Remove non-SASL authentication code (SMACK-446) 2014-03-01 14:31:29 +01:00
Florian Schmaus 2241dae16a Remove some deprecated code 2014-02-20 16:04:20 +01:00
Florian Schmaus 7bd7b3d24c Improve packet send and result collecting API
Instead of repeating the same pattern, when sending an IQ get/set packet
and collecting the response

PacketFilter filter = new PacketIDFilter(request.getPacketID()),
PacketCollector collector = connection.createPacketCollector(filter);
connection.sendPacket(reg);
IQ result = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
// Stop queuing results
collector.cancel();
if (result == null) {
    throw new XMPPException("No response from server.");
}
else if (result.getType() == IQ.Type.ERROR) {
    throw new XMPPException(result.getError());
}

the API got redesigned, so that the above code block can be replaced
with

Packet result = connection.createPacketCollectorAndSend(request).nextResultOrThrow();
2014-02-18 19:39:47 +01:00
Florian Schmaus 1e57f1c659 Activate checkstyle and add missing license headers
Delete also all "All rights reserved" statements, as they are
unnecessary and conflict with checkstyle's header check. Delete unused
imports.
2014-02-17 20:09:55 +01:00
Florian Schmaus 201152ef42 Migrate from Ant to Gradle (SMACK-265) 2014-02-14 18:46:33 +01:00
Renamed from source/org/jivesoftware/smack/XMPPConnection.java (Browse further)