Java 类org.jivesoftware.smackx.workgroup.packet.AgentInfo 实例源码

项目:EIM    文件:Agent.java   
/**
 * Return the agents name.
 *
 * @return - the agents name.
 */
public String getName() throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.GET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    AgentInfo response = (AgentInfo)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.getName();
}
项目:EIM    文件:Agent.java   
/**
 * Changes the name of the agent in the server. The server may have this functionality
 * disabled for all the agents or for this agent in particular. If the agent is not
 * allowed to change his name then an exception will be thrown with a service_unavailable
 * error code.
 *
 * @param newName the new name of the agent.
 * @throws XMPPException if the agent is not allowed to change his name or no response was
 *                       obtained from the server.
 */
public void setName(String newName) throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.SET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    agentInfo.setName(newName);
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    IQ response = (IQ)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;
}
项目:androidPN-client.    文件:Agent.java   
/**
 * Return the agents name.
 *
 * @return - the agents name.
 */
public String getName() throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.GET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    AgentInfo response = (AgentInfo)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.getName();
}
项目:androidPN-client.    文件:Agent.java   
/**
 * Changes the name of the agent in the server. The server may have this functionality
 * disabled for all the agents or for this agent in particular. If the agent is not
 * allowed to change his name then an exception will be thrown with a service_unavailable
 * error code.
 *
 * @param newName the new name of the agent.
 * @throws XMPPException if the agent is not allowed to change his name or no response was
 *                       obtained from the server.
 */
public void setName(String newName) throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.SET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    agentInfo.setName(newName);
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    IQ response = (IQ)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;
}
项目:xmppsupport_v2    文件:Agent.java   
/**
 * Return the agents name.
 * 
 * @return - the agents name.
 */
public String getName() throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.GET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    PacketCollector collector = connection
            .createPacketCollector(new PacketIDFilter(agentInfo
                    .getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    AgentInfo response = (AgentInfo) 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.getName();
}
项目:xmppsupport_v2    文件:Agent.java   
/**
 * Changes the name of the agent in the server. The server may have this
 * functionality disabled for all the agents or for this agent in
 * particular. If the agent is not allowed to change his name then an
 * exception will be thrown with a service_unavailable error code.
 * 
 * @param newName
 *            the new name of the agent.
 * @throws XMPPException
 *             if the agent is not allowed to change his name or no response
 *             was obtained from the server.
 */
public void setName(String newName) throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.SET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    agentInfo.setName(newName);
    PacketCollector collector = connection
            .createPacketCollector(new PacketIDFilter(agentInfo
                    .getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    IQ response = (IQ) 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;
}
项目:java-bells    文件:Agent.java   
/**
 * Return the agents name.
 *
 * @return - the agents name.
 */
public String getName() throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.GET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    AgentInfo response = (AgentInfo)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.getName();
}
项目:java-bells    文件:Agent.java   
/**
 * Changes the name of the agent in the server. The server may have this functionality
 * disabled for all the agents or for this agent in particular. If the agent is not
 * allowed to change his name then an exception will be thrown with a service_unavailable
 * error code.
 *
 * @param newName the new name of the agent.
 * @throws XMPPException if the agent is not allowed to change his name or no response was
 *                       obtained from the server.
 */
public void setName(String newName) throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.SET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    agentInfo.setName(newName);
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    IQ response = (IQ)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;
}
项目:telegraph    文件:Agent.java   
/**
 * Return the agents name.
 *
 * @return - the agents name.
 */
public String getName() throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.GET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    AgentInfo response = (AgentInfo)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.getName();
}
项目:telegraph    文件:Agent.java   
/**
 * Changes the name of the agent in the server. The server may have this functionality
 * disabled for all the agents or for this agent in particular. If the agent is not
 * allowed to change his name then an exception will be thrown with a service_unavailable
 * error code.
 *
 * @param newName the new name of the agent.
 * @throws XMPPException if the agent is not allowed to change his name or no response was
 *                       obtained from the server.
 */
public void setName(String newName) throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.SET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    agentInfo.setName(newName);
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    IQ response = (IQ)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;
}
项目:NewCommunication-Android    文件:Agent.java   
/**
 * Return the agents name.
 *
 * @return - the agents name.
 */
public String getName() throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.GET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    AgentInfo response = (AgentInfo)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.getName();
}
项目:NewCommunication-Android    文件:Agent.java   
/**
 * Changes the name of the agent in the server. The server may have this functionality
 * disabled for all the agents or for this agent in particular. If the agent is not
 * allowed to change his name then an exception will be thrown with a service_unavailable
 * error code.
 *
 * @param newName the new name of the agent.
 * @throws XMPPException if the agent is not allowed to change his name or no response was
 *                       obtained from the server.
 */
public void setName(String newName) throws XMPPException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.SET);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    agentInfo.setName(newName);
    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(agentInfo.getPacketID()));
    // Send the request
    connection.sendPacket(agentInfo);

    IQ response = (IQ)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;
}
项目:Smack    文件:Agent.java   
/**
 * Return the agents name.
 *
 * @return - the agents name.
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public String getName() throws NoResponseException, XMPPErrorException, NotConnectedException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.get);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    AgentInfo response = (AgentInfo) connection.createPacketCollectorAndSend(agentInfo).nextResultOrThrow();
    return response.getName();
}
项目:Smack    文件:Agent.java   
/**
 * Changes the name of the agent in the server. The server may have this functionality
 * disabled for all the agents or for this agent in particular. If the agent is not
 * allowed to change his name then an exception will be thrown with a service_unavailable
 * error code.
 *
 * @param newName the new name of the agent.
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public void setName(String newName) throws NoResponseException, XMPPErrorException, NotConnectedException {
    AgentInfo agentInfo = new AgentInfo();
    agentInfo.setType(IQ.Type.set);
    agentInfo.setTo(workgroupJID);
    agentInfo.setFrom(getUser());
    agentInfo.setName(newName);
    connection.createPacketCollectorAndSend(agentInfo).nextResultOrThrow();
}