Smack 4.2.4

-----BEGIN PGP SIGNATURE-----
 
 iQGTBAABCgB9FiEEl3UFnzoh3OFr5PuuIjmn6PWFIFIFAlrTPy5fFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDk3
 NzUwNTlGM0EyMURDRTE2QkU0RkJBRTIyMzlBN0U4RjU4NTIwNTIACgkQIjmn6PWF
 IFI5aAf/Rb6Y+hqxiHRbsmww74rt7HfgQnOjOjz3bPhgbVH2emzBHzxsU2pBBY87
 iTfCXjXA3qQ9FzluBchLrd9EciDEXq1A/ZblYnR+kch1DK7wvVipTPWIzOHt6ahD
 q7vfS9EmmFBCRjNM4tW8zwaajWWeJAWimXoZFxuy/n+2FORnx0x5NrnIHwYvyUtf
 nY432BOiCg7l6J9sgfcoYDgP0Ot4SkdfUIgGOYonv0lzKW8HkU/OZZwEMbFhlCHU
 s0inbU5ldDDP7xXIinDqHVSKpRlSIkaOJ0zbAQLjFz8h2fCnqDGhpnNbun8Xb7l2
 agsATloOl91tlUV5D+qRWjzkx7pDxA==
 =YqLS
 -----END PGP SIGNATURE-----

Merge tag '4.2.4'

Smack 4.2.4
This commit is contained in:
Florian Schmaus 2018-04-15 14:48:22 +02:00
commit 74f14484e6
13 changed files with 311 additions and 7 deletions

View File

