1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Merge branch '4.1'

Conflicts:
	version.gradle
This commit is contained in:
Florian Schmaus 2015-03-11 20:51:08 +01:00
commit 369878b6d9
8 changed files with 48 additions and 12 deletions

View file

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Set;
import org.jivesoftware.smack.util.TypedCloneable;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jxmpp.jid.Jid;
@ -51,7 +52,7 @@ import org.jxmpp.jid.Jid;
*
* @author Matt Tucker
*/
public final class Message extends Stanza implements Cloneable {
public final class Message extends Stanza implements TypedCloneable<Message> {
public static final String ELEMENT = "message";
public static final String BODY = "body";

View file

@ -20,6 +20,7 @@ package org.jivesoftware.smack.packet;
import java.util.Locale;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.TypedCloneable;
import org.jivesoftware.smack.util.XmlStringBuilder;
/**
@ -55,7 +56,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
*
* @author Matt Tucker
*/
public final class Presence extends Stanza implements Cloneable {
public final class Presence extends Stanza implements TypedCloneable<Presence> {
public static final String ELEMENT = "presence";

View file

@ -0,0 +1,34 @@
/**
*
* Copyright 2015 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.util;
/**
* An extended version of {@link java.lang.Cloneable}, which defines a generic {@link #clone()}
* method.
*
* @param <T> the type returned by {@link #clone()}.
*/
public interface TypedCloneable<T> extends Cloneable {
/**
* Clone this instance.
*
* @return a cloned version of this instance.
*/
public T clone();
}

View file

@ -201,7 +201,7 @@ public class EntityCapsManager extends Manager {
DiscoverInfo info = CAPS_CACHE.get(nodeVer);
// If it was not in CAPS_CACHE, try to retrieve the information from persistentCache
if (info == null) {
if (info == null && persistentCache != null) {
info = persistentCache.lookup(nodeVer);
// Promote the information to CAPS_CACHE if one was found
if (info != null) {

View file

@ -18,6 +18,7 @@ package org.jivesoftware.smackx.disco.packet;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.TypedCloneable;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jxmpp.util.XmppStringUtils;
@ -38,7 +39,7 @@ import java.util.Set;
*
* @author Gaston Dombiak
*/
public class DiscoverInfo extends IQ implements Cloneable {
public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo> {
public static final String ELEMENT = QUERY_ELEMENT;
public static final String NAMESPACE = "http://jabber.org/protocol/disco#info";
@ -266,7 +267,7 @@ public class DiscoverInfo extends IQ implements Cloneable {
* attributes.
*
*/
public static class Identity implements Comparable<Identity>, Cloneable {
public static class Identity implements Comparable<Identity>, TypedCloneable<Identity> {
private final String category;
private final String type;
@ -473,7 +474,7 @@ public class DiscoverInfo extends IQ implements Cloneable {
* as well as specific feature types of interest, if any (e.g., for the purpose of feature
* negotiation).
*/
public static class Feature implements Cloneable {
public static class Feature implements TypedCloneable<Feature> {
private final String variable;

View file

@ -150,9 +150,7 @@ public class MUCItem implements NamedElement {
xml.optAttribute("affiliation", getAffiliation());
xml.optAttribute("jid", getJid());
xml.optAttribute("nick", getNick());
if (role != null && role != MUCRole.none) {
xml.attribute("role", getRole());
}
xml.optAttribute("role", getRole());
xml.rightAngleBracket();
xml.optElement("reason", getReason());
if (getActor() != null) {

View file

@ -16,5 +16,6 @@
<className>org.jivesoftware.smackx.xdatalayout.XDataLayoutManager</className>
<className>org.jivesoftware.smackx.xdatavalidation.XDataValidationManager</className>
<className>org.jivesoftware.smackx.receipts.DeliveryReceiptManager</className>
<className>org.jivesoftware.smackx.iqversion.VersionManager</className>
</startupClasses>
</smack>

View file

@ -517,6 +517,9 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
disconnectedButResumeable = true;
} else {
disconnectedButResumeable = false;
// Reset the stream management session id to null, since if the stream is cleanly closed, i.e. sending a closing
// stream tag, there is no longer a stream to resume.
smSessionId = null;
}
authenticated = false;
connected = false;
@ -524,9 +527,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
reader = null;
writer = null;
// Reset the stream management session id to null, since if the stream is cleanly closed, i.e. sending a closing
// stream tag, there is no longer a stream to resume.
smSessionId = null;
maybeCompressFeaturesReceived.init();
compressSyncPoint.init();
smResumedSyncPoint.init();