Search in sources :

Example 1 with AgentWorkgroups

use of org.jivesoftware.smackx.workgroup.packet.AgentWorkgroups in project ecf by eclipse.

the class Agent method getWorkgroups.

public static Collection<String> getWorkgroups(String serviceJID, String agentJID, Connection connection) throws XMPPException {
    AgentWorkgroups request = new AgentWorkgroups(agentJID);
    request.setTo(serviceJID);
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    // Send the request
    connection.sendPacket(request);
    AgentWorkgroups response = (AgentWorkgroups) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
    // 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());
    }
    return response.getWorkgroups();
}
Also used : AgentWorkgroups(org.jivesoftware.smackx.workgroup.packet.AgentWorkgroups) PacketCollector(org.jivesoftware.smack.PacketCollector) XMPPException(org.jivesoftware.smack.XMPPException) PacketIDFilter(org.jivesoftware.smack.filter.PacketIDFilter)

Example 2 with AgentWorkgroups

use of org.jivesoftware.smackx.workgroup.packet.AgentWorkgroups in project Smack by igniterealtime.

the class Agent method getWorkgroups.

public static Collection<String> getWorkgroups(Jid serviceJID, Jid agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    AgentWorkgroups request = new AgentWorkgroups(agentJID);
    request.setTo(serviceJID);
    AgentWorkgroups response = connection.sendIqRequestAndWaitForResponse(request);
    return response.getWorkgroups();
}
Also used : AgentWorkgroups(org.jivesoftware.smackx.workgroup.packet.AgentWorkgroups)

Aggregations

AgentWorkgroups (org.jivesoftware.smackx.workgroup.packet.AgentWorkgroups)2 PacketCollector (org.jivesoftware.smack.PacketCollector)1 XMPPException (org.jivesoftware.smack.XMPPException)1 PacketIDFilter (org.jivesoftware.smack.filter.PacketIDFilter)1