1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-10-18 20:25:59 +02:00

Delete APIs scheduled for removal with Smack 4.5

This commit is contained in:
Florian Schmaus 2024-09-14 21:34:47 +02:00
parent af77e561c5
commit 4a101e2c99
38 changed files with 39 additions and 1534 deletions

View file

@ -1,51 +0,0 @@
/**
*
* Copyright 2009 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.
* 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;
/**
* The AbstractConnectionListener class provides an empty implementation for all
* methods defined by the {@link ConnectionListener} interface. This is a
* convenience class which should be used in case you do not need to implement
* all methods.
*
* @author Henning Staib
* @deprecated use {@link ConnectionListener} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public class AbstractConnectionListener implements ConnectionListener {
@Override
public void connected(XMPPConnection connection) {
// do nothing
}
@Override
public void authenticated(XMPPConnection connection, boolean resumed) {
// do nothing
}
@Override
public void connectionClosed() {
// do nothing
}
@Override
public void connectionClosedOnError(Exception e) {
// do nothing
}
}

View file

@ -1242,27 +1242,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}); });
} }
@Deprecated
@Override
public void addStanzaInterceptor(StanzaListener packetInterceptor,
StanzaFilter packetFilter) {
if (packetInterceptor == null) {
throw new NullPointerException("Packet interceptor is null.");
}
InterceptorWrapper interceptorWrapper = new InterceptorWrapper(packetInterceptor, packetFilter);
synchronized (interceptors) {
interceptors.put(packetInterceptor, interceptorWrapper);
}
}
@Deprecated
@Override
public void removeStanzaInterceptor(StanzaListener packetInterceptor) {
synchronized (interceptors) {
interceptors.remove(packetInterceptor);
}
}
private static <MPB extends MessageOrPresenceBuilder<MP, MPB>, MP extends MessageOrPresence<MPB>> void addInterceptor( private static <MPB extends MessageOrPresenceBuilder<MP, MPB>, MP extends MessageOrPresence<MPB>> void addInterceptor(
Map<Consumer<MPB>, GenericInterceptorWrapper<MPB, MP>> interceptors, Consumer<MPB> interceptor, Map<Consumer<MPB>, GenericInterceptorWrapper<MPB, MP>> interceptors, Consumer<MPB> interceptor,
Predicate<MP> filter) { Predicate<MP> filter) {

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software, 2017-2022 Florian Schmaus. * Copyright 2003-2007 Jive Software, 2017-2024 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -857,22 +857,6 @@ public abstract class ConnectionConfiguration {
return getThis(); return getThis();
} }
/**
* Set the host to connect to by either its fully qualified domain name (FQDN) or its IP.
*
* @param fqdnOrIp a CharSequence either representing the FQDN or the IP of the host.
* @return a reference to this builder.
* @see #setHost(DnsName)
* @see #setHostAddress(InetAddress)
* @since 4.3.2
* @deprecated use {@link #setHost(CharSequence)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public B setHostAddressByNameOrIp(CharSequence fqdnOrIp) {
return setHost(fqdnOrIp);
}
public B setPort(int port) { public B setPort(int port) {
if (port < 0 || port > 65535) { if (port < 0 || port > 65535) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
@ -1021,25 +1005,6 @@ public abstract class ConnectionConfiguration {
return getThis(); return getThis();
} }
/**
* Sets a custom SSLContext for creating SSL sockets.
* <p>
* For more information on how to create a SSLContext see <a href=
* "http://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide.html#X509TrustManager"
* >Java Secure Socket Extension (JSEE) Reference Guide: Creating Your Own X509TrustManager</a>
*
* @param context the custom SSLContext for new sockets.
* @return a reference to this builder.
* @deprecated use {@link #setSslContextFactory(SslContextFactory)} instead}.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public B setCustomSSLContext(SSLContext context) {
return setSslContextFactory(() -> {
return context;
});
}
/** /**
* Sets a custom SSLContext for creating SSL sockets. * Sets a custom SSLContext for creating SSL sockets.
* <p> * <p>
@ -1186,7 +1151,9 @@ public abstract class ConnectionConfiguration {
if (!SASLAuthentication.isSaslMechanismRegistered(SASLMechanism.EXTERNAL)) { if (!SASLAuthentication.isSaslMechanismRegistered(SASLMechanism.EXTERNAL)) {
throw new IllegalArgumentException("SASL " + SASLMechanism.EXTERNAL + " is not registered"); throw new IllegalArgumentException("SASL " + SASLMechanism.EXTERNAL + " is not registered");
} }
setCustomSSLContext(sslContext); setSslContextFactory(() -> {
return sslContext;
});
throwIfEnabledSaslMechanismsSet(); throwIfEnabledSaslMechanismsSet();
allowEmptyOrNullUsernames(); allowEmptyOrNullUsernames();

View file

@ -27,12 +27,6 @@ import org.jivesoftware.smack.packet.Stanza;
* the {@link #processStanza(Stanza)} method will be called. This is the * the {@link #processStanza(Stanza)} method will be called. This is the
* opposite approach to the functionality provided by a {@link StanzaCollector} * opposite approach to the functionality provided by a {@link StanzaCollector}
* which lets you block while waiting for results. * which lets you block while waiting for results.
* <p>
* Additionally you are able to intercept Packets that are going to be send and
* make modifications to them. You can register a PacketListener as interceptor
* by using {@link XMPPConnection#addStanzaInterceptor(StanzaListener,
* org.jivesoftware.smack.filter.StanzaFilter)}
* </p>
* *
* @see XMPPConnection#addAsyncStanzaListener(StanzaListener, org.jivesoftware.smack.filter.StanzaFilter) * @see XMPPConnection#addAsyncStanzaListener(StanzaListener, org.jivesoftware.smack.filter.StanzaFilter)
* @author Matt Tucker * @author Matt Tucker

View file

@ -423,7 +423,6 @@ public interface XMPPConnection {
* *
* @param stanzaListener the stanza listener to notify of new received stanzas. * @param stanzaListener the stanza listener to notify of new received stanzas.
* @param stanzaFilter the stanza filter to use. * @param stanzaFilter the stanza filter to use.
* @see #addStanzaInterceptor(StanzaListener, StanzaFilter)
* @since 4.1 * @since 4.1
*/ */
void addSyncStanzaListener(StanzaListener stanzaListener, StanzaFilter stanzaFilter); void addSyncStanzaListener(StanzaListener stanzaListener, StanzaFilter stanzaFilter);
@ -449,7 +448,6 @@ public interface XMPPConnection {
* *
* @param stanzaListener the stanza listener to notify of new received stanzas. * @param stanzaListener the stanza listener to notify of new received stanzas.
* @param stanzaFilter the stanza filter to use. * @param stanzaFilter the stanza filter to use.
* @see #addStanzaInterceptor(StanzaListener, StanzaFilter)
* @since 4.1 * @since 4.1
*/ */
void addAsyncStanzaListener(StanzaListener stanzaListener, StanzaFilter stanzaFilter); void addAsyncStanzaListener(StanzaListener stanzaListener, StanzaFilter stanzaFilter);
@ -483,34 +481,6 @@ public interface XMPPConnection {
*/ */
void removeStanzaSendingListener(StanzaListener stanzaListener); void removeStanzaSendingListener(StanzaListener stanzaListener);
/**
* Registers a stanza interceptor with this connection. The interceptor will be
* invoked every time a stanza is about to be sent by this connection. Interceptors
* may modify the stanza to be sent. A stanza filter determines which stanzas
* will be delivered to the interceptor.
*
* <p>
* NOTE: For a similar functionality on incoming stanzas, see {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)}.
* </p>
*
* @param stanzaInterceptor the stanza interceptor to notify of stanzas about to be sent.
* @param stanzaFilter the stanza filter to use.
* @deprecated use {@link #addMessageInterceptor(Consumer, Predicate)} or {@link #addPresenceInterceptor(Consumer, Predicate)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
void addStanzaInterceptor(StanzaListener stanzaInterceptor, StanzaFilter stanzaFilter);
/**
* Removes a stanza interceptor.
*
* @param stanzaInterceptor the stanza interceptor to remove.
* @deprecated use {@link #removeMessageInterceptor(Consumer)} or {@link #removePresenceInterceptor(Consumer)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
void removeStanzaInterceptor(StanzaListener stanzaInterceptor);
/** /**
* Registers a stanza interceptor with this connection. The interceptor will be * Registers a stanza interceptor with this connection. The interceptor will be
* invoked every time a stanza is about to be sent by this connection. Interceptors * invoked every time a stanza is about to be sent by this connection. Interceptors
@ -611,23 +581,6 @@ public interface XMPPConnection {
*/ */
FromMode getFromMode(); FromMode getFromMode();
/**
* Get the feature stanza extensions for a given stream feature of the
* server, or <code>null</code> if the server doesn't support that feature.
*
* @param <F> {@link ExtensionElement} type of the feature.
* @param element TODO javadoc me please
* @param namespace TODO javadoc me please
* @return a stanza extensions of the feature or <code>null</code>
* @deprecated use {@link #getFeature(Class)} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
default <F extends XmlElement> F getFeature(String element, String namespace) {
QName qname = new QName(namespace, element);
return getFeature(qname);
}
/** /**
* Get the feature stanza extensions for a given stream feature of the * Get the feature stanza extensions for a given stream feature of the
* server, or <code>null</code> if the server doesn't support that feature. * server, or <code>null</code> if the server doesn't support that feature.

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2017-2019 Florian Schmaus * Copyright © 2017-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -54,15 +54,4 @@ public abstract class AbstractTextElement implements ExtensionElement {
return lang; return lang;
} }
/**
* Deprecated.
*
* @return deprecated
* @deprecated use {@link #getLanguage()} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public final String getLang() {
return lang;
}
} }

View file

@ -287,20 +287,6 @@ public abstract class IQ extends Stanza implements IqView {
return ErrorIQ.createErrorResponse(request, error); return ErrorIQ.createErrorResponse(request, error);
} }
/**
* Deprecated.
*
* @param request the request.
* @param error the error.
* @return an error IQ.
* @deprecated use {@link #createErrorResponse(IQ, StanzaError)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Builder error) {
return createErrorResponse(request, error.build());
}
public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Condition condition) { public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Condition condition) {
return createErrorResponse(request, StanzaError.getBuilder(condition).build()); return createErrorResponse(request, StanzaError.getBuilder(condition).build());
} }

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smack.packet; package org.jivesoftware.smack.packet;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
@ -29,10 +28,6 @@ import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jxmpp.jid.Jid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.stringprep.XmppStringprepException;
/** /**
* Represents XMPP message packets. A message can be one of several types: * Represents XMPP message packets. A message can be one of several types:
* *
@ -63,85 +58,7 @@ public final class Message extends MessageOrPresence<MessageBuilder>
public static final String ELEMENT = "message"; public static final String ELEMENT = "message";
public static final String BODY = "body"; public static final String BODY = "body";
private Type type; private final Type type;
/**
* Creates a new, "normal" message.
* @deprecated use {@link StanzaBuilder}, preferable via {@link StanzaFactory}, instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Message() {
}
/**
* Creates a new "normal" message to the specified recipient.
*
* @param to the recipient of the message.
* @deprecated use {@link StanzaBuilder}, preferable via {@link StanzaFactory}, instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Message(Jid to) {
setTo(to);
}
/**
* Creates a new message of the specified type to a recipient.
*
* @param to the user to send the message to.
* @param type the message type.
* @deprecated use {@link StanzaBuilder}, preferable via {@link StanzaFactory}, instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Message(Jid to, Type type) {
this(to);
setType(type);
}
/**
* Creates a new message to the specified recipient and with the specified body.
*
* @param to the user to send the message to.
* @param body the body of the message.
* @deprecated use {@link StanzaBuilder}, preferable via {@link StanzaFactory}, instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Message(Jid to, String body) {
this(to);
setBody(body);
}
/**
* Creates a new message to the specified recipient and with the specified body.
*
* @param to the user to send the message to.
* @param body the body of the message.
* @throws XmppStringprepException if 'to' is not a valid XMPP address.
* @deprecated use {@link StanzaBuilder}, preferable via {@link StanzaFactory}, instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Message(String to, String body) throws XmppStringprepException {
this(JidCreate.from(to), body);
}
/**
* Creates a new message with the specified recipient and extension element.
*
* @param to TODO javadoc me please
* @param extensionElement TODO javadoc me please
* @since 4.2
* @deprecated use {@link StanzaBuilder}, preferable via {@link StanzaFactory}, instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Message(Jid to, ExtensionElement extensionElement) {
this(to);
addExtension(extensionElement);
}
Message(MessageBuilder messageBuilder) { Message(MessageBuilder messageBuilder) {
super(messageBuilder); super(messageBuilder);
@ -170,197 +87,6 @@ public final class Message extends MessageOrPresence<MessageBuilder>
return type; return type;
} }
/**
* Sets the type of the message.
*
* @param type the type of the message.
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void setType(Type type) {
this.type = type;
}
/**
* Sets the subject of the message. The subject is a short description of
* message contents.
*
* @param subject the subject of the message.
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove when stanza builder is ready.
public void setSubject(String subject) {
if (subject == null) {
removeSubject(""); // use empty string because #removeSubject(null) is ambiguous
return;
}
addSubject(null, subject);
}
/**
* Adds a subject with a corresponding language.
*
* @param language the language of the subject being added.
* @param subject the subject being added to the message.
* @return the new {@link org.jivesoftware.smack.packet.Message.Subject}
* @throws NullPointerException if the subject is null, a null pointer exception is thrown
*/
@Deprecated
// TODO: Remove when stanza builder is ready.
public Subject addSubject(String language, String subject) {
language = Stanza.determineLanguage(this, language);
List<Subject> currentSubjects = getExtensions(Subject.class);
for (Subject currentSubject : currentSubjects) {
if (language.equals(currentSubject.getLanguage())) {
throw new IllegalArgumentException("Subject with the language " + language + " already exists");
}
}
Subject messageSubject = new Subject(language, subject);
addExtension(messageSubject);
return messageSubject;
}
/**
* Removes the subject with the given language from the message.
*
* @param language the language of the subject which is to be removed
* @return true if a subject was removed and false if it was not.
*/
@Deprecated
// TODO: Remove when stanza builder is ready.
public boolean removeSubject(String language) {
language = Stanza.determineLanguage(this, language);
for (Subject subject : getExtensions(Subject.class)) {
if (language.equals(subject.language)) {
return removeSubject(subject);
}
}
return false;
}
/**
* Removes the subject from the message and returns true if the subject was removed.
*
* @param subject the subject being removed from the message.
* @return true if the subject was successfully removed and false if it was not.
*/
@Deprecated
// TODO: Remove when stanza builder is ready.
public boolean removeSubject(Subject subject) {
return removeExtension(subject) != null;
}
/**
* Sets the body of the message.
*
* @param body the body of the message.
* @see #setBody(String)
* @since 4.2
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove when stanza builder is ready.
public void setBody(CharSequence body) {
String bodyString;
if (body != null) {
bodyString = body.toString();
} else {
bodyString = null;
}
setBody(bodyString);
}
/**
* Sets the body of the message. The body is the main message contents.
*
* @param body the body of the message.
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove when stanza builder is ready.
public void setBody(String body) {
if (body == null) {
removeBody(""); // use empty string because #removeBody(null) is ambiguous
return;
}
addBody(null, body);
}
/**
* Adds a body with a corresponding language.
*
* @param language the language of the body being added.
* @param body the body being added to the message.
* @return the new {@link org.jivesoftware.smack.packet.Message.Body}
* @throws NullPointerException if the body is null, a null pointer exception is thrown
* @since 3.0.2
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove when stanza builder is ready.
public Body addBody(String language, String body) {
language = Stanza.determineLanguage(this, language);
removeBody(language);
Body messageBody = new Body(language, body);
addExtension(messageBody);
return messageBody;
}
/**
* Removes the body with the given language from the message.
*
* @param language the language of the body which is to be removed
* @return true if a body was removed and false if it was not.
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove when stanza builder is ready.
public boolean removeBody(String language) {
language = Stanza.determineLanguage(this, language);
for (Body body : getBodies()) {
String bodyLanguage = body.getLanguage();
if (Objects.equals(bodyLanguage, language)) {
removeExtension(body);
return true;
}
}
return false;
}
/**
* Removes the body from the message and returns true if the body was removed.
*
* @param body the body being removed from the message.
* @return true if the body was successfully removed and false if it was not.
* @since 3.0.2
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove when stanza builder is ready.
public boolean removeBody(Body body) {
XmlElement removedElement = removeExtension(body);
return removedElement != null;
}
/**
* Sets the thread id of the message, which is a unique identifier for a sequence
* of "chat" messages.
*
* @param thread the thread id of the message.
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove when stanza builder is ready.
public void setThread(String thread) {
addExtension(new Message.Thread(thread));
}
@Override @Override
public String getElementName() { public String getElementName() {
return ELEMENT; return ELEMENT;
@ -412,22 +138,6 @@ public final class Message extends MessageOrPresence<MessageBuilder>
return buf; return buf;
} }
/**
* Creates and returns a copy of this message stanza.
* <p>
* This does not perform a deep clone, as extension elements are shared between the new and old
* instance.
* </p>
* @return a clone of this message.
* @deprecated use {@link #asBuilder()} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
@Override
public Message clone() {
return new Message(this);
}
/** /**
* Represents a message subject, its language and the content of the subject. * Represents a message subject, its language and the content of the subject.
*/ */

View file

@ -20,11 +20,6 @@ import org.jivesoftware.smack.XMPPConnection;
public abstract class MessageOrPresence<MPB extends MessageOrPresenceBuilder<?, ?>> extends Stanza { public abstract class MessageOrPresence<MPB extends MessageOrPresenceBuilder<?, ?>> extends Stanza {
@Deprecated
// TODO: Remove in Smack 4.5.
protected MessageOrPresence() {
}
protected MessageOrPresence(StanzaBuilder<?> stanzaBuilder) { protected MessageOrPresence(StanzaBuilder<?> stanzaBuilder) {
super(stanzaBuilder); super(stanzaBuilder);
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software, 2020-2021 Florian Schmaus. * Copyright 2003-2007 Jive Software, 2020-2024 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -21,12 +21,9 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jxmpp.jid.Jid;
/** /**
* Represents XMPP presence stanzas. Every presence stanza has a type, which is one of * Represents XMPP presence stanzas. Every presence stanza has a type, which is one of
* the following values: * the following values:
@ -78,55 +75,6 @@ public final class Presence extends MessageOrPresence<PresenceBuilder>
private Mode mode = null; private Mode mode = null;
/**
* Creates a new presence update. Status, priority, and mode are left un-set.
*
* @param type the type.
* @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Presence(Type type) {
// Ensure that the stanza ID is set by calling super().
super();
setType(type);
}
/**
* Creates a new presence with the given type and using the given XMPP address as recipient.
*
* @param to the recipient.
* @param type the type.
* @since 4.2
* @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Presence(Jid to, Type type) {
this(type);
setTo(to);
}
/**
* Creates a new presence update with a specified status, priority, and mode.
*
* @param type the type.
* @param status a text message describing the presence update.
* @param priority the priority of this presence update.
* @param mode the mode type for this presence update.
* @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Presence(Type type, String status, int priority, Mode mode) {
// Ensure that the stanza ID is set by calling super().
super();
setType(type);
setStatus(status);
setPriority(priority);
setMode(mode);
}
Presence(PresenceBuilder presenceBuilder) { Presence(PresenceBuilder presenceBuilder) {
super(presenceBuilder); super(presenceBuilder);
type = presenceBuilder.type; type = presenceBuilder.type;
@ -186,36 +134,11 @@ public final class Presence extends MessageOrPresence<PresenceBuilder>
return type; return type;
} }
/**
* Sets the type of the presence packet.
*
* @param type the type of the presence packet.
* @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void setType(Type type) {
this.type = Objects.requireNonNull(type, "Type cannot be null");
}
@Override @Override
public String getStatus() { public String getStatus() {
return status; return status;
} }
/**
* Sets the status message of the presence update. The status is free-form text
* describing a user's presence (i.e., "gone to lunch").
*
* @param status the status message.
* @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void setStatus(String status) {
this.status = status;
}
@Override @Override
public int getPriority() { public int getPriority() {
return getPriorityByte(); return getPriorityByte();
@ -233,20 +156,11 @@ public final class Presence extends MessageOrPresence<PresenceBuilder>
* Sets the priority of the presence. The valid range is -128 through 127. * Sets the priority of the presence. The valid range is -128 through 127.
* *
* @param priority the priority of the presence. * @param priority the priority of the presence.
* @throws IllegalArgumentException if the priority is outside the valid range.
* @see <a href="https://tools.ietf.org/html/rfc6121#section-4.7.2.3">RFC 6121 § 4.7.2.3. Priority Element</a> * @see <a href="https://tools.ietf.org/html/rfc6121#section-4.7.2.3">RFC 6121 § 4.7.2.3. Priority Element</a>
* @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead. * @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
*/ */
@Deprecated @Deprecated
// TODO: Remove in Smack 4.5. // TODO: Remove in Smack 4.6.
public void setPriority(int priority) {
if (priority < -128 || priority > 127) {
throw new IllegalArgumentException("Priority value " + priority +
" is not valid. Valid range is -128 through 127.");
}
setPriority((byte) priority);
}
public void setPriority(byte priority) { public void setPriority(byte priority) {
this.priority = priority; this.priority = priority;
} }
@ -259,19 +173,6 @@ public final class Presence extends MessageOrPresence<PresenceBuilder>
return mode; return mode;
} }
/**
* Sets the mode of the presence update. A null presence mode value is interpreted
* to be the same thing as {@link Presence.Mode#available}.
*
* @param mode the mode.
* @deprecated use {@link PresenceBuilder} or {@link org.jivesoftware.smack.XMPPConnection#getStanzaFactory} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void setMode(Mode mode) {
this.mode = mode;
}
@Override @Override
public String getElementName() { public String getElementName() {
return ELEMENT; return ELEMENT;
@ -346,37 +247,6 @@ public final class Presence extends MessageOrPresence<PresenceBuilder>
return buf; return buf;
} }
/**
* Creates and returns a copy of this presence stanza.
* <p>
* This does not perform a deep clone, as extension elements are shared between the new and old
* instance.
* </p>
* @return a clone of this presence.
* @deprecated use {@link #asBuilder()} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
@Override
public Presence clone() {
return new Presence(this);
}
/**
* Clone this presence and set a newly generated stanza ID as the clone's ID.
*
* @return a "clone" of this presence with a different stanza ID.
* @since 4.1.2
* @deprecated use {@link #asBuilder(XMPPConnection)} or {@link #asBuilder(String)}instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public Presence cloneWithNewId() {
Presence clone = clone();
clone.setNewStanzaId();
return clone;
}
/** /**
* An enum to represent the presence type. Note that presence type is often confused * An enum to represent the presence type. Note that presence type is often confused
* with presence mode. Generally, if a user is signed in to a server, they have a presence * with presence mode. Generally, if a user is signed in to a server, they have a presence

View file

@ -159,22 +159,6 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
return id != null; return id != null;
} }
/**
* Set the stanza id if none is set.
*
* @return the stanza id.
* @since 4.2
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public String setStanzaId() {
if (!hasStanzaIdSet()) {
setNewStanzaId();
}
return getStanzaId();
}
/** /**
* Throws an {@link IllegalArgumentException} if this stanza has no stanza ID set. * Throws an {@link IllegalArgumentException} if this stanza has no stanza ID set.
* *
@ -255,34 +239,11 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
error = stanzaError; error = stanzaError;
} }
/**
* Deprecated.
* @param stanzaError the stanza error.
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void setError(StanzaError.Builder stanzaError) {
setError(stanzaError.build());
}
@Override @Override
public final String getLanguage() { public final String getLanguage() {
return language; return language;
} }
/**
* Sets the xml:lang of this Stanza.
*
* @param language the xml:lang of this Stanza.
* @deprecated use {@link StanzaBuilder#setLanguage(String)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void setLanguage(String language) {
this.language = language;
}
@Override @Override
public final List<XmlElement> getExtensions() { public final List<XmlElement> getExtensions() {
synchronized (extensionElements) { synchronized (extensionElements) {
@ -374,22 +335,6 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
return packetExtension; return packetExtension;
} }
/**
* This method is deprecated. Use preferably {@link #getExtension(Class)} or {@link #getExtensionElement(String, String)}.
*
* @param <E> the type to cast to.
* @param elementName the XML element name of the extension. (May be null)
* @param namespace the XML element namespace of the extension.
* @return the extension, or <code>null</code> if it doesn't exist.
* @deprecated use {@link #getExtension(Class)} or {@link #getExtensionElement(String, String)} instead.
*/
// TODO: Remove in Smack 4.5.
@SuppressWarnings("unchecked")
@Deprecated
public final <E extends ExtensionElement> E getExtension(String elementName, String namespace) {
return (E) getExtensionElement(elementName, namespace);
}
@Override @Override
public final XmlElement getExtension(QName qname) { public final XmlElement getExtension(QName qname) {
synchronized (extensionElements) { synchronized (extensionElements) {
@ -501,27 +446,6 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
} }
} }
/**
* Removes a stanza extension from the packet.
*
* @param extension the stanza extension to remove.
* @return the removed stanza extension or null.
* @deprecated use {@link StanzaBuilder} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public final XmlElement removeExtension(XmlElement extension) {
QName key = extension.getQName();
synchronized (extensionElements) {
List<XmlElement> list = extensionElements.getAll(key);
boolean removed = list.remove(extension);
if (removed) {
return extension;
}
}
return null;
}
/** /**
* Returns a short String describing the Stanza. This method is suited for log purposes. * Returns a short String describing the Stanza. This method is suited for log purposes.
*/ */

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2015-2020 Florian Schmaus * Copyright © 2015-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,18 +18,6 @@ package org.jivesoftware.smack.util;
public class NumberUtil { public class NumberUtil {
/**
* Checks if the given long is within the range of an unsigned 32-bit integer, the XML type "xs:unsignedInt".
*
* @param value TODO javadoc me please
* @deprecated use {@link #requireUInt32(long)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public static void checkIfInUInt32Range(long value) {
requireUInt32(value);
}
/** /**
* Checks if the given long is within the range of an unsigned 32-bit integer, the XML type "xs:unsignedInt". * Checks if the given long is within the range of an unsigned 32-bit integer, the XML type "xs:unsignedInt".
* *

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014-2023 Florian Schmaus * Copyright © 2014-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,8 +23,6 @@ import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import javax.xml.namespace.QName;
import org.jivesoftware.smack.datatypes.UInt16; import org.jivesoftware.smack.datatypes.UInt16;
import org.jivesoftware.smack.datatypes.UInt32; import org.jivesoftware.smack.datatypes.UInt32;
import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.packet.XmlEnvironment;
@ -367,19 +365,6 @@ public class ParserUtils {
return parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang"); return parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang");
} }
/**
* Get the QName of the current element.
*
* @param parser the parser.
* @return the Qname.
* @deprecated use {@link XmlPullParser#getQName()} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5
public static QName getQName(XmlPullParser parser) {
return parser.getQName();
}
public static InternetAddress getInternetAddressIngoringZoneIdAttribute(XmlPullParser parser, String attribute) { public static InternetAddress getInternetAddressIngoringZoneIdAttribute(XmlPullParser parser, String attribute) {
String inetAddressString = parser.getAttributeValue(attribute); String inetAddressString = parser.getAttributeValue(attribute);
if (inetAddressString == null) { if (inetAddressString == null) {

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software, 2016-2021 Florian Schmaus. * Copyright 2003-2007 Jive Software, 2016-2024 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -36,24 +36,6 @@ public class StringUtils {
public static final String MD5 = "MD5"; public static final String MD5 = "MD5";
public static final String SHA1 = "SHA-1"; public static final String SHA1 = "SHA-1";
/**
* Deprecated, do not use.
*
* @deprecated use StandardCharsets.UTF_8 instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public static final String UTF8 = "UTF-8";
/**
* Deprecated, do not use.
*
* @deprecated use StandardCharsets.US_ASCII instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public static final String USASCII = "US-ASCII";
public static final String QUOTE_ENCODE = "&quot;"; public static final String QUOTE_ENCODE = "&quot;";
public static final String APOS_ENCODE = "&apos;"; public static final String APOS_ENCODE = "&apos;";
public static final String AMP_ENCODE = "&amp;"; public static final String AMP_ENCODE = "&amp;";

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2014-2020 Florian Schmaus * Copyright 2014-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -68,52 +68,6 @@ public class TLSUtils {
return builder; return builder;
} }
/**
* Enable only TLS. Connections created with the given ConnectionConfiguration will only support TLS.
* <p>
* According to the <a
* href="https://raw.githubusercontent.com/stpeter/manifesto/master/manifesto.txt">Encrypted
* XMPP Manifesto</a>, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
* TLSv1.1. This method goes one step beyond and upgrades the handshake to use TLSv1 or better.
* This method requires the underlying OS to support all of TLSv1.2 , 1.1 and 1.0.
* </p>
*
* @param builder the configuration builder to apply this setting to
* @param <B> Type of the ConnectionConfiguration builder.
*
* @return the given builder
* @deprecated use {@link #setEnabledTlsProtocolsToRecommended(org.jivesoftware.smack.ConnectionConfiguration.Builder)} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public static <B extends ConnectionConfiguration.Builder<B, ?>> B setTLSOnly(B builder) {
builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1 });
return builder;
}
/**
* Enable only TLS and SSLv3. Connections created with the given ConnectionConfiguration will
* only support TLS and SSLv3.
* <p>
* According to the <a
* href="https://raw.githubusercontent.com/stpeter/manifesto/master/manifesto.txt">Encrypted
* XMPP Manifesto</a>, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
* TLSv1.1.
* </p>
*
* @param builder the configuration builder to apply this setting to
* @param <B> Type of the ConnectionConfiguration builder.
*
* @return the given builder
* @deprecated use {@link #setEnabledTlsProtocolsToRecommended(org.jivesoftware.smack.ConnectionConfiguration.Builder)} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public static <B extends ConnectionConfiguration.Builder<B, ?>> B setSSLv3AndTLSOnly(B builder) {
builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1, PROTO_SSL3 });
return builder;
}
/** /**
* Accept all TLS certificates. * Accept all TLS certificates.
* <p> * <p>

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2014-2023 Florian Schmaus * Copyright 2014-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -138,20 +138,6 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
return this; return this;
} }
/**
* Deprecated.
*
* @param element deprecated.
* @return deprecated.
* @deprecated use {@link #append(Element)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public XmlStringBuilder element(Element element) {
assert element != null;
return append(element.toXML());
}
public XmlStringBuilder optElement(String name, String content) { public XmlStringBuilder optElement(String name, String content) {
if (content != null) { if (content != null) {
element(name, content); element(name, content);

View file

@ -181,21 +181,6 @@ public class MultiUserChatLight {
; ;
} }
/**
* Sends a Message to the chat room.
*
* @param message TODO javadoc me please
* the message.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
* @deprecated use {@link #sendMessage(MessageBuilder)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void sendMessage(Message message) throws NotConnectedException, InterruptedException {
sendMessage(message.asBuilder());
}
/** /**
* Sends a Message to the chat room. * Sends a Message to the chat room.
* *

View file

@ -38,28 +38,6 @@ public class OriginIdElement extends StableAndUniqueIdElement {
super(id); super(id);
} }
/**
* Add an origin-id element to a message and set the stanzas id to the same id as in the origin-id element.
*
* @param message message.
* @return the added origin-id element.
* @deprecated use {@link #addTo(MessageBuilder)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public static OriginIdElement addOriginId(Message message) {
OriginIdElement originId = message.getExtension(OriginIdElement.class);
if (originId != null) {
return originId;
}
originId = new OriginIdElement();
message.addExtension(originId);
// TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID.
// message.setStanzaId(originId.getId());
return originId;
}
/** /**
* Add an origin-id element to a message and set the stanzas id to the same id as in the origin-id element. * Add an origin-id element to a message and set the stanzas id to the same id as in the origin-id element.
* *

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2016 Fernando Ramirez, 2020 Florian Schmaus * Copyright 2016 Fernando Ramirez, 2020-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -65,18 +65,6 @@ public class BoBIQ extends IQ {
this(cid, null); this(cid, null);
} }
/**
* Get the BoB hash.
*
* @return the BoB hash
* @deprecated use {@link #getContentId()} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public ContentId getBoBHash() {
return cid;
}
/** /**
* Get the BoB hash. * Get the BoB hash.
* *

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software, 2018-2022 Florian Schmaus. * Copyright 2003-2007 Jive Software, 2018-2024 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -442,27 +442,6 @@ public final class ServiceDiscoveryManager extends Manager {
return features.contains(feature); return features.contains(feature);
} }
/**
* Registers extended discovery information of this XMPP entity. When this
* client is queried for its information this data form will be returned as
* specified by XEP-0128.
* <p>
*
* Since no stanza is actually sent to the server it is safe to perform this
* operation before logging to the server. In fact, you may want to
* configure the extended info before logging to the server so that the
* information is already available if it is required upon login.
*
* @param info the data form that contains the extend service discovery
* information.
* @deprecated use {@link #addExtendedInfo(DataForm)} instead.
*/
// TODO: Remove in Smack 4.5
@Deprecated
public synchronized void setExtendedInfo(DataForm info) {
addExtendedInfo(info);
}
/** /**
* Registers extended discovery information of this XMPP entity. When this * Registers extended discovery information of this XMPP entity. When this
* client is queried for its information this data form will be returned as * client is queried for its information this data form will be returned as
@ -518,19 +497,6 @@ public final class ServiceDiscoveryManager extends Manager {
return CollectionUtil.newListWith(extendedInfos); return CollectionUtil.newListWith(extendedInfos);
} }
/**
* Returns the data form as List of PacketExtensions, or null if no data form is set.
* This representation is needed by some classes (e.g. EntityCapsManager, NodeInformationProvider)
*
* @return the data form as List of PacketExtensions
* @deprecated use {@link #getExtendedInfo()} instead.
*/
// TODO: Remove in Smack 4.5
@Deprecated
public List<DataForm> getExtendedInfoAsList() {
return getExtendedInfo();
}
/** /**
* Removes the data form containing extended service discovery information * Removes the data form containing extended service discovery information
* from the information returned by this XMPP entity.<p> * from the information returned by this XMPP entity.<p>

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.disco.packet; package org.jivesoftware.smackx.disco.packet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
@ -83,17 +82,6 @@ public class DiscoverInfo extends IQ implements DiscoverInfoView {
} }
} }
/**
* Deprecated.
*
* @deprecated use {@link DiscoverInfoBuilder} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public DiscoverInfo() {
super(ELEMENT, NAMESPACE);
}
/** /**
* Copy constructor. * Copy constructor.
* *
@ -114,85 +102,11 @@ public class DiscoverInfo extends IQ implements DiscoverInfoView {
identitiesSet.addAll(d.identitiesSet); identitiesSet.addAll(d.identitiesSet);
} }
/**
* Adds a new feature to the discovered information.
*
* @param feature the discovered feature
* @return true if the feature did not already exist.
* @deprecated use {@link DiscoverInfoBuilder#addFeature(String)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public boolean addFeature(String feature) {
return addFeature(new Feature(feature));
}
/**
* Adds a collection of features to the packet. Does noting if featuresToAdd is null.
*
* @param featuresToAdd TODO javadoc me please
* @deprecated use {@link DiscoverInfoBuilder#addFeatures(Collection)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void addFeatures(Collection<String> featuresToAdd) {
if (featuresToAdd == null) return;
for (String feature : featuresToAdd) {
addFeature(feature);
}
}
/**
* Deprecated.
*
* @param feature the future.
* @return true if the feature is new.
* @deprecated use {@link DiscoverInfoBuilder#addFeature(DiscoverInfo.Feature)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public boolean addFeature(Feature feature) {
features.add(feature);
boolean featureIsNew = featuresSet.add(feature);
if (!featureIsNew) {
containsDuplicateFeatures = true;
}
return featureIsNew;
}
@Override @Override
public List<Feature> getFeatures() { public List<Feature> getFeatures() {
return Collections.unmodifiableList(features); return Collections.unmodifiableList(features);
} }
/**
* Adds a new identity of the requested entity to the discovered information.
*
* @param identity the discovered entity's identity
* @deprecated use {@link DiscoverInfoBuilder#addIdentity(DiscoverInfo.Identity)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void addIdentity(Identity identity) {
identities.add(identity);
identitiesSet.add(identity.getKey());
}
/**
* Adds identities to the DiscoverInfo stanza.
*
* @param identitiesToAdd TODO javadoc me please
* @deprecated use {@link DiscoverInfoBuilder#addIdentities(Collection)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void addIdentities(Collection<Identity> identitiesToAdd) {
if (identitiesToAdd == null) return;
for (Identity identity : identitiesToAdd) {
addIdentity(identity);
}
}
@Override @Override
public List<Identity> getIdentities() { public List<Identity> getIdentities() {
return Collections.unmodifiableList(identities); return Collections.unmodifiableList(identities);
@ -232,22 +146,6 @@ public class DiscoverInfo extends IQ implements DiscoverInfoView {
return node; return node;
} }
/**
* Sets the node attribute that supplements the 'jid' attribute. A node is merely
* something that is associated with a JID and for which the JID can provide information.<p>
*
* Node attributes SHOULD be used only when trying to provide or query information which
* is not directly addressable.
*
* @param node the node attribute that supplements the 'jid' attribute
* @deprecated use {@link DiscoverInfoBuilder#setNode(String)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void setNode(String node) {
this.node = StringUtils.requireNullOrNotEmpty(node, "The node can not be the empty string");
}
/** /**
* Returns true if the specified feature is part of the discovered information. * Returns true if the specified feature is part of the discovered information.
* *
@ -310,18 +208,6 @@ public class DiscoverInfo extends IQ implements DiscoverInfoView {
return new DiscoverInfoBuilder(this, stanzaId); return new DiscoverInfoBuilder(this, stanzaId);
} }
/**
* 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);
}
public static DiscoverInfoBuilder builder(XMPPConnection connection) { public static DiscoverInfoBuilder builder(XMPPConnection connection) {
return new DiscoverInfoBuilder(connection); return new DiscoverInfoBuilder(connection);
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2014 Florian Schmaus. * Copyright 2014-2024 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -50,25 +50,6 @@ public class JivePropertiesManager {
return javaObjectEnabled; return javaObjectEnabled;
} }
/**
* Convenience method to add a property to a packet.
*
* @param packet the stanza to add the property to.
* @param name the name of the property to add.
* @param value the value of the property to add.
* @deprecated use {@link #addProperty(StanzaBuilder, String, Object)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public static void addProperty(Stanza packet, String name, Object value) {
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe == null) {
jpe = new JivePropertiesExtension();
packet.addExtension(jpe);
}
jpe.setProperty(name, value);
}
/** /**
* Convenience method to add a property to a stanza. * Convenience method to add a property to a stanza.
* *

View file

@ -1,98 +0,0 @@
/**
*
* Copyright 2003-2007 Jive Software.
*
* 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.smackx.muc;
import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.Jid;
import org.jxmpp.jid.parts.Resourcepart;
/**
* Default implementation of the ParticipantStatusListener interface.<p>
*
* This class does not provide any behavior by default. It just avoids having
* to implement all the interface methods if the user is only interested in implementing
* some of the methods.
*
* @author Gaston Dombiak
* @deprecated use {@link ParticipantStatusListener} instead.
*/
// TODO: Remove in Smack 4.5
@Deprecated
public class DefaultParticipantStatusListener implements ParticipantStatusListener {
@Override
public void joined(EntityFullJid participant) {
}
@Override
public void left(EntityFullJid participant) {
}
@Override
public void kicked(EntityFullJid participant, Jid actor, String reason) {
}
@Override
public void voiceGranted(EntityFullJid participant) {
}
@Override
public void voiceRevoked(EntityFullJid participant) {
}
@Override
public void banned(EntityFullJid participant, Jid actor, String reason) {
}
@Override
public void membershipGranted(EntityFullJid participant) {
}
@Override
public void membershipRevoked(EntityFullJid participant) {
}
@Override
public void moderatorGranted(EntityFullJid participant) {
}
@Override
public void moderatorRevoked(EntityFullJid participant) {
}
@Override
public void ownershipGranted(EntityFullJid participant) {
}
@Override
public void ownershipRevoked(EntityFullJid participant) {
}
@Override
public void adminGranted(EntityFullJid participant) {
}
@Override
public void adminRevoked(EntityFullJid participant) {
}
@Override
public void nicknameChanged(EntityFullJid participant, Resourcepart newNickname) {
}
}

View file

@ -1,88 +0,0 @@
/**
*
* Copyright 2003-2007 Jive Software.
*
* 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.smackx.muc;
import org.jxmpp.jid.Jid;
/**
* Default implementation of the UserStatusListener interface.<p>
*
* This class does not provide any behavior by default. It just avoids having
* to implement all the interface methods if the user is only interested in implementing
* some of the methods.
*
* @author Gaston Dombiak
* @deprecated use {@link UserStatusListener} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public class DefaultUserStatusListener implements UserStatusListener {
@Override
public void kicked(Jid actor, String reason) {
}
@Override
public void voiceGranted() {
}
@Override
public void voiceRevoked() {
}
@Override
public void banned(Jid actor, String reason) {
}
@Override
public void membershipGranted() {
}
@Override
public void membershipRevoked() {
}
@Override
public void moderatorGranted() {
}
@Override
public void moderatorRevoked() {
}
@Override
public void ownershipGranted() {
}
@Override
public void ownershipRevoked() {
}
@Override
public void adminGranted() {
}
@Override
public void adminRevoked() {
}
@Override
public void roomDestroyed(MultiUserChat alternateMUC, String password, String reason) {
}
}

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2015-2020 Florian Schmaus * Copyright 2015-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -60,13 +60,8 @@ public final class MucEnterConfiguration {
since = builder.since; since = builder.since;
timeout = builder.timeout; timeout = builder.timeout;
final PresenceBuilder joinPresenceBuilder; final PresenceBuilder joinPresenceBuilder = builder.joinPresenceBuilder.ofType(Presence.Type.available);
if (builder.joinPresence == null) {
joinPresenceBuilder = builder.joinPresenceBuilder.ofType(Presence.Type.available);
}
else {
joinPresenceBuilder = builder.joinPresence.asBuilder();
}
// Indicate the client supports MUC // Indicate the client supports MUC
joinPresenceBuilder.addExtension(new MUCInitialPresence(password, maxChars, maxStanzas, seconds, joinPresenceBuilder.addExtension(new MUCInitialPresence(password, maxChars, maxStanzas, seconds,
since)); since));
@ -95,9 +90,6 @@ public final class MucEnterConfiguration {
private final PresenceBuilder joinPresenceBuilder; private final PresenceBuilder joinPresenceBuilder;
// TODO: Remove in Smack 4.5.
private Presence joinPresence;
Builder(Resourcepart nickname, XMPPConnection connection) { Builder(Resourcepart nickname, XMPPConnection connection) {
this.nickname = Objects.requireNonNull(nickname, "Nickname must not be null"); this.nickname = Objects.requireNonNull(nickname, "Nickname must not be null");
@ -107,28 +99,6 @@ public final class MucEnterConfiguration {
joinPresenceBuilder = connection.getStanzaFactory().buildPresenceStanza(); joinPresenceBuilder = connection.getStanzaFactory().buildPresenceStanza();
} }
/**
* Set the presence used to join the MUC room.
* <p>
* The 'to' value of the given presence will be overridden and the given presence must be of type
* 'available', otherwise an {@link IllegalArgumentException} will be thrown.
* <p>
*
* @param presence TODO javadoc me please
* @return a reference to this builder.
* @deprecated use {@link #withPresence(Consumer)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Builder withPresence(Presence presence) {
if (presence.getType() != Presence.Type.available) {
throw new IllegalArgumentException("Presence must be of type 'available'");
}
joinPresence = presence;
return this;
}
/** /**
* Set the presence used to join the MUC room. * Set the presence used to join the MUC room.
* <p> * <p>

View file

@ -718,7 +718,7 @@ public class MultiUserChat {
// nickname. // nickname.
if (isJoined()) { if (isJoined()) {
try { try {
leaveSync(); leave();
} }
catch (XMPPErrorException | NoResponseException | MucNotJoinedException e) { catch (XMPPErrorException | NoResponseException | MucNotJoinedException e) {
LOGGER.log(Level.WARNING, "Could not leave MUC prior joining, assuming we are not joined", e); LOGGER.log(Level.WARNING, "Could not leave MUC prior joining, assuming we are not joined", e);
@ -738,23 +738,6 @@ public class MultiUserChat {
return getMyRoomJid() != null; return getMyRoomJid() != null;
} }
/**
* Leave the chat room.
*
* @return the leave presence as reflected by the MUC.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
* @throws XMPPErrorException if there was an XMPP error returned.
* @throws NoResponseException if there was no response from the remote entity.
* @throws MucNotJoinedException if not joined to the Multi-User Chat.
* @deprecated use {@link #leave()} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public synchronized Presence leaveSync() throws NotConnectedException, InterruptedException, MucNotJoinedException, NoResponseException, XMPPErrorException {
return leave();
}
/** /**
* Leave the chat room. * Leave the chat room.
* *
@ -1028,36 +1011,6 @@ public class MultiUserChat {
invite(connection.getStanzaFactory().buildMessageStanza(), user, reason); invite(connection.getStanzaFactory().buildMessageStanza(), user, reason);
} }
/**
* Invites another user to the room in which one is an occupant using a given Message. The invitation
* will be sent to the room which in turn will forward the invitation to the invitee.<p>
*
* If the room is password-protected, the invitee will receive a password to use to join
* the room. If the room is members-only, the invitee may be added to the member list.
*
* @param message the message to use for sending the invitation.
* @param user the user to invite to the room.(e.g. hecate@shakespeare.lit)
* @param reason the reason why the user is being invited.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
* @deprecated use {@link #invite(MessageBuilder, EntityBareJid, String)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void invite(Message message, EntityBareJid user, String reason) throws NotConnectedException, InterruptedException {
// TODO listen for 404 error code when inviter supplies a non-existent JID
message.setTo(room);
// Create the MUCUser packet that will include the invitation
MUCUser mucUser = new MUCUser();
MUCUser.Invite invite = new MUCUser.Invite(reason, user);
mucUser.setInvite(invite);
// Add the MUCUser packet that includes the invitation to the message
message.addExtension(mucUser);
connection.sendStanza(message);
}
/** /**
* Invites another user to the room in which one is an occupant using a given Message. The invitation * Invites another user to the room in which one is an occupant using a given Message. The invitation
* will be sent to the room which in turn will forward the invitation to the invitee.<p> * will be sent to the room which in turn will forward the invitation to the invitee.<p>
@ -2137,20 +2090,6 @@ public class MultiUserChat {
; ;
} }
/**
* Sends a Message to the chat room.
*
* @param message the message.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
* @deprecated use {@link #sendMessage(MessageBuilder)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public void sendMessage(Message message) throws NotConnectedException, InterruptedException {
sendMessage(message.asBuilder());
}
/** /**
* Sends a Message to the chat room. * Sends a Message to the chat room.
* *

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014-2015 Florian Schmaus * Copyright © 2014-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -88,7 +88,7 @@ public abstract class MultiUserChatException extends SmackException {
/** /**
* Thrown when trying to enter a MUC room that is not hosted a domain providing a MUC service. * Thrown when trying to enter a MUC room that is not hosted a domain providing a MUC service.
* Try {@link MultiUserChatManager#getXMPPServiceDomains()} for a list of client-local domains * Try {@link MultiUserChatManager#getMucServiceDomains()} for a list of client-local domains
* providing a MUC service. * providing a MUC service.
*/ */
public static class NotAMucServiceException extends MultiUserChatException { public static class NotAMucServiceException extends MultiUserChatException {

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014-2021 Florian Schmaus * Copyright © 2014-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -421,22 +421,6 @@ public final class MultiUserChatManager extends Manager {
return serviceDiscoveryManager.findServices(MUCInitialPresence.NAMESPACE, false, false); return serviceDiscoveryManager.findServices(MUCInitialPresence.NAMESPACE, false, false);
} }
/**
* Returns a collection with the XMPP addresses of the Multi-User Chat services.
*
* @return a collection with the XMPP addresses of the Multi-User Chat services.
* @throws XMPPErrorException if there was an XMPP error returned.
* @throws NoResponseException if there was no response from the remote entity.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
* @deprecated use {@link #getMucServiceDomains()} instead.
*/
// TODO: Remove in Smack 4.5
@Deprecated
public List<DomainBareJid> getXMPPServiceDomains() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getMucServiceDomains();
}
/** /**
* Check if the provided domain bare JID provides a MUC service. * Check if the provided domain bare JID provides a MUC service.
* *

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software, 2015-2020 Florian Schmaus * Copyright 2003-2007 Jive Software, 2015-2024 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -248,32 +248,6 @@ public final class PepManager extends Manager {
return pepPubSubManager; return pepPubSubManager;
} }
/**
* Adds a listener to PEPs. The listener will be fired anytime PEP events are received from remote XMPP clients.
*
* @param pepListener a roster exchange listener.
* @return true if pepListener was added.
* @deprecated use {@link #addPepEventListener(String, Class, PepEventListener)} instead.
*/
// TODO: Remove in Smack 4.5
@Deprecated
public boolean addPepListener(PepListener pepListener) {
return pepListeners.add(pepListener);
}
/**
* Removes a listener from PEP events.
*
* @param pepListener a roster exchange listener.
* @return true, if pepListener was removed.
* @deprecated use {@link #removePepEventListener(PepEventListener)} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public boolean removePepListener(PepListener pepListener) {
return pepListeners.remove(pepListener);
}
/** /**
* Publish an event. * Publish an event.
* *

View file

@ -31,7 +31,7 @@ public class ItemDeleteEvent extends SubscriptionEvent {
* Constructs an <code>ItemDeleteEvent</code> that indicates the supplied * Constructs an <code>ItemDeleteEvent</code> that indicates the supplied
* items (by id) have been deleted, and that the event matches the listed * items (by id) have been deleted, and that the event matches the listed
* subscriptions. The subscriptions would have been created by calling * subscriptions. The subscriptions would have been created by calling
* {@link LeafNode#subscribe(String)}. * {@link LeafNode#subscribe(org.jxmpp.Jid)}.
* *
* @param nodeId The id of the node the event came from * @param nodeId The id of the node the event came from
* @param deletedItemIds The item ids of the items that were deleted. * @param deletedItemIds The item ids of the items that were deleted.

View file

@ -52,8 +52,6 @@ import org.jivesoftware.smackx.shim.packet.HeadersExtension;
import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.stringprep.XmppStringprepException;
public abstract class Node { public abstract class Node {
protected final PubSubManager pubSubManager; protected final PubSubManager pubSubManager;
@ -403,39 +401,6 @@ public abstract class Node {
return reply.getExtension(PubSubElementType.SUBSCRIPTION); return reply.getExtension(PubSubElementType.SUBSCRIPTION);
} }
/**
* The user subscribes to the node using the supplied jid. The
* bare jid portion of this one must match the jid for the connection.
*
* Please note that the {@link Subscription.State} should be checked
* on return since more actions may be required by the caller.
* {@link Subscription.State#pending} - The owner must approve the subscription
* request before messages will be received.
* {@link Subscription.State#unconfigured} - If the {@link Subscription#isConfigRequired()} is true,
* the caller must configure the subscription before messages will be received. If it is false
* the caller can configure it but is not required to do so.
*
* @param jidString The jid to subscribe as.
* @return The subscription
* @throws XMPPErrorException if there was an XMPP error returned.
* @throws NoResponseException if there was no response from the remote entity.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
* @throws IllegalArgumentException if the provided string is not a valid JID.
* @deprecated use {@link #subscribe(Jid)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Subscription subscribe(String jidString) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Jid jid;
try {
jid = JidCreate.from(jidString);
} catch (XmppStringprepException e) {
throw new IllegalArgumentException(e);
}
return subscribe(jid);
}
/** /**
* The user subscribes to the node using the supplied jid and subscription * The user subscribes to the node using the supplied jid and subscription
* options. The bare jid portion of this one must match the jid for the * options. The bare jid portion of this one must match the jid for the
@ -466,42 +431,6 @@ public abstract class Node {
return reply.getExtension(PubSubElementType.SUBSCRIPTION); return reply.getExtension(PubSubElementType.SUBSCRIPTION);
} }
/**
* The user subscribes to the node using the supplied jid and subscription
* options. The bare jid portion of this one must match the jid for the
* connection.
*
* Please note that the {@link Subscription.State} should be checked
* on return since more actions may be required by the caller.
* {@link Subscription.State#pending} - The owner must approve the subscription
* request before messages will be received.
* {@link Subscription.State#unconfigured} - If the {@link Subscription#isConfigRequired()} is true,
* the caller must configure the subscription before messages will be received. If it is false
* the caller can configure it but is not required to do so.
*
* @param jidString The jid to subscribe as.
* @param subForm TODO javadoc me please
*
* @return The subscription
* @throws XMPPErrorException if there was an XMPP error returned.
* @throws NoResponseException if there was no response from the remote entity.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
* @throws IllegalArgumentException if the provided string is not a valid JID.
* @deprecated use {@link #subscribe(Jid, FillableSubscribeForm)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public Subscription subscribe(String jidString, FillableSubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Jid jid;
try {
jid = JidCreate.from(jidString);
} catch (XmppStringprepException e) {
throw new IllegalArgumentException(e);
}
return subscribe(jid, subForm);
}
/** /**
* Remove the subscription related to the specified JID. This will only * Remove the subscription related to the specified JID. This will only
* work if there is only 1 subscription. If there are multiple subscriptions, * work if there is only 1 subscription. If there are multiple subscriptions,

View file

@ -156,33 +156,6 @@ public final class PubSubManager extends Manager {
return pubSubManager; return pubSubManager;
} }
/**
* Deprecated.
*
* @param connection the connection.
* @return the PubSub manager for the given connection.
* @deprecated use {@link #getInstanceFor(XMPPConnection)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public static PubSubManager getInstance(XMPPConnection connection) {
return getInstanceFor(connection);
}
/**
* Deprecated.
*
* @param connection the connection.
* @param pubSubService the XMPP address of the PubSub service.
* @return the PubSub manager for the given connection.
* @deprecated use {@link #getInstanceFor(XMPPConnection, BareJid)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5.
public static PubSubManager getInstance(XMPPConnection connection, BareJid pubSubService) {
return getInstanceFor(connection, pubSubService);
}
/** /**
* Create a pubsub manager associated to the specified connection where * Create a pubsub manager associated to the specified connection where
* the pubsub requests require a specific to address for packets. * the pubsub requests require a specific to address for packets.

View file

@ -59,27 +59,6 @@ public class SimplePayload implements XmlElement {
ns = StringUtils.requireNotNullNorEmpty(qname.getNamespaceURI(), "Could not determine namespace from XML payload"); ns = StringUtils.requireNotNullNorEmpty(qname.getNamespaceURI(), "Could not determine namespace from XML payload");
} }
/**
* Construct a <code>SimplePayload</code> object with the specified element name,
* namespace and content. The content must be well formed XML.
*
* @param elementName The root element name (of the payload)
* @param namespace The namespace of the payload, null if there is none
* @param xmlPayload The payload data
* @deprecated use {@link #SimplePayload(String)} instead.
*/
// TODO: Remove in Smack 4.5
@Deprecated
public SimplePayload(String elementName, String namespace, CharSequence xmlPayload) {
this(xmlPayload.toString());
if (!elementName.equals(this.elemName)) {
throw new IllegalArgumentException();
}
if (!namespace.equals(this.ns)) {
throw new IllegalArgumentException();
}
}
@Override @Override
public String getElementName() { public String getElementName() {
return elemName; return elemName;

View file

@ -106,7 +106,7 @@ public final class VCardManager extends Manager {
vcard.setType(IQ.Type.set); vcard.setType(IQ.Type.set);
// Also make sure to generate a new stanza id (the given vcard could be a vcard result), in which case we don't // Also make sure to generate a new stanza id (the given vcard could be a vcard result), in which case we don't
// want to use the same stanza id again (although it wouldn't break if we did) // want to use the same stanza id again (although it wouldn't break if we did)
vcard.setStanzaId(); // vcard.setStanzaId(); TODO FIXME
connection().sendIqRequestAndWaitForResponse(vcard); connection().sendIqRequestAndWaitForResponse(vcard);
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software, 2019-2021 Florian Schmaus. * Copyright 2003-2007 Jive Software, 2019-2024 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -342,23 +342,6 @@ public abstract class FormField implements XmlElement {
return XmppDateTime.parseXEP0082Date(valueString); return XmppDateTime.parseXEP0082Date(valueString);
} }
/**
* Returns the field's name, also known as the variable name in case this is an filled out answer form.
* <p>
* According to XEP-4 § 3.2 the variable name (the 'var' attribute)
* "uniquely identifies the field in the context of the form" (if the field is not of type 'fixed', in which case
* the field "MAY possess a 'var' attribute")
* </p>
*
* @return the field's name.
* @deprecated use {@link #getFieldName()} instead.
*/
// TODO: Remove in Smack 4.5
@Deprecated
public String getVariable() {
return getFieldName();
}
/** /**
* Returns the field's name, also known as the variable name in case this is an filled out answer form. * Returns the field's name, also known as the variable name in case this is an filled out answer form.
* <p> * <p>

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software, 2020-2021 Florian Schmaus. * Copyright 2003-2007 Jive Software, 2020-2024 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,7 +33,6 @@ import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.StanzaView; import org.jivesoftware.smack.packet.StanzaView;
import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.CollectionUtil; import org.jivesoftware.smack.util.CollectionUtil;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.util.XmlStringBuilder;
@ -356,8 +355,7 @@ public final class DataForm implements ExtensionElement {
} }
public static final class Builder { public static final class Builder {
// TODO: Make this field final once setType() is gone. private final Type type;
private Type type;
private String title; private String title;
private List<String> instructions; private List<String> instructions;
private ReportedData reportedData; private ReportedData reportedData;
@ -409,20 +407,6 @@ public final class DataForm implements ExtensionElement {
} }
} }
/**
* Deprecated do not use.
*
* @param type the type.
* @return a reference to this builder.
* @deprecated use {@link DataForm#builder(Type)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5 and then make this.type final.
public Builder setType(Type type) {
this.type = Objects.requireNonNull(type);
return this;
}
/** /**
* Sets the description of the data. It is similar to the title on a web page or an X window. * Sets the description of the data. It is similar to the title on a web page or an X window.
* You can put a &lt;title/&gt; on either a form to fill out, or a set of data results. * You can put a &lt;title/&gt; on either a form to fill out, or a set of data results.

View file

@ -133,10 +133,12 @@ public class Chat {
public void sendMessage(Message message) throws NotConnectedException, InterruptedException { public void sendMessage(Message message) throws NotConnectedException, InterruptedException {
// Force the recipient, message type, and thread ID since the user elected // Force the recipient, message type, and thread ID since the user elected
// to send the message through this chat object. // to send the message through this chat object.
message.setTo(participant); Message chatMessage = message.asBuilder()
message.setType(Message.Type.chat); .to(participant)
message.setThread(threadID); .ofType(Message.Type.chat)
chatManager.sendMessage(this, message); .setThread(threadID)
.build();
chatManager.sendMessage(this, chatMessage);
} }
/** /**
@ -199,10 +201,10 @@ public class Chat {
// Because the collector and listeners are expecting a thread ID with // Because the collector and listeners are expecting a thread ID with
// a specific value, set the thread ID on the message even though it // a specific value, set the thread ID on the message even though it
// probably never had one. // probably never had one.
message.setThread(threadID); Message chatMessage = message.asBuilder().setThread(threadID).build();
for (ChatMessageListener listener : listeners) { for (ChatMessageListener listener : listeners) {
listener.processMessage(this, message); listener.processMessage(this, chatMessage);
} }
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software, 2016-2022 Florian Schmaus. * Copyright 2003-2007 Jive Software, 2016-2024 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -218,7 +218,7 @@ public final class Roster extends Manager {
* <p> * <p>
* This method will never return <code>null</code>, instead if the user has not yet logged into * This method will never return <code>null</code>, instead if the user has not yet logged into
* the server all modifying methods of the returned roster object * the server all modifying methods of the returned roster object
* like {@link Roster#createEntry(BareJid, String, String[])}, * like {@link Roster#createItemAndRequestSubscription(BareJid, String, String[])},
* {@link Roster#removeEntry(RosterEntry)} , etc. except adding or removing * {@link Roster#removeEntry(RosterEntry)} , etc. except adding or removing
* {@link RosterListener}s will throw an IllegalStateException. * {@link RosterListener}s will throw an IllegalStateException.
* </p> * </p>
@ -754,27 +754,6 @@ public final class Roster extends Manager {
return group; return group;
} }
/**
* Creates a new roster entry and presence subscription. The server will asynchronously
* update the roster with the subscription status.
*
* @param user the user. (e.g. johndoe@jabber.org)
* @param name the nickname of the user.
* @param groups the list of group names the entry will belong to, or <code>null</code> if
* the roster entry won't belong to a group.
* @throws NoResponseException if there was no response from the server.
* @throws XMPPErrorException if an XMPP exception occurs.
* @throws NotLoggedInException If not logged in.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
* @deprecated use {@link #createItemAndRequestSubscription(BareJid, String, String[])} instead.
*/
// TODO: Remove in Smack 4.5.
@Deprecated
public void createEntry(BareJid user, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
createItemAndRequestSubscription(user, name, groups);
}
/** /**
* Creates a new roster item. The server will asynchronously update the roster with the subscription status. * Creates a new roster item. The server will asynchronously update the roster with the subscription status.
* <p> * <p>