1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-09 10:19:41 +02:00

Delete TypedCloneable

This commit is contained in:
Florian Schmaus 2020-06-14 17:38:51 +02:00
parent 18c2c37ad0
commit 3f9ca68134
9 changed files with 67 additions and 61 deletions

View file

@ -962,8 +962,9 @@ public final class ServiceDiscoveryManager extends Manager {
// to respect ConnectionConfiguration.isSendPresence()
final Presence presenceSend = this.presenceSend;
if (connection.isAuthenticated() && presenceSend != null) {
Presence presence = presenceSend.asBuilder(connection).build();
try {
connection.sendStanza(presenceSend.cloneWithNewId());
connection.sendStanza(presence);
}
catch (InterruptedException | NotConnectedException e) {
LOGGER.log(Level.WARNING, "Could could not update presence with caps info", e);

View file

@ -30,7 +30,6 @@ import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.util.EqualsUtil;
import org.jivesoftware.smack.util.HashCode;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.TypedCloneable;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jxmpp.util.XmppStringUtils;
@ -44,7 +43,7 @@ import org.jxmpp.util.XmppStringUtils;
*
* @author Gaston Dombiak
*/
public class DiscoverInfo extends IQ implements DiscoverInfoView, TypedCloneable<DiscoverInfo> {
public class DiscoverInfo extends IQ implements DiscoverInfoView {
public static final String ELEMENT = QUERY_ELEMENT;
public static final String NAMESPACE = "http://jabber.org/protocol/disco#info";
@ -303,7 +302,13 @@ public class DiscoverInfo extends IQ implements DiscoverInfoView, TypedCloneable
return new DiscoverInfoBuilder(this, stanzaId);
}
// TODO: Deprecate in favor of asBuilder().
/**
* Deprecated, do not use.
*
* @deprecated use {@link #asBuilder(String)} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
@Override
public DiscoverInfo clone() {
return new DiscoverInfo(this);
@ -516,7 +521,7 @@ public class DiscoverInfo extends IQ implements DiscoverInfoView, TypedCloneable
* as well as specific feature types of interest, if any (e.g., for the purpose of feature
* negotiation).
*/
public static final class Feature implements TypedCloneable<Feature> {
public static final class Feature {
private final String variable;
@ -566,11 +571,6 @@ public class DiscoverInfo extends IQ implements DiscoverInfoView, TypedCloneable
return variable.hashCode();
}
@Override
public Feature clone() {
return new Feature(this);
}
@Override
public String toString() {
return toXML().toString();

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2016 Florian Schmaus
* Copyright 2015-2020 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -60,15 +60,17 @@ public final class MucEnterConfiguration {
since = builder.since;
timeout = builder.timeout;
final PresenceBuilder joinPresenceBuilder;
if (builder.joinPresence == null) {
joinPresence = builder.joinPresenceBuilder.ofType(Presence.Type.available).build();
joinPresenceBuilder = builder.joinPresenceBuilder.ofType(Presence.Type.available);
}
else {
joinPresence = builder.joinPresence.clone();
joinPresenceBuilder = builder.joinPresence.asBuilder();
}
// Indicate the the client supports MUC
joinPresence.addExtension(new MUCInitialPresence(password, maxChars, maxStanzas, seconds,
joinPresenceBuilder.addExtension(new MUCInitialPresence(password, maxChars, maxStanzas, seconds,
since));
joinPresence = joinPresenceBuilder.build();
}
Presence getJoinPresence(MultiUserChat multiUserChat) {
@ -92,6 +94,8 @@ public final class MucEnterConfiguration {
private long timeout;
private final PresenceBuilder joinPresenceBuilder;
// TODO: Remove in Smack 4.5.
private Presence joinPresence;
Builder(Resourcepart nickname, XMPPConnection connection) {