use of org.jivesoftware.xmpp.workgroup.interceptor.PacketRejectedException in project Openfire by igniterealtime.
the class Chatbot method userDepartQueue.
private void userDepartQueue(Message message) {
// Remove the user from the queue if he was waiting in the queue
try {
Request request = UserRequest.getRequest(workgroup, message.getFrom());
InterceptorManager interceptorManager = QueueInterceptorManager.getInstance();
try {
interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), message, true, false);
request.cancel(Request.CancelType.DEPART);
// Remove the session (the goodbye message is sent when leaving the queue)
removeSession(message.getFrom());
interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), message, true, true);
} catch (PacketRejectedException e) {
workgroup.rejectPacket(message, e);
}
} catch (NotFoundException e) {
// Send the goodbye message and close the session
closeSession(message);
}
}
use of org.jivesoftware.xmpp.workgroup.interceptor.PacketRejectedException in project Openfire by igniterealtime.
the class Chatbot method userJoinQueue.
private void userJoinQueue(Message message, ChatbotSession session) {
InterceptorManager interceptorManager = QueueInterceptorManager.getInstance();
try {
interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), message, true, false);
if (getRoutingMessage() != null && getRoutingMessage().length() > 0) {
sendReply(message, getRoutingMessage());
}
// Set that we are currently joining a waiting queue
session.setCurrentStep(3);
// Received a Join Queue request from a visitor, create a new request.
UserRequest request = new UserRequest(session, workgroup);
// Let the workgroup process the new request
if (!workgroup.queueRequest(request)) {
// It was not possible to add the request to a queue so send message saying that
// the workgroup is not accepting new join requests
sendReply(message, getCannotJoinMessage());
// Send the goodbye message and close the session
closeSession(message);
} else {
session.setRequest(request);
}
interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), message, true, true);
} catch (PacketRejectedException e) {
workgroup.rejectPacket(message, e);
}
}
use of org.jivesoftware.xmpp.workgroup.interceptor.PacketRejectedException in project Openfire by igniterealtime.
the class Chatbot method send.
private void send(Message packet) {
InterceptorManager interceptorManager = ChatbotInterceptorManager.getInstance();
try {
interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), packet, false, false);
workgroup.send(packet);
interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), packet, false, true);
} catch (PacketRejectedException e) {
Log.warn("Packet was not sent " + "due to interceptor REJECTION: " + packet.toXML(), e);
}
}
use of org.jivesoftware.xmpp.workgroup.interceptor.PacketRejectedException in project Openfire by igniterealtime.
the class Workgroup method send.
public void send(Packet packet) {
InterceptorManager interceptorManager = WorkgroupInterceptorManager.getInstance();
try {
interceptorManager.invokeInterceptors(getJID().toBareJID(), packet, false, false);
WorkgroupManager.getInstance().send(packet);
interceptorManager.invokeInterceptors(getJID().toBareJID(), packet, false, true);
} catch (PacketRejectedException e) {
Log.warn("Packet was not sent " + "due to interceptor REJECTION: " + packet.toXML(), e);
}
}
use of org.jivesoftware.xmpp.workgroup.interceptor.PacketRejectedException in project Openfire by igniterealtime.
the class AgentSession method sendOffer.
/**
* Send an offer
*
* @param offer the <code>Offer</code> to send.
* @param offerPacket the packet to send to the agent with the offer.
* @return true if the packet was sent to the agent.
*/
public boolean sendOffer(Offer offer, IQ offerPacket) {
synchronized (this) {
if (this.offer != null) {
return false;
}
this.offer = offer;
}
try {
offer.addPendingSession(this);
InterceptorManager interceptorManager = OfferInterceptorManager.getInstance();
try {
Workgroup workgroup = offer.getRequest().getWorkgroup();
interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), offerPacket, false, false);
// Send the Offer to the agent
WorkgroupManager.getInstance().send(offerPacket);
interceptorManager.invokeInterceptors(workgroup.getJID().toBareJID(), offerPacket, false, true);
} catch (PacketRejectedException e) {
Log.warn("Offer was not sent " + "due to interceptor REJECTION: " + offerPacket.toXML(), e);
}
return true;
} catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
return false;
}
}
Aggregations