I agree Mike a single location is what I would say is a solid solution. To simplify for beginners a simple editing script could be made to assist when adding a plugin to config the hooks. Talk about a solid plugin architecture was brought up in recent discussion and I have been seeing more and more about this so I would say maybe it is time implement more solid plugin functionality.
 
Pat
 
 

 
On 7/31/08, Michael Baierl <mail@mbaierl.com> wrote:
Florian Lagg wrote:
> So here are my questions:
> * How should a plugin-architecture be implemented in RoundCube?
> Maybe my approach is completely wrong, just tell me if you think so...
> I'm thinking of a PluginHooks singleton class which is called from
> various points in the existing source code. This class reads a config
> file if there is a plugin registered for the specific event. This config
> contains a line for each event like this:
> $rcmail_config['pluginevent_userlogin'] =
> array('Funambol');                            //registers a single
> plugin called "funambol" for the event "userlogin"
> $rcmail_config['pluginevent_nextEvent'] = array('Funambol',
> 'AnotherPlugin);    //call two plugins in the given order
> PluginHooks then initates a class Funambol (located in
> RC_Home/plugins/Funambol) and calls a method pluginevent_userlogin.
> Because PluginHooks is a singleton, it could provide methods to the
> plugins to get or manipulate data from the rest of RC. so anything is
> handled over this class.
> I hope I discribed it well. Please bring your own ideas if you have
> better once.

Hi Florian,
first of all thanks for the offer to do a lot of work for the community!

Regarding the config as you outline it above - I don't think this is the
way to go as it is not very flexible; ideally a plugin just requires to
be downloaded to a certain directory and to be enabled in a single
place, that's it. In the above code every time a plugin is added the
config has to be changed to adopt the hooks.

Instead I would recommend a well-known location (index.php, config.php)
in the plugins directory which calls those hook-registration points
itself. This gives full control over to the plugin with minimal impact
on configuration.

My 2 cents,

Mike

--
Michael Baierl
<http://mbaierl.com/blog/> < Mike's Blog
- - - - - - - - - - - - - - - - - - - - -
Java is renowned for its industry-standard visual interface which
supports up to 16 colors thanks to its cutting-edge SmartColor™
technology./n
_______________________________________________
List info: http://lists.roundcube.net/dev/