1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-02 14:55:58 +01:00
Commit graph

130 commits

Author SHA1 Message Date
Florian Schmaus
8840236b72 Gracefully disconnect XMPPTCPConnection
That is, wait with a timeout for a closing stream element if we have
sent a closing stream element to the server. See RFC 6120 § 4.4.

Fixes SMACK-633.
2015-05-27 17:36:04 +02:00
Florian Schmaus
01f08e87c2 Merge branch '4.1'
Conflicts:
	smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5BytestreamManager.java
	version.gradle
2015-05-24 22:36:11 +02:00
Florian Schmaus
8db0403138 Improve writing XML elements to socket
Instead of allocating one big continuous memory block before "writing"
the XMPP stream element to the socket, write the single CharSequences of
LazyStringBuilder/XmlStringBuilder.

Also change Obserable writer to only notify the listeners after a
flush *or* if a certain limit has been reached since the last
notification. Otherwise the debugger would "print" every single XML part
as result of this change.
2015-05-21 22:41:21 +02:00
Florian Schmaus
576980097e Request SM ack when re-sending after stream resumption
Fixes SMACK-667.
2015-05-19 14:21:52 +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
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
189f524195 Make SynchronizationPoint interruptible
SMACK-632
2015-04-12 18:33:43 +02:00
Florian Schmaus
4a16ab9329 Merge branch '4.1'
Conflicts:
	version.gradle
2015-04-12 18:32:55 +02:00
Florian Schmaus
dabbb40de6 Fix isSmResumptionPossible() returning wrong values
The cases where reversed. Change the condition for better readability.

Also fix int and long handling in the computation of
maxResumptionMillies.

Fixes SMACK-654.
2015-04-07 08:51:03 +02:00
Florian Schmaus
3b6891b0d0 Fix integer overflow if no max resumption time
is specified by client and server.

Fixes SMACK-653.
2015-04-07 08:51:03 +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
b4694ec152 Add FinalClass checkstyle check
And mark affected classes final.
2015-04-06 10:45:12 +02:00
Florian Schmaus
0a6ac76447 Remove package-info.java from test packages
as otherwhise eclipse will complain "The type package-info is already
defined".
2015-04-05 10:48:00 +02:00
Florian Schmaus
de528eee67 Add JavadocPackage checkstyle
change from package.html to package-info.java. Add missing
package-info.java with a placeholder description.
2015-04-04 17:16:47 +02:00
Florian Schmaus
64d134052d Enable javadoc checkstyle
and fix violations.
2015-03-29 12:29:32 +02: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
b7fbd0614e Fix assert statement in XMPPTCPConnection 2015-03-23 22:44:15 +01:00
Florian Schmaus
5e86db4f80 Substitute 'packet' with 'stanza(/packet)' in javadoc 2015-03-21 09:36:28 +01:00
Florian Schmaus
f410ece468 Call connection created listeners in constructor
Fixes SMACK-638.
2015-03-19 08:21:47 +01:00
Florian Schmaus
b2221d5483 Add more checkstyle tests
- Lines containing tab(s) after space
- Usage of printStackTrace
- Usage of println
- Add SupressionCommentFilter module

SuppressionCommentFilter can be enabled with
// CHECKSTYLE:OFF
and disabled with
// CHECKSTYLE:ON
2015-03-17 22:02:44 +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
369878b6d9 Merge branch '4.1'
Conflicts:
	version.gradle
2015-03-11 20:51:08 +01:00
Florian Schmaus
92c76d1023 Only reset smSessionId if the stream is no longer resumeable 2015-03-10 13:17: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
96bb37f924 Fix counting bug Stream Management implementation
Previously Smack would put messages in the unacknowledgedStanzas queue
after it received the 'enabled' element, when it should do so right
after sending the 'enable' stream element.

Imagine a session where '-->' denotes "received from server" and '<--'
"sent to server"

<-- enable
--> iq roster push set
--> presence some presence
<-- iq roster push result
--> enabled

then Smack would not add the iq roster push result stanza to the
unacknowledgedStanzas queue.

This fixes the issue by initializing the unacknowledgedStanzas queue
when the writer thread encounters a 'Enable' stream element.

The additional 'instanceof' invocation in the writer thread should not
be a big performance issue, since the existing "instanceof Stanza" check
should be the common case and the "instanceof Enable" is an exclusive
alternative to this case.
2015-03-02 16:17:47 +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
4b7a396b9b Improve logging wrt XMPPTCPConnection.shutdownDone 2015-02-26 08:27:19 +01:00
Florian Schmaus
90969e252a Improve the bundle and defer mechanism
Instead of always bundling when the queue is empty, only bundle once the
queue has become empty and then only if it has been become empty again.

The previous algorithm would also bundle and defer the last element
found in the queue. This is not the case now.
2015-02-22 10:51:44 +01:00
Florian Schmaus
8b0ccd7420 Minor javadoc fixes and improvements 2015-02-22 10:41:53 +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
bfcb403673 Fix Stream Management ack listner invocation
aborting to early, because of a 'return' statement, when 'continue'
should be used.

Thanks to Daniele Ricci for reporting this bug.
2015-02-19 23:01:38 +01:00
Florian Schmaus
5f4374ec26 Use host(name) to construct the SSLSocket
in XMPPTCPConnection.

So that the hostname and not the IP is available to the SSLSocket and
the SSLSession, which handed over to HostnameVerifier. This leaves the
HostnameVerifier with the

- name of the XMPP service (first argument of verify(String, SSLSession)
- name of the used host (found in the SSLSession)

allowing more complex verification mechanisms performed by the
HostnameVerifier.
2015-02-19 12:14:16 +01:00
Florian Schmaus
d415661e35 Add BundleAndDeferCallback to smack-tcp 2015-02-19 12:14:10 +01:00
Florian Schmaus
aa8daba1cf Add StreamManagemtCounterError
to allow graceful connectionClosedOnError() disconnects, since we
received a bunch of reports where the counter seems wrong, which is
causing a NPE in a thread pool executor, causing the VM or Android App
to terminate.

Now we throw the StreamManagementCounterError instead.
2015-02-18 12:07:44 +01:00
Florian Schmaus
7897fca876 Add comment about Stream Management's unacked stanzas queue 2015-02-18 11:59:45 +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
96e3d5c533 Add XMPPTCPConnection(CharSequence, String) constructor 2015-02-09 07:35:16 +01:00
Florian Schmaus
1630b44b8d Reset smSessionId on XMPPTCPConnection.disconnect() 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
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
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
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