mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-14 06:51:08 +01:00
Use Jid (and subclasses) from jxmpp-jid
Fixes SMACK-634
This commit is contained in:
parent
0ee2d9ed1e
commit
5bb4727c57
180 changed files with 1510 additions and 1032 deletions
|
|
@ -22,6 +22,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
|||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
|
||||
import org.jivesoftware.smackx.xdata.Form;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -146,7 +147,7 @@ public abstract class AdHocCommand {
|
|||
*
|
||||
* @return the owner JID.
|
||||
*/
|
||||
public abstract String getOwnerJID();
|
||||
public abstract Jid getOwnerJID();
|
||||
|
||||
/**
|
||||
* Returns the notes that the command has at the current stage.
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
|||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
||||
import org.jivesoftware.smackx.xdata.Form;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
/**
|
||||
* An AdHocCommandManager is responsible for keeping the list of available
|
||||
|
|
@ -254,7 +255,7 @@ public class AdHocCommandManager extends Manager {
|
|||
* @throws SmackException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public DiscoverItems discoverCommands(String jid) throws XMPPException, SmackException, InterruptedException {
|
||||
public DiscoverItems discoverCommands(Jid jid) throws XMPPException, SmackException, InterruptedException {
|
||||
return serviceDiscoveryManager.discoverItems(jid, NAMESPACE);
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +267,7 @@ public class AdHocCommandManager extends Manager {
|
|||
* @throws SmackException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void publishCommands(String jid) throws XMPPException, SmackException, InterruptedException {
|
||||
public void publishCommands(Jid jid) throws XMPPException, SmackException, InterruptedException {
|
||||
// Collects the commands to publish as items
|
||||
DiscoverItems discoverItems = new DiscoverItems();
|
||||
Collection<AdHocCommandInfo> xCommandsList = getRegisteredCommands();
|
||||
|
|
@ -291,7 +292,7 @@ public class AdHocCommandManager extends Manager {
|
|||
* @param node the identifier of the command
|
||||
* @return a local instance equivalent to the remote command.
|
||||
*/
|
||||
public RemoteCommand getRemoteCommand(String jid, String node) {
|
||||
public RemoteCommand getRemoteCommand(Jid jid, String node) {
|
||||
return new RemoteCommand(connection(), node, jid);
|
||||
}
|
||||
|
||||
|
|
@ -652,10 +653,10 @@ public class AdHocCommandManager extends Manager {
|
|||
|
||||
private String node;
|
||||
private String name;
|
||||
private String ownerJID;
|
||||
private final Jid ownerJID;
|
||||
private LocalCommandFactory factory;
|
||||
|
||||
public AdHocCommandInfo(String node, String name, String ownerJID,
|
||||
public AdHocCommandInfo(String node, String name, Jid ownerJID,
|
||||
LocalCommandFactory factory)
|
||||
{
|
||||
this.node = node;
|
||||
|
|
@ -678,7 +679,7 @@ public class AdHocCommandManager extends Manager {
|
|||
return node;
|
||||
}
|
||||
|
||||
public String getOwnerJID() {
|
||||
public Jid getOwnerJID() {
|
||||
return ownerJID;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
package org.jivesoftware.smackx.commands;
|
||||
|
||||
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
/**
|
||||
* Represents a command that can be executed locally from a remote location. This
|
||||
|
|
@ -52,7 +53,7 @@ public abstract class LocalCommand extends AdHocCommand {
|
|||
/**
|
||||
* The full JID of the host of the command.
|
||||
*/
|
||||
private String ownerJID;
|
||||
private Jid ownerJID;
|
||||
|
||||
/**
|
||||
* The number of the current stage.
|
||||
|
|
@ -91,12 +92,12 @@ public abstract class LocalCommand extends AdHocCommand {
|
|||
*
|
||||
* @param ownerJID the JID of the owner.
|
||||
*/
|
||||
public void setOwnerJID(String ownerJID) {
|
||||
public void setOwnerJID(Jid ownerJID) {
|
||||
this.ownerJID = ownerJID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnerJID() {
|
||||
public Jid getOwnerJID() {
|
||||
return ownerJID;
|
||||
}
|
||||
|
||||
|
|
@ -128,7 +129,7 @@ public abstract class LocalCommand extends AdHocCommand {
|
|||
* @param jid the JID to check permissions on.
|
||||
* @return true if the user has permission to execute this action.
|
||||
*/
|
||||
public abstract boolean hasPermission(String jid);
|
||||
public abstract boolean hasPermission(Jid jid);
|
||||
|
||||
/**
|
||||
* Returns the currently executing stage number. The first stage number is
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
|||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
|
||||
import org.jivesoftware.smackx.xdata.Form;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
/**
|
||||
* Represents a command that is in a remote location. Invoking one of the
|
||||
|
|
@ -48,7 +49,7 @@ public class RemoteCommand extends AdHocCommand {
|
|||
/**
|
||||
* The full JID of the command host
|
||||
*/
|
||||
private String jid;
|
||||
private Jid jid;
|
||||
|
||||
/**
|
||||
* The session ID of this execution.
|
||||
|
|
@ -64,7 +65,7 @@ public class RemoteCommand extends AdHocCommand {
|
|||
* @param node the identifier of the command.
|
||||
* @param jid the JID of the host.
|
||||
*/
|
||||
protected RemoteCommand(XMPPConnection connection, String node, String jid) {
|
||||
protected RemoteCommand(XMPPConnection connection, String node, Jid jid) {
|
||||
super();
|
||||
this.connection = connection;
|
||||
this.jid = jid;
|
||||
|
|
@ -150,7 +151,7 @@ public class RemoteCommand extends AdHocCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getOwnerJID() {
|
||||
public Jid getOwnerJID() {
|
||||
return jid;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.jivesoftware.smackx.commands.AdHocCommand.Action;
|
|||
import org.jivesoftware.smackx.commands.AdHocCommand.SpecificErrorCondition;
|
||||
import org.jivesoftware.smackx.commands.AdHocCommandNote;
|
||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -39,7 +40,7 @@ public class AdHocCommandData extends IQ {
|
|||
public static final String NAMESPACE = "http://jabber.org/protocol/commands";
|
||||
|
||||
/* JID of the command host */
|
||||
private String id;
|
||||
private Jid id;
|
||||
|
||||
/* Command name */
|
||||
private String name;
|
||||
|
|
@ -114,11 +115,11 @@ public class AdHocCommandData extends IQ {
|
|||
*
|
||||
* @return the JID of the command host.
|
||||
*/
|
||||
public String getId() {
|
||||
public Jid getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
public void setId(Jid id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue