rero.bridges.event

Class EventBridge

public class EventBridge extends Object implements Loadable, Environment, PredicateEnvironment, FilterEnvironment

Man, I feel bad for the mantainer of this class. Oh wait thats me. Actually its not that bad. However this class isn't just as straight forward as registering any kind of event and going with it one way. Nope, there are 3 ways events can be handled.
    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 ChatFrameworkframework
protected HashMaplisteners
protected HashMapregisteredEvents
protected HashMapunloadEvents
Constructor Summary
EventBridge()
Method Summary
voidannounceFramework(ChatFramework f)
voidbindFilteredFunction(ScriptInstance si, String typeKeyword, String keyword, String filter, Block functionBody)
voidbindFunction(ScriptInstance si, String type, String name, Block code)
voidbindPredicate(ScriptInstance si, String type, Check pred, Block code)
protected EventChatListenergetListenerFor(String event_name)
protected EventChatListenergetNewListenerFor(String event_name)
voidregisterEvent(String name, ScriptedEventListener listener)
adds another type of "event" for the event bridge to manage.
booleanscriptLoaded(ScriptInstance si)
booleanscriptUnloaded(ScriptInstance si)

Field Detail

framework

protected ChatFramework framework

listeners

protected HashMap listeners

registeredEvents

protected HashMap registeredEvents

unloadEvents

protected HashMap unloadEvents

Constructor Detail

EventBridge

public EventBridge()

Method Detail

announceFramework

public void announceFramework(ChatFramework f)

bindFilteredFunction

public void bindFilteredFunction(ScriptInstance si, String typeKeyword, String keyword, String filter, Block functionBody)

bindFunction

public void bindFunction(ScriptInstance si, String type, String name, Block code)

bindPredicate

public void bindPredicate(ScriptInstance si, String type, Check pred, Block code)

getListenerFor

protected EventChatListener getListenerFor(String event_name)

getNewListenerFor

protected EventChatListener getNewListenerFor(String event_name)

registerEvent

public void registerEvent(String name, ScriptedEventListener listener)
adds another type of "event" for the event bridge to manage. By default events are just registered with the irc framework. ScriptedEventListener allows any sort of event to be incorporated into the client scripting

scriptLoaded

public boolean scriptLoaded(ScriptInstance si)

scriptUnloaded

public boolean scriptUnloaded(ScriptInstance si)