Search in sources :

Example 31 with NotFoundException

use of org.jivesoftware.util.NotFoundException in project Openfire by igniterealtime.

the class LocalMUCRoom method sendPrivatePacket.

@Override
public void sendPrivatePacket(Packet packet, MUCRole senderRole) throws NotFoundException, ForbiddenException {
    switch(// intended fall-through
    senderRole.getRole()) {
        case none:
            throw new ForbiddenException();
        default:
        case visitor:
            if (canSendPrivateMessage().equals("participants"))
                throw new ForbiddenException();
        case participant:
            if (canSendPrivateMessage().equals("moderators"))
                throw new ForbiddenException();
        case moderator:
            if (canSendPrivateMessage().equals("none"))
                throw new ForbiddenException();
    }
    String resource = packet.getTo().getResource();
    List<MUCRole> occupants = occupantsByNickname.get(resource.toLowerCase());
    if (occupants == null || occupants.size() == 0) {
        throw new NotFoundException();
    }
    for (MUCRole occupant : occupants) {
        packet.setFrom(senderRole.getRoleAddress());
        occupant.send(packet);
        if (packet instanceof Message) {
            Message message = (Message) packet;
            MUCEventDispatcher.privateMessageRecieved(occupant.getUserAddress(), senderRole.getUserAddress(), message);
        }
    }
}
Also used : ForbiddenException(org.jivesoftware.openfire.muc.ForbiddenException) MUCRole(org.jivesoftware.openfire.muc.MUCRole) Message(org.xmpp.packet.Message) GroupNotFoundException(org.jivesoftware.openfire.group.GroupNotFoundException) NotFoundException(org.jivesoftware.util.NotFoundException) UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException)

Example 32 with NotFoundException

use of org.jivesoftware.util.NotFoundException in project Openfire by igniterealtime.

the class LocalMUCUser method process.

/**
     * This method does all packet routing in the chat server. Packet routing is actually very
     * simple:
     * 
     * <ul>
     * <li>Discover the room the user is talking to (server packets are dropped)</li>
     * <li>If the room is not registered and this is a presence "available" packet, try to join the
     * room</li>
     * <li>If the room is registered, and presence "unavailable" leave the room</li>
     * <li>Otherwise, rewrite the sender address and send to the room.</li>
     * </ul>
     * 
     * @param packet The packet to route.
     */
