Inject the ChatProvider as well.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5159 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-06-08 10:10:41 +00:00
parent 3404d14e7b
commit a531fd2196
2 changed files with 15 additions and 21 deletions
@@ -23,6 +23,8 @@ package com.threerings.crowd.chat.server;
import java.util.Iterator;
import com.google.inject.Inject;
import com.samskivert.util.StringUtil;
import com.threerings.util.MessageBundle;
import com.threerings.util.Name;
@@ -80,6 +82,15 @@ public class ChatProvider
public void forwardBroadcast (Name from, String bundle, String msg, boolean attention);
}
/**
* Creates and registers this chat provider.
*/
@Inject public ChatProvider (InvocationManager invmgr)
{
// register a chat provider with the invocation manager
invmgr.registerDispatcher(new ChatDispatcher(this), CrowdCodes.CROWD_GROUP);
}
/**
* Set an object to which all broadcasts should be sent, rather than iterating over the place
* objects and sending to each of them.
@@ -112,15 +123,6 @@ public class ChatProvider
_chatForwarder = forwarder;
}
/**
* Initializes the chat services and registers a chat provider with the invocation manager.
*/
public void init (InvocationManager invmgr, DObjectManager omgr)
{
// register a chat provider with the invocation manager
invmgr.registerDispatcher(new ChatDispatcher(this), CrowdCodes.CROWD_GROUP);
}
/**
* Processes a request from a client to deliver a tell message to another client.
*/
@@ -74,6 +74,7 @@ public class CrowdServer extends PresentsServer
// LEGACY: set up our legacy static references
plreg = _plreg;
chatprov = _chatprov;
// configure the client manager to use our bits
clmgr.setClientFactory(new ClientFactory() {
@@ -90,18 +91,6 @@ public class CrowdServer extends PresentsServer
// initialize the body services
BodyProvider.init(invmgr);
// initialize the chat services
chatprov = createChatProvider();
chatprov.init(invmgr, omgr);
}
/**
* Creates the {@link ChatProvider} we'll use to handle chat (or a derivation).
*/
protected ChatProvider createChatProvider ()
{
return new ChatProvider();
}
/**
@@ -162,6 +151,9 @@ public class CrowdServer extends PresentsServer
/** Handles the creation and tracking of place managers. */
@Inject protected PlaceRegistry _plreg;
/** Provides chat-related invocation services. */
@Inject protected ChatProvider _chatprov;
/** Used to look up {@link BodyObject} instance for online users. See {@link #lookupBody}. */
protected static BodyLocator _lookup;