rero.bridges.event
public class EventBridge extends Object implements Loadable, Environment, PredicateEnvironment, FilterEnvironment
1. normal chat event i.e. on JOIN for a channel join this is handled by adding the code to a collapsed listener (i.e. one real listener attached to the framework for the JOIN event). If the collapsed listener does not exist it is created and registered with the irc framework. 2. temporary chat event i.e. on PART for a channel part temporary chat events are handled by just creating a real listener and attaching it to the framework as a temporary listener. No muss, no fuss. 3. "registered" listeners i.e. on WINDOW registered listeners are listeners that aren't really IRC events. They have there own framework for dealing with themselves. There is a super class ScriptedEventListener that provides the interface the event bridge works with. Other frameworks have a listener class that extends ScriptedEventListener and know to fire dispatchEvent when the listener is fired. This should be more efficient as it keeps overhead low on some high occurence events (i.e. on WINDOW) and keeps the framework from being mucked up with tons of events. All valuable things right.
Field Summary | |
---|---|
protected ChatFramework | framework |
protected HashMap | listeners |
protected HashMap | registeredEvents |
protected HashMap | unloadEvents |
Constructor Summary | |
---|---|
EventBridge() |
Method Summary | |
---|---|
void | announceFramework(ChatFramework f) |
void | bindFilteredFunction(ScriptInstance si, String typeKeyword, String keyword, String filter, Block functionBody) |
void | bindFunction(ScriptInstance si, String type, String name, Block code) |
void | bindPredicate(ScriptInstance si, String type, Check pred, Block code) |
protected EventChatListener | getListenerFor(String event_name) |
protected EventChatListener | getNewListenerFor(String event_name) |
void | registerEvent(String name, ScriptedEventListener listener) adds another type of "event" for the event bridge to manage. |
boolean | scriptLoaded(ScriptInstance si) |
boolean | scriptUnloaded(ScriptInstance si) |