public void process(Message packet) {
    // Ignore messages of type ERROR sent to a room 
    if (Message.Type.error == packet.getType()) {
        return;
    }
    lastPacketTime = System.currentTimeMillis();
    JID recipient = packet.getTo();
    String group = recipient.getNode();
    if (group == null) {
        // Packets to the groupchat server. This should not occur (should be handled by MultiUserChatServiceImpl instead)
        Log.warn(LocaleUtils.getLocalizedString("muc.error.not-supported") + " " + packet.toString());
    } else {
        MUCRole role = roles.get(group);
        if (role == null) {
            if (server.hasChatRoom(group)) {
                boolean declinedInvitation = false;
                Element userInfo = null;
                if (Message.Type.normal == packet.getType()) {
                    // An user that is not an occupant could be declining an invitation
                    userInfo = packet.getChildElement("x", "http://jabber.org/protocol/muc#user");
                    if (userInfo != null && userInfo.element("decline") != null) {
                        // A user has declined an invitation to a room
                        // WARNING: Potential fraud if someone fakes the "from" of the
                        // message with the JID of a member and sends a "decline"
                        declinedInvitation = true;
                    }
                }
                if (declinedInvitation) {
                    Element info = userInfo.element("decline");
                    server.getChatRoom(group).sendInvitationRejection(new JID(info.attributeValue("to")), info.elementTextTrim("reason"), packet.getFrom());
                } else {
                    // The sender is not an occupant of the room
                    sendErrorPacket(packet, PacketError.Condition.not_acceptable);
                }
            } else {
                // The sender is not an occupant of a NON-EXISTENT room!!!
                sendErrorPacket(packet, PacketError.Condition.recipient_unavailable);
            }
        } else {
            // In other words, another user already has this nickname
            if (!role.getUserAddress().equals(packet.getFrom())) {
                sendErrorPacket(packet, PacketError.Condition.conflict);
            } else {
                try {
                    if (role.getChatRoom().getRoomHistory().isSubjectChangeRequest(packet)) {
                        // An occupant is trying to change the room's subject
                        role.getChatRoom().changeSubject(packet, role);
                    } else {
                        // An occupant is trying to send a private, send public message,
                        // invite someone to the room or reject an invitation
                        Message.Type type = packet.getType();
                        String resource = packet.getTo().getResource();
                        if (resource == null || resource.trim().length() == 0) {
                            resource = null;
                        }
                        if (resource == null && Message.Type.groupchat == type) {
                            // An occupant is trying to send a public message
                            role.getChatRoom().sendPublicMessage(packet, role);
                        } else if (resource != null && (Message.Type.chat == type || Message.Type.normal == type)) {
                            // An occupant is trying to send a private message
                            role.getChatRoom().sendPrivatePacket(packet, role);
                        } else if (resource == null && Message.Type.normal == type) {
                            // An occupant could be sending an invitation or declining an
                            // invitation
                            Element userInfo = packet.getChildElement("x", "http://jabber.org/protocol/muc#user");
                            // Real real real UGLY TRICK!!! Will and MUST be solved when
                            // persistence will be added. Replace locking with transactions!
                            LocalMUCRoom room = (LocalMUCRoom) role.getChatRoom();
                            if (userInfo != null && userInfo.element("invite") != null) {
                                // An occupant is sending invitations
                                // Try to keep the list of extensions sent together with the
                                // message invitation. These extensions will be sent to the
                                // invitees.
                                @SuppressWarnings("unchecked") List<Element> extensions = new ArrayList<>(packet.getElement().elements());
                                extensions.remove(userInfo);
                                // Send invitations to invitees
                                @SuppressWarnings("unchecked") Iterator<Element> it = userInfo.elementIterator("invite");
                                while (it.hasNext()) {
                                    Element info = it.next();
                                    JID jid = new JID(info.attributeValue("to"));
                                    // members only
                                    if (room.isMembersOnly()) {
                                        room.addMember(jid, null, role);
                                    }
                                    // Send the invitation to the invitee
                                    room.sendInvitation(jid, info.elementTextTrim("reason"), role, extensions);
                                }
                            } else if (userInfo != null && userInfo.element("decline") != null) {
                                // An occupant has declined an invitation
                                Element info = userInfo.element("decline");
                                room.sendInvitationRejection(new JID(info.attributeValue("to")), info.elementTextTrim("reason"), packet.getFrom());
                            } else {
                                sendErrorPacket(packet, PacketError.Condition.bad_request);
                            }
                        } else {
                            sendErrorPacket(packet, PacketError.Condition.bad_request);
                        }
                    }
                } catch (ForbiddenException e) {
                    sendErrorPacket(packet, PacketError.Condition.forbidden);
                } catch (NotFoundException e) {
                    sendErrorPacket(packet, PacketError.Condition.recipient_unavailable);
                } catch (ConflictException e) {
                    sendErrorPacket(packet, PacketError.Condition.conflict);
                } catch (CannotBeInvitedException e) {
                    sendErrorPacket(packet, PacketError.Condition.not_acceptable);
                } catch (IllegalArgumentException e) {
                    sendErrorPacket(packet, PacketError.Condition.jid_malformed);
                }
            }
        }
    }
}
Also used : Element(org.dom4j.Element) NotFoundException(org.jivesoftware.util.NotFoundException)

Example 33 with NotFoundException

use of org.jivesoftware.util.NotFoundException in project Openfire by igniterealtime.

the class WorkgroupIQHandler method handleIQGet.

