当前位置: 首页>>代码示例>>Java>>正文


Java AdHocCommandData.setType方法代码示例

本文整理汇总了Java中org.jivesoftware.smackx.packet.AdHocCommandData.setType方法的典型用法代码示例。如果您正苦于以下问题:Java AdHocCommandData.setType方法的具体用法?Java AdHocCommandData.setType怎么用?Java AdHocCommandData.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smackx.packet.AdHocCommandData的用法示例。


在下文中一共展示了AdHocCommandData.setType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeAction

import org.jivesoftware.smackx.packet.AdHocCommandData; //导入方法依赖的package包/类
/**
 * Executes the <code>action</codo> with the <code>form</code>.
 * The action could be any of the available actions. The form must
 * be the anwser of the previous stage. It can be <tt>null</tt> if it is the first stage.
 *
 * @param action the action to execute.
 * @param form the form with the information.
 * @param timeout the amount of time to wait for a reply.
 * @throws XMPPException if there is a problem executing the command.
 */
private void executeAction(Action action, Form form, long timeout) throws XMPPException {
    // TODO: Check that all the required fields of the form were filled, if
    // TODO: not throw the corresponding exeption. This will make a faster response,
    // TODO: since the request is stoped before it's sent.
    AdHocCommandData data = new AdHocCommandData();
    data.setType(IQ.Type.SET);
    data.setTo(getOwnerJID());
    data.setNode(getNode());
    data.setSessionID(sessionID);
    data.setAction(action);

    if (form != null) {
        data.setForm(form.getDataFormToSend());
    }

    PacketCollector collector = connection.createPacketCollector(
            new PacketIDFilter(data.getPacketID()));

    connection.sendPacket(data);

    Packet response = collector.nextResult(timeout);

    // Cancel the collector.
    collector.cancel();
    if (response == null) {
        throw new XMPPException("No response from server on status set.");
    }
    if (response.getError() != null) {
        throw new XMPPException(response.getError());
    }

    AdHocCommandData responseData = (AdHocCommandData) response;
    this.sessionID = responseData.getSessionID();
    super.setData(responseData);
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:46,代码来源:RemoteCommand.java

示例2: executeAction

import org.jivesoftware.smackx.packet.AdHocCommandData; //导入方法依赖的package包/类
/**
 * Executes the <code>action</codo> with the <code>form</code>. The action
 * could be any of the available actions. The form must be the anwser of the
 * previous stage. It can be <tt>null</tt> if it is the first stage.
 * 
 * @param action
 *            the action to execute.
 * @param form
 *            the form with the information.
 * @param timeout
 *            the amount of time to wait for a reply.
 * @throws XMPPException
 *             if there is a problem executing the command.
 */
private void executeAction(Action action, Form form, long timeout)
		throws XMPPException {
	// TODO: Check that all the required fields of the form were filled, if
	// TODO: not throw the corresponding exeption. This will make a faster
	// response,
	// TODO: since the request is stoped before it's sent.
	AdHocCommandData data = new AdHocCommandData();
	data.setType(IQ.Type.SET);
	data.setTo(getOwnerJID());
	data.setNode(getNode());
	data.setSessionID(sessionID);
	data.setAction(action);

	if (form != null) {
		data.setForm(form.getDataFormToSend());
	}

	PacketCollector collector = connection
			.createPacketCollector(new PacketIDFilter(data.getPacketID()));

	connection.sendPacket(data);

	Packet response = collector.nextResult(timeout);

	// Cancel the collector.
	collector.cancel();
	if (response == null) {
		throw new XMPPException("No response from server on status set.");
	}
	if (response.getError() != null) {
		throw new XMPPException(response.getError());
	}

	AdHocCommandData responseData = (AdHocCommandData) response;
	this.sessionID = responseData.getSessionID();
	super.setData(responseData);
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:52,代码来源:RemoteCommand.java

示例3: respondError

import org.jivesoftware.smackx.packet.AdHocCommandData; //导入方法依赖的package包/类
/**
 * Responds an error with an specific error.
 * 
 * @param response the response to send.
 * @param error the error to send.
 */
private void respondError(AdHocCommandData response, XMPPError error) {
    response.setType(IQ.Type.ERROR);
    response.setError(error);
    connection.sendPacket(response);
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:12,代码来源:AdHocCommandManager.java

示例4: respondError

import org.jivesoftware.smackx.packet.AdHocCommandData; //导入方法依赖的package包/类
/**
 * Responds an error with an specific error.
 * 
 * @param response the response to send.
 * @param error the error to send.
 */
private void respondError(AdHocCommandData response, XMPPError error) {
    response.setType(IQ.Type.ERROR);
    response.setError(error);
    connection.get().sendPacket(response);
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:12,代码来源:AdHocCommandManager.java

示例5: respondError

import org.jivesoftware.smackx.packet.AdHocCommandData; //导入方法依赖的package包/类
/**
 * Responds an error with an specific error.
 * 
 * @param response
 *            the response to send.
 * @param error
 *            the error to send.
 */
private void respondError(AdHocCommandData response, XMPPError error) {
	response.setType(IQ.Type.ERROR);
	response.setError(error);
	connection.sendPacket(response);
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:14,代码来源:AdHocCommandManager.java


注:本文中的org.jivesoftware.smackx.packet.AdHocCommandData.setType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。