|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.zion.jbuddy.bots.BotUser
public class BotUser
Represents a bot user session.
The engine responds to user input events (such as messages and presence
changes) with outgoing gateway
commands and
engine events
. To create or retrieve a
BotUser
instance, call getUser
on a
BotClient
. This is done automatically by the default gateways, and
doesn't have to be done explicity unless a custom gateway implementation is
needed.
BotClient
,
BotGateway
,
processMessage(com.zion.jbuddy.bots.BotMessage)
,
processPresence()
Method Summary | |
---|---|
boolean |
equals(Object object)
|
BotClient |
getClient()
Returns the client this user is associated with. |
long |
getCreationTime()
Returns the system time when this user was created. |
Object |
getCustomProperty(String name)
Returns a custom property value. |
String |
getDisplayName()
Returns this user's display name. |
BotEventHandlerSet |
getEventHandlers()
Returns this user's event handlers. |
String |
getName()
Returns this user's unique name. |
String |
getStatus()
Returns this user's status. |
String |
getStatusMessage()
Returns this user's status message. |
BotTargetSet |
getTargets()
Returns this user's targets. |
long |
getUpdateTime()
Returns the system time when this user was last updated. |
int |
hashCode()
|
boolean |
processMessage(BotMessage message)
Processes an incoming message from this user. |
boolean |
processPresence()
Processes a presence change from this user. |
void |
processXML(Document document)
Processes Bot Definition XML. |
void |
processXML(InputSource inputSource)
Processes Bot Definition XML. |
Object |
setCustomProperty(String name,
Object value)
Sets a custom property value. |
void |
setDisplayName(String displayName)
Sets this user's display name. |
void |
setStatus(String status,
String message)
Sets this user's status. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public BotClient getClient()
public String getName()
The content variable ${name}
is replaced with this value.
For example, the following target can be used to display a greeting to
users:
public String getDisplayName()
The content variable ${displayName}
is replaced with this
value. For example, the following target can be used to display a
greeting to users:
public void setDisplayName(String displayName)
displayName
- the display name. If null
or empty, the
user's name will be used as its display name.public String getStatus()
public String getStatusMessage()
public void setStatus(String status, String message)
This method does not automatically process presence event handlers. To
process event handlers, call processPresence
.
status
- the statusmessage
- the status messagepublic BotTargetSet getTargets()
The first time this method is called, the bot engine's targets are copied into this user instance. This allows this user's targets to be modified separately from the bot engine's. This can be used, for example, to create a target or menu for this user only, instead of for all users.
public BotEventHandlerSet getEventHandlers()
The first time this method is called, the bot engine's event handlers are copied into this user instance. This allows this user's event handlers to be modified separately from the bot engine's. This can be used, for example, to create an event handler for this user only, instead of for all users.
public long getCreationTime()
public long getUpdateTime()
A user is updated when input or messages are received from it, or the engine uses it for some other reason (such as when the engine triggers an event handler associated with the user).
public boolean processMessage(BotMessage message) throws Exception
The BotEngine
processes this message, and triggers any
associated targets
or
event handlers
.
If this message has type IM
or null
, it is
processed as a user command. Any targets with the associated command are
triggered. For example, an IM
type message with the body
gettime
would trigger a target having the command
gettime
.
Exception
- if a problem occurs, such as the bot engine not being
started before attempting to process inputpublic boolean processPresence() throws Exception
The BotEngine
processes this presence change, and triggers any
associated event handlers
. This method should be
called after setting presence-related values, such as the status or
status message.
Exception
- if a problem occurs, such as the bot engine not being
started before attempting to process inputpublic void processXML(Document document) throws Exception
BotCall
and presented to the user as if it was part of the
original Bot Definition.
document
- the XML document
Exception
public void processXML(InputSource inputSource) throws Exception
BotCall
and presented to the user as if it was part of the
original Bot Definition.
inputSource
- the XML input source
Exception
public Object getCustomProperty(String name)
name
- the property's namepublic Object setCustomProperty(String name, Object value)
Custom properties can be attached to this user instance by an application using the bot framework, for convenience. They are not used by the engine itself.
name
- the property's namevalue
- the property's value (if null
, the property is
removed)
null
public int hashCode()
hashCode
in class Object
public boolean equals(Object object)
equals
in class Object
public String toString()
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |