[RCD] Plugin API - events

Thomas Bruederli roundcube at gmail.com
Mon May 24 21:34:58 CEST 2010

A.L.E.C wrote:
> In function http_response (app.js) we have:
> // execute callback functions of plugins 
> if (response.callbacks && response.callbacks.length) {
>    for (var i=0; i < response.callbacks.length; i++)
>      this.triggerEvent(response.callbacks[i][0], response.callbacks[i][1]);
> }
> This code isn't realy useful and redundant because we have 
> response.exec. Is someone using it?

This is the way we suggest to implement ajax conversation with the server:

In class rcube_json_output all commands starting with "plugin." will be
added to the response.callbacks list. The reason for this was to force that
all these callbacks have only one single parameter in order to make things
easier. This is not given with the internal commands which end up in the
response.exec list and which needs to be eval'ed on the client. The latter
one is legacy code and is subject to be changed once in favor of the
response.callbacks mechanism.

You should revert your changes in r3650 and bring back the old events.
Otherwise we'll end up with many broken plugins.

> I propose to replace this with
> something more useful:
> this.triggerEvent('response'+response.action, {});
> or, even better, two calls responsebefore* and responseafter*.
I currently don't see a concrete use-case for these before* and after*
events. And why do we need two of them ('responseafter' and

List info: http://lists.roundcube.net/dev/

More information about the Dev mailing list