public class PrivateChat extends Mod implements UserMod
Chat
mod attached to the context.Chat
Constructor and Description |
---|
PrivateChat(boolean allowPrivate,
boolean allowPush)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
attachTo, clone, context, ensureHolding, ensureInContext, ensureReachable, ensureSameContext, ensureSameUser, holder, isEphemeral, markAsChanged, markAsEphemeral, object
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.public JSONLiteral encode(EncodeControl control)
@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.Copyright © 2017. All rights reserved.