1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-01 09:45:59 +01:00
Commit graph

2295 commits

Author SHA1 Message Date
Florian Schmaus
8e693ba5d5 Add nightly javadoc and documentation link to README 2014-03-10 10:23:33 +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
f3e007bad5 NPE check in SmackConfiguration 2014-03-09 23:43:34 +01:00
Florian Schmaus
1f2183605c Make IQReplyFilter aware of user-less connection state
SMACK-533
2014-03-09 21:31:48 +01:00
Florian Schmaus
a7ec0338bc Don't set SASL authid parameter to username (SMACK-371)
RFC4616 states that if the authorization identity (authzid) parameter is
null, then it is derived from the authentication
identity (authcid). Smack currently sets both, authzid and authcid, to
the username, resulting in auth attempts of

userid\0userid\0password

instead of

userid\0password

Which are different users on most systems (e.g. Kerberos).

We now set only SASLMechanism.authenticationId to username. The
authenticate(String, CallbackHandler) method does now not longer receive
the username, as it's send by the CallbackHandler.
2014-03-09 14:59:45 +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
45226080e6 Fix typo in variable name 2014-03-09 14:59:45 +01:00
Lars Noschinski
1a2933793c Tune documentation
Waiting for an answer is synchronous behaviour, not asynchronous.
2014-03-09 14:59:45 +01:00
Lars Noschinski
4cb799228c Cleanup texts and comments 2014-03-09 11:20:32 +01:00
Lars Noschinski
86a4bfa43f Remove deprecated constructor for FromMatchesFilter (SMACK-71) 2014-03-09 11:20:32 +01:00
Georg Lukas
62de78ef7c SMACK-53: create VersionProvider and VersionManager
The VersionProvider is used to parse Version IQs. Integration:

	providerManager.addIQProvider("query", Version.NAMESPACE, new VersionProvider());

The VersionManager is used to reply to Version IQs. Integration:

	VersionManger.getInstanceFor(connection).setVersion(
		new Version("App Name", "1.23", "Operating System"));
2014-03-09 11:20:31 +01:00
Vyacheslav Blinov
61bf5cd4ce Advanced Message Processing implementation (XEP-0079)
Fixes SMACK-544
2014-03-09 11:20:31 +01:00
Vyacheslav Blinov
06f88674ee SMACK-541 Fix of XHTMLExtensionProvider on Android
This fixes issue there on android in XHTMLExtension bodys contained "null" instead of actual xhtml tags
This happened due to difference in XPP implementation in KXmlPullParser (on Android) MXParser (in other cases)
This fix replaces usage of getText method of XPP with restoration of xhtml tags using XPP api.
2014-03-09 11:20:31 +01:00
Florian Schmaus
585e20e93e Rework XMPP Date/Time related code
- Fix "packet.Time is not thread-safe" (SMACK-543)
- Update packet.Time to XEP-0202

Add SDM.supportsFeature(), since this is a pattern that repeats over and
over again in Smack. Also add abstract Manager class, that takes care of
the weak reference to Connection, as this is also a repeating pattern in
Smack.
2014-03-09 11:20:31 +01:00
Florian Schmaus
768700b301 Move Roster Item Exchange code to legacy project
XEP-93 has been deprecated and superseded by XEP-144.
2014-03-09 11:20:30 +01:00
Florian Schmaus
fa289eac04 Migrated Roster Item Exchange to new manager design
The finalize approach was flawed anyway, it would have never been
called. Because if the packetListener was still referenced from a
connection, and the connection was still strong referenced, then a
strong reference from a gc root would still exists to the manager, which
would prevent it from being gc'ed and finalized being called.
2014-03-09 11:20:30 +01:00
Florian Schmaus
14b43581dc Move Jingle packet and provider under smackx.jingle
The Jingle integration-tests where also accidentally not within the
smackx package.
2014-03-09 11:20:30 +01:00
Florian Schmaus
84a3fd7bd9 s/XMPPConnection/TCPConnection 2014-03-09 11:20:30 +01:00
Florian Schmaus
07649cc758 Code cleanup in SASLMechanism
- typos
- deprecated methods
- whitespace fixes
2014-03-07 16:15:34 +01:00
Lars Noschinski
57231648c8 Remove remainders of non-SASL authentication (SMACK-446) 2014-03-07 16:15:24 +01:00
Lars Noschinski
e654eac9d5 Unify AndFilter and OrFilter
AndFilter and OrFilter are dual; there is no reason why they should have
differing interfaces.
2014-03-07 16:13:58 +01:00
Lars Noschinski
9ac882241a Process only requested roster results (SMACK-538)
Prior to this change, Smack processes each RosterPacket (which is not of
type IQ.Type.RESULT) as a roster result.

