Commit Graph

2440 Commits

Author SHA1 Message Date
Florian Schmaus 5bb4727c57 Use Jid (and subclasses) from jxmpp-jid
Fixes SMACK-634
2015-02-17 16:07:16 +01:00
Florian Schmaus 0ee2d9ed1e Remove deprecated Packet class 2015-02-14 16:21:26 +01:00
Florian Schmaus bc61527bd2 Expose InterruptedException
SMACK-632
2015-02-14 14:57:33 +01:00
Florian Schmaus 43b99a2a85 Smack 4.2.0-alpha1-SNAPSHOT 2015-02-14 09:36:52 +01:00
Florian Schmaus 8a32d22739 Smack 4.1.0-rc1 2015-02-14 09:36:31 +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
Florian Schmaus 57c1b57b7c s/ a XMPP/ an XMPP/ 2015-02-12 12:13:19 +01:00
Florian Schmaus a927d55bb1 Improve XMPPConnection javadoc
It's an interface

State that it does intentionally not declare any state changing
methods (e.g. connect(), disconnect())
2015-02-12 12:09:53 +01:00
Florian Schmaus 2853ec39b4 Fix XMPPConnection javadoc
The XMPPConnection interface does not define methods to manipulate the
connection state (e.g. connect(), disconnect()). The example should use
the connection type as declared type.
2015-02-11 17:37:34 +01:00
Florian Schmaus b7ac16c1fb Add missing 'break' statement in BOSHPacketReader 2015-02-10 16:36:34 +01:00
Florian Schmaus 96e3d5c533 Add XMPPTCPConnection(CharSequence, String) constructor 2015-02-09 07:35:16 +01:00
Florian Schmaus 943dc29f92 Move vCard unit test into its own package 2015-02-09 07:35:15 +01:00
Chris Deering 0b4072ad66 Re-implementing the vCard provider using a pull parser. Extended unit tests. 2015-02-09 07:35:15 +01:00
Florian Schmaus 1630b44b8d Reset smSessionId on XMPPTCPConnection.disconnect() 2015-02-09 07:35:15 +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 3b8f4c144e Add missing space in log statement within XMPPTCPConnection 2015-02-09 07:35:15 +01:00
Florian Schmaus e0a2441c62 Add Stanza.hasStanzaIdSet() 2015-02-09 07:35:07 +01:00
Florian Schmaus 1190edad0f Add 'Packet' interface
to aid transition to the new 'Stanza' class ('Packet' was renamed to
'Stanza' a few commits before this).
2015-02-06 09:34:58 +01:00
Florian Schmaus 772da6bfa0 Fix connections.md: It's 'XMPPTCPConnectionConfiguration.Builder'
added the missing dot ('.'). The Builder was renamed a while ago.
2015-02-06 09:34:58 +01:00
Florian Schmaus a5beb7bd79 Add Stanza.getExtensions(String,String) 2015-02-06 09:34:58 +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 9fc26f1d83 Use MultiMap for Stanza extension elements 2015-02-05 11:04:38 +01:00
Florian Schmaus e977c349a8 Add documentation/developer/provider.md
also fix stanzas.md
2015-02-04 16:34:10 +01:00
Florian Schmaus 5c16fdb017 Make Presence.getMode() return available if null 2015-02-03 19:32:08 +01:00
Florian Schmaus 4013c68584 Use Objects.requireNonNull() in Presence
Also make Objects.requireNonNull() throw NullPointerException to match
the original API behavior.
2015-02-03 19:32:04 +01:00
Florian Schmaus 34ce7929a8 Smack 4.1.0-beta3-SNAPSHOT 2015-02-02 13:14:45 +01:00
Florian Schmaus 4b215814db Smack 4.1.0-beta2 2015-02-02 13:04:47 +01:00
Florian Schmaus 4a769b0262 Throw IAE in IQReplyFilter if there is no local JID
available yet.
2015-01-30 09:37:55 +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 612ca1ad9d Use CharSequence instead of String for username
in XMPPTCPConnection's constructor.
2015-01-28 09:34:01 +01:00
Florian Schmaus 37081b2810 Send more information with the stream open tag 2015-01-28 09:31:28 +01:00
Florian Schmaus e493500cfe Consider XMPP service name in isSubscribedToMyPresence() 2015-01-27 09:45:50 +01:00
Florian Schmaus ed4d815fba Make Message.setType(Type) not throw if type is null
RFC 6121 § 5.2.2:
"""
If an application receives a message with no 'type' attribute or the
application does not understand the value of the 'type' attribute
provided, it MUST consider the message to be of type "normal" (i.e.,
"normal" is the default).
"""
2015-01-26 20:47:14 +01:00
Florian Schmaus 3299515b36 Make Roster.isRosterVersioningSupported public 2015-01-26 20:47:14 +01:00
Florian Schmaus 7348e8bc8b Add Roster.getEntriesAndAddListener(RosterListener,RosterEntries) 2015-01-26 20:47:14 +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 603f64166b Improve Roster, RosterEntry and RosterGroup
Use final where possible, add javadoc. Fix duplicate comment in
Roster.