private void handleIQGet(IQ packet) {
    IQ reply = null;
    // TODO: verify namespace and send error if wrong
    Element iq = packet.getChildElement();
    UserRequest request;
    final WorkgroupStats stats = new WorkgroupStats(workgroup);
    String name = iq.getName();
    String namespace = iq.getNamespaceURI();
    if ("queue-status".equals(name)) {
        try {
            request = UserRequest.getRequest(workgroup, packet.getFrom());
            request.updateQueueStatus(true);
        } catch (NotFoundException e) {
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.item_not_found));
        }
    } else if ("transcripts".equals(name)) {
        try {
            // Otherwise return a not_authorized
            if (agentManager.getAgentSession(packet.getFrom()) == null) {
                reply = IQ.createResultIQ(packet);
                reply.setChildElement(packet.getChildElement().createCopy());
                reply.setError(new PacketError(PacketError.Condition.not_authorized));
            } else {
                String userID = iq.attributeValue("userID");
                stats.getChatTranscripts(packet, userID);
            }
        } catch (AgentNotFoundException e) {
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.not_authorized));
        }
    } else if ("transcript".equals(name)) {
        try {
            // Otherwise return a not_authorized
            if (agentManager.getAgentSession(packet.getFrom()) == null) {
                reply = IQ.createResultIQ(packet);
                reply.setChildElement(packet.getChildElement().createCopy());
                reply.setError(new PacketError(PacketError.Condition.not_authorized));
            } else {
                String sessionID = iq.attributeValue("sessionID");
                stats.getChatTranscript(packet, sessionID);
            }
        } catch (AgentNotFoundException e) {
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.not_authorized));
        }
    } else if ("agent-status-request".equals(name)) {
        try {
            AgentSession agentSession = agentManager.getAgentSession(packet.getFrom());
            if (agentSession == null) {
                reply = IQ.createResultIQ(packet);
                reply.setChildElement(packet.getChildElement().createCopy());
                reply.setError(new PacketError(PacketError.Condition.item_not_found));
            } else {
                agentSession.sendAgentsInWorkgroup(packet, workgroup);
            }
        } catch (AgentNotFoundException e) {
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.item_not_found));
        }
    } else if ("agent-info".equals(name)) {
        try {
            // Send the agent's info to the session that requested its own information
            AgentSession agentSession = agentManager.getAgentSession(packet.getFrom());
            if (agentSession == null) {
                reply = IQ.createResultIQ(packet);
                reply.setChildElement(packet.getChildElement().createCopy());
                reply.setError(new PacketError(PacketError.Condition.item_not_found));
            } else {
                agentSession.sendAgentInfo(packet);
            }
        } catch (AgentNotFoundException e) {
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.item_not_found));
        }
    } else if ("occupants-info".equals(name)) {
        try {
            // Just check that the packet was sent by a logged agent to this workgroup
            AgentSession agentSession = agentManager.getAgentSession(packet.getFrom());
            if (agentSession == null) {
                reply = IQ.createResultIQ(packet);
                reply.setChildElement(packet.getChildElement().createCopy());
                reply.setError(new PacketError(PacketError.Condition.not_authorized));
            } else {
                // Send information about the occupants of the requested room
                String roomID = iq.attributeValue("roomID");
                workgroup.sendOccupantsInfo(packet, roomID);
            }
        } catch (AgentNotFoundException e) {
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.not_authorized));
        }
    } else if ("chat-settings".equals(name)) {
        ChatSettingsManager chatSettingsManager = ChatSettingsManager.getInstance();
        String key = iq.attributeValue("key");
        String type = iq.attributeValue("type");
        if (ModelUtil.hasLength(key)) {
            chatSettingsManager.getChatSettingByKey(packet, workgroup, key);
        } else if (ModelUtil.hasLength(type)) {
            try {
                int typeInt = Integer.parseInt(type);
                chatSettingsManager.getChatSettingsByType(packet, workgroup, typeInt);
            } catch (NumberFormatException e) {
            // Bad type.
            }
        } else {
            chatSettingsManager.getAllChatSettings(packet, workgroup);
        }
    } else if ("jabber:iq:private".equals(namespace)) {
        // IQ private for agents global macro storage
        getIQPrivate(packet);
    } else if ("vcard-temp".equals(namespace)) {
        // Return workgroup's VCard
        getVCard(packet);
    } else {
        // none are found, send bad request error.
        for (WorkgroupProvider provider : providerManager.getWorkgroupProviders()) {
            // Will provider handle the GET
            if (provider.handleGet(packet)) {
                // Pass off packet
                provider.executeGet(packet, workgroup);
                return;
            }
        }
        dropPacket(packet);
        reply = IQ.createResultIQ(packet);
        reply.setChildElement(packet.getChildElement().createCopy());
        reply.setError(new PacketError(PacketError.Condition.bad_request));
    }
    if (reply != null) {
        workgroup.send(reply);
    }
}
Also used : ChatSettingsManager(org.jivesoftware.openfire.fastpath.settings.chat.ChatSettingsManager) Element(org.dom4j.Element) IQ(org.xmpp.packet.IQ) NotFoundException(org.jivesoftware.util.NotFoundException) PacketError(org.xmpp.packet.PacketError) UserRequest(org.jivesoftware.xmpp.workgroup.request.UserRequest)

