Skip to content

Smack 4.2 Readme and Upgrade Guide

Florian Schmaus edited this page Mar 20, 2017 · 13 revisions

Smack 4.2 is the current stable release of Smack. The full list of fixed issue and improvements can be found in the JIRA release notes for Smack 4.2.

Notable changes and important new features

Experimental support for DNSSEC

Experimental support for DNSSEC was added. For more information, have a look at the documentation.

Network operations became interruptible

Methods invoking network operations and awaiting responses are now interruptible. This means you can interrupt the thread performing them in case they are take too long to complete.

Use JXMPP's JID types

JXMPP's JID types provide an powerful yet simply to use abstraction over an XMPP address (also called "JID"). This helps to minimize problems caused by using the wrong JID type or by the normalization applied to JIDs. To create a JID from a CharSequence (this includes String) simply use JidCreate.from(charSequence).

Improved the Multi User Chat API

The MUC API was improved allowing easy creation of rooms and joining them.

Support for SASL authzid

Smack now supports SASL authzid.

API Changes

Warning: This list may not be complete

Introduced ConnectionConfiguration.setHostAddress(InetAddress)

In previous versions of Smack, ConnectionConfiguration.setHost(String) could be used to set the XMPP service's host IP address. This is no longer possible due to the added DNSSEC support. You have to use the new connection configuration ConnectionConfiguration.setHostAddress(InetAddress) instead.

Removed loginAnonymously()

Use ConnectionConfiguration.performSaslAnonymousAuthentication() instead. Then simply call the zero argument variant of login().

Further API additions/changes/removals and improvements

  • Rewrote the PEP API to use the existing PubSub API
  • Renamed processPacket(Stanza) to processStanza(Stanza)
  • Renamed PacketCollector to StanzaCollector

Including Smack 4.2 into your project

Smack 4.2 provides two artifacts as entry points that you can refer to when including Smack in your project: smack-java7 and smack-android. A typical Smack setup may also want to additional declare dependencies on smack-tcp, smack-extensions and smack-experimental

Projects that target a JVM supporting Java7

With Gradle

repositories {
  maven {
    url 'https://oss.sonatype.org/content/repositories/snapshots'
  }
  mavenCentral()
}
dependencies {
   compile "org.igniterealtime.smack:smack-java7:4.2.0"
   // Optional for XMPPTCPConnection
   compile "org.igniterealtime.smack:smack-tcp:4.2.0"
   // Optional for XMPP-IM (RFC 6121) support (Roster, Threaded Chats, …)
   compile "org.igniterealtime.smack:smack-im:4.2.0"
   // Optional for XMPP extensions support
   compile "org.igniterealtime.smack:smack-extensions:4.2.0"
}

With Maven

<dependency>
        <groupId>org.igniterealtime.smack</groupId>
        <artifactId>smack-java7</artifactId>
        <version>4.2.0</version>
</dependency>
<dependency>
        <groupId>org.igniterealtime.smack</groupId>
        <artifactId>smack-tcp</artifactId>
        <version>4.2.0</version>
</dependency>
<dependency>
        <groupId>org.igniterealtime.smack</groupId>
        <artifactId>smack-im</artifactId>
        <version>4.2.0</version>
</dependency>
<dependency>
        <groupId>org.igniterealtime.smack</groupId>
        <artifactId>smack-extensions</artifactId>
        <version>4.2.0</version>
</dependency>

With Ivy

<dependency org="org.igniterealtime.smack" name="smack-java7" rev="4.2.0"/>
<dependency org="org.igniterealtime.smack" name="smack-tcp" rev="4.2.0"/>
<dependency org="org.igniterealtime.smack" name="smack-extensions" rev="4.2.0"/>

Projects that target Android

With Gradle

repositories {
  maven {
    url 'https://oss.sonatype.org/content/repositories/snapshots'
  }
  mavenCentral()
}

Smack configuration with smack-extensions for XMPP over TCP

dependencies {
  compile "org.igniterealtime.smack:smack-android-extensions:4.2.0"
  compile "org.igniterealtime.smack:smack-tcp:4.2.0"
}

Minimal Smack configuration for XMPP over TCP

dependencies {
  compile "org.igniterealtime.smack:smack-android:4.2.0"
  compile "org.igniterealtime.smack:smack-tcp:4.2.0"
}

Smack configuration with experimental extensions (XEP-0280, XEP-0352, XEP-0332, XEP-0335)

dependencies {
  compile "org.igniterealtime.smack:smack-android-extensions:4.2.0"
  compile "org.igniterealtime.smack:smack-experimental:4.2.0"
  compile "org.igniterealtime.smack:smack-tcp:4.2.0"
}

Using Eclipse's Android Development Tools (ADT) Ant based build

We recommend using the MavenToAndroidAnt Python3 script to fetch the required artifacts from maven central. Use the following artifact definition file

smackVersion=4.2.0
jxmppVersion=0.5.0
minidnsVersion=0.2.1
org.igniterealtime.smack,smack-android,$smackVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.igniterealtime.smack,smack-android-extensions,$smackVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.igniterealtime.smack,smack-core,$smackVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.igniterealtime.smack,smack-im,$smackVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.igniterealtime.smack,smack-tcp,$smackVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.igniterealtime.smack,smack-extensions,$smackVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.igniterealtime.smack,smack-experimental,$smackVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.igniterealtime.smack,smack-resolver-minidns,$smackVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.igniterealtime.smack,smack-sasl-provided,$smackVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.jxmpp,jxmpp-core,$jxmppVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.jxmpp,jxmpp-util-cache,$jxmppVersion,1357B01865B2503C18453D208CAC2A9678548E35
org.jxmpp,jxmpp-jid,$jxmppVersion,1357B01865B2503C18453D208CAC2A9678548E35
de.measite.minidns,minidns-core,$minidnsVersion,4677EF84C286721DA33C09C98D2028BA8AF1E192
de.measite.minidns,minidns-iterative-resolver,$minidnsVersion,4677EF84C286721DA33C09C98D2028BA8AF1E192
de.measite.minidns,minidns-dnssec,$minidnsVersion,4677EF84C286721DA33C09C98D2028BA8AF1E192
de.measite.minidns,minidns-hla,$minidnsVersion,4677EF84C286721DA33C09C98D2028BA8AF1E192

and save it as artifacts.csv. Now run

getMavenArtifactsNg.py -f artifacts.csv -p <projectdir>

to let the script download and install the artifacts into your Android Ant project.

What to do if there are any issues with this Smack version?

Please have a look at

https://github.com/igniterealtime/Smack/wiki/How-to-ask-for-help,-report-an-issue-and-possible-solve-the-problem-yourself

Please report bugs in the "Smack Developers" forum. The IRC channel #smack on freenode can be used to discuss Smack and to ask for help.

Clone this wiki locally