Search in sources :

Example 1 with GroupEventListener

use of org.jivesoftware.openfire.event.GroupEventListener in project Openfire by igniterealtime.

the class WorkgroupManager method addGroupManagerListener.

/**
     * Listens for changes in the Group model to update respective agents.
     */
private void addGroupManagerListener() {
    groupEventListener = new GroupEventListener() {

        public void groupCreated(Group group, Map params) {
        }

        public void groupDeleting(Group group, Map params) {
        }

        public void groupModified(Group group, Map params) {
        }

        public void memberAdded(Group group, Map params) {
            String userJID = (String) params.get("member");
            JID jid = new JID(userJID);
            if (!agentManager.hasAgent(jid)) {
                for (Workgroup workgroup : workgroups.values()) {
                    for (RequestQueue queue : workgroup.getRequestQueues()) {
                        if (queue.hasGroup(group)) {
                            agentManager.getAgents(group);
                        }
                    }
                }
            }
        }

        public void memberRemoved(Group group, Map params) {
        }

        public void adminAdded(Group group, Map params) {
        }

        public void adminRemoved(Group group, Map params) {
        }
    };
    GroupEventDispatcher.addListener(groupEventListener);
}
Also used : GroupEventListener(org.jivesoftware.openfire.event.GroupEventListener) Group(org.jivesoftware.openfire.group.Group) JID(org.xmpp.packet.JID) CreateWorkgroup(org.jivesoftware.openfire.fastpath.commands.CreateWorkgroup) DeleteWorkgroup(org.jivesoftware.openfire.fastpath.commands.DeleteWorkgroup) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 GroupEventListener (org.jivesoftware.openfire.event.GroupEventListener)1 CreateWorkgroup (org.jivesoftware.openfire.fastpath.commands.CreateWorkgroup)1 DeleteWorkgroup (org.jivesoftware.openfire.fastpath.commands.DeleteWorkgroup)1 Group (org.jivesoftware.openfire.group.Group)1 JID (org.xmpp.packet.JID)1