Package org.jivesoftware.smackx.workgroup.ext.macros

Examples of org.jivesoftware.smackx.workgroup.ext.macros.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();
    }
View Full Code Here


     *
     * @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());

View Full Code Here

     * @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();
    }
View Full Code Here

     *
     * @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());

View Full Code Here

     * @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();
    }
View Full Code Here

     *
     * @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());

View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.workgroup.ext.macros.Macros

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.