|
|||||||||
| 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.PrivateChat
public class PrivateChat
Mod to enable users in a context to chat privately with each other. This
mod must be attached to a user, but note that it is not to be attached to
the user record in the object database. It never persists, but is always
attached dynamically by a Chat mod attached to the context.
Chat| Constructor Summary | |
|---|---|
PrivateChat(boolean allowPrivate,
boolean allowPush)
Constructor. |
|
| Method Summary | |
|---|---|
JSONLiteral |
encode(EncodeControl control)
Encode this mod for transmission or persistence. |
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 |
|---|
public PrivateChat(boolean allowPrivate,
boolean allowPush)
allowPrivate - If true, users can chat privately, i.e., transmit
utterances to other individual users.allowPush - 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.
@JSONMethod(value={"url","frame","features"})
public void push(User from,
String url,
OptString frame,
OptString features)
throws MessageHandlerException
This message pushes a URL to the user this mod is attached to. This is done by echoing the 'push' message to the target user, 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' constructor parameter was false.
@JSONMethod(value="text")
public void say(User from,
String text)
throws MessageHandlerException
This message transmits chat text to the user this mod is attached to. This is done by echoing the 'say' message to the target user, marked as being from the user who sent it.
recv: { to:REF, op:"say", text:STR }
send: { to:REF, op:"say", text:STR,
from:REF }
text - The chat text being "spoken".
MessageHandlerException - if 'from' is not in the same context as
this mod or if the 'allowPrivate' constructor parameter was false.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||