|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.elkoserver.server.context.Mod
org.elkoserver.server.context.mods.Chat
public class Chat
Mod to enable users in a context to chat with each other. This mod must be attached to a context.
PrivateChat| Constructor Summary | |
|---|---|
Chat(OptBoolean allowChat,
OptBoolean allowPrivate,
OptBoolean allowPush,
OptBoolean allowPrivatePush)
JSON-driven constructor. |
|
| Method Summary | |
|---|---|
JSONLiteral |
encode(EncodeControl control)
Encode this mod for transmission or persistence. |
void |
objectIsComplete()
If this mod's configuration enables private chat and/or private push, arrange to automatically attach ephemeral PrivateChat mods to
arriving users. |
void |
push(User from,
String url,
OptString frame,
OptString features)
Message handler for the 'push' message. |
void |
say(User from,
String text)
Message handler for the 'say' message. |
| Methods inherited from class org.elkoserver.server.context.Mod |
|---|
attachTo, clone, context, ensureHolding, ensureInContext, ensureReachable, ensureSameContext, ensureSameUser, holder, isEphemeral, markAsChanged, markAsEphemeral, object |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@JSONMethod(value={"allowchat","allowprivate","allowpush","allowprivatepush"})
public Chat(OptBoolean allowChat,
OptBoolean allowPrivate,
OptBoolean allowPush,
OptBoolean allowPrivatePush)
If 'allowPrivate' or 'allowPrivatePush' is true, this mod will
automatically attach a correspondingly configured ephemeral PrivateChat mod to any user who enters the context.
Note that setting all four 'allow' parameters to false is permitted but not useful.
allowChat - If true, users can chat publicly, i.e., issue
utterances that are broadcast to everyone in the context.allowPrivate - If true, users can chat privately, i.e., transmit
utterances to other individual users.allowPush - If true, users can push URLs publicly, i.e., to
everyone in the context.allowPrivatePush - If true, users can push URLs privately, i.e.,
to other individual users.| Method Detail |
|---|
public JSONLiteral encode(EncodeControl control)
encode in interface Encodablecontrol - Encode control determining what flavor of encoding
should be done.
public void objectIsComplete()
PrivateChat mods to
arriving users.
Application code should not call this method.
objectIsComplete in interface ObjectCompletionWatcher
@JSONMethod(value={"url","frame","features"})
public void push(User from,
String url,
OptString frame,
OptString features)
throws MessageHandlerException
This message pushes a URL to everyone in the context. This is done by echoing the 'push' message to the context, marked as being from the user who sent it.
recv: { to:REF, op:"push", url:STR,
frame:optSTR,
features:optSTR }
send: { to:REF, op:"push", url:STR,
frame:optSTR, features:optSTR,
from:REF }
url - The URL being pushed.frame - Optional name of a frame to push it to.features - Optional features string to associate with it.
MessageHandlerException - if 'from' is not in the same context as
this mod or if the 'allowPush' configuration was parameter false.
@JSONMethod(value="text")
public void say(User from,
String text)
throws MessageHandlerException
This message broadcasts chat text to everyone in the context. This is done by echoing the 'say' message to the context, marked as being from the user who sent it.
recv: { to:REF, op:"say", text:STR }
send: { to:REF, op:"say", text:STR,
from:fromREF }
text - The chat text being "spoken".
MessageHandlerException - if 'from' is not in the same context as
this mod or if the 'allowChat' configuration parameter was false.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||