Smack 4.1.2

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQF8BAABCgBmBQJVjpgTXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxMzU3QjAxODY1QjI1MDNDMTg0NTNEMjA4
 Q0FDMkE5Njc4NTQ4RTM1AAoJEIysKpZ4VI41g0IH/3dJedDe6D8BySl4YVoFkQEk
 Ax6T9oguTHN4o+6wnIjZUMBqycxKbwCppwE8ydrsarpxBicehwLzgaegxqVOtqM/
 /7ZNzMiASxzeSCOQpR6dxNYGZp/buY3yaL4hweVh8V+vRVxzk/dXBpl6Syba+G1N
 ytpCfeC6bGd+Gf5aQ9SA8rPz3ZP99twFNuKYwZGkC8/ePtieT8YthKwwnaIlCuFL
 BZbhgR24W5pDtaCocTBUnI2wTqv2WsEx6+6LNEHsg2pbAwf2hYw12LPk0krvZOOV
 PSK/Jtq5qdXrq/vNudvfuVmk5KnhS8BO/WIY+8+EsYBFfP0W7ajZl69KGOxobNQ=
 =dg39
 -----END PGP SIGNATURE-----

Merge tag '4.1.2'

Smack 4.1.2

Conflicts:
	version.gradle
This commit is contained in:
Florian Schmaus 2015-06-27 15:04:54 +02:00
commit ebcbdb75cd
8 changed files with 97 additions and 12 deletions

View File

