Commit 490e5a7b authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

Updating Live Assistant 2.0 Server to check for ChatBots


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@201 b35dd754-fafc-0310-a699-88a17e54d16e
parent 28ea6969
......@@ -11,19 +11,19 @@
package org.jivesoftware.messenger.spi;
import org.jivesoftware.messenger.container.BasicModule;
import org.jivesoftware.messenger.container.TrackInfo;
import org.jivesoftware.messenger.container.ServiceLookupFactory;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.*;
import org.jivesoftware.messenger.chatbot.ChatbotManager;
import org.jivesoftware.messenger.handler.IQHandler;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import javax.xml.stream.XMLStreamException;
import org.jivesoftware.messenger.*;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.messenger.chatbot.ChatbotManager;
import org.jivesoftware.messenger.container.BasicModule;
import org.jivesoftware.messenger.container.ServiceLookupFactory;
import org.jivesoftware.messenger.container.TrackInfo;
import org.jivesoftware.messenger.handler.IQHandler;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
/**
* Generic presence routing base class.
......@@ -44,12 +44,6 @@ public class IQRouterImpl extends BasicModule implements IQRouter {
*/
public IQRouterImpl() {
super("XMPP IQ Router");
try {
chatBotManager = (ChatbotManager)ServiceLookupFactory.getLookup().lookup(ChatbotManager.class);
}
catch (UnauthorizedException e) {
Log.error(e);
}
}
public void route(IQ packet) {
......@@ -83,7 +77,16 @@ public class IQRouterImpl extends BasicModule implements IQRouter {
|| "".equals(recipientJID.getResource());
if(recipientJID != null){
if (recipientJID != null && isLocalServer) {
if (chatBotManager == null) {
try {
chatBotManager = (ChatbotManager)ServiceLookupFactory.getLookup().lookup(ChatbotManager.class);
}
catch (UnauthorizedException e) {
Log.error(e);
}
}
isLocalServer = !chatBotManager.isChatbot(recipientJID);
}
return isLocalServer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment