Commit 408fd4e5 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@199 b35dd754-fafc-0310-a699-88a17e54d16e
parent 4903df13
......@@ -13,9 +13,11 @@ 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;
......@@ -68,14 +70,21 @@ public class IQRouterImpl extends BasicModule implements IQRouter {
}
}
private boolean isLocalServer(XMPPAddress recipientJID) {
boolean isLocalServer = recipientJID == null || recipientJID.getHost() == null
|| "".equals(recipientJID.getHost()) || recipientJID.getResource() == null
|| "".equals(recipientJID.getResource());
private boolean isLocalServer(XMPPAddress recipientJID){
// ridiculously long check for local server target
return recipientJID == null
|| recipientJID.getHost() == null
|| "".equals(recipientJID.getHost())
|| ((recipientJID.getName() == null || "".equals(recipientJID.getName()))
&& (recipientJID.getResource() == null || "".equals(recipientJID.getResource())));
try {
if(recipientJID != null){
ChatbotManager chatBotManager = (ChatbotManager)ServiceLookupFactory.getLookup().lookup(ChatbotManager.class);
isLocalServer = !chatBotManager.isChatbot(recipientJID);
}
}
catch (UnauthorizedException e) {
e.printStackTrace();
}
return isLocalServer;
}
private void handle(IQ packet) {
......
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