@ -71,6 +71,7 @@ Smack Extensions and currently supported XEPs of smack-extensions
| Bits of Binary | [XEP-0231](https://xmpp.org/extensions/xep-0231.html) | n/a | Including or referring to small bits of binary data in an XML stanza. |
| Best Practices for Resource Locking | [XEP-0296](https://xmpp.org/extensions/xep-0296.html) | n/a | Specifies best practices to be followed by Jabber/XMPP clients about when to lock into, and unlock away from, resources. |
| Last Message Correction | [XEP-0308](https://xmpp.org/extensions/xep-0308.html) | n/a | Provides a method for indicating that a message is a correction of the last sent message. |
| Last User Interaction in Presence | [XEP-0319](https://xmpp.org/extensions/xep-0319.html) | n/a | Communicate time of last user interaction via XMPP presence notifications. |
| [Group Chat Invitations](invitation.md) | n/a | n/a | Send invitations to other users to join a group chat room. |
| [Jive Properties](properties.md) | n/a | n/a | TODO |

View File

@ -142,6 +142,40 @@ hr {
<div id="pageBody">
<h2>4.2.4 -- <span style="font-weight: normal;">2018-04-15</span></h2>
<h2> Bug
</h2>
<ul>
<li>[<a href='https://issues.igniterealtime.org/browse/SMACK-804'>SMACK-804</a>] - ServiceAdministrationManager does not use correct form actions
</li>
<li>[<a href='https://issues.igniterealtime.org/browse/SMACK-805'>SMACK-805</a>] - ServiceDiscoveryManager.findService() only considers the first service by feature
</li>
<li>[<a href='https://issues.igniterealtime.org/browse/SMACK-813'>SMACK-813</a>] - Smack uses hostname instead of XMPP service name for SNI
</li>
</ul>
<h2> New Feature
</h2>
<ul>
<li>[<a href='https://issues.igniterealtime.org/browse/SMACK-794'>SMACK-794</a>] - Add support for XEP-0394: Message Markup
</li>
<li>[<a href='https://issues.igniterealtime.org/browse/SMACK-795'>SMACK-795</a>] - Add support for XEP-0382: Spoiler messages
</li>
<li>[<a href='https://issues.igniterealtime.org/browse/SMACK-799'>SMACK-799</a>] - Add support for XEP-0372: References
</li>
<li>[<a href='https://issues.igniterealtime.org/browse/SMACK-800'>SMACK-800</a>] - Add support for XEP-0392: Consistent Color Generation
</li>
</ul>
<h2> Improvement
</h2>
<ul>
<li>[<a href='https://issues.igniterealtime.org/browse/SMACK-802'>SMACK-802</a>] - Rename and deprecate: addPacketSendingListener(), removePacketSendingListener(), addPacketInterceptor() and removePacketInterceptor()
</li>
<li>[<a href='https://issues.igniterealtime.org/browse/SMACK-809'>SMACK-809</a>] - Make Roster&#39;s non-roster presence map second-level map bounded
</li>
</ul>
<h2>4.2.3 -- <span style="font-weight: normal;">2018-02-07</span></h2>

View File

@ -42,6 +42,8 @@ public class ExplicitMessageEncryptionElement implements ExtensionElement {
otrV0("urn:xmpp:otr:0", "Off-the-Record Messaging (XEP-0364)"),
omemoVAxolotl("eu.siacs.conversations.axolotl", "OMEMO Multi End Message and Object Encryption (XEP-0384)"),
legacyOpenPGP("jabber:x:encrypted", "Legacy OpenPGP for XMPP [DANGEROUS, DO NOT USE!]"),
;

View File

@ -0,0 +1,101 @@
/**
*
* Copyright © 2018 Paul Schaub
*
* 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.last_interaction.element;
import java.util.Date;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.XmlStringBuilder;
public class IdleElement implements ExtensionElement {
public static final String NAMESPACE = "urn:xmpp:idle:1";
public static final String ELEMENT = "idle";
public static final String ATTR_SINCE = "since";
private final Date since;
/**
* Create a new IdleElement with the current date as date of last user interaction.
*/
public IdleElement() {
this(new Date());
}
/**
* Create a new IdleElement.
* @param since date of last user interaction
*/
public IdleElement(Date since) {
this.since = Objects.requireNonNull(since);
}
/**
* Return the value of last user interaction.
* @return date of last interaction
*/
public Date getSince() {
return since;
}
/**
* Add an Idle element with current date to the presence.
* @param presence presence
*/
public static void addToPresence(Presence presence) {
presence.addExtension(new IdleElement());
}
/**
* Return the IdleElement from a presence.
* Returns null, if no IdleElement found.
*
* @param presence presence
* @return idleElement from presence or null
*/
public static IdleElement fromPresence(Presence presence) {
return presence.getExtension(ELEMENT, NAMESPACE);
}
/**
* {@inheritDoc}
*/
@Override
public String getNamespace() {
return NAMESPACE;
}
/**
* {@inheritDoc}
*/
@Override
public String getElementName() {
return ELEMENT;
}
/**
* {@inheritDoc}
*/
@Override
public XmlStringBuilder toXML() {
return new XmlStringBuilder(this)
.attribute(ATTR_SINCE, since)
.closeEmptyElement();
}
}

View File

@ -0,0 +1,21 @@
/**
*
* Copyright © 2018 Paul Schaub
*
* 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.
*/
/**
* Element classes for XEP-0319: Last User Interaction in Presence.
*/
package org.jivesoftware.smackx.last_interaction.element;

View File

@ -0,0 +1,21 @@
/**
*
* Copyright © 2018 Paul Schaub
*
* 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.
*/
/**
* Smack's API for XEP-0319: Last User Interaction in Presence.
*/
package org.jivesoftware.smackx.last_interaction;

View File

@ -0,0 +1,40 @@
/**
*
* Copyright © 2018 Paul Schaub
*
* 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.last_interaction.provider;
import java.util.Date;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smackx.last_interaction.element.IdleElement;
import org.jxmpp.util.XmppDateTime;
import org.xmlpull.v1.XmlPullParser;
public class IdleProvider extends ExtensionElementProvider<IdleElement> {
public static final IdleProvider TEST_INSTANCE = new IdleProvider();
/**
* {@inheritDoc}
*/
@Override
public IdleElement parse(XmlPullParser parser, int initialDepth) throws Exception {
String dateString = parser.getAttributeValue(null, IdleElement.ATTR_SINCE);
Date since = XmppDateTime.parseXEP0082Date(dateString);
return new IdleElement(since);
}
}

View File

@ -0,0 +1,21 @@
/**
*
* Copyright © 2018 Paul Schaub
*
* 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.
*/
/**
* Provider classes for XEP-0319: Last User Interaction in Presence.
*/
package org.jivesoftware.smackx.last_interaction.provider;

View File

@ -249,8 +249,8 @@ public class VCard extends IQ {
return otherSimpleFields.get("JABBERID");
}
public void setJabberId(String jabberId) {
otherSimpleFields.put("JABBERID", jabberId);
public void setJabberId(CharSequence jabberId) {
otherSimpleFields.put("JABBERID", jabberId.toString());
}
public String getOrganization() {

View File

@ -514,7 +514,14 @@
<namespace>urn:xmpp:message-correct:0</namespace>
<className>org.jivesoftware.smackx.message_correct.provider.MessageCorrectProvider</className>
</extensionProvider>
<!-- XEP-0319: Last User Interaction in Presence -->
<extensionProvider>
<elementName>idle</elementName>
<namespace>urn:xmpp:idle:1</namespace>
<className>org.jivesoftware.smackx.last_interaction.provider.IdleProvider</className>
</extensionProvider>
<!-- XEP-0191 Blocking Command -->
<iqProvider>
<elementName>blocklist</elementName>

View File

@ -0,0 +1,57 @@
/**
*
* Copyright © 2018 Paul Schaub
*
* 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.last_interaction;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import java.util.Date;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smackx.last_interaction.element.IdleElement;
import org.jivesoftware.smackx.last_interaction.provider.IdleProvider;
import org.junit.Test;
import org.jxmpp.util.XmppDateTime;
import org.xmlpull.v1.XmlPullParser;
public class IdleTest extends SmackTestSuite {
@Test
public void providerTest() throws Exception {
String xml = "<idle xmlns='urn:xmpp:idle:1' since='1969-07-21T02:56:15Z' />";
XmlPullParser parser = TestUtils.getParser(xml);
assertNotNull(parser);
IdleElement parsed = IdleProvider.TEST_INSTANCE.parse(parser);
Date date = XmppDateTime.parseXEP0082Date("1969-07-21T02:56:15Z");
assertEquals(date, parsed.getSince());
IdleElement element = new IdleElement(date);
assertXMLEqual("<idle xmlns='urn:xmpp:idle:1' since='1969-07-21T02:56:15.000+00:00'/>", element.toXML().toString());
}
@Test
public void helperTest() {
Presence presence = new Presence(Presence.Type.available);
IdleElement.addToPresence(presence);
IdleElement element = IdleElement.fromPresence(presence);
assertNotNull(element);
}
}

View File

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.omemo;
import static org.jivesoftware.smackx.omemo.util.OmemoConstants.BODY_OMEMO_HINT;
import static org.jivesoftware.smackx.omemo.util.OmemoConstants.OMEMO;
import static org.jivesoftware.smackx.omemo.util.OmemoConstants.OMEMO_NAMESPACE_V_AXOLOTL;
import static org.jivesoftware.smackx.omemo.util.OmemoConstants.PEP_NODE_DEVICE_LIST_NOTIFY;
@ -42,7 +41,6 @@ import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.Async;
import org.jivesoftware.smackx.carbons.CarbonManager;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.eme.element.ExplicitMessageEncryptionElement;
@ -474,7 +472,8 @@ public final class OmemoManager extends Manager {
}
if (OmemoConfiguration.getAddEmeEncryptionHint()) {
chatMessage.addExtension(new ExplicitMessageEncryptionElement(OMEMO_NAMESPACE_V_AXOLOTL, OMEMO));
chatMessage.addExtension(new ExplicitMessageEncryptionElement(
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol.omemoVAxolotl));
}
return chatMessage;

View File

@ -788,7 +788,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
Socket plain = socket;
// Secure the plain connection
socket = context.getSocketFactory().createSocket(plain,
host, plain.getPort(), true);
config.getXMPPServiceDomain().toString(), plain.getPort(), true);
final SSLSocket sslSocket = (SSLSocket) socket;
// Immediately set the enabled SSL protocols and ciphers. See SMACK-712 why this is