Example 34 with NotFoundException

use of org.jivesoftware.util.NotFoundException in project Openfire by igniterealtime.

the class WorkgroupIQHandler method handleIQSet.

private void handleIQSet(IQ packet) {
    IQ reply;
    // TODO: verify namespace and send error if wrong
    Element iq = packet.getChildElement();
    JID sender = packet.getFrom();
    reply = IQ.createResultIQ(packet);
    reply.setFrom(workgroup.getJID());
    String queryName = iq.getName();
    String queryNamespace = iq.getNamespace().toString();
    if ("join-queue".equals(queryName)) {
        InterceptorManager interceptorManager = QueueInterceptorManager.getInstance();
        try {
            interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), packet, true, false);
            // Received a Join Queue request from a visitor, create a new request.
            UserRequest request = new UserRequest(packet, workgroup);
            // Let the workgroup process the new request
            if (!workgroup.queueRequest(request)) {
                // It was not possible to add the request to a queue so answer that the
                // workgroup is not accepting new join-queue requests
                reply.setChildElement(packet.getChildElement().createCopy());
                reply.setError(new PacketError(PacketError.Condition.service_unavailable));
            }
            interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), packet, true, true);
        } catch (PacketRejectedException e) {
            workgroup.rejectPacket(packet, e);
            reply = null;
        }
    } else if ("depart-queue".equals(queryName)) {
        // Visitor is departing queue
        try {
            Request request = UserRequest.getRequest(workgroup, sender);
            InterceptorManager interceptorManager = QueueInterceptorManager.getInstance();
            try {
                interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), packet, true, false);
                request.cancel(Request.CancelType.DEPART);
                iq.add(request.getSessionElement());
                interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), packet, true, true);
            } catch (PacketRejectedException e) {
                workgroup.rejectPacket(packet, e);
                reply = null;
            }
        } catch (NotFoundException e) {
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.item_not_found));
            Log.debug("Request not found" + " while departing queue:", e);
        }
    } else if ("offer-accept".equals(queryName)) {
        try {
            InterceptorManager interceptorManager = OfferInterceptorManager.getInstance();
            String id = iq.attributeValue("id");
            String jid = iq.attributeValue("jid");
            if (id != null || jid != null) {
                Request request;
                if (id != null) {
                    // Search request by its unique ID
                    request = Request.getRequest(id);
                } else {
                    // Old version of FP refers to requests by the user's jid. This old version
                    // implements transfers and invitations on the client and not the server side.
                    // Therefore, for each user's jid there is always a unique Request
                    request = UserRequest.getRequest(workgroup, new JID(jid));
                }
                Offer offer = request.getOffer();
                if (offer != null && offer.isOutstanding()) {
                    AgentSession agentSession = agentManager.getAgentSession(packet.getFrom());
                    if (agentSession == null) {
                        reply.setChildElement(packet.getChildElement().createCopy());
                        reply.setError(new PacketError(PacketError.Condition.item_not_found));
                        Log.debug("Agent not found while accepting offer");
                    } else {
                        try {
                            interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), packet, true, false);
                            offer.accept(agentSession);
                            interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), packet, true, true);
                        } catch (PacketRejectedException e) {
                            workgroup.rejectPacket(packet, e);
                            reply = null;
                        }
                    }
                } else {
                    reply.setChildElement(packet.getChildElement().createCopy());
                    reply.setError(new PacketError(PacketError.Condition.not_acceptable));
                }
            }
        } catch (NotFoundException e) {
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.item_not_found));
            Log.debug("Request not found " + "while accepting offer: ", e);
        } catch (AgentNotFoundException e) {
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.item_not_found));
            Log.debug("Agent not found " + "while accepting offer: ", e);
        }
    } else if ("offer-reject".equals(queryName)) {
        try {
            InterceptorManager interceptorManager = OfferInterceptorManager.getInstance();
            String id = iq.attributeValue("id");
            String jid = iq.attributeValue("jid");
            if (id != null || jid != null) {
                Request request;
                if (id != null) {
                    // Search request by its unique ID
                    request = Request.getRequest(id);
                } else {
                    // Old version of FP refers to requests by the user's jid. This old version
                    // implements transfers and invitations on the client and not the server side.
                    // Therefore, for each user's jid there is always a unique Request
                    request = UserRequest.getRequest(workgroup, new JID(jid));
                }
                Offer offer = request.getOffer();
                if (offer != null) {
                    AgentSession agentSession = agentManager.getAgentSession(packet.getFrom());
                    if (agentSession == null) {
                        reply.setChildElement(packet.getChildElement().createCopy());
                        reply.setError(new PacketError(PacketError.Condition.item_not_found));
                        Log.debug("Agent not found while accepting offer");
                    } else {
                        try {
                            interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), packet, true, false);
                            offer.reject(agentSession);
                            interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), packet, true, true);
                        } catch (PacketRejectedException e) {
                            workgroup.rejectPacket(packet, e);
                            reply = null;
                        }
                    }
                }
            }
        } catch (NotFoundException e) {
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.item_not_found));
            Log.debug("Request not found " + "while rejecting offer: ", e);
        } catch (AgentNotFoundException e) {
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.item_not_found));
            Log.debug("Agent not found " + "while accepting offer: ", e);
        }
    } else if ("invite".equals(queryName)) {
        // Get the type of inviation (i.e. entity type is being invited)
        InvitationRequest request = new InvitationRequest(packet, workgroup);
        workgroup.processInvitation(request, packet);
        reply = null;
    } else if ("transfer".equals(queryName)) {
        // Get the type of transfer (i.e. entity type is going to get the transfer offer)
        TransferRequest request = new TransferRequest(packet, workgroup);
        workgroup.processTransfer(request, packet);
        reply = null;
    } else if ("jabber:iq:private".equals(queryNamespace)) {
        // IQ private for agents global macro storage
        setIQPrivate(packet);
    } else if ("agent-info".equals(queryName)) {
        if (!JiveGlobals.getBooleanProperty("xmpp.live.agent.change-properties", true)) {
            // Answer that agents are not allowed to change their properties (feature disabled)
            reply = IQ.createResultIQ(packet);
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(new PacketError(PacketError.Condition.service_unavailable));
        } else {
            try {
                AgentSession agentSession = agentManager.getAgentSession(packet.getFrom());
                if (agentSession == null) {
                    reply = IQ.createResultIQ(packet);
                    reply.setChildElement(packet.getChildElement().createCopy());
                    reply.setError(new PacketError(PacketError.Condition.item_not_found));
                } else {
                    String allowsToChange = agentSession.getAgent().getProperties().getProperty("change-properties");
                    if (!"false".equals(allowsToChange)) {
                        // Set the new agent's info
                        agentSession.getAgent().updateAgentInfo(packet);
                    } else {
                        // Answer that this agent is not allowed to change his properties
                        reply = IQ.createResultIQ(packet);
                        reply.setChildElement(packet.getChildElement().createCopy());
                        reply.setError(new PacketError(PacketError.Condition.service_unavailable));
                    }
                }
            } catch (AgentNotFoundException e) {
                reply = IQ.createResultIQ(packet);
                reply.setChildElement(packet.getChildElement().createCopy());
                reply.setError(new PacketError(PacketError.Condition.item_not_found));
            }
        }
    } else {
        // none are found, send bad request error.
        for (WorkgroupProvider provider : providerManager.getWorkgroupProviders()) {
            // Handle packet?
            if (provider.handleSet(packet)) {
                // If provider accepts responsibility, hand off packet.
                provider.executeSet(packet, workgroup);
                return;
            }
        }
        dropPacket(packet);
        reply.setChildElement(packet.getChildElement().createCopy());
        reply.setError(new PacketError(PacketError.Condition.bad_request));
    }
    if (reply != null) {
        workgroup.send(reply);
    }
}
Also used : JID(org.xmpp.packet.JID) Element(org.dom4j.Element) OfferInterceptorManager(org.jivesoftware.xmpp.workgroup.interceptor.OfferInterceptorManager) QueueInterceptorManager(org.jivesoftware.xmpp.workgroup.interceptor.QueueInterceptorManager) InterceptorManager(org.jivesoftware.xmpp.workgroup.interceptor.InterceptorManager) IQ(org.xmpp.packet.IQ) Request(org.jivesoftware.xmpp.workgroup.request.Request) TransferRequest(org.jivesoftware.xmpp.workgroup.request.TransferRequest) InvitationRequest(org.jivesoftware.xmpp.workgroup.request.InvitationRequest) UserRequest(org.jivesoftware.xmpp.workgroup.request.UserRequest) PacketError(org.xmpp.packet.PacketError) NotFoundException(org.jivesoftware.util.NotFoundException) InvitationRequest(org.jivesoftware.xmpp.workgroup.request.InvitationRequest) TransferRequest(org.jivesoftware.xmpp.workgroup.request.TransferRequest) PacketRejectedException(org.jivesoftware.xmpp.workgroup.interceptor.PacketRejectedException) UserRequest(org.jivesoftware.xmpp.workgroup.request.UserRequest)

