Started work on the 'crowd' package.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3935 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// $Id: ChatDisplay.java 3098 2004-08-27 02:12:55Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.crowd.chat.client {
|
||||
|
||||
import com.threerings.crowd.chat.data.ChatMessage;
|
||||
|
||||
/**
|
||||
* A chat display provides a means by which chat messages can be
|
||||
* displayed. The chat display will be notified when chat messages of
|
||||
* various sorts have been received by the client.
|
||||
*/
|
||||
public interface ChatDisplay
|
||||
{
|
||||
/**
|
||||
* Called to clear the chat display.
|
||||
*/
|
||||
public function clear () :void;
|
||||
|
||||
/**
|
||||
* Called to display a chat message.
|
||||
*
|
||||
* @see ChatMessage
|
||||
*/
|
||||
public function displayMessage (msg :ChatMessage) :void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// $Id: ChatService.java 3310 2005-01-24 23:08:21Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.crowd.chat.client {
|
||||
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.InvocationListener;
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
|
||||
/**
|
||||
* The chat services provide a mechanism by which the client can broadcast
|
||||
* chat messages to all clients that are subscribed to a particular place
|
||||
* object or directly to a particular client. These services should not be
|
||||
* used directly, but instead should be accessed via the {@link
|
||||
* ChatDirector}.
|
||||
*/
|
||||
public interface ChatService extends InvocationService
|
||||
{
|
||||
/**
|
||||
* Requests that a tell message be delivered to the user with username
|
||||
* equal to <code>target</code>.
|
||||
*
|
||||
* @param client a connected, operational client instance.
|
||||
* @param target the username of the user to which the tell message
|
||||
* should be delivered.
|
||||
* @param message the contents of the message.
|
||||
* @param listener the reference that will receive the tell response.
|
||||
*/
|
||||
function tell (
|
||||
client :Client, target :Name, message :String, listener :TellListener)
|
||||
:void;
|
||||
|
||||
/**
|
||||
* Requests that a message be broadcast to all users in the system.
|
||||
*
|
||||
* @param client a connected, operational client instance.
|
||||
* @param message the contents of the message.
|
||||
* @param listener the reference that will receive a failure response.
|
||||
*/
|
||||
function broadcast (
|
||||
client :Client, message :String, listener :InvocationListener) :void;
|
||||
|
||||
/**
|
||||
* Sets this client's away message. If the message is null or the
|
||||
* empty string, the away message will be cleared.
|
||||
*/
|
||||
function away (client :Client, message :String) :void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.threerings.crowd.chat.client {
|
||||
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
|
||||
/**
|
||||
* Used to implement a slash command (e.g. <code>/who</code>).
|
||||
*/
|
||||
public /* abstract */ class CommandHandler
|
||||
{
|
||||
/**
|
||||
* Handles the specified chat command.
|
||||
*
|
||||
* @param speakSvc an optional SpeakService object representing
|
||||
* the object to send the chat message on.
|
||||
* @param command the slash command that was used to invoke this
|
||||
* handler (e.g. <code>/tell</code>).
|
||||
* @param args the arguments provided along with the command (e.g.
|
||||
* <code>Bob hello</code>) or <code>null</code> if no arguments
|
||||
* were supplied.
|
||||
* @param history an in/out parameter that allows the command to
|
||||
* modify the text that will be appended to the chat history. If
|
||||
* this is set to null, nothing will be appended.
|
||||
*
|
||||
* @return an untranslated string that will be reported to the
|
||||
* chat box to convey an error response to the user, or {@link
|
||||
* ChatCodes#SUCCESS}.
|
||||
*/
|
||||
public function handleCommand (
|
||||
speakSvc :SpeakService, cmd :String, args :String, history :Array)
|
||||
:void
|
||||
{
|
||||
throw new Error("abstract");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this user should have access to this chat
|
||||
* command.
|
||||
*/
|
||||
public function checkAccess (user :BodyObject) :Boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// $Id: SpeakService.java 3098 2004-08-27 02:12:55Z mdb $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.crowd.chat.client {
|
||||
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
|
||||
/**
|
||||
* Provides a means by which "speaking" can be allowed among subscribers
|
||||
* of a particular distributed object.
|
||||
*/
|
||||
public interface SpeakService extends InvocationService
|
||||
{
|
||||
/**
|
||||
* Issues a request to speak "on" the distributed object via which
|
||||
* this speak service was provided.
|
||||
*
|
||||
* @param message the message to be spoken.
|
||||
* @param mode the "mode" of the message. This is an opaque value that
|
||||
* will be passed back down via the {@link ChatDirector} to the {@link
|
||||
* ChatDisplay} implementations which can interpret it in an
|
||||
* application specific manner. It's useful for differentiating
|
||||
* between regular speech, emotes, etc.
|
||||
*/
|
||||
function speak (client :Client, message :String, mode :int) :void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.threerings.crowd.chat.client {
|
||||
|
||||
import com.threerings.util.long;
|
||||
|
||||
import com.threerings.presents.client.InvocationListener
|
||||
|
||||
public interface TellListener extends InvocationListener
|
||||
{
|
||||
function tellSucceeded (idleTime :long, awayMessage :String) :void;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user