Use createPacketCollectorAndSend(packet).nextResultOrThrow when
possible, and only set the entry name if the IQ set is successful.
2015-01-26 16:24:32 +01:00
Florian Schmaus 763139684b Add javadoc for Roster.reloadAndWait()/setRosterStore() 2015-01-26 11:45:25 +01:00
Florian Schmaus 7aa784a494 SCRAM-SHA1: Always calculate serverSignature
Otherwise we may get an NPE if the key was cached:

Connection closed with error java.lang.NullPointerException: Attempt to get length of null array
	at org.jivesoftware.smack.util.stringencoder.Base64.encodeToString(Base64.java:43)
	at org.jivesoftware.smack.sasl.core.SCRAMSHA1Mechanism.evaluateChallenge(SCRAMSHA1Mechanism.java:201)
	at org.jivesoftware.smack.sasl.SASLMechanism.challengeReceived(SASLMechanism.java:230)
 	at org.jivesoftware.smack.SASLAuthentication.challengeReceived(SASLAuthentication.java:328)
 	at org.jivesoftware.smack.SASLAuthentication.authenticated(SASLAuthentication.java:347)
 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:894)
 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:909)
 	at java.lang.Thread.run(Thread.java:818)
2015-01-26 07:54:13 +01:00
Florian Schmaus 1407f10f7f Make connect() return a self-reference 2015-01-26 07:54:13 +01:00
Florian Schmaus 780872f2ef Remove superflous throwAlreadyConnected…Exception
in XMPPTCPConnection. connectInternal() is only called by
AbstractXMPPConnection.connect() which does already invoke this method.
2015-01-26 07:54:12 +01:00
Florian Schmaus 2cba6a68eb Fix DataFormProvider parsing 'fixed' FormFields
b71039660b made FormField.setType(Type)
throw an illegal argument exception if type is fixed, but the
DataFormProvider was not changed, so it still would call
setType(Type.fixed).

Change DataFormProvider so that the non-argument constructer of
FormField is used when type == fixed.
2015-01-26 07:54:12 +01:00
Florian Schmaus 616768a5a9 Add smack-bosh to Android Projects
Replace SaslException with SmackException in XMPPBOSHConnection, that is
the exception which is used in XMPPTCPConnection for the same purpose.

Also make androidProjects a multi-line list.
2015-01-26 07:54:12 +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 30ec2bd072 Cleanup XMPPTCPConnection, mostly exception handling
In initConnection, only initReaderAndWriter() throws IOException.

connectUsingConfiguration doesn't need to take an argument.

PacketReader.init does not throw a SmackException.

Use Async.go() in PacketWriter, just like it's already done in PacketReader.
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 605c29a6fc Fix javadox in XMPPConnection 2015-01-26 07:54:11 +01:00