Package org.jivesoftware.xmpp.workgroup

Examples of org.jivesoftware.xmpp.workgroup.AgentManager


     * @param queue  the <code>RequestQueue</code> to add agents to.
     * @param agents a comma-delimited list of agents.
     */
    public static void addAgents(RequestQueue queue, String agents) {
        WorkgroupManager workgroupManager = WorkgroupManager.getInstance();
        AgentManager agentManager = workgroupManager.getAgentManager();

        // loop thru all params
        StringTokenizer tokenizer = new StringTokenizer(agents, ", \t\n\r\f");
        while (tokenizer.hasMoreTokens()) {
            String usernameToken = tokenizer.nextToken();
            if (usernameToken.indexOf('@') != -1) {
                usernameToken = JID.escapeNode(usernameToken);
            }
            try {
                // See if they are a user in the system.
                UserManager.getInstance().getUser(usernameToken);
                usernameToken += ("@" + ComponentManagerFactory.getComponentManager().getServerName());
                JID address = new JID(usernameToken.trim());
                Agent agent;

                if (agentManager.hasAgent(address)) {
                    agent = agentManager.getAgent(address);
                }
                else {
                    agent = agentManager.createAgent(address);
                }
                queue.addMember(agent);
            }
            catch (Exception e) {
                Log.error(e.getMessage(), e);
View Full Code Here

TOP

Related Classes of org.jivesoftware.xmpp.workgroup.AgentManager

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.