Any other client on the XMPP network can send such a packet (not only
our server). This allows a malicious party to overwrite our Roster.

This patch changes smack so that a RosterPacket is discarded if it is
not a reply to a roster request.
2014-03-07 16:13:19 +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
Lars Noschinski
980047c4e1 Create accurate filter for matching on from address (SMACK-71)
Smack contains two PacketFilters to filter on the from address.
FromContainsFilter simply does a substring match, which is problematic
as explained in SMACK-71. FromMatchesFilter partially fixes this
weakness, but it still uses String#startsWith to filter on bare
addresses. For example, when setup to match all JIDs with bare JID
"foo@example.co", it will still match "foo@example.com".

This commit changes FromMatchesFilter to test equality with the bare
from instead of startsWith with the full from.

Moreover, we convert all uses of FromContainsFilter to FromMatchesFilter
and remove FromContainsFilter. Additionally, the unused ToContainsFilter
(which as the same weaknesses) is removed, too.
2014-03-05 06:48:40 +01:00
Florian Schmaus
0e49b23687 Use correct namespace for MUC.getAdmins()
Fixes (again) SMACK-371
2014-03-01 15:38:07 +01:00
Florian Schmaus
e7963b698d PingManager should notify PingFailedListeners only once
Fixes SMACK-548
2014-03-01 15:29:35 +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
3a4e6c6d39 Add automatically scheduled pings in PingManager
replaces keep-alive functionality. SMACK-537
2014-02-26 22:03:02 +01:00
Florian Schmaus
54a421e84e Make JUL Loggers final (SMACK-536) 2014-02-26 22:00:27 +01:00
Florian Schmaus
f0c6d1f1d3 Properly escape PubSub item's text (SMACK-546) 2014-02-26 22:00:27 +01:00
Florian Schmaus
2c7f1efe80 Send request after the PacketCollector was setup
This bug was introduced with 7bd7b3d24. Thanks to Lars Noschinski for
discovering it.
2014-02-25 22:52:07 +01:00
Florian Schmaus
3093333533 Reworked Smack initialization
Move extension relevant configuration options from SmackConfiguration to
the extension. Introduced disabledSmackClasses that can be configured
via a system property or configuration file.
2014-02-23 17:48:07 +01:00
Florian Schmaus
4121ec2c0e Use String(String,String) constructor in SmackConfiguration
String(String, Charset) is not available on all platforms, as it's only
provided by Android on API level 9 or higher.
2014-02-22 14:41:19 +01:00
Florian Schmaus
2241dae16a Remove some deprecated code 2014-02-20 16:04:20 +01:00
Florian Schmaus
352c362e90 Remove the dependency on javax.xml.transform
Not all platforms support this API (e.g. Android). Strip the
prettyPrint() method since it wasn't used anyway.

Also move XmlUtil in a more appropriate package.
2014-02-20 14:47:05 +01:00
Florian Schmaus
24b637876f Substitute MXParser with a call to XmlPullParserFactory
This makes Smack more portable, as there are platforms that support the
XmlPullParser interface, but not MXParser (e.g. Android).

Also enable checkstyle check that MXParser is not used.
2014-02-20 13:48:36 +01:00
Florian Schmaus
4db0b101c2 Raise jbosh version to 0.7.0 2014-02-20 13:11:10 +01:00
Florian Schmaus
b4d735e862 Cleanup of build.gradle
- Moved helper code at the end
- Add description to the POM
2014-02-19 23:26:56 +01:00
Florian Schmaus
1a94812660 Add BOSH subproject (SMACK-187) 2014-02-19 22:41:31 +01:00
Georg Lukas
fea2db2be7 SMACK-465: XMPPException using Java's wrapped Throwable 2014-02-19 10:42:39 +01:00
Florian Schmaus
602a8fc812 Activate the jingle subproject and move integration tests
The jingle subproject builds now. This doesn't change that the code is
outdated with regard to the specification and unmaintained for
years. But hopefully this is the first step to change that. :)

The integration tests have been moved into SourceSets of 'core' and
'extensions'.
2014-02-19 10:38:30 +01:00
Florian Schmaus
f7d3f559a2 Fix eclipse formatter settings: indentation.size=4 2014-02-18 23:15:38 +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
e6d5385129 Add more pom metadata 2014-02-18 10:51:24 +01:00
Florian Schmaus
312f2f7508 Move EntityCaps and Bookmarks API in correct package
Also move ProviderConfigTest into core, since it tests core
functionality, nothing provided by extensions. Found the reason the test
was failing since the gradle migration (provider entry test.providers),
and activated it again. \o/

New API design as of SMACK-545
2014-02-18 10:24:59 +01:00
Florian Schmaus
1f63ac31a5 Update README.md 2014-02-18 10:03:42 +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