|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectEmoteManager
Creates emote texts for chat rooms. Emotes enable shortcut 'action' messages to be broadcast to a chat room, along the lines of "Waves" or "Winks". It is also possible to mention a specific user in an Emote, although the message still goes to the entire room - for example "Waves at fred" or "Winks at jenny".
Each Emote therefore has a dual form, the 'room' form, and the 'user' form. In the user form, the string "%s" is used as a placeholder for the name of the targeted user - for example "Waves at %s" when targeted at "jenny" becomes "Waves at jenny".
Yahoo allows users to add their own Emotes via a configuration file which is read and appended to the default Emotes Yahoo holds internally. This class mimics this behaviour, by loading and building lists of Emotes from various input sources. The class holds an array of default Emotes. When creating an instance, these defaults can either be included or ignored. Any Emotes loaded by this class which share the same name as an Emote already defined will override the original.
The standard file format for custom Yahoo Emotes is:
# Comment line <name>\<room form>\<user form>The sequence %s is a placeholder for the target user's name in a room Emote. For example:
# This is a winks Emote Winks\Winks.\Winks at %s. # This is a waves Emote Waves\Waves at room.\Waves at %s.
Constructor Summary | |
EmoteManager(File fl,
boolean b)
Creates an Emote list from a given file. |
|
EmoteManager(String fn,
boolean b)
Creates an Emote list from a given filename. |
|
EmoteManager(URL u,
boolean b)
Creates an Emote list from a given URL. |
Method Summary | |
static String |
encodeEmote(String u,
String em)
Utility method to combine an Emote string (from getRoomEmote )
with the supplied username. |
Vector |
getErrors()
Returns the loading/parsing errors which occured during creation. |
Vector |
getNames()
Returns a list of all Emote names held by this manager. |
String |
getRoomEmote(String name)
Returns the room version of a given Emote. |
String |
getUserEmote(String name)
Returns the user version of a given Emote. |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EmoteManager(File fl, boolean b)
fl
- file with emote configb
- true to pre-load default Emotespublic EmoteManager(String fn, boolean b)
fn
- file with emote configb
- true to pre-load default Emotespublic EmoteManager(URL u, boolean b)
u
- file with emote configb
- true to pre-load default EmotesMethod Detail |
public Vector getErrors()
Vector
holds String
objects which
detail the various errors while attempting to load and parse the
Emote configurations. If the vector is empty, no errors occured.
public String getRoomEmote(String name)
name
- name of Emote
public String getUserEmote(String name)
name
- name of Emote
public Vector getNames()
public static String encodeEmote(String u, String em)
getRoomEmote
)
with the supplied username. Any reference to %s
in the
Emote string is replaced with the contents of the username string.
This method is not fooled by "%s" occurances inside the username string
itself.
u
- target usernameem
- Emote text
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |