Commit Graph

19 Commits

Author SHA1 Message Date
atsykholyas 236ea71cee Added support for HOXT (XEP-0332)
This is initial impementation of XEP-0332 (SMACK-552) -
HTTP over XMPP transport.
Created extensions, providers and unit tests.
Two features are missing: jingle and sipub.
2014-03-20 12:36:04 +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 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 b8a5437b28 Fix all javadoc warnings 2014-03-10 21:58:12 +01:00
Florian Schmaus 489816c61f Renamed Connection to XMPPConnection 2014-03-10 09:45:50 +01:00
Florian Schmaus f7fc38e1f4 Refactor Managers to subclass abstract Manager
Also use ServiceDiscoveryManager.supportsFeature() where possible.
2014-03-09 14:59:45 +01:00
Florian Schmaus 93eea8ab8d Move gradle subproject configuration into the subproject 2014-03-09 14:59:45 +01:00
Lars Noschinski 6c7296a37b Add and use IQReplyFilter (SMACK-533)
In the absence of checks on the from address, it is possible for other
clients to fake an answer to an IQ request.

This commit adds an IQReplyFilter, which drops all packets which are not
a valid reply to an IQ request. In particular, it checks for packet id,
from address and packet type.

Most(?) places waiting for a reply to an IQ request are converted to use
the IQReplyFilter.

For a discussion of the issues, see the thread "Spoofing of iq ids and
misbehaving servers" from 2014-01 on the jdev@jabber.org mailing list
and following discussion in February and March.
2014-03-07 16:13:07 +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 d069e1be64 Normalize newlines to '\n'
Change all \r\n into unix style newlines. Add missing newlines at the
end of a file and activate the newline checkstyle module, that enforces
'\n' as newline and a newline at the end of every file.
2014-02-17 23:58:40 +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 6dd64da930 Create new subproject 'legacy', move workgroup API into it 2014-02-17 08:24:10 +01:00
Florian Schmaus 2ad517b6dd Add initializer tests and move classpath files
The initializer tests verify that every non-optional initializer, this
includes Providers, is loadable.

Creating files under META-INF is not considered best practice. Smack's
configuration and provider files reside now in classpath directory
qualified by Smack's package namespace.
2014-02-15 22:12:12 +01:00
Florian Schmaus 8d3814a8a7 New API design (SMACK-545) 2014-02-15 13:03:47 +01:00
Florian Schmaus 201152ef42 Migrate from Ant to Gradle (SMACK-265) 2014-02-14 18:46:33 +01:00
Florian Schmaus 9c61c6c945 Convert Connection references to weak references
If a Manager is strong referenced from a gc root, usually the instances
map, it should not hold itself a strong reference the connection in
order to avoid a cycle that prevents the Connection instance from being
gc'ed.

SMACK-383
2014-02-07 13:17:36 +01:00
Florian Schmaus 4c8af8c17f Don't use manager's constructor in connectionCreated
This could cause duplicate managers. Use getInstanceFor()
instead. SMACK-403.
2014-02-07 12:15:04 +01:00
rcollier faa0f21906 SMACK-434 Added missing javadoc and some test code cleanup
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_4_0@13883 b35dd754-fafc-0310-a699-88a17e54d16e
2014-01-31 03:49:47 +00:00
rcollier 33e2094fe4 SMACK-434 (and 529) Added support for experimental code, that is XEP's that have not yet made it to the draft state.
This new souce directory and artifact initially contains message carbons (XEP-0280) code provided by George Lukas.


git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_4_0@13882 b35dd754-fafc-0310-a699-88a17e54d16e
2014-01-31 03:41:25 +00:00