本文整理汇总了Java中org.jivesoftware.smack.packet.IQ.setError方法的典型用法代码示例。如果您正苦于以下问题:Java IQ.setError方法的具体用法?Java IQ.setError怎么用?Java IQ.setError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.packet.IQ
的用法示例。
在下文中一共展示了IQ.setError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createJingleError
import org.jivesoftware.smack.packet.IQ; //导入方法依赖的package包/类
/**
* Complete and send an error. Complete all the null fields in an IQ error
* reponse, using the sesssion information we have or some info from the
* incoming packet.
*
* @param iq
* The Jingle stanza(/packet) we are responing to
* @param jingleError
* the IQ stanza(/packet) we want to complete and send
*/
public IQ createJingleError(IQ iq, JingleError jingleError) {
IQ errorPacket = null;
if (jingleError != null) {
// TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways
XMPPError error = new XMPPError(XMPPError.Condition.undefined_condition, jingleError);
errorPacket = IQ.createErrorResponse(iq, error);
// Fill in the fields with the info from the Jingle packet
errorPacket.setStanzaId(iq.getStanzaId());
errorPacket.setError(error);
// errorPacket.addExtension(jingleError);
// NO! Let the normal state machinery do all of the sending.
// getConnection().sendStanza(perror);
LOGGER.severe("Error sent: " + errorPacket.toXML());
}
return errorPacket;
}