1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-10-31 17:25:58 +01:00

Smack 4.1.6

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQF8BAABCgBmBQJWo2DDXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxMzU3QjAxODY1QjI1MDNDMTg0NTNEMjA4
 Q0FDMkE5Njc4NTQ4RTM1AAoJEIysKpZ4VI41Q0AH/22s1WOI0mgFjQnuSRoZwtNQ
 WN7eudnKlnknmNrJwPcbW1EYO/kNj1SQnqv7ed2aVpyeFFOf1/CUIgq57K1hBjA0
 gTVtv0vK9pABZOmYY5UYURF6AZqKC2s5grHzOgIQbEhT0IOxc/Kz3/ubRxYwvxQl
 lKenkNw75NMViylC0wFQc673SUuwPKyS3PjFm44ASxhbHNIexqagsxNU3MICmCWr
 vGuyv2pGuVvVbILdqqoRGJhucHUs8HnYjA/H1lAlXH4FE0k3EXnjtztHaiLXQoxC
 I2MbunwlVWcE5099V85wcgBbtMWqgljyz+Yh8MmkPojZTVnWjYPUWybK4G8TREg=
 =1rYD
 -----END PGP SIGNATURE-----

Merge tag '4.1.6'

Smack 4.1.6
This commit is contained in:
Florian Schmaus 2016-01-23 13:27:16 +01:00
commit 85e818cffb
6 changed files with 73 additions and 12 deletions

View file

