Skip to content

Commit

Permalink
Merge tag '4.4.0'
Browse files Browse the repository at this point in the history
Smack 4.4.0
  • Loading branch information
Flowdalic committed Dec 6, 2020
2 parents 1a963cc + d8864b6 commit d864284
Show file tree
Hide file tree
Showing 18 changed files with 403 additions and 81 deletions.
106 changes: 106 additions & 0 deletions resources/releasedocs/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,112 @@ <h1>Smack Changelog</h1>

<div id="pageBody">



<h2>4.4.0 -- <span style="font-weight: normal;">2020-12-06</span></h2>

<h2> Bug
</h2>
<ul>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-561'>SMACK-561</a>] - Smack should not reply with multiple stream types after stream initiation is offered
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-624'>SMACK-624</a>] - AdHocCommandManager&#39;s session sweeping thread does never stop
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-729'>SMACK-729</a>] - Not all providers from smack-legacy.jar are loaded
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-770'>SMACK-770</a>] - There is no Bits of Binary Extension Element provider registered
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-848'>SMACK-848</a>] - Make MultiUserChat.leave() wait for response
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-874'>SMACK-874</a>] - PacketParserUtilsTest#invalidXMLInMessageBody() fails on non-english machines
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-881'>SMACK-881</a>] - Deadlock between reader and writer if Stream Mangement unacked stanza queue is full
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-888'>SMACK-888</a>] - MUC roomDestroyed() callback is not invoked
</li>
</ul>

<h2> New Feature
</h2>
<ul>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-257'>SMACK-257</a>] - Add support for XEP-0118: User Tune
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-636'>SMACK-636</a>] - Add support for XEP-0319: Last User Interaction in Presence
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-743'>SMACK-743</a>] - Add support for XEP-0384: OMEMO Encryption
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-801'>SMACK-801</a>] - Update Smack to Java 8
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-824'>SMACK-824</a>] - Add support for XEP-0221: Data Forms Media Element
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-862'>SMACK-862</a>] - Add support for XEP-0418: DNS Queries over XMPP (DoX)
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-871'>SMACK-871</a>] - Add support for XEP-0350: Data Forms Geolocation Element
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-872'>SMACK-872</a>] - Add support for XEP-0315: Data Forms XML Element
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-878'>SMACK-878</a>] - Add support for XEP-0328: JID Prep
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-884'>SMACK-884</a>] - Add support for XEP-0422: Message Fastening
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-885'>SMACK-885</a>] - Add support for XEP-0420 Stanza Content Encryption
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-889'>SMACK-889</a>] - Add support for XEP-0428: Fallback Indication
</li>
</ul>

<h2> Improvement
</h2>
<ul>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-591'>SMACK-591</a>] - Replace XPP3 by SmackXmlPullParser (wrapping Stax&#39;s XmlStreamReader and XPP3 on Android)
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-650'>SMACK-650</a>] - Enable Java8&#39;s javadoc doclint
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-651'>SMACK-651</a>] - Perform sound cross-compilation: Use newer javac&#39;s --release feature
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-718'>SMACK-718</a>] - Prevent extremely long reply timeouts from being set
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-821'>SMACK-821</a>] - Make Forwarded a generic type
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-822'>SMACK-822</a>] - Add API for XEP-0313 § 6.2 Advanced configuration via Ad-Hoc commands
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-825'>SMACK-825</a>] - Discourage Stanza.getExtension(String, String) in favor of Stanza.getExtension(Class&lt;E extends ExtensionElement&gt;)
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-826'>SMACK-826</a>] - Add support for XEP-0373:&quot; OpenPGP for XMPP&quot; and XEP-0374: &quot;OpenPGP for XMPP Instant Messaging&quot;
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-828'>SMACK-828</a>] - Add support for XEP-0107: User Mood
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-836'>SMACK-836</a>] - Save a ServiceDiscoveryManager instance in a private field of MultiUserChatManger
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-839'>SMACK-839</a>] - Provider.parse() should not throw a generic Exception, but instead IOException and XmlPullParserException
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-852'>SMACK-852</a>] - Message thread and subject should be designed and implemented as ExtensionElements
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-854'>SMACK-854</a>] - Rename smack-java7 to smack-java8
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-866'>SMACK-866</a>] - Remove all tabs from the source code and add checkstyle rule that enforces no-tabs
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-867'>SMACK-867</a>] - Extend HttpFileUploadManager by methods with InputStream parameter
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-882'>SMACK-882</a>] - Add support for MUC status code 333
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-883'>SMACK-883</a>] - Add generic MUC callback for &quot;participant left&quot; caused by unavailable presences
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-890'>SMACK-890</a>] - Update Message Archive Management (XEP-0313) support to urn:xmpp:mam:2
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-892'>SMACK-892</a>] - Smack performs unnecessary escaping in XML text
</li>
</ul>

<h2> Task
</h2>
<ul>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-750'>SMACK-750</a>] - Raise Smack&#39;s minimum required Android SDK level to 19 (Android 4.4, Kit Kat, 2013-10)
</li>
<li>[<a href='https://igniterealtime.atlassian.net/browse/SMACK-840'>SMACK-840</a>] - Remove smack-compression-jzlib, as it is obsolete (Smack uses Java 7 de- and inflate API now)
</li>
</ul>

<h2>4.3.4 -- <span style="font-weight: normal;">2019-05-27</span></h2>

<h2> Bug
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* Copyright 2019 Florian Schmaus
* Copyright 2019-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.
Expand All @@ -16,7 +16,9 @@
*/
package org.jivesoftware.smack.datatypes;

