Added interface to all other packages to plug into the chat provider and

provide an auto response to a tell.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2688 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Eric Lundberg
2003-07-01 21:50:18 +00:00
parent 81460a9496
commit 00286b608e
@@ -1,5 +1,5 @@
// //
// $Id: ChatProvider.java,v 1.21 2003/06/25 17:17:41 ray Exp $ // $Id: ChatProvider.java,v 1.22 2003/07/01 21:50:18 eric Exp $
package com.threerings.crowd.chat.server; package com.threerings.crowd.chat.server;
@@ -37,6 +37,22 @@ public class ChatProvider
/** The access control identifier for broadcast chat privileges. */ /** The access control identifier for broadcast chat privileges. */
public static final String BROADCAST_TOKEN = "crowd.chat.broadcast"; public static final String BROADCAST_TOKEN = "crowd.chat.broadcast";
/** Interface to allow an auto response to a tell message. */
public static interface TellAutoResponder {
public void sentTell (BodyObject teller, BodyObject tellee,
String message);
}
/**
* Set the auto tell responder for the chat provider. Only one auto
* responder is allowed.
*/
public static void setTellAutoResponder (TellAutoResponder autoRespond)
{
_autoRespond = autoRespond;
}
/** /**
* Initializes the chat services and registers a chat provider with * Initializes the chat services and registers a chat provider with
* the invocation manager. * the invocation manager.
@@ -84,6 +100,11 @@ public class ChatProvider
// normal success // normal success
listener.tellSucceeded(); listener.tellSucceeded();
} }
// do the autoresponse if needed
if (_autoRespond != null) {
_autoRespond.sentTell(source, tobj, message);
}
} }
/** /**
@@ -137,4 +158,7 @@ public class ChatProvider
/** The distributed object manager used by the chat services. */ /** The distributed object manager used by the chat services. */
protected static DObjectManager _omgr; protected static DObjectManager _omgr;
/** Reference to our auto responder object. */
protected static TellAutoResponder _autoRespond;
} }