Hey, i've talked about this with Yabba, and decided i might as well post it here.
Atm grabbing the events from a plugin goes;
Load Plugin, Scan plugin's class for functions, remove any found functions that are not known events, and then keep the result.
I believe it should be done like so;
Have a variable inside the plugin called $events, which is like so;
$events = array ( 'SessionLoaded', 'another event', 'etc' );
And to get the events do the following;
Load Plugin, Use $Plugin->events
No checks to see if the plugin exists would be necessary, as the only 'problem' that could occur would be if that array contains a event that the plugin doesn't have, in which case a php warning would be displayed when the missing function is called, but this will only happen on developer setups, so on the base b2evo install it wouldn't matter, and a developer would prefer seeing a warning to know something went wrong than to just not register the event for that plugin.
So yeh thats the basic idea.
Heres some other ideas i have.
In the Plugins class, have it so when a event is being 'recorded/registered', what happens is this;
$Plugins->events = array (
array( 'event' => 'SessionLoaded', 'plugins' => array( 'gallery_plugin', 'another_plugin' ) ),
//another of the above
$Plugins->ref_events = array (
'SessionLoaded' = & $Plugins->events
// this would be automatic
So plugins can easily register additional events, and the plugins class can easily fire events.
So events would become dynamic.
So am i a crazy man, or am i on to something?