public class TalkPrefs extends Mod implements ObjectCompletionWatcher, UserMod
TalkOptions
and Chat
mods that
should be attached to the context the user is in.
This mod gets attached to a user, but note that it is not normally attached
to the user record in the object database. It does not persist, but instead
is attached dynamically by the TalkOptions
mod.Constructor and Description |
---|
TalkPrefs(StyleDesc style)
JSON-driven constructor.
|
Modifier and Type | Method and Description |
---|---|
JSONLiteral |
encode(EncodeControl control)
Encode this mod for transmission or persistence.
|
void |
objectIsComplete()
Upon completion of the user object to which this mod attached, grab the
next set of available style choices from the context's
TalkOptions mod. |
void |
style(User from,
OptString color,
OptString backgroundColor,
OptString icon,
OptString textStyle)
Message handler for the 'style' message.
|
attachTo, clone, context, ensureHolding, ensureInContext, ensureReachable, ensureSameContext, ensureSameUser, holder, isEphemeral, markAsChanged, markAsEphemeral, object
@JSONMethod(value="style") public TalkPrefs(StyleDesc style)
objectIsComplete()
method) by choosing, in a round-robin fashion, from
the style options available in in the context's TalkOptions
mod.style
- The StyleDesc
associated with the chat text of the
user to whom this mod is attached.public JSONLiteral encode(EncodeControl control)
public void objectIsComplete()
TalkOptions
mod.
Application code should not call this method.
objectIsComplete
in interface ObjectCompletionWatcher
@JSONMethod(value={"color","backgroundColor","icon","textStyle"}) public void style(User from, OptString color, OptString backgroundColor, OptString icon, OptString textStyle) throws MessageHandlerException
This is a request from a client to change one or more of the style attributes. If the change operation is successful, a corresponding 'style' message is broadcast to the context.
recv: { to:REF, op:"style", color:optSTR,
backgroundColor:optSTR, icon:optSTR,
textStyle:optSTR }
send: { to:REF, op:"style", color:optSTR,
backgroundColor:optSTR, icon:optSTR,
textStyle:optSTR }
from
- The user who sent the message.color
- New text color value (optional).backgroundColor
- New background color value (optional).icon
- New icon URL string (optional).textStyle
- New typeface/style info (optional).MessageHandlerException
- if 'from' is not in the same user this
mod is attached to.Copyright © 2017. All rights reserved.