Java 类org.jivesoftware.smackx.workgroup.ext.macros.Macros 实例源码

项目:EIM    文件:AgentSession.java   
/**
 * Asks the workgroup for it's Global Macros.
 *
 * @param global true to retrieve global macros, otherwise false for personal macros.
 * @return MacroGroup the root macro group.
 * @throws XMPPException if an error occurs while getting information from the server.
 */
public MacroGroup getMacros(boolean global) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.GET);
    request.setTo(workgroupJID);
    request.setPersonal(!global);

    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);


    Macros response = (Macros)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

    // Cancel the collector.
    collector.cancel();
    if (response == null) {
        throw new XMPPException("No response from server.");
    }
    if (response.getError() != null) {
        throw new XMPPException(response.getError());
    }
    return response.getRootGroup();
}
项目:EIM    文件:AgentSession.java   
/**
 * Persists the Personal Macro for an agent.
 *
 * @param group the macro group to save. 
 * @throws XMPPException if an error occurs while getting information from the server.
 */
public void saveMacros(MacroGroup group) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.SET);
    request.setTo(workgroupJID);
    request.setPersonal(true);
    request.setPersonalMacroGroup(group);

    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);


    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());
    }
}
项目:androidPN-client.    文件:AgentSession.java   
/**
 * Asks the workgroup for it's Global Macros.
 *
 * @param global true to retrieve global macros, otherwise false for personal macros.
 * @return MacroGroup the root macro group.
 * @throws XMPPException if an error occurs while getting information from the server.
 */
public MacroGroup getMacros(boolean global) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.GET);
    request.setTo(workgroupJID);
    request.setPersonal(!global);

    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);


    Macros response = (Macros)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

    // Cancel the collector.
    collector.cancel();
    if (response == null) {
        throw new XMPPException("No response from server.");
    }
    if (response.getError() != null) {
        throw new XMPPException(response.getError());
    }
    return response.getRootGroup();
}
项目:androidPN-client.    文件:AgentSession.java   
/**
 * Persists the Personal Macro for an agent.
 *
 * @param group the macro group to save. 
 * @throws XMPPException if an error occurs while getting information from the server.
 */
public void saveMacros(MacroGroup group) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.SET);
    request.setTo(workgroupJID);
    request.setPersonal(true);
    request.setPersonalMacroGroup(group);

    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);


    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());
    }
}
项目:xmppsupport_v2    文件:AgentSession.java   
/**
 * Asks the workgroup for it's Global Macros.
 * 
 * @param global
 *            true to retrieve global macros, otherwise false for personal
 *            macros.
 * @return MacroGroup the root macro group.
 * @throws XMPPException
 *             if an error occurs while getting information from the server.
 */
public MacroGroup getMacros(boolean global) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.GET);
    request.setTo(workgroupJID);
    request.setPersonal(!global);

    PacketCollector collector = connection
            .createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);

    Macros response = (Macros) collector.nextResult(SmackConfiguration
            .getPacketReplyTimeout());

    // Cancel the collector.
    collector.cancel();
    if (response == null) {
        throw new XMPPException("No response from server.");
    }
    if (response.getError() != null) {
        throw new XMPPException(response.getError());
    }
    return response.getRootGroup();
}
项目:xmppsupport_v2    文件:AgentSession.java   
/**
 * Persists the Personal Macro for an agent.
 * 
 * @param group
 *            the macro group to save.
 * @throws XMPPException
 *             if an error occurs while getting information from the server.
 */
public void saveMacros(MacroGroup group) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.SET);
    request.setTo(workgroupJID);
    request.setPersonal(true);
    request.setPersonalMacroGroup(group);

    PacketCollector collector = connection
            .createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);

    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());
    }
}
项目:java-bells    文件:AgentSession.java   
/**
 * Asks the workgroup for it's Global Macros.
 *
 * @param global true to retrieve global macros, otherwise false for personal macros.
 * @return MacroGroup the root macro group.
 * @throws XMPPException if an error occurs while getting information from the server.
 */