public abstract class Scalar extends java.lang.Number {
import org.jivesoftware.smack.util.DefaultCharSequence;

public abstract class Scalar extends java.lang.Number implements DefaultCharSequence {

/**
*
Expand Down Expand Up @@ -83,4 +85,11 @@ public boolean equals(Object other) {
public final String toString() {
return number.toString();
}

public abstract Scalar getMinValue();

public abstract Scalar getMaxValue();

public abstract Scalar incrementedByOne();

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* Copyright 2019 Florian Schmaus
* Copyright 2019-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.
Expand All @@ -21,12 +21,18 @@
/**
* A number representing an unsigned 16-bit integer. Can be used for values with the XML schema type "xs:unsingedShort".
*/
public final class UInt16 extends Scalar {
public final class UInt16 extends Scalar implements Comparable<UInt16> {

private static final long serialVersionUID = 1L;

private final int number;

public static final int MIN_VALUE_INT = 0;
public static final int MAX_VALUE_INT = (1 << 16) - 1;

public static final UInt16 MIN_VALUE = UInt16.from(MIN_VALUE_INT);
public static final UInt16 MAX_VALUE = UInt16.from(MAX_VALUE_INT);

private UInt16(int number) {
super(NumberUtil.requireUShort16(number));
this.number = number;
Expand Down Expand Up @@ -54,4 +60,25 @@ public boolean equals(Object other) {

return super.equals(other);
}

@Override
public int compareTo(UInt16 o) {
return Integer.compare(number, o.number);
}

@Override
public UInt16 getMinValue() {
return MIN_VALUE;
}

@Override
public UInt16 getMaxValue() {
return MAX_VALUE;
}

@Override
public UInt16 incrementedByOne() {
int incrementedValue = number < MAX_VALUE_INT ? number + 1 : 0;
return UInt16.from(incrementedValue);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* Copyright 2019 Florian Schmaus
* Copyright 2019-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.
Expand All @@ -27,6 +27,12 @@ public final class UInt32 extends Scalar {

private final long number;

public static final long MIN_VALUE_LONG = 0;
public static final long MAX_VALUE_LONG = (1L << 32) - 1;

public static final UInt32 MIN_VALUE = UInt32.from(MAX_VALUE_LONG);
public static final UInt32 MAX_VALUE = UInt32.from(MAX_VALUE_LONG);

private UInt32(long number) {
super(NumberUtil.requireUInt32(number));
this.number = number;
Expand Down Expand Up @@ -55,4 +61,20 @@ public boolean equals(Object other) {

return super.equals(other);
}

@Override
public UInt32 getMinValue() {
return MIN_VALUE;
}

@Override
public UInt32 getMaxValue() {
return MAX_VALUE;
}

@Override
public UInt32 incrementedByOne() {
long incrementedValue = number < MAX_VALUE_LONG ? number + 1 : 0;
return UInt32.from(incrementedValue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,28 @@ public SmackUriSyntaxParsingException(URISyntaxException uriSyntaxException) {
super(uriSyntaxException);
}
}

public static class RequiredValueMissingException extends SmackParsingException {
/**
*
*/
private static final long serialVersionUID = 1L;

public RequiredValueMissingException(String message) {
super(message);
}

}

public static class RequiredAttributeMissingException extends RequiredValueMissingException {
/**
*
*/
private static final long serialVersionUID = 1L;

public RequiredAttributeMissingException(String attributeName) {
super("The required attribute '" + attributeName + "' is missing (or has the empty String as value)");
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
*
* Copyright 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.
* 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;

public interface DefaultCharSequence extends CharSequence {

@Override
default int length() {
return toString().length();
}

@Override
default char charAt(int index) {
return toString().charAt(index);
}

@Override
default CharSequence subSequence(int start, int end) {
return toString().subSequence(start, end);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.jivesoftware.smack.datatypes.UInt32;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.RequiredAttributeMissingException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackTextParseException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackUriSyntaxParsingException;
import org.jivesoftware.smack.xml.XmlPullParser;
Expand Down Expand Up @@ -231,6 +232,14 @@ public static UInt16 getUInt16Attribute(XmlPullParser parser, String name) {
return UInt16.from(integer);
}

public static UInt16 getRequiredUInt16Attribute(XmlPullParser parser, String name) throws RequiredAttributeMissingException {
UInt16 uint16 = getUInt16Attribute(parser, name);
if (uint16 == null) {
throw new SmackParsingException.RequiredAttributeMissingException(name);
}
return uint16;
}

public static int getIntegerFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException {
String intString = parser.nextText();
return Integer.valueOf(intString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,20 @@ public XmlStringBuilder optAttribute(String name, Number number) {
return this;
}

/**
* Same as {@link #optAttribute(String, CharSequence)}, but with a different method name. This method can be used if
* the provided attribute value argument type causes ambiguity in method overloading. For example if the type is a
* subclass of Number and CharSequence.
*
* @param name the name of the attribute.
* @param value the value of the attribute.
* @return a reference to this object.
* @since 4.5
*/
public XmlStringBuilder optAttributeCs(String name, CharSequence value) {
return optAttribute(name, value);
}

/**
* Add the given attribute if {@code value => 0}.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
*
* Copyright 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.
* 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.datatypes;

import static org.junit.Assert.assertEquals;

import org.junit.jupiter.api.Test;

public class UInt16Test {

@Test
public void testMaxValue() {
assertEquals(65535, UInt16.MAX_VALUE_INT);
}

}

0 comments on commit d864284

Please sign in to comment.