當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。