@ -141,6 +141,37 @@ hr {
<div id="pageBody">
<h2>4.1.2 -- <span style="font-weight: normal;">2015-06-27</span></h2>
<h2> Bug
</h2>
<ul>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-664'>SMACK-664</a>] - Invalid IQ error response to OfferRequestPacket and OfferRevokePacket
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-668'>SMACK-668</a>] - ReconnectionManager&#39;s value of &#39;attempts&#39; is not reset after successful reconnection
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-669'>SMACK-669</a>] - Only add Entity Capabilities extension to available presences
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-670'>SMACK-670</a>] - SASLMechanism.authenticate should treat an empty byte array like &#39;null&#39; byte array
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-672'>SMACK-672</a>] - Memory leak caused by RosterGroup declaring a strong reference to XMPPConnection
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-673'>SMACK-673</a>] - VCard API does not support all elements
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-676'>SMACK-676</a>] - ConcurrentModificationException in ServerPingWithAlarmManager
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-678'>SMACK-678</a>] - Login hangs if starttls advertised, but security is set to &#39;disabled&#39; and compression is also advertised
</li>
</ul>
<h2> Improvement
</h2>
<ul>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-667'>SMACK-667</a>] - Request Stream Mangement Acknowledgement after re-sending unack&#39;ed stanzas after stream resumption
</li>
<li>[<a href='https://igniterealtime.org/issues/browse/SMACK-671'>SMACK-671</a>] - Don&#39;t disable Scoks5BytestreamManager on connection termination
</li>
</ul>
<h2>4.1.1 -- <span style="font-weight: normal;">2015-05-09</span></h2>

View File

@ -17,8 +17,10 @@
package org.jivesoftware.smackx.ping.android;
import java.util.Iterator;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.logging.Logger;
@ -110,10 +112,16 @@ public final class ServerPingWithAlarmManager extends Manager {
@Override
public void onReceive(Context context, Intent intent) {
LOGGER.fine("Ping Alarm broadcast received");
Iterator<XMPPConnection> it = INSTANCES.keySet().iterator();
while (it.hasNext()) {
XMPPConnection connection = it.next();
if (ServerPingWithAlarmManager.getInstanceFor(connection).isEnabled()) {
Set<Entry<XMPPConnection, ServerPingWithAlarmManager>> managers;
synchronized (ServerPingWithAlarmManager.class) {
// Make a copy to avoid ConcurrentModificationException when
// iterating directly over INSTANCES and the Set is modified
// concurrently by creating a new ServerPingWithAlarmManager.
managers = new HashSet<>(INSTANCES.entrySet());
}
for (Entry<XMPPConnection, ServerPingWithAlarmManager> entry : managers) {
XMPPConnection connection = entry.getKey();
if (entry.getValue().isEnabled()) {
LOGGER.fine("Calling pingServerIfNecessary for connection "
+ connection);
final PingManager pingManager = PingManager.getInstanceFor(connection);

View File

@ -301,7 +301,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
}
protected ConnectionConfiguration getConfiguration() {
/**
* Get the connection configuration used by this connection.
*
* @return the connection configuration.
*/
public ConnectionConfiguration getConfiguration() {
return config;
}

View File

@ -20,6 +20,7 @@ import org.jivesoftware.smack.XMPPException.StreamErrorException;
import org.jivesoftware.smack.packet.StreamError;
import org.jivesoftware.smack.util.Async;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.Map;
import java.util.Random;
@ -239,8 +240,17 @@ public final class ReconnectionManager {
if (isReconnectionPossible(connection)) {
connection.connect();
}
// TODO Starting with Smack 4.2, connect() will no
// longer login automatically. So change this and the
// previous lines to connection.connect().login() in the
// 4.2, or any later, branch.
if (!connection.isAuthenticated()) {
connection.login();
}
// Successfully reconnected.
attempts = 0;
}
catch (Exception e) {
catch (SmackException | IOException | XMPPException | InterruptedException e) {
// Fires the failed reconnection notification
for (ConnectionListener listener : connection.connectionListeners) {
listener.reconnectionFailed(e);

View File

@ -108,6 +108,8 @@ public class VCard extends IQ {
private String firstName;
private String lastName;
private String middleName;
private String prefix;
private String suffix;
private String emailHome;
private String emailWork;
@ -198,6 +200,24 @@ public class VCard extends IQ {
updateFN();
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
updateFN();
}
public String getSuffix() {
return suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
updateFN();
}
public String getNickName() {
return otherSimpleFields.get("NICKNAME");
}
@ -572,6 +592,8 @@ public class VCard extends IQ {
xml.optElement("FAMILY", lastName);
xml.optElement("GIVEN", firstName);
xml.optElement("MIDDLE", middleName);
xml.optElement("PREFIX", prefix);
xml.optElement("SUFFIX", suffix);
xml.closeElement("N");
}
if (hasOrganizationFields()) {
@ -696,7 +718,8 @@ public class VCard extends IQ {
}
private boolean hasNameField() {
return firstName != null || lastName != null || middleName != null;
return firstName != null || lastName != null || middleName != null
|| prefix != null || suffix != null;
}
private boolean hasOrganizationFields() {

View File

@ -284,6 +284,12 @@ public class VCardProvider extends IQProvider<VCard> {
case "MIDDLE":
vCard.setMiddleName(parser.nextText());
break;
case "PREFIX":
vCard.setPrefix(parser.nextText());
break;
case "SUFFIX":
vCard.setSuffix(parser.nextText());
break;
default:
break;
}

View File

@ -41,6 +41,8 @@ public class VCardTest extends InitExtensions {
+ "<FAMILY>Name</FAMILY>"
+ "<GIVEN>User</GIVEN>"
+ "<MIDDLE>PJ</MIDDLE>"
+ "<PREFIX>Mr.</PREFIX>"
+ "<SUFFIX>III</SUFFIX>"
+ "</N>"
+ "<NICKNAME>User dude</NICKNAME>"
+ "<URL>http://www.igniterealtime.org</URL>"
@ -92,6 +94,8 @@ public class VCardTest extends InitExtensions {
assertEquals("Name", vCard.getLastName());
assertEquals("PJ", vCard.getMiddleName());
assertEquals("User dude", vCard.getNickName());
assertEquals("Mr.", vCard.getPrefix());
assertEquals("III", vCard.getSuffix());
assertEquals("Programmer & tester", vCard.getField("TITLE"));
assertEquals("Bug fixer", vCard.getField("ROLE"));

View File

@ -846,11 +846,9 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
return;
}
if (config.getSecurityMode() == ConnectionConfiguration.SecurityMode.disabled) {
// Do not secure the connection using TLS since TLS was disabled
return;
if (config.getSecurityMode() != ConnectionConfiguration.SecurityMode.disabled) {
send(new StartTls());
}
send(new StartTls());
}
// If TLS is required but the server doesn't offer it, disconnect
// from the server and throw an error. First check if we've already negotiated TLS