Example 35 with NotFoundException

use of org.jivesoftware.util.NotFoundException in project Openfire by igniterealtime.

the class RoutingManager method getBestQueue.

/**
     * Returns the best {@link RequestQueue} in the specified {@link Workgroup} that could
     * handle the specified {@link UserRequest}.
     *
     * @param workgroup the workgroup where a queue will be searched.
     * @param request the user request to be handled.
     * @return the best RequestQueue in the specified Workgroup.
     */
public RequestQueue getBestQueue(Workgroup workgroup, UserRequest request) {
    WordMatchRouter router = new WordMatchRouter();
    for (RoutingRule rule : getRoutingRules(workgroup)) {
        String query = rule.getQuery();
        boolean handled = router.checkForHits(request.getMetaData(), query);
        if (handled) {
            // Retrieve queue and route to it.
            try {
                return workgroup.getRequestQueue(rule.getQueueID());
            } catch (NotFoundException e) {
                Log.error(e.getMessage(), e);
            }
        }
    }
    List<RequestQueue> availableRequestQueues = new ArrayList<RequestQueue>();
    // Route to best queue based on availability.
    for (RequestQueue requestQueue : workgroup.getRequestQueues()) {
        // Skip queues that do not have agents at the moment
        if (requestQueue != null && requestQueue.isOpened()) {
            availableRequestQueues.add(requestQueue);
        }
    }
    Collections.sort(availableRequestQueues, queueComparator);
    return availableRequestQueues.get(0);
}
Also used : WordMatchRouter(org.jivesoftware.xmpp.workgroup.spi.routers.WordMatchRouter) RequestQueue(org.jivesoftware.xmpp.workgroup.RequestQueue) ArrayList(java.util.ArrayList) NotFoundException(org.jivesoftware.util.NotFoundException)

Aggregations

NotFoundException (org.jivesoftware.util.NotFoundException)67 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)29 Element (org.dom4j.Element)17 JID (org.xmpp.packet.JID)15 ArrayList (java.util.ArrayList)10 Connection (java.sql.Connection)8 PreparedStatement (java.sql.PreparedStatement)8 SQLException (java.sql.SQLException)8 ResultSet (java.sql.ResultSet)7 TransportSession (net.sf.kraken.session.TransportSession)7 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)6 Avatar (net.sf.kraken.avatars.Avatar)5 TransportBuddy (net.sf.kraken.roster.TransportBuddy)5 Packet (org.xmpp.packet.Packet)5 Date (java.util.Date)4 MultiUserChatServiceImpl (org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl)4 UserRequest (org.jivesoftware.xmpp.workgroup.request.UserRequest)4 KrakenPlugin (net.sf.kraken.KrakenPlugin)3 Registration (net.sf.kraken.registration.Registration)3 UnauthorizedException (org.jivesoftware.openfire.auth.UnauthorizedException)3