public MacroGroup getMacros(boolean global) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.GET);
    request.setTo(workgroupJID);
    request.setPersonal(!global);

    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);


    Macros response = (Macros)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

    // Cancel the collector.
    collector.cancel();
    if (response == null) {
        throw new XMPPException("No response from server.");
    }
    if (response.getError() != null) {
        throw new XMPPException(response.getError());
    }
    return response.getRootGroup();
}
项目:java-bells    文件:AgentSession.java   
/**
 * Persists the Personal Macro for an agent.
 *
 * @param group the macro group to save. 
 * @throws XMPPException if an error occurs while getting information from the server.
 */
public void saveMacros(MacroGroup group) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.SET);
    request.setTo(workgroupJID);
    request.setPersonal(true);
    request.setPersonalMacroGroup(group);

    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);


    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());
    }
}
项目:telegraph    文件:AgentSession.java   
/**
 * Asks the workgroup for it's Global Macros.
 *
 * @param global true to retrieve global macros, otherwise false for personal macros.
 * @return MacroGroup the root macro group.
 * @throws XMPPException if an error occurs while getting information from the server.
 */
public MacroGroup getMacros(boolean global) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.GET);
    request.setTo(workgroupJID);
    request.setPersonal(!global);

    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);


    Macros response = (Macros)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

    // Cancel the collector.
    collector.cancel();
    if (response == null) {
        throw new XMPPException("No response from server.");
    }
    if (response.getError() != null) {
        throw new XMPPException(response.getError());
    }
    return response.getRootGroup();
}
项目:telegraph    文件:AgentSession.java   
/**
 * Persists the Personal Macro for an agent.
 *
 * @param group the macro group to save. 
 * @throws XMPPException if an error occurs while getting information from the server.
 */
public void saveMacros(MacroGroup group) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.SET);
    request.setTo(workgroupJID);
    request.setPersonal(true);
    request.setPersonalMacroGroup(group);

    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);


    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());
    }
}
项目:NewCommunication-Android    文件:AgentSession.java   
/**
 * Asks the workgroup for it's Global Macros.
 *
 * @param global true to retrieve global macros, otherwise false for personal macros.
 * @return MacroGroup the root macro group.
 * @throws XMPPException if an error occurs while getting information from the server.
 */
public MacroGroup getMacros(boolean global) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.GET);
    request.setTo(workgroupJID);
    request.setPersonal(!global);

    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);


    Macros response = (Macros)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

    // Cancel the collector.
    collector.cancel();
    if (response == null) {
        throw new XMPPException("No response from server.");
    }
    if (response.getError() != null) {
        throw new XMPPException(response.getError());
    }
    return response.getRootGroup();
}
项目:NewCommunication-Android    文件:AgentSession.java   
/**
 * Persists the Personal Macro for an agent.
 *
 * @param group the macro group to save. 
 * @throws XMPPException if an error occurs while getting information from the server.
 */
public void saveMacros(MacroGroup group) throws XMPPException {
    Macros request = new Macros();
    request.setType(IQ.Type.SET);
    request.setTo(workgroupJID);
    request.setPersonal(true);
    request.setPersonalMacroGroup(group);

    PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(request.getPacketID()));
    connection.sendPacket(request);


    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());
    }
}
项目:Smack    文件:AgentSession.java   
/**
 * Asks the workgroup for it's Global Macros.
 *
 * @param global true to retrieve global macros, otherwise false for personal macros.
 * @return MacroGroup the root macro group.
 * @throws XMPPErrorException if an error occurs while getting information from the server.
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public MacroGroup getMacros(boolean global) throws NoResponseException, XMPPErrorException, NotConnectedException {
    Macros request = new Macros();
    request.setType(IQ.Type.get);
    request.setTo(workgroupJID);
    request.setPersonal(!global);

    Macros response = (Macros) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
    return response.getRootGroup();
}
项目:Smack    文件:AgentSession.java   
/**
 * Persists the Personal Macro for an agent.
 *
 * @param group the macro group to save. 
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public void saveMacros(MacroGroup group) throws NoResponseException, XMPPErrorException, NotConnectedException {
    Macros request = new Macros();
    request.setType(IQ.Type.set);
    request.setTo(workgroupJID);
    request.setPersonal(true);
    request.setPersonalMacroGroup(group);

    connection.createPacketCollectorAndSend(request).nextResultOrThrow();
}