@ -141,6 +141,25 @@ hr {
<div id="pageBody">
<h2>4.1.6 -- <span style="font-weight: normal;">2016-01-23</span></h2>
<h2> Bug
</h2>
<ul>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-705'>SMACK-705</a>] - PubSub&#39;s Affiliation.getElementName() returns wrong name
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-706'>SMACK-706</a>] - Smack may sends &lt;bind/&gt; and &lt;session/&gt; twice if Stream Management is used and a previous SM state exists
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-707'>SMACK-707</a>] - Infinite loop of NullPointerExceptions in Socks5Proxy
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-708'>SMACK-708</a>] - DeliveryReceipt(Manager) should ensure that receipts (and requests) have an ID set
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-709'>SMACK-709</a>] - Don&#39;t request delivery receipts for messages without a body
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-710'>SMACK-710</a>] - SASL DIGEST-MD5 backslash must be quoted
</li>
</ul>
<h2>4.1.5 -- <span style="font-weight: normal;">2015-11-22</span></h2>
<h2> Bug

View file

@ -387,7 +387,7 @@ public final class Socks5Proxy {
try {
if (Socks5Proxy.this.serverSocket.isClosed()
if (Socks5Proxy.this.serverSocket == null || Socks5Proxy.this.serverSocket.isClosed()
|| Thread.currentThread().isInterrupted()) {
return;
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2013-2014 the original author or authors
* Copyright 2013-2015 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,6 +22,7 @@ import java.util.Map;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
/**
@ -42,7 +43,7 @@ public class DeliveryReceipt implements ExtensionElement
public DeliveryReceipt(String id)
{
this.id = id;
this.id = StringUtils.requireNotNullOrEmpty(id, "id must not be null");
}
public String getId()

View file

@ -20,6 +20,7 @@ import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
@ -31,6 +32,7 @@ import org.jivesoftware.smack.XMPPConnectionRegistry;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.MessageTypeFilter;
import org.jivesoftware.smack.filter.MessageWithBodiesFilter;
import org.jivesoftware.smack.filter.NotFilter;
import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.filter.StanzaExtensionFilter;
@ -38,6 +40,7 @@ import org.jivesoftware.smack.filter.StanzaTypeFilter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.roster.Roster;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jxmpp.jid.Jid;
@ -74,6 +77,8 @@ public final class DeliveryReceiptManager extends Manager {
private static final StanzaFilter MESSAGES_WITH_DELIVERY_RECEIPT = new AndFilter(StanzaTypeFilter.MESSAGE,
new StanzaExtensionFilter(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE));
private static final Logger LOGGER = Logger.getLogger(DeliveryReceiptManager.class.getName());
private static Map<XMPPConnection, DeliveryReceiptManager> instances = new WeakHashMap<XMPPConnection, DeliveryReceiptManager>();
static {
@ -160,6 +165,11 @@ public final class DeliveryReceiptManager extends Manager {
final Message messageWithReceiptRequest = (Message) packet;
Message ack = receiptMessageFor(messageWithReceiptRequest);
if (ack == null) {
LOGGER.warning("Received message stanza with receipt request from '" + from
+ "' without a stanza ID set. Message: " + messageWithReceiptRequest);
return;
}
connection.sendStanza(ack);
}
}, MESSAGES_WITH_DEVLIERY_RECEIPT_REQUEST);
@ -237,13 +247,17 @@ public final class DeliveryReceiptManager extends Manager {
/**
* A filter for stanzas to request delivery receipts for. Notably those are message stanzas of type normal, chat or
* headline, which <b>do not</b>contain a delivery receipt, i.e. are ack messages.
* headline, which <b>do not</b>contain a delivery receipt, i.e. are ack messages, and have a body extension.
*
* @see <a href="http://xmpp.org/extensions/xep-0184.html#when-ack">XEP-184 § 5.4 Ack Messages</a>
*/
private static final StanzaFilter MESSAGES_TO_REQUEST_RECEIPTS_FOR = new AndFilter(
MessageTypeFilter.NORMAL_OR_CHAT_OR_HEADLINE, new NotFilter(new StanzaExtensionFilter(
DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE)));
// @formatter:off
MessageTypeFilter.NORMAL_OR_CHAT_OR_HEADLINE,
new NotFilter(new StanzaExtensionFilter(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE)),
MessageWithBodiesFilter.INSTANCE
);
// @formatter:on
private static final StanzaListener AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER = new StanzaListener() {
@Override
@ -254,7 +268,9 @@ public final class DeliveryReceiptManager extends Manager {
};
/**
* Enables automatic requests of delivery receipts for outgoing messages of type 'normal', 'chat' or 'headline.
* Enables automatic requests of delivery receipts for outgoing messages of
* {@link Message.Type#normal}, {@link Message.Type#chat} or {@link Message.Type#headline}, and
* with a {@link Message.Body} extension.
*
* @since 4.1
* @see #dontAutoAddDeliveryReceiptRequests()
@ -302,14 +318,21 @@ public final class DeliveryReceiptManager extends Manager {
/**
* Create and return a new message including a delivery receipt extension for the given message.
* <p>
* If {@code messageWithReceiptRequest} does not have a Stanza ID set, then {@code null} will be returned.
* </p>
*
* @param messageWithReceiptRequest the given message with a receipt request extension.
* @return a new message with a receipt.
* @return a new message with a receipt or <code>null</code>.
* @since 4.1
*/
public static Message receiptMessageFor(Message messageWithReceiptRequest) {
String stanzaId = messageWithReceiptRequest.getStanzaId();
if (StringUtils.isNullOrEmpty(stanzaId)) {
return null;
}
Message message = new Message(messageWithReceiptRequest.getFrom(), messageWithReceiptRequest.getType());
message.addExtension(new DeliveryReceipt(messageWithReceiptRequest.getStanzaId()));
message.addExtension(new DeliveryReceipt(stanzaId));
return message;
}
}

View file

@ -152,7 +152,7 @@ public class SASLDigestMD5Mechanism extends SASLMechanism {
} else {
authzid = ",authzid=\"" + authorizationId + '"';
}
String saslString = "username=\"" + authenticationId + '"'
String saslString = "username=\"" + quoteBackslash(authenticationId) + '"'
+ authzid
+ ",realm=\"" + serviceName + '"'
+ ",nonce=\"" + nonce + '"'
@ -228,4 +228,18 @@ public class SASLDigestMD5Mechanism extends SASLMechanism {
return responseValue;
}
/**
* Quote the backslash in the given String. Replaces all occurrences of "\" with "\\".
* <p>
* According to RFC 2831 § 7.2 a quoted-string consists either of qdtext or quoted-pair. And since quoted-pair is a
* backslash followed by a char, every backslash in qdtext must be quoted, since it otherwise would be treated as
* qdtext.
* </p>
*
* @param string the input string.
* @return the input string where the every backslash is quoted.
*/
public static String quoteBackslash(String string) {
return string.replace("\\", "\\\\");
}
}

View file

@ -396,8 +396,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
LOGGER.fine("Stream resumption failed, continuing with normal stream establishment process");
}
bindResourceAndEstablishSession(resource);
List<Stanza> previouslyUnackedStanzas = new LinkedList<Stanza>();
if (unacknowledgedStanzas != null) {
// There was a previous connection with SM enabled but that was either not resumable or
@ -410,6 +408,12 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// after the 'enable' stream element has been sent.
dropSmState();
}
// Now bind the resource. It is important to do this *after* we dropped an eventually
// existing Stream Management state. As otherwise <bind/> and <session/> may end up in
// unacknowledgedStanzas and become duplicated on reconnect. See SMACK-706.
bindResourceAndEstablishSession(resource);
if (isSmAvailable() && useSm) {
// Remove what is maybe left from previously stream managed sessions
serverHandledStanzasCount = 0;