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


Java IQ.setType方法代码示例

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


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

示例1: sendStanza

import org.jivesoftware.smack.packet.IQ; //导入方法依赖的package包/类
@Override
public void sendStanza(Stanza packet) throws NotConnectedException {
    super.sendStanza(packet);

    if (packet instanceof IQ && !timeout) {
        timeout = false;
        // Set reply packet to match one being sent. We haven't started the
        // other thread yet so this is still safe.
        IQ replyPacket = replyQ.peek();

        // If no reply has been set via addIQReply, then we create a simple reply
        if (replyPacket == null) {
            replyPacket = IQ.createResultIQ((IQ) packet);
            replyQ.add(replyPacket);
        }
        replyPacket.setStanzaId(packet.getStanzaId());
        replyPacket.setFrom(packet.getTo());
        replyPacket.setTo(packet.getFrom());
        replyPacket.setType(Type.result);

        new ProcessQueue(replyQ).start();
    }
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:24,代码来源:ThreadedDummyConnection.java

示例2: createResultIQ

import org.jivesoftware.smack.packet.IQ; //导入方法依赖的package包/类
/**
 * Returns a result IQ.
 * 
 * @param from the senders JID
 * @param to the recipients JID
 * @return a result IQ
 */
public static IQ createResultIQ(String from, String to) {
    IQ result = new EmptyResultIQ();
    result.setType(IQ.Type.result);
    result.setFrom(from);
    result.setTo(to);
    return result;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:15,代码来源:IBBPacketUtils.java

示例3: sendRoomInvitation

import org.jivesoftware.smack.packet.IQ; //导入方法依赖的package包/类
/**
 * Invites a user or agent to an existing session support. The provided invitee's JID can be of
 * a user, an agent, a queue or a workgroup. In the case of a queue or a workgroup the workgroup service
 * will decide the best agent to receive the invitation.<p>
 *
 * This method will return either when the service returned an ACK of the request or if an error occured
 * while requesting the invitation. After sending the ACK the service will send the invitation to the target
 * entity. When dealing with agents the common sequence of offer-response will be followed. However, when
 * sending an invitation to a user a standard MUC invitation will be sent.<p>
 *
 * The agent or user that accepted the offer <b>MUST</b> join the room. Failing to do so will make
 * the invitation to fail. The inviter will eventually receive a message error indicating that the invitee
 * accepted the offer but failed to join the room.
 *
 * Different situations may lead to a failed invitation. Possible cases are: 1) all agents rejected the
 * offer and ther are no agents available, 2) the agent that accepted the offer failed to join the room or
 * 2) the user that received the MUC invitation never replied or joined the room. In any of these cases
 * (or other failing cases) the inviter will get an error message with the failed notification.
 *
 * @param type type of entity that will get the invitation.
 * @param invitee JID of entity that will get the invitation.
 * @param sessionID ID of the support session that the invitee is being invited.
 * @param reason the reason of the invitation.
 * @throws XMPPErrorException if the sender of the invitation is not an agent or the service failed to process
 *         the request.
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public void sendRoomInvitation(RoomInvitation.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException
        {
    final RoomInvitation invitation = new RoomInvitation(type, invitee, sessionID, reason);
    IQ iq = new RoomInvitation.RoomInvitationIQ(invitation);
    iq.setType(IQ.Type.set);
    iq.setTo(workgroupJID);
    iq.setFrom(connection.getUser());

    connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:39,代码来源:AgentSession.java

示例4: sendRoomTransfer

import org.jivesoftware.smack.packet.IQ; //导入方法依赖的package包/类
/**
 * Transfer an existing session support to another user or agent. The provided invitee's JID can be of
 * a user, an agent, a queue or a workgroup. In the case of a queue or a workgroup the workgroup service
 * will decide the best agent to receive the invitation.<p>
 *
 * This method will return either when the service returned an ACK of the request or if an error occured
 * while requesting the transfer. After sending the ACK the service will send the invitation to the target
 * entity. When dealing with agents the common sequence of offer-response will be followed. However, when
 * sending an invitation to a user a standard MUC invitation will be sent.<p>
 *
 * Once the invitee joins the support room the workgroup service will kick the inviter from the room.<p>
 *
 * Different situations may lead to a failed transfers. Possible cases are: 1) all agents rejected the
 * offer and there are no agents available, 2) the agent that accepted the offer failed to join the room
 * or 2) the user that received the MUC invitation never replied or joined the room. In any of these cases
 * (or other failing cases) the inviter will get an error message with the failed notification.
 *
 * @param type type of entity that will get the invitation.
 * @param invitee JID of entity that will get the invitation.
 * @param sessionID ID of the support session that the invitee is being invited.
 * @param reason the reason of the invitation.
 * @throws XMPPErrorException if the sender of the invitation is not an agent or the service failed to process
 *         the request.
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public void sendRoomTransfer(RoomTransfer.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException
        {
    final RoomTransfer transfer = new RoomTransfer(type, invitee, sessionID, reason);
    IQ iq = new RoomTransfer.RoomTransferIQ(transfer);
    iq.setType(IQ.Type.set);
    iq.setTo(workgroupJID);
    iq.setFrom(connection.getUser());

    connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:37,代码来源:AgentSession.java

示例5: createErrorIQ

import org.jivesoftware.smack.packet.IQ; //导入方法依赖的package包/类
/**
 * Returns an error IQ.
 * 
 * @param from the senders JID
 * @param to the recipients JID
 * @param xmppError the XMPP error
 * @return an error IQ
 */
public static IQ createErrorIQ(String from, String to, XMPPError xmppError) {
    IQ errorIQ = new ErrorIQ(xmppError);
    errorIQ.setType(IQ.Type.error);
    errorIQ.setFrom(from);
    errorIQ.setTo(to);
    return errorIQ;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:16,代码来源:IBBPacketUtils.java


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