mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 14:01:08 +01:00
Merge branch '4.1'
Conflicts: smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java version.gradle
This commit is contained in:
commit
83b84c5bd3
168 changed files with 780 additions and 687 deletions
|
|
@ -64,9 +64,9 @@ public interface NodeInformationProvider {
|
|||
List<DiscoverInfo.Identity> getNodeIdentities();
|
||||
|
||||
/**
|
||||
* Returns a list of the packet extensions defined in the node.
|
||||
* Returns a list of the stanza(/packet) extensions defined in the node.
|
||||
*
|
||||
* @return a list of the packet extensions defined in the node.
|
||||
* @return a list of the stanza(/packet) extensions defined in the node.
|
||||
*/
|
||||
List<ExtensionElement> getNodePacketExtensions();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smack.util.Objects;
|
||||
import org.jivesoftware.smackx.caps.EntityCapsManager;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
||||
|
|
@ -202,9 +203,10 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
*
|
||||
* @param identity
|
||||
*/
|
||||
public void setIdentity(Identity identity) {
|
||||
if (identity == null) throw new IllegalArgumentException("Identity can not be null");
|
||||
this.identity = identity;
|
||||
public synchronized void setIdentity(Identity identity) {
|
||||
this.identity = Objects.requireNonNull(identity, "Identity can not be null");
|
||||
// Notify others of a state change of SDM. In order to keep the state consistent, this
|
||||
// method is synchronized
|
||||
renewEntityCapsVersion();
|
||||
}
|
||||
|
||||
|
|
@ -234,8 +236,10 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
*
|
||||
* @param identity
|
||||
*/
|
||||
public void addIdentity(DiscoverInfo.Identity identity) {
|
||||
public synchronized void addIdentity(DiscoverInfo.Identity identity) {
|
||||
identities.add(identity);
|
||||
// Notify others of a state change of SDM. In order to keep the state consistent, this
|
||||
// method is synchronized
|
||||
renewEntityCapsVersion();
|
||||
}
|
||||
|
||||
|
|
@ -246,9 +250,11 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @param identity
|
||||
* @return true, if successful. Otherwise the default identity was given.
|
||||
*/
|
||||
public boolean removeIdentity(DiscoverInfo.Identity identity) {
|
||||
public synchronized boolean removeIdentity(DiscoverInfo.Identity identity) {
|
||||
if (identity.equals(this.identity)) return false;
|
||||
identities.remove(identity);
|
||||
// Notify others of a state change of SDM. In order to keep the state consistent, this
|
||||
// method is synchronized
|
||||
renewEntityCapsVersion();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -288,17 +294,15 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
*
|
||||
* @param response the discover info response packet
|
||||
*/
|
||||
public void addDiscoverInfoTo(DiscoverInfo response) {
|
||||
public synchronized void addDiscoverInfoTo(DiscoverInfo response) {
|
||||
// First add the identities of the connection
|
||||
response.addIdentities(getIdentities());
|
||||
|
||||
// Add the registered features to the response
|
||||
synchronized (features) {
|
||||
for (String feature : getFeatures()) {
|
||||
response.addFeature(feature);
|
||||
}
|
||||
response.addExtension(extendedInfo);
|
||||
for (String feature : getFeatures()) {
|
||||
response.addFeature(feature);
|
||||
}
|
||||
response.addExtension(extendedInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -358,45 +362,41 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
*
|
||||
* @return a List of the supported features by this XMPP entity.
|
||||
*/
|
||||
public List<String> getFeatures() {
|
||||
synchronized (features) {
|
||||
return new ArrayList<String>(features);
|
||||
}
|
||||
public synchronized List<String> getFeatures() {
|
||||
return new ArrayList<String>(features);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers that a new feature is supported by this XMPP entity. When this client is
|
||||
* queried for its information the registered features will be answered.<p>
|
||||
*
|
||||
* Since no packet is actually sent to the server it is safe to perform this operation
|
||||
* Since no stanza(/packet) 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 supported features
|
||||
* before logging to the server so that the information is already available if it is required
|
||||
* upon login.
|
||||
*
|
||||
* @param feature the feature to register as supported.
|
||||
*/
|
||||
public void addFeature(String feature) {
|
||||
synchronized (features) {
|
||||
if (!features.contains(feature)) {
|
||||
features.add(feature);
|
||||
renewEntityCapsVersion();
|
||||
}
|
||||
}
|
||||
public synchronized void addFeature(String feature) {
|
||||
features.add(feature);
|
||||
// Notify others of a state change of SDM. In order to keep the state consistent, this
|
||||
// method is synchronized
|
||||
renewEntityCapsVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified feature from the supported features by this XMPP entity.<p>
|
||||
*
|
||||
* Since no packet is actually sent to the server it is safe to perform this operation
|
||||
* Since no stanza(/packet) is actually sent to the server it is safe to perform this operation
|
||||
* before logging to the server.
|
||||
*
|
||||
* @param feature the feature to remove from the supported features.
|
||||
*/
|
||||
public void removeFeature(String feature) {
|
||||
synchronized (features) {
|
||||
features.remove(feature);
|
||||
renewEntityCapsVersion();
|
||||
}
|
||||
public synchronized void removeFeature(String feature) {
|
||||
features.remove(feature);
|
||||
// Notify others of a state change of SDM. In order to keep the state consistent, this
|
||||
// method is synchronized
|
||||
renewEntityCapsVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -405,10 +405,8 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* @param feature the feature to look for.
|
||||
* @return a boolean indicating if the specified featured is registered or not.
|
||||
*/
|
||||
public boolean includesFeature(String feature) {
|
||||
synchronized (features) {
|
||||
return features.contains(feature);
|
||||
}
|
||||
public synchronized boolean includesFeature(String feature) {
|
||||
return features.contains(feature);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -417,7 +415,7 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* specified by XEP-0128.
|
||||
* <p>
|
||||
*
|
||||
* Since no packet is actually sent to the server it is safe to perform this
|
||||
* Since no stanza(/packet) 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.
|
||||
|
|
@ -426,8 +424,10 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* the data form that contains the extend service discovery
|
||||
* information.
|
||||
*/
|
||||
public void setExtendedInfo(DataForm info) {
|
||||
public synchronized void setExtendedInfo(DataForm info) {
|
||||
extendedInfo = info;
|
||||
// Notify others of a state change of SDM. In order to keep the state consistent, this
|
||||
// method is synchronized
|
||||
renewEntityCapsVersion();
|
||||
}
|
||||
|
||||
|
|
@ -460,11 +460,13 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* Removes the data form containing extended service discovery information
|
||||
* from the information returned by this XMPP entity.<p>
|
||||
*
|
||||
* Since no packet is actually sent to the server it is safe to perform this
|
||||
* Since no stanza(/packet) is actually sent to the server it is safe to perform this
|
||||
* operation before logging to the server.
|
||||
*/
|
||||
public void removeExtendedInfo() {
|
||||
public synchronized void removeExtendedInfo() {
|
||||
extendedInfo = null;
|
||||
// Notify others of a state change of SDM. In order to keep the state consistent, this
|
||||
// method is synchronized
|
||||
renewEntityCapsVersion();
|
||||
}
|
||||
|
||||
|
|
@ -599,7 +601,7 @@ public class ServiceDiscoveryManager extends Manager {
|
|||
* be returned by the server whenever the server receives a disco request targeted to the bare
|
||||
* address of the client (i.e. user@host.com).
|
||||
*
|
||||
* @param info the discover info packet to check.
|
||||
* @param info the discover info stanza(/packet) to check.
|
||||
* @return true if the server supports publishing of items.
|
||||
*/
|
||||
public static boolean canPublishItems(DiscoverInfo info) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue