正在查看: bbinstant v6.24.0 应用的 AdHocCommand.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: bbinstant v6.24.0 应用的 AdHocCommand.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.jivesoftware.smackx.commands;
import java.util.List;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.xdata.Form;
import org.jxmpp.jid.i;
public abstract class AdHocCommand {
private AdHocCommandData data = new AdHocCommandData();
public enum Action {
execute,
cancel,
prev,
next,
complete,
unknown
}
public enum SpecificErrorCondition {
badAction("bad-action"),
malformedAction("malformed-action"),
badLocale("bad-locale"),
badPayload("bad-payload"),
badSessionid("bad-sessionid"),
sessionExpired("session-expired");
private final String value;
SpecificErrorCondition(String str) {
this.value = str;
}
@Override
public String toString() {
return this.value;
}
}
public enum Status {
executing,
completed,
canceled
}
public static SpecificErrorCondition getSpecificErrorCondition(XMPPError xMPPError) {
for (SpecificErrorCondition specificErrorCondition : SpecificErrorCondition.values()) {
if (xMPPError.getExtension(specificErrorCondition.toString(), "http://jabber.org/protocol/commands") != null) {
return specificErrorCondition;
}
}
return null;
}
protected void addActionAvailable(Action action) {
this.data.addAction(action);
}
protected void addNote(AdHocCommandNote adHocCommandNote) {
this.data.addNote(adHocCommandNote);
}
public abstract void cancel() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException;
public abstract void complete(Form form) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException;
public abstract void execute() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException;
protected List<Action> getActions() {
return this.data.getActions();
}
AdHocCommandData getData() {
return this.data;
}
protected Action getExecuteAction() {
return this.data.getExecuteAction();
}
public Form getForm() {
if (this.data.getForm() == null) {
return null;
}
return new Form(this.data.getForm());
}
public String getName() {
return this.data.getName();
}
public String getNode() {
return this.data.getNode();
}
public List<AdHocCommandNote> getNotes() {
return this.data.getNotes();
}
public abstract i getOwnerJID();
public String getRaw() {
return this.data.getChildElementXML().toString();
}
public Status getStatus() {
return this.data.getStatus();
}
public boolean isCompleted() {
return getStatus() == Status.completed;
}
protected boolean isValidAction(Action action) {
return getActions().contains(action) || Action.cancel.equals(action);
}
public abstract void next(Form form) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException;
public abstract void prev() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException;
void setData(AdHocCommandData adHocCommandData) {
this.data = adHocCommandData;
}
protected void setExecuteAction(Action action) {
this.data.setExecuteAction(action);
}
protected void setForm(Form form) {
this.data.setForm(form.getDataFormToSend());
}
public void setName(String str) {
this.data.setName(str);
}
public void setNode(String str) {
this.data.setNode(str);
}
}