1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-29 23:42:06 +01:00

Compare commits

..

No commits in common. "3e74d11b45fc796984dcc2e8142c3bafad2919fe" and "eecd5b70d3428e19028e51f4ef56f9800833c24f" have entirely different histories.

4 changed files with 3 additions and 52 deletions

View file

@ -2012,7 +2012,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
from = XmppStringUtils.completeJidFrom(localpart, to); from = XmppStringUtils.completeJidFrom(localpart, to);
} }
String id = getStreamId(); String id = getStreamId();
sendNonza(new StreamOpen(to, from, id, config.getXmlLang(), StreamOpen.StreamContentNamespace.client)); sendNonza(new StreamOpen(to, from, id));
} }
public static final class SmackTlsContext { public static final class SmackTlsContext {

View file

@ -24,7 +24,6 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -119,8 +118,6 @@ public abstract class ConnectionConfiguration {
private final String password; private final String password;
private final Resourcepart resource; private final Resourcepart resource;
private final Locale language;
/** /**
* The optional SASL authorization identity (see RFC 6120 § 6.3.8). * The optional SASL authorization identity (see RFC 6120 § 6.3.8).
*/ */
@ -168,8 +165,6 @@ public abstract class ConnectionConfiguration {
// Resource can be null, this means that the server must provide one // Resource can be null, this means that the server must provide one
resource = builder.resource; resource = builder.resource;
language = builder.language;
xmppServiceDomain = builder.xmppServiceDomain; xmppServiceDomain = builder.xmppServiceDomain;
if (xmppServiceDomain == null) { if (xmppServiceDomain == null) {
throw new IllegalArgumentException("Must define the XMPP domain"); throw new IllegalArgumentException("Must define the XMPP domain");
@ -481,34 +476,6 @@ public abstract class ConnectionConfiguration {
return resource; return resource;
} }
/**
* Returns the stream language to use when connecting to the server.
*
* @return the stream language to use when connecting to the server.
*/
public Locale getLanguage() {
return language;
}
/**
* Returns the xml:lang string of the stream language to use when connecting to the server.
*
* <p>If the developer sets the language to null, this will also return null, leading to
* the removal of the xml:lang tag from the stream. If a Locale("") is configured, this will
* return "", which can be used as an override.</p>
*
* @return the stream language to use when connecting to the server.
*/
public String getXmlLang() {
// TODO: Change to Locale.toLanguageTag() once Smack's minimum Android API level is 21 or higher.
// This will need a workaround for new Locale("").getLanguageTag() returning "und". Expected
// behavior of this function:
// - returns null if language is null
// - returns "" if language.getLanguage() returns the empty string
// - returns language.toLanguageTag() otherwise
return language != null ? language.toString().replace("_", "-") : null;
}
/** /**
* Returns the optional XMPP address to be requested as the SASL authorization identity. * Returns the optional XMPP address to be requested as the SASL authorization identity.
* *
@ -597,7 +564,6 @@ public abstract class ConnectionConfiguration {
private CharSequence username; private CharSequence username;
private String password; private String password;
private Resourcepart resource; private Resourcepart resource;
private Locale language = Locale.getDefault();
private boolean sendPresence = true; private boolean sendPresence = true;
private ProxyInfo proxy; private ProxyInfo proxy;
private CallbackHandler callbackHandler; private CallbackHandler callbackHandler;
@ -722,19 +688,6 @@ public abstract class ConnectionConfiguration {
return getThis(); return getThis();
} }
/**
* Set the stream language.
*
* @param language the language to use.
* @return a reference to this builder.
* @see <a href="https://tools.ietf.org/html/rfc6120#section-4.7.4">RFC 6120 § 4.7.4</a>
* @see <a href="https://www.w3.org/TR/xml/#sec-lang-tag">XML 1.0 § 2.12 Language Identification</a>
*/
public B setLanguage(Locale language) {
this.language = language;
return getThis();
}
/** /**
* Set the resource we are requesting from the server. * Set the resource we are requesting from the server.
* *

View file

@ -112,7 +112,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
public XmlStringBuilder element(String name, Enum<?> content) { public XmlStringBuilder element(String name, Enum<?> content) {
assert content != null; assert content != null;
element(name, content.toString()); element(name, content.name());
return this; return this;
} }

View file

@ -19,14 +19,12 @@ package org.jivesoftware.smackx.muc;
import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.util.MemoryLeakTestUtil; import org.jivesoftware.smack.util.MemoryLeakTestUtil;
import org.junit.jupiter.api.Disabled; import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.jxmpp.stringprep.XmppStringprepException; import org.jxmpp.stringprep.XmppStringprepException;
public class MucMemoryLeakTest extends SmackTestSuite { public class MucMemoryLeakTest extends SmackTestSuite {
@Test @Test
@Disabled
public void mucMemoryLeakTest() throws XmppStringprepException, IllegalArgumentException, InterruptedException { public void mucMemoryLeakTest() throws XmppStringprepException, IllegalArgumentException, InterruptedException {
MemoryLeakTestUtil.noResourceLeakTest(c -> MultiUserChatManager.getInstanceFor(c)); MemoryLeakTestUtil.noResourceLeakTest(c -> MultiUserChatManager.getInstanceFor(c));
} }